PowerBlocks SDK
 
Loading...
Searching...
No Matches
bltootls.h
1
12
13#pragma once
14
15#include "FreeRTOS.h"
16
17#include <stdbool.h>
18
20
21// Known Driver IDs part of PowerBlocks
22#define BLUETOOTH_DRIVER_ID_INVALID 0
23#define BLUETOOTH_DRIVER_ID_WIIMOTE 1
24
25typedef struct {
26 uint16_t driver_id; // Unique ID to the driver, that can be used to find it.
27
28 // Covered when a device appears to be discoverable,
29 // This can be used to filter out discovered devices
30 // Return true if the device applys to this driver
31 bool (*filter_device)(const hci_discovered_device_info_t* device, const char* device_name);
32
33 // Called once the filter passes, will attempt to add the device
34 // Return a non-null reference to the device if successful
35 void* (*initialize_device)(const hci_discovered_device_info_t* device);
36
37 // Called when the device is disconnected. Free up the driver
38 void (*free_device)(void* instance);
40
41typedef struct {
42 uint16_t driver_id;
43 void* instance;
45
52int bltools_initialize();
53
62extern void bltools_register_driver(bluetooth_driver_t driver);
63
69extern bluetooth_driver_t* bltoots_find_driver_by_id(uint16_t driver_id);
70
80extern bluetooth_driver_t* bltools_find_compatable_driver(const hci_discovered_device_info_t* device, const char* device_name);
81
93extern int bltools_load_driver(const bluetooth_driver_t* driver, const hci_discovered_device_info_t* device);
94
105extern int bltools_load_compatable_driver(const hci_discovered_device_info_t* device, const char* device_name);
106
124extern int bltools_begin_automatic_discovery(TickType_t duration);
Bluetooth HCI Driver.
Definition bltootls.h:41
Definition bltootls.h:25
Definition hci.h:27