mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 15:39:59 +00:00
try to enable notification/indication
This commit is contained in:
parent
d4b743c227
commit
863e2c6b5a
@ -100,6 +100,7 @@ static timer_source_t heartbeat;
|
|||||||
static uint8_t counter = 0;
|
static uint8_t counter = 0;
|
||||||
static int update_client = 0;
|
static int update_client = 0;
|
||||||
static int client_configuration = 0;
|
static int client_configuration = 0;
|
||||||
|
static uint16_t client_configuration_handle;
|
||||||
|
|
||||||
static uint16_t handle = 0;
|
static uint16_t handle = 0;
|
||||||
|
|
||||||
@ -220,22 +221,29 @@ static uint16_t att_read_callback(uint16_t handle, uint16_t offset, uint8_t * bu
|
|||||||
// write requests
|
// write requests
|
||||||
static int att_write_callback(uint16_t handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size, signature_t * signature){
|
static int att_write_callback(uint16_t handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size, signature_t * signature){
|
||||||
printf("WRITE Callback, handle %04x\n", handle);
|
printf("WRITE Callback, handle %04x\n", handle);
|
||||||
|
|
||||||
|
switch(handle){
|
||||||
|
case 0x0012:
|
||||||
|
case 0x0015:
|
||||||
|
case 0x002a:
|
||||||
|
case 0x002d:
|
||||||
|
client_configuration = buffer[0];
|
||||||
|
client_configuration_handle = handle;
|
||||||
|
printf("Client Configuration set to %u for handle %04x\n", client_configuration, handle);
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
printf("Value: ");
|
printf("Value: ");
|
||||||
hexdump(buffer, buffer_size);
|
hexdump(buffer, buffer_size);
|
||||||
|
|
||||||
if (buffer_size > ATT_VALUE_MAX_LEN){
|
if (buffer_size > ATT_VALUE_MAX_LEN){
|
||||||
buffer_size = ATT_VALUE_MAX_LEN;
|
buffer_size = ATT_VALUE_MAX_LEN;
|
||||||
}
|
}
|
||||||
memcpy(att_value, buffer, buffer_size);
|
memcpy(att_value, buffer, buffer_size);
|
||||||
att_value_len = buffer_size;
|
att_value_len = buffer_size;
|
||||||
|
|
||||||
switch(handle){
|
|
||||||
case 0x0010:
|
|
||||||
client_configuration = buffer[0];
|
|
||||||
printf("Client Configuration set to %u\n", client_configuration);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ PRIMARY_SERVICE, F000
|
|||||||
INCLUDE_SERVICE, FFF4
|
INCLUDE_SERVICE, FFF4
|
||||||
// Characteristics 16 and 128 bit with different authoriztion/authentication/encryption requirements and read/write flags
|
// Characteristics 16 and 128 bit with different authoriztion/authentication/encryption requirements and read/write flags
|
||||||
// - no requirements
|
// - no requirements
|
||||||
CHARACTERISTIC, F100, READ | WRITE | DYNAMIC,
|
CHARACTERISTIC, F100, READ | WRITE | DYNAMIC | CLIENT_CONFIGURATION,
|
||||||
CHARACTERISTIC, 0000F101-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC,
|
CHARACTERISTIC, 0000F101-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC | CLIENT_CONFIGURATION,
|
||||||
// - neither read nor writable
|
// - neither read nor writable
|
||||||
CHARACTERISTIC, F102, DYNAMIC,
|
CHARACTERISTIC, F102, DYNAMIC,
|
||||||
CHARACTERISTIC, 0000F103-0000-1000-8000-00805F9B34FB, DYNAMIC,
|
CHARACTERISTIC, 0000F103-0000-1000-8000-00805F9B34FB, DYNAMIC,
|
||||||
@ -64,8 +64,8 @@ PRIMARY_SERVICE, 0000F001-0000-1000-8000-00805F9B34FB
|
|||||||
INCLUDE_SERVICE, FFF4
|
INCLUDE_SERVICE, FFF4
|
||||||
// Characteristics 16 and 128 bit with different authoriztion/authentication/encryption requirements and read/write flags
|
// Characteristics 16 and 128 bit with different authoriztion/authentication/encryption requirements and read/write flags
|
||||||
// - no requirements
|
// - no requirements
|
||||||
CHARACTERISTIC, F200, READ | WRITE | DYNAMIC,
|
CHARACTERISTIC, F200, READ | WRITE | DYNAMIC | CLIENT_CONFIGURATION,
|
||||||
CHARACTERISTIC, 0000F201-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC,
|
CHARACTERISTIC, 0000F201-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC | CLIENT_CONFIGURATION,
|
||||||
// - neither read nor writable
|
// - neither read nor writable
|
||||||
CHARACTERISTIC, F202, DYNAMIC,
|
CHARACTERISTIC, F202, DYNAMIC,
|
||||||
CHARACTERISTIC, 0000F203-0000-1000-8000-00805F9B34FB, DYNAMIC,
|
CHARACTERISTIC, 0000F203-0000-1000-8000-00805F9B34FB, DYNAMIC,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user