add ble_gattc_handle_range_t to clientService

This commit is contained in:
hathach committed 2017-04-13 15:42:58 +07:00
1 parent 08187e3c15
commit cece1ef746
5 files changed
+48

No files matched your search

+31
View File
@@ -38,11 +38,27 @@
BLEGatt::BLEGatt(void)
//: _adamsg()
{
varclr(&_server);
varclr(&_client);
}
uint16_t BLEGatt::readCharByUuid(uint16_t conn_hdl, BLEUuid bleuuid, void* buffer, uint16_t bufsize, uint16_t start_hdl, uint16_t end_hdl)
{
#if 0
ble_gattc_handle_range_t hdl_range = { .start_handle = start_hdl, .end_handle = end_hdl };
_adamsg.prepare(buffer, bufsize);
VERIFY_STATUS( sd_ble_gattc_char_value_by_uuid_read(conn_hdl, &bleuuid._uuid, &hdl_range), 0);
int32_t count = _adamsg.waitUntilComplete(BLE_GENERIC_TIMEOUT);
return (count < 0) ? 0 : count;
#endif
return 0;
}
void BLEGatt::_eventHandler(ble_evt_t* evt)
{
// Server Characteristics
@@ -77,6 +93,21 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
{
for(int i=0; i<_client.svc_count; i++) _client.svc_list[i]->disconnect();
}
#if 0
// GATTC Read Characteristic by UUID procedure
if ( evt->header.evt_id == BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP )
{
ble_gattc_evt_char_val_by_uuid_read_rsp_t* rd_rsp = &evt->evt.gattc_evt.params.char_val_by_uuid_read_rsp;
PRINT_INT(rd_rsp->count);
PRINT_INT(rd_rsp->value_len);
if (rd_rsp->count)
{
_adamsg.feed(rd_rsp->handle_value[0].p_value, rd_rsp->value_len)
}
}
#endif
}
bool BLEGatt::_addCharacteristic(BLECharacteristic* chr)