1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
*
*/
#define MESH_IO_TX_COUNT_UNLIMITED 0
enum mesh_io_type {
MESH_IO_TYPE_NONE = 0,
MESH_IO_TYPE_UNIT_TEST,
MESH_IO_TYPE_AUTO, /* If MGMT required, add after here */
MESH_IO_TYPE_MGMT,
MESH_IO_TYPE_GENERIC,
};
enum mesh_io_timing_type {
MESH_IO_TIMING_TYPE_GENERAL = 1,
MESH_IO_TIMING_TYPE_POLL,
MESH_IO_TIMING_TYPE_POLL_RSP
};
struct mesh_io_recv_info {
const uint8_t *addr;
uint32_t instant;
uint8_t chan;
int8_t rssi;
};
struct mesh_io_send_info {
enum mesh_io_timing_type type;
union {
struct {
uint16_t interval;
uint8_t cnt;
uint8_t min_delay;
uint8_t max_delay;
} gen;
struct {
uint16_t scan_duration;
uint8_t scan_delay;
uint8_t filter_ids[2];
uint8_t min_delay;
uint8_t max_delay;
} poll;
struct {
uint32_t instant;
uint8_t delay;
} poll_rsp;
} u;
};
struct mesh_io_caps {
uint8_t max_num_filters;
uint8_t window_accuracy;
};
typedef void (*mesh_io_recv_func_t)(void *user_data,
struct mesh_io_recv_info *info,
const uint8_t *data, uint16_t len);
typedef void (*mesh_io_recv_ext_func_t)(void *user_data,
struct mesh_io_recv_info *info,
const uint8_t *data, uint16_t len,
const uint8_t *addr);
typedef void (*mesh_io_ready_func_t)(void *user_data, bool result);
struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts,
mesh_io_ready_func_t cb, void *user_data);
void mesh_io_destroy(struct mesh_io *io);
bool mesh_io_get_caps(struct mesh_io *io, struct mesh_io_caps *caps);
bool mesh_io_register_recv_cb(struct mesh_io *io, const uint8_t *filter,
uint8_t len, mesh_io_recv_func_t cb,
void *user_data);
bool mesh_io_deregister_recv_cb(struct mesh_io *io, const uint8_t *filter,
uint8_t len);
bool mesh_io_send(struct mesh_io *io, struct mesh_io_send_info *info,
const uint8_t *data, uint16_t len);
bool mesh_io_send_cancel(struct mesh_io *io, const uint8_t *pattern,
uint8_t len);
|