libnx  v4.2.0
btdev.h
Go to the documentation of this file.
1 /**
2  * @file btdev.h
3  * @brief Wrapper around the bt/btmu services for using bluetooth BLE.
4  * @note Only available on [5.0.0+].
5  * @note See also: https://switchbrew.org/wiki/BTM_services
6  * @author yellows8
7  * @copyright libnx Authors
8  */
9 #pragma once
10 #include "../types.h"
11 #include "../kernel/event.h"
12 #include "../services/btdrv_types.h"
13 
14 /// GattAttribute
15 typedef struct {
16  u8 type; ///< Type
17  BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
18  u16 handle; ///< Handle
19  u32 connection_handle; ///< ConnectionHandle
21 
22 /// GattService
23 typedef struct {
24  BtdevGattAttribute attr; ///< \ref BtdevGattAttribute
25  u16 instance_id; ///< InstanceId
26  u16 end_group_handle; ///< EndGroupHandle
27  bool primary_service; ///< PrimaryService
29 
30 /// GattCharacteristic
31 typedef struct {
32  BtdevGattAttribute attr; ///< \ref BtdevGattAttribute
33  u16 instance_id; ///< InstanceId
34  u8 properties; ///< Properties
35  u64 value_size; ///< Size of value.
36  u8 value[0x200]; ///< Value
38 
39 /// GattDescriptor
40 typedef struct {
41  BtdevGattAttribute attr; ///< \ref BtdevGattAttribute
42  u64 value_size; ///< Size of value.
43  u8 value[0x200]; ///< Value
45 
46 /// Initialize bt/btmu.
48 
49 /// Exit bt/btmu.
50 void btdevExit(void);
51 
52 /// Compares two \ref BtdrvGattAttributeUuid, returning whether these match.
54 
55 /// Wrapper for \ref btmuAcquireBleScanEvent.
57 
58 /// Wrapper for \ref btmuGetBleScanFilterParameter.
60 
61 /// Wrapper for \ref btmuGetBleScanFilterParameter2.
63 
64 /// Wrapper for \ref btdevStartBleScanGeneral.
66 
67 /// Wrapper for \ref btmuStopBleScanForGeneral.
69 
70 /**
71  * @brief Wrapper for \ref btmuGetBleScanResultsForGeneral and \ref btmuGetBleScanResultsForSmartDevice.
72  * @param[out] results Output array of \ref BtdrvBleScanResult.
73  * @param[in] count Size of the results array in entries.
74  * @param[out] total_out Total output entries.
75  */
76 Result btdevGetBleScanResult(BtdrvBleScanResult *results, u8 count, u8 *total_out);
77 
78 /// Wrapper for \ref btmuStartBleScanForPaired.
80 
81 /// Wrapper for \ref btmuStopBleScanForPaired.
83 
84 /// Wrapper for \ref btmuStartBleScanForSmartDevice.
86 
87 /// Wrapper for \ref btmuStopBleScanForSmartDevice.
89 
90 /// Wrapper for \ref btmuAcquireBleConnectionEvent.
92 
93 /// Wrapper for \ref btmuBleConnect.
95 
96 /// Wrapper for \ref btmuBleDisconnect.
97 Result btdevDisconnectFromGattServer(u32 connection_handle);
98 
99 /// Wrapper for \ref btmuBleGetConnectionState.
101 
102 /// Wrapper for \ref btmuAcquireBleServiceDiscoveryEvent.
104 
105 /**
106  * @brief Wrapper for \ref btmuGetGattServices.
107  * @param[in] connection_handle ConnectionHandle
108  * @param[out] services Output array of \ref BtdevGattService.
109  * @param[in] count Size of the services array in entries. The max is 100.
110  * @param[out] total_out Total output entries.
111  */
112 Result btdevGetGattServices(u32 connection_handle, BtdevGattService *services, u8 count, u8 *total_out);
113 
114 /**
115  * @brief Wrapper for \ref btmuGetGattService.
116  * @param[in] connection_handle ConnectionHandle
117  * @param[in] uuid \ref BtdrvGattAttributeUuid
118  * @param[out] service \ref BtdevGattService
119  * @param[out] flag Whether a \ref BtdevGattService was returned.
120  */
121 Result btdevGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtdevGattService *service, bool *flag);
122 
123 /// Wrapper for \ref btmuAcquireBlePairingEvent.
125 
126 /// Wrapper for \ref btmuBlePairDevice.
128 
129 /// Wrapper for \ref btmuBleUnPairDevice.
131 
132 /// Wrapper for \ref btmuBleUnPairDevice2.
134 
135 /// Wrapper for \ref btmuBleGetPairedDevices.
137 
138 /// Wrapper for \ref btmuAcquireBleMtuConfigEvent.
140 
141 /**
142  * @brief Wrapper for \ref btmuConfigureBleMtu.
143  * @param[in] connection_handle Same as \ref btmuBleDisconnect.
144  * @param[in] mtu MTU, must be 0x18-0x200.
145  */
146 Result btdevConfigureBleMtu(u32 connection_handle, u16 mtu);
147 
148 /// Wrapper for \ref btmuGetBleMtu.
149 Result btdevGetBleMtu(u32 connection_handle, u16 *out);
150 
151 /// Wrapper for \ref btRegisterBleEvent.
153 
154 /**
155  * @brief Wrapper for \ref btmuRegisterBleGattDataPath.
156  * @param[in] uuid \ref BtdrvGattAttributeUuid
157  */
159 
160 /**
161  * @brief Wrapper for \ref btmuUnregisterBleGattDataPath.
162  * @param[in] uuid \ref BtdrvGattAttributeUuid
163  */
165 
166 /**
167  * @brief Wrapper for \ref btGetLeEventInfo.
168  * @param[out] out \ref BtdrvBleClientGattOperationInfo
169  */
171 
172 /**
173  * @brief Wrapper for \ref btLeClientReadCharacteristic.
174  * @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
175  * @param c \ref BtdevGattCharacteristic
176  */
178 
179 /**
180  * @brief Wrapper for \ref btLeClientWriteCharacteristic.
181  * @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
182  * @note This uses the Value from \ref btdevGattCharacteristicSetValue.
183  * @param c \ref BtdevGattCharacteristic
184  */
186 
187 /**
188  * @brief Wrapper for \ref btLeClientRegisterNotification / \ref btLeClientDeregisterNotification.
189  * @note An error is thrown if the properties from \ref btdevGattCharacteristicGetProperties don't allow using this.
190  * @param c \ref BtdevGattCharacteristic
191  * @param[in] flag Whether to enable/disable, controls which func to call.
192  */
194 
195 /**
196  * @brief Wrapper for \ref btLeClientReadDescriptor.
197  * @param d \ref BtdevGattDescriptor
198  */
200 
201 /**
202  * @brief Wrapper for \ref btLeClientWriteDescriptor.
203  * @note This uses the Value from \ref btdevGattDescriptorSetValue.
204  * @param d \ref BtdevGattDescriptor
205  */
207 
208 ///@name GattAttribute
209 ///@{
210 
211 /**
212  * @brief Creates a \ref BtdevGattAttribute object. This is intended for internal use.
213  * @param a \ref BtdevGattAttribute
214  * @param[in] uuid \ref BtdrvGattAttributeUuid
215  * @param[in] handle Handle
216  * @param[in] connection_handle ConnectionHandle
217  */
218 void btdevGattAttributeCreate(BtdevGattAttribute *a, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
219 
220 /**
221  * @brief Gets the Type.
222  * @param a \ref BtdevGattAttribute
223  */
225  return a->type;
226 }
227 
228 /**
229  * @brief Gets the Uuid.
230  * @param a \ref BtdevGattAttribute
231  * @param[out] out \ref BtdrvGattAttributeUuid
232  */
234  *out = a->uuid;
235 }
236 
237 /**
238  * @brief Gets the Handle.
239  * @param a \ref BtdevGattAttribute
240  */
242  return a->handle;
243 }
244 
245 /**
246  * @brief Gets the ConnectionHandle.
247  * @param a \ref BtdevGattAttribute
248  */
250  return a->connection_handle;
251 }
252 
253 ///@}
254 
255 ///@name GattService
256 ///@{
257 
258 /**
259  * @brief Creates a \ref BtdevGattService object. This is intended for internal use.
260  * @param s \ref BtdevGattService
261  * @param[in] uuid \ref BtdrvGattAttributeUuid
262  * @param[in] handle Handle
263  * @param[in] connection_handle ConnectionHandle
264  * @param[in] instance_id InstanceId
265  * @param[in] end_group_handle EndGroupHandle
266  * @param[in] primary_service PrimaryService
267  */
268 void btdevGattServiceCreate(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u16 end_group_handle, bool primary_service);
269 
270 /**
271  * @brief Gets the InstanceId.
272  * @param s \ref BtdevGattService
273  */
275  return s->instance_id;
276 }
277 
278 /**
279  * @brief Gets the EndGroupHandle.
280  * @param s \ref BtdevGattService
281  */
283  return s->end_group_handle;
284 }
285 
286 /**
287  * @brief Gets whether this is the PrimaryService.
288  * @param s \ref BtdevGattService
289  */
291  return s->primary_service;
292 }
293 
294 /**
295  * @brief Wrapper for \ref btmuGetGattIncludedServices.
296  * @param s \ref BtdevGattService
297  * @param[out] services Output array of \ref BtdevGattService.
298  * @param[in] count Size of the services array in entries. The max is 100.
299  * @param[out] total_out Total output entries.
300  */
302 
303 /**
304  * @brief Wrapper for \ref btmuGetGattCharacteristics.
305  * @param s \ref BtdevGattService
306  * @param[out] characteristics Output array of \ref BtdevGattCharacteristic.
307  * @param[in] count Size of the characteristics array in entries. The max is 100.
308  * @param[out] total_out Total output entries.
309  */
311 
312 /**
313  * @brief Same as \ref btdevGattServiceGetCharacteristics except this only returns the \ref BtdevGattCharacteristic which contains a matching \ref BtdrvGattAttributeUuid.
314  * @param s \ref BtdevGattService
315  * @param[in] uuid \ref BtdrvGattAttributeUuid
316  * @param[out] characteristic \ref BtdevGattCharacteristic
317  * @param[out] flag Whether a \ref BtdevGattService was returned.
318  */
320 
321 ///@}
322 
323 ///@name GattCharacteristic
324 ///@{
325 
326 /**
327  * @brief Creates a \ref BtdevGattCharacteristic object. This is intended for internal use.
328  * @param c \ref BtdevGattCharacteristic
329  * @param[in] uuid \ref BtdrvGattAttributeUuid
330  * @param[in] handle Handle
331  * @param[in] connection_handle ConnectionHandle
332  * @param[in] instance_id InstanceId
333  * @param[in] properties Properties
334  */
335 void btdevGattCharacteristicCreate(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u8 properties);
336 
337 /**
338  * @brief Gets the InstanceId.
339  * @param c \ref BtdevGattCharacteristic
340  */
342  return c->instance_id;
343 }
344 
345 /**
346  * @brief Gets the Properties.
347  * @param c \ref BtdevGattCharacteristic
348  */
350  return c->properties;
351 }
352 
353 /**
354  * @brief Wrapper for \ref btmuGetBelongingGattService.
355  * @note Gets the \ref BtdevGattService which belongs to this object.
356  * @param c \ref BtdevGattCharacteristic.
357  * @param[out] service \ref BtdevGattService
358  */
360 
361 /**
362  * @brief Wrapper for \ref btmuGetGattDescriptors.
363  * @note Gets the descriptors which belongs to this object.
364  * @param c \ref BtdevGattCharacteristic
365  * @param[out] descriptors Output array of \ref BtdevGattDescriptor.
366  * @param[in] count Size of the descriptors array in entries. The max is 100.
367  * @param[out] total_out Total output entries.
368  */
370 
371 /**
372  * @brief Same as \ref btdevGattCharacteristicGetDescriptors except this only returns a \ref BtdevGattDescriptor which contains a matching \ref BtdrvGattAttributeUuid.
373  * @param c \ref BtdevGattCharacteristic
374  * @param[in] uuid \ref BtdrvGattAttributeUuid
375  * @param[out] descriptor \ref BtdevGattDescriptor
376  * @param[out] flag Whether a \ref BtdevGattDescriptor was returned.
377  */
379 
380 /**
381  * @brief Sets the Value in the object.
382  * @note See also \ref btdevWriteGattCharacteristic.
383  * @param c \ref BtdevGattCharacteristic
384  * @param[in] buffer Input buffer.
385  * @param[in] size Input buffer size, max is 0x200.
386  */
387 void btdevGattCharacteristicSetValue(BtdevGattCharacteristic *c, const void* buffer, size_t size);
388 
389 /**
390  * @brief Gets the Value in the object, returns the copied value size.
391  * @param c \ref BtdevGattCharacteristic
392  * @param[out] buffer Output buffer.
393  * @param[in] size Output buffer size, max is 0x200.
394  */
395 u64 btdevGattCharacteristicGetValue(BtdevGattCharacteristic *c, void* buffer, size_t size);
396 
397 ///@}
398 
399 ///@name GattDescriptor
400 ///@{
401 
402 /**
403  * @brief Creates a \ref BtdevGattDescriptor object. This is intended for internal use.
404  * @param d \ref BtdevGattDescriptor
405  * @param[in] uuid \ref BtdrvGattAttributeUuid
406  * @param[in] handle Handle
407  * @param[in] connection_handle ConnectionHandle
408  */
409 void btdevGattDescriptorCreate(BtdevGattDescriptor *d, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle);
410 
411 /**
412  * @brief Wrapper for \ref btmuGetBelongingGattService.
413  * @note Gets the \ref BtdevGattService which belongs to this object.
414  * @param d \ref BtdevGattDescriptor
415  * @param[out] service \ref BtdevGattService
416  */
418 
419 /**
420  * @brief Wrapper for \ref btmuGetGattCharacteristics.
421  * @note Gets the \ref BtdevGattCharacteristic which belongs to this object.
422  * @param d \ref BtdevGattDescriptor
423  * @param[out] characteristic \ref BtdevGattCharacteristic
424  */
426 
427 /**
428  * @brief Sets the Value in the object.
429  * @note See also \ref btdevWriteGattDescriptor.
430  * @param d \ref BtdevGattDescriptor
431  * @param[in] buffer Input buffer.
432  * @param[in] size Input buffer size, max is 0x200.
433  */
434 void btdevGattDescriptorSetValue(BtdevGattDescriptor *d, const void* buffer, size_t size);
435 
436 /**
437  * @brief Gets the Value in the object, returns the copied value size.
438  * @param d \ref BtdevGattDescriptor
439  * @param[out] buffer Output buffer.
440  * @param[in] size Output buffer size, max is 0x200.
441  */
442 u64 btdevGattDescriptorGetValue(BtdevGattDescriptor *d, void* buffer, size_t size);
443 
444 ///@}
445 
btdevRegisterGattOperationNotification
Result btdevRegisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid)
Wrapper for btmuRegisterBleGattDataPath.
btdevGetBleScanResult
Result btdevGetBleScanResult(BtdrvBleScanResult *results, u8 count, u8 *total_out)
Wrapper for btmuGetBleScanResultsForGeneral and btmuGetBleScanResultsForSmartDevice.
btdevGetBleMtu
Result btdevGetBleMtu(u32 connection_handle, u16 *out)
Wrapper for btmuGetBleMtu.
btdevAcquireBlePairingEvent
Result btdevAcquireBlePairingEvent(Event *out_event)
Wrapper for btmuAcquireBlePairingEvent.
btdevGattAttributeGetType
static u8 btdevGattAttributeGetType(BtdevGattAttribute *a)
Gets the Type.
Definition: btdev.h:224
btdevGetBleScanParameter2
Result btdevGetBleScanParameter2(u16 parameter_id, BtdrvGattAttributeUuid *out)
Wrapper for btmuGetBleScanFilterParameter2.
btdevGattCharacteristicGetInstanceId
static u16 btdevGattCharacteristicGetInstanceId(BtdevGattCharacteristic *c)
Gets the InstanceId.
Definition: btdev.h:341
BtdrvBleClientGattOperationInfo
BleClientGattOperationInfo.
Definition: btdrv_types.h:325
btdevGattServiceCreate
void btdevGattServiceCreate(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u16 end_group_handle, bool primary_service)
Creates a BtdevGattService object.
btdevGattServiceGetCharacteristic
Result btdevGattServiceGetCharacteristic(BtdevGattService *s, const BtdrvGattAttributeUuid *uuid, BtdevGattCharacteristic *characteristic, bool *flag)
Same as btdevGattServiceGetCharacteristics except this only returns the BtdevGattCharacteristic which...
u8
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
BtdevGattAttribute::handle
u16 handle
Handle.
Definition: btdev.h:18
NX_CONSTEXPR
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:88
btdevDisconnectFromGattServer
Result btdevDisconnectFromGattServer(u32 connection_handle)
Wrapper for btmuBleDisconnect.
BtdevGattCharacteristic::attr
BtdevGattAttribute attr
BtdevGattAttribute
Definition: btdev.h:32
BtdevGattCharacteristic::properties
u8 properties
Properties.
Definition: btdev.h:34
btdevGattDescriptorSetValue
void btdevGattDescriptorSetValue(BtdevGattDescriptor *d, const void *buffer, size_t size)
Sets the Value in the object.
BtdevGattAttribute::type
u8 type
Type.
Definition: btdev.h:16
Event
Kernel-mode event structure.
Definition: event.h:13
btdevStartBleScanSmartDevice
Result btdevStartBleScanSmartDevice(const BtdrvGattAttributeUuid *uuid)
Wrapper for btmuStartBleScanForSmartDevice.
btdevGattServiceGetEndGroupHandle
static u16 btdevGattServiceGetEndGroupHandle(BtdevGattService *s)
Gets the EndGroupHandle.
Definition: btdev.h:282
btdevInitialize
Result btdevInitialize(void)
Initialize bt/btmu.
btdevStopBleScanSmartDevice
Result btdevStopBleScanSmartDevice(void)
Wrapper for btmuStopBleScanForSmartDevice.
btdevGetGattService
Result btdevGetGattService(u32 connection_handle, const BtdrvGattAttributeUuid *uuid, BtdevGattService *service, bool *flag)
Wrapper for btmuGetGattService.
btdevGattServiceGetCharacteristics
Result btdevGattServiceGetCharacteristics(BtdevGattService *s, BtdevGattCharacteristic *characteristics, u8 count, u8 *total_out)
Wrapper for btmuGetGattCharacteristics.
btdevDisableBleAutoConnection
Result btdevDisableBleAutoConnection(void)
Wrapper for btmuStopBleScanForPaired.
btdevWriteGattDescriptor
Result btdevWriteGattDescriptor(BtdevGattDescriptor *d)
Wrapper for btLeClientWriteDescriptor.
BtdevGattService::instance_id
u16 instance_id
InstanceId.
Definition: btdev.h:25
btdevGattAttributeGetHandle
static u16 btdevGattAttributeGetHandle(BtdevGattAttribute *a)
Gets the Handle.
Definition: btdev.h:241
btdevGattAttributeUuidIsSame
bool btdevGattAttributeUuidIsSame(const BtdrvGattAttributeUuid *a, const BtdrvGattAttributeUuid *b)
Compares two BtdrvGattAttributeUuid, returning whether these match.
btdevGattAttributeGetConnectionHandle
static u32 btdevGattAttributeGetConnectionHandle(BtdevGattAttribute *a)
Gets the ConnectionHandle.
Definition: btdev.h:249
btdevGattDescriptorGetCharacteristic
Result btdevGattDescriptorGetCharacteristic(BtdevGattDescriptor *d, BtdevGattCharacteristic *characteristic)
Wrapper for btmuGetGattCharacteristics.
btdevGetGattOperationResult
Result btdevGetGattOperationResult(BtdrvBleClientGattOperationInfo *out)
Wrapper for btGetLeEventInfo.
btdevGattCharacteristicGetDescriptors
Result btdevGattCharacteristicGetDescriptors(BtdevGattCharacteristic *c, BtdevGattDescriptor *descriptors, u8 count, u8 *total_out)
Wrapper for btmuGetGattDescriptors.
btdevGattServiceGetIncludedServices
Result btdevGattServiceGetIncludedServices(BtdevGattService *s, BtdevGattService *services, u8 count, u8 *total_out)
Wrapper for btmuGetGattIncludedServices.
btdevStopBleScanGeneral
Result btdevStopBleScanGeneral(void)
Wrapper for btmuStopBleScanForGeneral.
btdevUnregisterGattOperationNotification
Result btdevUnregisterGattOperationNotification(const BtdrvGattAttributeUuid *uuid)
Wrapper for btmuUnregisterBleGattDataPath.
btdevGetPairedGattServerAddress
Result btdevGetPairedGattServerAddress(BtdrvBleAdvertisePacketParameter param, BtdrvAddress *addrs, u8 count, u8 *total_out)
Wrapper for btmuBleGetPairedDevices.
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
btdevGattDescriptorGetValue
u64 btdevGattDescriptorGetValue(BtdevGattDescriptor *d, void *buffer, size_t size)
Gets the Value in the object, returns the copied value size.
BtdevGattAttribute::connection_handle
u32 connection_handle
ConnectionHandle.
Definition: btdev.h:19
btdevReadGattCharacteristic
Result btdevReadGattCharacteristic(BtdevGattCharacteristic *c)
Wrapper for btLeClientReadCharacteristic.
btdevGetGattServices
Result btdevGetGattServices(u32 connection_handle, BtdevGattService *services, u8 count, u8 *total_out)
Wrapper for btmuGetGattServices.
btdevGattAttributeCreate
void btdevGattAttributeCreate(BtdevGattAttribute *a, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle)
Creates a BtdevGattAttribute object.
btdevPairGattServer
Result btdevPairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param)
Wrapper for btmuBlePairDevice.
u64
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
BtdevGattCharacteristic::value_size
u64 value_size
Size of value.
Definition: btdev.h:35
btdevAcquireBleScanEvent
Result btdevAcquireBleScanEvent(Event *out_event)
Wrapper for btmuAcquireBleScanEvent.
BtdevGattDescriptor::value_size
u64 value_size
Size of value.
Definition: btdev.h:42
BtdevGattCharacteristic
GattCharacteristic.
Definition: btdev.h:31
BtdevGattDescriptor
GattDescriptor.
Definition: btdev.h:40
btdevConfigureBleMtu
Result btdevConfigureBleMtu(u32 connection_handle, u16 mtu)
Wrapper for btmuConfigureBleMtu.
BtdevGattDescriptor::attr
BtdevGattAttribute attr
BtdevGattAttribute
Definition: btdev.h:41
btdevGattDescriptorCreate
void btdevGattDescriptorCreate(BtdevGattDescriptor *d, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle)
Creates a BtdevGattDescriptor object.
Result
u32 Result
Function error code result type.
Definition: types.h:44
btdevGattCharacteristicSetValue
void btdevGattCharacteristicSetValue(BtdevGattCharacteristic *c, const void *buffer, size_t size)
Sets the Value in the object.
BtdevGattAttribute::uuid
BtdrvGattAttributeUuid uuid
BtdrvGattAttributeUuid
Definition: btdev.h:17
btdevGattCharacteristicGetService
Result btdevGattCharacteristicGetService(BtdevGattCharacteristic *c, BtdevGattService *service)
Wrapper for btmuGetBelongingGattService.
BtdrvGattAttributeUuid
GattAttributeUuid.
Definition: btdrv_types.h:299
BtdevGattAttribute
GattAttribute.
Definition: btdev.h:15
BtdevGattService::attr
BtdevGattAttribute attr
BtdevGattAttribute
Definition: btdev.h:24
BtdevGattService::end_group_handle
u16 end_group_handle
EndGroupHandle.
Definition: btdev.h:26
BtdrvBleConnectionInfo
BleConnectionInfo.
Definition: btdrv_types.h:292
btdevUnpairGattServer
Result btdevUnpairGattServer(u32 connection_handle, BtdrvBleAdvertisePacketParameter param)
Wrapper for btmuBleUnPairDevice.
BtdevGattService
GattService.
Definition: btdev.h:23
btdevGattDescriptorGetService
Result btdevGattDescriptorGetService(BtdevGattDescriptor *d, BtdevGattService *service)
Wrapper for btmuGetBelongingGattService.
btdevUnpairGattServer2
Result btdevUnpairGattServer2(BtdrvAddress addr, BtdrvBleAdvertisePacketParameter param)
Wrapper for btmuBleUnPairDevice2.
btdevReadGattDescriptor
Result btdevReadGattDescriptor(BtdevGattDescriptor *d)
Wrapper for btLeClientReadDescriptor.
btdevGetBleConnectionInfoList
Result btdevGetBleConnectionInfoList(BtdrvBleConnectionInfo *info, u8 count, u8 *total_out)
Wrapper for btmuBleGetConnectionState.
btdevAcquireBleMtuConfigEvent
Result btdevAcquireBleMtuConfigEvent(Event *out_event)
Wrapper for btmuAcquireBleMtuConfigEvent.
btdevGattCharacteristicCreate
void btdevGattCharacteristicCreate(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, u16 handle, u32 connection_handle, u16 instance_id, u8 properties)
Creates a BtdevGattCharacteristic object.
btdevExit
void btdevExit(void)
Exit bt/btmu.
BtdrvAddress
Address.
Definition: btdrv_types.h:161
btdevEnableGattCharacteristicNotification
Result btdevEnableGattCharacteristicNotification(BtdevGattCharacteristic *c, bool flag)
Wrapper for btLeClientRegisterNotification / btLeClientDeregisterNotification.
btdevWriteGattCharacteristic
Result btdevWriteGattCharacteristic(BtdevGattCharacteristic *c)
Wrapper for btLeClientWriteCharacteristic.
btdevGattCharacteristicGetProperties
static u8 btdevGattCharacteristicGetProperties(BtdevGattCharacteristic *c)
Gets the Properties.
Definition: btdev.h:349
btdevGattCharacteristicGetDescriptor
Result btdevGattCharacteristicGetDescriptor(BtdevGattCharacteristic *c, const BtdrvGattAttributeUuid *uuid, BtdevGattDescriptor *descriptor, bool *flag)
Same as btdevGattCharacteristicGetDescriptors except this only returns a BtdevGattDescriptor which co...
btdevGattCharacteristicGetValue
u64 btdevGattCharacteristicGetValue(BtdevGattCharacteristic *c, void *buffer, size_t size)
Gets the Value in the object, returns the copied value size.
BtdrvBleScanResult
BleScanResult.
Definition: btdrv_types.h:283
btdevGattServiceGetInstanceId
static u16 btdevGattServiceGetInstanceId(BtdevGattService *s)
Gets the InstanceId.
Definition: btdev.h:274
btdevAcquireBleConnectionStateChangedEvent
Result btdevAcquireBleConnectionStateChangedEvent(Event *out_event)
Wrapper for btmuAcquireBleConnectionEvent.
btdevStartBleScanGeneral
Result btdevStartBleScanGeneral(BtdrvBleAdvertisePacketParameter param)
Wrapper for btdevStartBleScanGeneral.
BtdevGattService::primary_service
bool primary_service
PrimaryService.
Definition: btdev.h:27
btdevAcquireBleGattOperationEvent
Result btdevAcquireBleGattOperationEvent(Event *out_event)
Wrapper for btRegisterBleEvent.
BtdevGattCharacteristic::instance_id
u16 instance_id
InstanceId.
Definition: btdev.h:33
BtdrvBleAdvertisePacketParameter
BleAdvertisePacketParameter.
Definition: btdrv_types.h:278
btdevGattServiceIsPrimaryService
static u16 btdevGattServiceIsPrimaryService(BtdevGattService *s)
Gets whether this is the PrimaryService.
Definition: btdev.h:290
btdevGetBleScanParameter
Result btdevGetBleScanParameter(u16 parameter_id, BtdrvBleAdvertisePacketParameter *out)
Wrapper for btmuGetBleScanFilterParameter.
btdevConnectToGattServer
Result btdevConnectToGattServer(BtdrvAddress addr)
Wrapper for btmuBleConnect.
u16
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
btdevEnableBleAutoConnection
Result btdevEnableBleAutoConnection(BtdrvBleAdvertisePacketParameter param)
Wrapper for btmuStartBleScanForPaired.
btdevGattAttributeGetUuid
static void btdevGattAttributeGetUuid(BtdevGattAttribute *a, BtdrvGattAttributeUuid *out)
Gets the Uuid.
Definition: btdev.h:233
btdevAcquireBleServiceDiscoveryEvent
Result btdevAcquireBleServiceDiscoveryEvent(Event *out_event)
Wrapper for btmuAcquireBleServiceDiscoveryEvent.