Hi,
I’m sending data from firmware on DeviceOS 3.3.0 to an iOS mobile app.
This is how the BLE characteristic is defined:
constexpr char serviceUUID[] = "b4ad5b8d-d2db-44d6-9d35-5d43b9e50321";
constexpr char readUUID[] = "226285d5-7a5a-448d-8317-dae1fd2d6c36";
txCharacteristic = new BleCharacteristic("txapp", BleCharacteristicProperty::NOTIFY, readUUID, serviceUUID);
BLE.addCharacteristic(*txCharacteristic);
This is how the data is sent:
void MyLib::sendInfoToMobileApp(const char *info)
{
int len = snprintf(pushToAppBuffer, 236, info);
// log to console
MyLog.info("Sending to mobile app:");
MyLog.info(pushToAppBuffer);
txCharacteristic->setValue((uint8_t *)pushToAppBuffer, len);
}
However, some 15 seconds after the connection succeeds and the Argon is sending data normally, the connection breaks and I see this:
[app.ble_my_lib] INFO: Sending to mobile app:
0000026926 [app.ble_my_lib] INFO: {"1234567890"}
0000026927 [hal.ble] ERROR: sd_ble_gatts_hvx() failed: 8
0000026929 [app.ble_my_lib] INFO: Sending to mobile app:
0000026929 [app.ble_my_lib] INFO: {"1234567890"}
0000026930 [hal.ble] ERROR: sd_ble_gatts_hvx() failed: 8
0000026931 [app.ble_my_lib] INFO: Sending to mobile app:
0000026931 [app.ble_my_lib] INFO: {"1234567890"}
0000026932 [hal.ble] ERROR: sd_ble_gatts_hvx() failed: 8
0000026955 [app] INFO: **************************************************** Disconnected from mobile app
(I increased logs to TRACE)
0000053025 [wiring.ble] TRACE: Disconnected by remote device.
0000053073 [system.ctrl.ble] TRACE: Disconnected
This seems to only happen only on iOS, and NOT on Android.
What is this error message ERROR: sd_ble_gatts_hvx() failed: 8 trying to tell me?
By looking at the DeviceOS source code, I could not find a table of error codes, and what that 8 means.
I guess the library I’m using on my iOS phone is disconnecting due to something, but I’d like to know why, if at all possible. I could not find any relevant info on the mobile side (yet).
Thank you.