Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 9 months ago.
can I send digital data though GAP service? IF yes how to include the device?
#include "mbed.h" #include "BLEDevice.h" // BLE object BLEDevice ble; DigitalIn sensor(P0_5) // Optional: Device Name, add for human read-ability const static char DEVICE_NAME[] = "Flowmeter Tom_field"; // Optional: device name // You have up to 26 bytes of advertising data to use. const static uint8_t AdvData[] = {0x01,0x02,0x03,0x04,0x05}; // example of hex data //const static uint8_t AdvData[] = {"ChangeThisData"}; // example of character data static uint8_t analog_enabled = 0; static uint8_t old_state = 0; // Optional: Restart advertising when phone app disconnects void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) { ble.startAdvertising(); }
Question relating to:
1 Answer
8 years, 9 months ago.
The GAP service is a standard service with read-only characteristics: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.generic_access.xml
Some of its characteristics can be updated using methods offered by BLE_API, but it's not a good idea to overload standard characteristics to send application-specific digital data.
Also the code gives errors.
posted by jayendra mishra 23 Jul 2015