mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 09:08:06 +00:00
spp_and_le_counter: allow writes on test characteristic
This commit is contained in:
parent
0af43532f7
commit
07fdcd55d7
@ -197,11 +197,22 @@ static uint16_t att_read_callback(uint16_t con_handle, uint16_t att_handle, uint
|
||||
|
||||
// write requests
|
||||
static int att_write_callback(uint16_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){
|
||||
// printf("WRITE Callback, handle %04x, mode %u, offset %u, data: ", handle, transaction_mode, offset);
|
||||
// printf_hexdump(buffer, buffer_size);
|
||||
if (att_handle != ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE) return 0;
|
||||
le_notification_enabled = READ_BT_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION;
|
||||
return 0;
|
||||
// ignore cancel sent for new connections
|
||||
if (transaction_mode == ATT_TRANSACTION_MODE_CANCEL) return 0;
|
||||
// find characteristic for handle
|
||||
switch (att_handle){
|
||||
case ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE:
|
||||
le_notification_enabled = READ_BT_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION;
|
||||
return 0;
|
||||
case ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE:
|
||||
printf("Write on test characteristic: ");
|
||||
printf_hexdump(buffer, buffer_size);
|
||||
return 0;
|
||||
default:
|
||||
printf("WRITE Callback, handle %04x, mode %u, offset %u, data: ", con_handle, transaction_mode, offset);
|
||||
printf_hexdump(buffer, buffer_size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6,7 +6,6 @@ CHARACTERISTIC, GATT_SERVICE_CHANGED, READ,
|
||||
|
||||
// Counter Service
|
||||
PRIMARY_SERVICE, 0000FF10-0000-1000-8000-00805F9B34FB
|
||||
// Counter Characteristic, with read and notify
|
||||
CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, READ | NOTIFY | DYNAMIC,
|
||||
|
||||
// Counter Characteristic, with read, write, write_without_response and notify
|
||||
CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, READ | NOTIFY | WRITE | WRITE_WITHOUT_RESPONSE | DYNAMIC,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user