-
I'm very unfamiliar with bluetooth and working on a simple project to collect data from a few devices. Other examples I'm seeing don't seem to "connect" to the device, rather they seem to listen for all bluetooth signals and filter only the messages relevant to the task at hand. I think my devices aren't staying connected because they aren't really meant to be permanently connected (I think). Does this library offer a way to simply grab all messages as they come, potentially even in an event-driven way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Bluetooth LE (BLE) comes with two different modes of operation. One would be the devices (e.g. a sensor) broadcasting some data in the BLE advertisement payload which could be read by any central device (e.g. a PC or smartphone). The other is a BLE connection which would allow a central to read/write GATT characteristics of the peripheral to gather data or write e.g. configuration parameters etc. From the above the first scenario likely applies to your use-case. SimpleBLE does support both. scan_start() or scan_for() in Adapter.h would scan for peripherals and does expose the advertisement payload data into callback functions linked with set_callback_on_scan_found() or set_callback_on_scan_updated() also in Adapter.h. The "scan" example would be a good starting point and you would need to extend the callback functions set_callback_on_scan_found() and/or set_callback_on_scan_updated() with extracting the payload data (likely manufacturer specific data). By default the example just leverage the device name, mac address and rssi value. Functions simpleble_peripheral_manufacturer_data_count() and simpleble_peripheral_manufacturer_data_get() would do the job for manufacturer specific data whereas simpleble_peripheral_services_count() and simpleble_peripheral_services_get() would do it for advertised service data. Good reading to get better understanding of BLE advertisments would be here and here. |
Beta Was this translation helpful? Give feedback.
Bluetooth LE (BLE) comes with two different modes of operation. One would be the devices (e.g. a sensor) broadcasting some data in the BLE advertisement payload which could be read by any central device (e.g. a PC or smartphone). The other is a BLE connection which would allow a central to read/write GATT characteristics of the peripheral to gather data or write e.g. configuration parameters etc. From the above the first scenario likely applies to your use-case.
SimpleBLE does support both. scan_start() or scan_for() in Adapter.h would scan for peripherals and does expose the advertisement payload data into callback functions linked with set_callback_on_scan_found() or set_callback_on_sca…