From 9898fed80634c99c9dbe8ee8682dfdc259463654 Mon Sep 17 00:00:00 2001 From: JF Date: Tue, 16 Jun 2020 20:36:24 +0200 Subject: Update to nimble 1.3.0 + WIP : debug BLE connection issue with android phones. --- src/Components/Ble/AlertNotificationService.cpp | 8 ++++++-- src/Components/Ble/CurrentTimeService.cpp | 8 ++++++-- src/Components/Ble/DeviceInformationService.cpp | 8 ++++++-- src/Components/Ble/DfuService.cpp | 8 ++++++-- src/Components/Ble/NimbleController.cpp | 4 ++-- 5 files changed, 26 insertions(+), 10 deletions(-) (limited to 'src/Components/Ble') diff --git a/src/Components/Ble/AlertNotificationService.cpp b/src/Components/Ble/AlertNotificationService.cpp index 8e3b712d..fd69bda3 100644 --- a/src/Components/Ble/AlertNotificationService.cpp +++ b/src/Components/Ble/AlertNotificationService.cpp @@ -17,8 +17,12 @@ int AlertNotificationCallback(uint16_t conn_handle, uint16_t attr_handle, struct } void AlertNotificationService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager ) : m_systemTask{systemTask}, m_notificationManager{notificationManager}, diff --git a/src/Components/Ble/CurrentTimeService.cpp b/src/Components/Ble/CurrentTimeService.cpp index 9ae4c3b8..80ad9c25 100644 --- a/src/Components/Ble/CurrentTimeService.cpp +++ b/src/Components/Ble/CurrentTimeService.cpp @@ -13,8 +13,12 @@ int CTSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_acce } void CurrentTimeService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } diff --git a/src/Components/Ble/DeviceInformationService.cpp b/src/Components/Ble/DeviceInformationService.cpp index 3099b1bf..c1d55541 100644 --- a/src/Components/Ble/DeviceInformationService.cpp +++ b/src/Components/Ble/DeviceInformationService.cpp @@ -15,8 +15,12 @@ int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct } void DeviceInformationService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } diff --git a/src/Components/Ble/DfuService.cpp b/src/Components/Ble/DfuService.cpp index ff899e6f..c6d8493f 100644 --- a/src/Components/Ble/DfuService.cpp +++ b/src/Components/Ble/DfuService.cpp @@ -74,8 +74,12 @@ DfuService::DfuService(Pinetime::System::SystemTask &systemTask, Pinetime::Contr } void DfuService::Init() { - ble_gatts_count_cfg(serviceDefinition); - ble_gatts_add_svcs(serviceDefinition); + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); } int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context) { diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index 561dbce4..8c4675b7 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -180,8 +180,8 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { StartAdvertising(); bleController.Disconnect(); } else { - bleController.Connect(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + //bleController.Connect(); + //systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); connectionHandle = event->connect.conn_handle; // Service discovery is deffered via systemtask } -- cgit v1.2.3 From 3dfba0b90d8549d17a2aa4d228f31fbdcf803e70 Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 19 Jun 2020 22:20:12 +0200 Subject: Update BLE status when BLE is connected. --- src/Components/Ble/NimbleController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Components/Ble') diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index 8c4675b7..561dbce4 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -180,8 +180,8 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { StartAdvertising(); bleController.Disconnect(); } else { - //bleController.Connect(); - //systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + bleController.Connect(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); connectionHandle = event->connect.conn_handle; // Service discovery is deffered via systemtask } -- cgit v1.2.3