ble/battery_service_server: assert battery service exists

This commit is contained in:
Milanka Ringwald 2020-09-25 11:33:42 +02:00
parent 0b0c01c942
commit 2e5374e1ad

View File

@ -47,6 +47,8 @@
#include "ble/att_server.h"
#include "btstack_util.h"
#include "bluetooth_gatt.h"
#include "btstack_debug.h"
#include "ble/gatt-service/battery_service_server.h"
@ -98,7 +100,7 @@ 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);
if (!service_found) return;
btstack_assert(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);