correct lastService and Parent Service behavior

This commit is contained in:
hathach committed 2017-01-21 01:11:30 +07:00
1 parent 113f8ed5b8
commit 5042dbc00d
2 files changed
+8 -4

No files matched your search

@@ -44,7 +44,7 @@ void BLECharacteristic::init(void)
varclr(&_report_ref_desc);
_service = BLEService::lastService;
_service = NULL;
_handles.value_handle = BLE_GATT_HANDLE_INVALID;
_handles.user_desc_handle = BLE_GATT_HANDLE_INVALID;
@@ -153,6 +153,8 @@ ble_gatts_char_handles_t BLECharacteristic::handles(void)
err_t BLECharacteristic::start(void)
{
_service = BLEService::lastService;
// Add UUID128 if needed
uuid.add();
+5 -3
View File
@@ -42,8 +42,6 @@ BLEService* BLEService::lastService = NULL;
void BLEService::_init(void)
{
_handle = BLE_GATT_HANDLE_INVALID;
lastService = this;
}
BLEService::BLEService(void)
@@ -80,6 +78,10 @@ err_t BLEService::addToGatt(void)
uuid.add();
uint16_t handle;
return sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &uuid._uuid, &handle);
VERIFY_STATUS( sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &uuid._uuid, &handle) );
lastService = this;
return NRF_SUCCESS;
}