mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-15 23:42:52 +00:00
gatt-services: use assert to check service found in att db
This commit is contained in:
parent
e86f2b509d
commit
a2489f29b6
@ -100,7 +100,8 @@ void battery_service_server_init(uint8_t value){
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xfff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE, &start_handle, &end_handle);
|
||||
btstack_assert(service_found);
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get characteristic value handle and client configuration handle
|
||||
battery_value_handle_value = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL);
|
||||
|
@ -1030,10 +1030,9 @@ void cycling_power_service_server_init(uint32_t feature_flags,
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_CYCLING_POWER, &start_handle, &end_handle);
|
||||
if (!service_found){
|
||||
log_error("no service found\n");
|
||||
return;
|
||||
}
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get CP Mesurement characteristic value handle and client configuration handle
|
||||
instance->measurement_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_CYCLING_POWER_MEASUREMENT);
|
||||
instance->measurement_client_configuration_descriptor_handle = gatt_server_get_client_configuration_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_CYCLING_POWER_MEASUREMENT);
|
||||
|
@ -305,10 +305,9 @@ void cycling_speed_and_cadence_service_server_init(uint32_t supported_sensor_loc
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_CYCLING_SPEED_AND_CADENCE, &start_handle, &end_handle);
|
||||
if (!service_found){
|
||||
// printf("no service found\n");
|
||||
return;
|
||||
}
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// // get CSC Mesurement characteristic value handle and client configuration handle
|
||||
instance->measurement_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_CSC_MEASUREMENT);
|
||||
instance->measurement_client_configuration_descriptor_handle = gatt_server_get_client_configuration_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_CSC_MEASUREMENT);
|
||||
|
@ -150,7 +150,8 @@ void heart_rate_service_server_init(heart_rate_service_body_sensor_location_t lo
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_HEART_RATE, &start_handle, &end_handle);
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get Heart Rate Mesurement characteristic value handle and client configuration handle
|
||||
instance->measurement_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||
|
@ -288,7 +288,8 @@ void hids_device_init(uint8_t country_code, const uint8_t * descriptor, uint16_t
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xfff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_HUMAN_INTERFACE_DEVICE, &start_handle, &end_handle);
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get report map handle
|
||||
instance->hid_report_map_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_REPORT_MAP);
|
||||
|
@ -197,8 +197,8 @@ void mesh_provisioning_service_server_init(void){
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_MESH_PROVISIONING, &start_handle, &end_handle);
|
||||
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
instance->data_in_client_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_MESH_PROVISIONING_DATA_IN);
|
||||
instance->data_out_client_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_MESH_PROVISIONING_DATA_OUT);
|
||||
|
@ -160,8 +160,8 @@ void mesh_proxy_service_server_init(void){
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_MESH_PROXY, &start_handle, &end_handle);
|
||||
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
instance->data_in_client_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_MESH_PROXY_DATA_IN);
|
||||
instance->data_out_client_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_MESH_PROXY_DATA_OUT);
|
||||
|
@ -113,7 +113,8 @@ void nordic_spp_service_server_init(void (*callback)(hci_con_handle_t con_handle
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xffff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid128(nordic_spp_profile_uuid128, &start_handle, &end_handle);
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get characteristic value handle and client configuration handle
|
||||
nordic_spp_rx_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid128(start_handle, end_handle, nordic_spp_rx_uuid128);
|
||||
|
@ -221,7 +221,8 @@ void ublox_spp_service_server_init(void (*client_data_callback)(hci_con_handle_t
|
||||
uint16_t start_handle = 0;
|
||||
uint16_t end_handle = 0xfff;
|
||||
int service_found = gatt_server_get_get_handle_range_for_service_with_uuid128(ublox_spp_profile_uuid128, &start_handle, &end_handle);
|
||||
if (!service_found) return;
|
||||
btstack_assert(service_found != 0);
|
||||
UNUSED(service_found);
|
||||
|
||||
// get characteristic value handle and client configuration handle
|
||||
// FIFO
|
||||
|
Loading…
x
Reference in New Issue
Block a user