mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 00:32:52 +00:00
ble/battery_service_server: assert battery service exists
This commit is contained in:
parent
0b0c01c942
commit
2e5374e1ad
@ -47,6 +47,8 @@
|
|||||||
#include "ble/att_server.h"
|
#include "ble/att_server.h"
|
||||||
#include "btstack_util.h"
|
#include "btstack_util.h"
|
||||||
#include "bluetooth_gatt.h"
|
#include "bluetooth_gatt.h"
|
||||||
|
#include "btstack_debug.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ble/gatt-service/battery_service_server.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 start_handle = 0;
|
||||||
uint16_t end_handle = 0xfff;
|
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);
|
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
|
// 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);
|
battery_value_handle_value = gatt_server_get_value_handle_for_characteristic_with_uuid16(start_handle, end_handle, ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user