bluetooth-llapi
2.0.2
bluetooth-llapi
bsp
bluetooth
inc
LLBLUETOOTH_defines.h
Go to the documentation of this file.
1
/*
2
* C
3
*
4
* Copyright 2018-2020 MicroEJ Corp. All rights reserved.
5
* This library is provided in source code for use, modification and test, subject to license terms.
6
* Any modification of the source code will break MicroEJ Corp. warranties on the whole library.
7
*/
8
17
#ifndef _LLBLUETOOTH_DEFINES
18
#define _LLBLUETOOTH_DEFINES
19
20
#include <stdint.h>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
27
#define ATTRIBUTE_TYPE_CHARACTERISTIC (0)
28
#define ATTRIBUTE_TYPE_DESCRIPTOR (1)
29
31
#define ATTRIBUTE_PERMISSION_NONE (0x00)
32
#define ATTRIBUTE_PERMISSION_READ (0x01)
33
#define ATTRIBUTE_PERMISSION_READ_ENCRYPT (0x02)
34
#define ATTRIBUTE_PERMISSION_READ_AUTH (0x04)
35
#define ATTRIBUTE_PERMISSION_WRITE (0x08)
36
#define ATTRIBUTE_PERMISSION_WRITE_ENCRYPT (0x10)
37
#define ATTRIBUTE_PERMISSION_WRITE_AUTH (0x20)
38
40
#define ADDRESS_TYPE_PUBLIC (0)
41
#define ADDRESS_TYPE_PRIVATE (1)
42
44
#define SCAN_FILTER_ACTION_NONE (0)
45
#define SCAN_FILTER_ACTION_FIELD_EXISTS (1)
46
#define SCAN_FILTER_ACTION_FIELD_EQUALS (2)
47
#define SCAN_FILTER_ACTION_FIELD_STARTS_WITH (3)
48
50
#define EVENT_GAP_SCAN_RESULT (1)
51
#define EVENT_GAP_SCAN_COMPLETED (2)
52
#define EVENT_GAP_ADVERTISEMENT_COMPLETED (3)
53
#define EVENT_GAP_CONNECT_FAILED (4)
54
#define EVENT_GAP_CONNECTED (5)
55
#define EVENT_GAP_DISCONNECTED (6)
56
#define EVENT_GAP_PAIR_REQUEST (7)
57
#define EVENT_GAP_PAIR_COMPLETED (8)
58
#define EVENT_GAP_PASSKEY_REQUEST (9)
59
#define EVENT_GAP_PASSKEY_GENERATED (10)
60
#define EVENT_GATTC_DISCOVERY_RESULT (11)
61
#define EVENT_GATTC_DISCOVERY_COMPLETED (12)
62
#define EVENT_GATTC_READ_COMPLETED (13)
63
#define EVENT_GATTC_WRITE_COMPLETED (14)
64
#define EVENT_GATTC_NOTIFICATION_RECEIVED (15)
65
#define EVENT_GATTS_READ_REQUEST (16)
66
#define EVENT_GATTS_WRITE_REQUEST (17)
67
#define EVENT_GATTS_NOTIFICATION_SENT (18)
68
70
typedef
struct
{
71
uint8_t type;
// one of ADDRESS_TYPE_* values
72
uint8_t addr[6];
// in big-endian
73
}
LLBLUETOOTH_address_t
;
74
76
typedef
struct
{
77
uint8_t uuid[16];
// in big-endian
78
}
LLBLUETOOTH_uuid_t
;
79
81
typedef
struct
{
82
uint8_t type;
// one of ATTRIBUTE_TYPE_* values
83
uint8_t _padding;
84
union
{
85
struct
{
86
LLBLUETOOTH_uuid_t
uuid;
87
uint8_t permissions;
// combined ATTRIBUTE_PERMISSION_* values
88
uint8_t properties;
89
} characteristic;
90
struct
{
91
LLBLUETOOTH_uuid_t
uuid;
92
uint8_t permissions;
// combined ATTRIBUTE_PERMISSION_* values
93
} descriptor;
94
};
95
}
LLBLUETOOTH_gatts_attribute_t
;
96
98
typedef
struct
{
99
LLBLUETOOTH_uuid_t
uuid;
100
uint8_t num_characteristics;
101
uint8_t num_descriptors;
102
// followed by: LLBLUETOOTH_gatts_attribute_t attributes[num_char+num_desc];
103
}
LLBLUETOOTH_gatts_service_t
;
104
106
typedef
struct
{
107
uint8_t type;
// one of ATTRIBUTE_TYPE_* values
108
uint8_t _padding;
109
LLBLUETOOTH_uuid_t
uuid;
110
union
{
111
struct
{
112
uint16_t value_handle;
113
uint8_t properties;
114
uint8_t _padding;
115
} characteristic;
116
struct
{
117
uint16_t handle;
118
} descriptor;
119
};
120
}
LLBLUETOOTH_gattc_attribute_t
;
121
123
typedef
struct
{
124
uint8_t event_type;
// one of EVENT_* values
125
}
LLBLUETOOTH_event_t
;
126
128
typedef
struct
{
129
uint8_t event_type;
130
LLBLUETOOTH_address_t
addr;
131
uint8_t rssi;
132
uint8_t adv_data_size;
133
// followed by: uint8_t adv_data[adv_data_size];
134
}
LLBLUETOOTH_event_gap_scan_result_t
;
135
137
typedef
struct
{
138
uint8_t event_type;
139
}
LLBLUETOOTH_event_gap_scan_completed_t
;
140
142
typedef
struct
{
143
uint8_t event_type;
144
}
LLBLUETOOTH_event_gap_advertisement_completed_t
;
145
147
typedef
struct
{
148
uint8_t event_type;
149
LLBLUETOOTH_address_t
addr;
150
}
LLBLUETOOTH_event_gap_connect_failed_t
;
151
153
typedef
struct
{
154
uint8_t event_type;
155
LLBLUETOOTH_address_t
addr;
156
uint16_t conn_handle;
157
}
LLBLUETOOTH_event_gap_connected_t
;
158
160
typedef
struct
{
161
uint8_t event_type;
162
uint8_t _padding;
163
uint16_t conn_handle;
164
}
LLBLUETOOTH_event_gap_disconnected_t
;
165
167
typedef
struct
{
168
uint8_t event_type;
169
uint8_t _padding;
170
uint16_t conn_handle;
171
}
LLBLUETOOTH_event_gap_pair_request_t
;
172
174
typedef
struct
{
175
uint8_t event_type;
176
uint8_t success;
177
uint16_t conn_handle;
178
}
LLBLUETOOTH_event_gap_pair_completed_t
;
179
181
typedef
struct
{
182
uint8_t event_type;
183
uint8_t _padding;
184
uint16_t conn_handle;
185
}
LLBLUETOOTH_event_gap_passkey_request_t
;
186
188
typedef
struct
{
189
uint8_t event_type;
190
uint8_t _padding;
191
uint16_t conn_handle;
192
uint32_t passkey;
193
}
LLBLUETOOTH_event_gap_passkey_generated_t
;
194
196
typedef
struct
{
197
uint8_t event_type;
198
uint8_t num_attributes;
199
uint16_t conn_handle;
200
uint16_t service_handle;
201
LLBLUETOOTH_uuid_t
service_uuid;
202
// followed by: LLBLUETOOTH_gattc_attribute_t attributes[num_attributes];
203
}
LLBLUETOOTH_event_gattc_discovery_result_t
;
204
206
typedef
struct
{
207
uint8_t event_type;
208
uint8_t _padding;
209
uint16_t conn_handle;
210
}
LLBLUETOOTH_event_gattc_discovery_completed_t
;
211
213
typedef
struct
{
214
uint8_t event_type;
215
uint8_t status;
216
uint16_t conn_handle;
217
uint16_t attr_handle;
218
uint16_t value_size;
219
// followed by: uint8_t value[value_size];
220
}
LLBLUETOOTH_event_gattc_read_completed_t
;
221
223
typedef
struct
{
224
uint8_t event_type;
225
uint8_t status;
226
uint16_t conn_handle;
227
uint16_t attr_handle;
228
}
LLBLUETOOTH_event_gattc_write_completed_t
;
229
231
typedef
struct
{
232
uint8_t event_type;
233
uint8_t _padding;
234
uint16_t conn_handle;
235
uint16_t attr_handle;
236
uint16_t value_size;
237
// followed by: uint8_t value[value_size];
238
}
LLBLUETOOTH_event_gattc_notification_received_t
;
239
241
typedef
struct
{
242
uint8_t event_type;
243
uint8_t _padding;
244
uint16_t conn_handle;
245
uint16_t attr_handle;
246
}
LLBLUETOOTH_event_gatts_read_request_t
;
247
249
typedef
struct
{
250
uint8_t event_type;
251
uint8_t _padding;
252
uint16_t conn_handle;
253
uint16_t attr_handle;
254
uint16_t value_size;
255
// followed by: uint8_t value[value_size];
256
}
LLBLUETOOTH_event_gatts_write_request_t
;
257
259
typedef
struct
{
260
uint8_t event_type;
261
uint8_t success;
262
uint16_t conn_handle;
263
uint16_t attr_handle;
264
}
LLBLUETOOTH_event_gatts_notification_sent_t
;
265
266
#ifdef __cplusplus
267
}
268
#endif
269
270
#endif // _LLBLUETOOTH_DEFINES
LLBLUETOOTH_event_gattc_write_completed_t
Definition:
LLBLUETOOTH_defines.h:223
LLBLUETOOTH_event_gap_scan_result_t
Definition:
LLBLUETOOTH_defines.h:128
LLBLUETOOTH_event_gap_disconnected_t
Definition:
LLBLUETOOTH_defines.h:160
LLBLUETOOTH_event_gatts_write_request_t
Definition:
LLBLUETOOTH_defines.h:249
LLBLUETOOTH_event_gap_passkey_request_t
Definition:
LLBLUETOOTH_defines.h:181
LLBLUETOOTH_address_t
Definition:
LLBLUETOOTH_defines.h:70
LLBLUETOOTH_event_gatts_notification_sent_t
Definition:
LLBLUETOOTH_defines.h:259
LLBLUETOOTH_event_gatts_read_request_t
Definition:
LLBLUETOOTH_defines.h:241
LLBLUETOOTH_event_gattc_discovery_completed_t
Definition:
LLBLUETOOTH_defines.h:206
LLBLUETOOTH_event_gattc_read_completed_t
Definition:
LLBLUETOOTH_defines.h:213
LLBLUETOOTH_uuid_t
Definition:
LLBLUETOOTH_defines.h:76
LLBLUETOOTH_event_gap_connected_t
Definition:
LLBLUETOOTH_defines.h:153
LLBLUETOOTH_event_gattc_notification_received_t
Definition:
LLBLUETOOTH_defines.h:231
LLBLUETOOTH_event_gap_pair_request_t
Definition:
LLBLUETOOTH_defines.h:167
LLBLUETOOTH_event_gattc_discovery_result_t
Definition:
LLBLUETOOTH_defines.h:196
LLBLUETOOTH_event_gap_connect_failed_t
Definition:
LLBLUETOOTH_defines.h:147
LLBLUETOOTH_gatts_service_t
Definition:
LLBLUETOOTH_defines.h:98
LLBLUETOOTH_event_gap_pair_completed_t
Definition:
LLBLUETOOTH_defines.h:174
LLBLUETOOTH_event_gap_scan_completed_t
Definition:
LLBLUETOOTH_defines.h:137
LLBLUETOOTH_gatts_attribute_t
Definition:
LLBLUETOOTH_defines.h:81
LLBLUETOOTH_event_gap_passkey_generated_t
Definition:
LLBLUETOOTH_defines.h:188
LLBLUETOOTH_event_t
Definition:
LLBLUETOOTH_defines.h:123
LLBLUETOOTH_event_gap_advertisement_completed_t
Definition:
LLBLUETOOTH_defines.h:142
LLBLUETOOTH_gattc_attribute_t
Definition:
LLBLUETOOTH_defines.h:106
Generated by
1.8.12