From 5fcb90a14951ec70a8ec41a656f6f58358b9986b Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 25 Apr 2020 13:09:47 +0200 Subject: NimbleController : CTS & ANS working but not at the same time (conflict during discovery) --- src/Components/Ble/CurrentTimeClient.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Components/Ble/CurrentTimeClient.cpp') diff --git a/src/Components/Ble/CurrentTimeClient.cpp b/src/Components/Ble/CurrentTimeClient.cpp index 524c37d5..44065bce 100644 --- a/src/Components/Ble/CurrentTimeClient.cpp +++ b/src/Components/Ble/CurrentTimeClient.cpp @@ -37,21 +37,23 @@ void CurrentTimeClient::StartDiscovery(uint16_t connectionHandle) { ble_gattc_disc_svc_by_uuid(connectionHandle, ((ble_uuid_t*)&ctsServiceUuid), CurrentTimeDiscoveryEventCallback, this); } -int CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { - if(service == nullptr && error->status == BLE_HS_EDONE) - NRF_LOG_INFO("Discovery complete"); +bool CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("CTS Discovery complete"); + return true; + } if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ctsServiceUuid), &service->uuid.u) == 0) { - NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); + NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); ble_gattc_disc_chrs_by_uuid(connectionHandle, service->start_handle, service->end_handle, ((ble_uuid_t*)¤tTimeCharacteristicUuid), CurrentTimeCharacteristicDiscoveredCallback, this); } - return 0; + return false; } int CurrentTimeClient::OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error *error, const ble_gatt_chr *characteristic) { if(characteristic == nullptr && error->status == BLE_HS_EDONE) - NRF_LOG_INFO("Characteristic discovery complete"); + NRF_LOG_INFO("CTS Characteristic discovery complete"); if(characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*)¤tTimeCharacteristicUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("CTS Characteristic discovered : 0x%x", characteristic->val_handle); -- cgit v1.2.3