BLE examples
BLE examples are intended to demonstrate the BLE functionality, and to provide code that you can copy and adapt into your own projects
BLE battery service
This example creates BLE battery service with the Battery Level characteristic to monitor battery levels. This example application is in \examples\ble\ble_svc_battery
. The BLE battery service is in \quick_dev\app_ref\ble_services\bas_svc.c
.
During initialization, it starts system timers and adds battery services and battery level characteristic. After the timer timeout, the device will notify the client the battery level characteristics.
BLE data input/output service
This example creates BLE data input/output service send or receive data via BLE. The example application is in \examples\ble\ble_svc_data_io
. The BLE User Data Service is in \quick_dev\app_ref\ble_services\ud_svc.c
.
When the user sends data, the data will be sent to the Le task first. Then Le task will pass the data into the GattDispatchHandler in User define Service. According data's access permission that include read, write or notify, developer could create different handler to handle. This example use write handler GattWriteHandler
to handle write access data from phone (APP). GattWriteHandler
will be responsible for passing the data to the application, and the application will return the respnose to the phone (APP) via DataoutNotify.