Permalink
Browse files

att_db: introduce PERSISTENT_WRITE_CCC, add to CCC ATT handle

  • Loading branch information...
mringwal committed Oct 17, 2017
1 parent 596b7fd commit 8f8dd6263af8212959ce0b7f2946af745a589350
Showing with 14 additions and 6 deletions.
  1. +1 −1 src/ble/att_db_util.c
  2. +1 −0 src/btstack_defines.h
  3. +1 −1 test/att_db/le_counter.h
  4. +11 −4 tool/compile_gatt.py
View
@@ -157,7 +157,7 @@ void att_db_util_add_service_uuid128(uint8_t * uuid128){
static void att_db_util_add_client_characteristic_configuration(uint16_t properties){
uint8_t buffer[2];
// keep authentication flags
uint16_t flags = (properties & 0x1ff00) | ATT_DB_FLAGS_READ_WITHOUT_AUTHENTICATION | ATT_PROPERTY_READ | ATT_PROPERTY_WRITE | ATT_PROPERTY_DYNAMIC;
uint16_t flags = (properties & 0x1ff00) | ATT_DB_PERSISTENT_WRITE_CCC | ATT_DB_FLAGS_READ_WITHOUT_AUTHENTICATION | ATT_PROPERTY_READ | ATT_PROPERTY_WRITE | ATT_PROPERTY_DYNAMIC;
little_endian_store_16(buffer, 0, 0);
att_db_util_add_attribute_uuid16(GATT_CLIENT_CHARACTERISTICS_CONFIGURATION, flags, buffer, 2);
}
View
@@ -298,6 +298,7 @@ typedef uint8_t sm_key_t[16];
// ..
// Internal properties reuse some GATT Characteristic Properties fields
#define ATT_DB_FLAGS_READ_WITHOUT_AUTHENTICATION 0x0001
#define ATT_DB_PERSISTENT_WRITE_CCC 0x0010
// EVENTS
View
@@ -31,7 +31,7 @@ const uint8_t profile_data[] =
// 0x0009 VALUE-0000FF11-0000-1000-8000-00805F9B34FB-READ | NOTIFY | DYNAMIC-''
0x16, 0x00, 0x02, 0x03, 0x09, 0x00, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x11, 0xff, 0x00, 0x00,
// 0x000a CLIENT_CHARACTERISTIC_CONFIGURATION
0x0a, 0x00, 0x0b, 0x01, 0x0a, 0x00, 0x02, 0x29, 0x00, 0x00,
0x0a, 0x00, 0x1b, 0x01, 0x0a, 0x00, 0x02, 0x29, 0x00, 0x00,
// END
0x00, 0x00,
View
@@ -75,10 +75,11 @@
# only used by gatt compiler >= 0xffff
# Extended Properties
'RELIABLE_WRITE': 0x10000,
'RELIABLE_WRITE': 0x10000,
# Broadcast, Notify, Indicate, Extended Properties are only used to describe a GATT Characteristic, but are free to use with att_db
'READ_WITHOUT_AUTHENTICATION': 0x0001,
'PERSISTENT_WRITE_CCC': 0x0010,
# 0x10
# 0x20
# 0x80
@@ -317,8 +318,9 @@ def parseCharacteristic(fout, parts):
else:
size = size + len(value.split())
# drop Broadcast, Notify, Indicate - not used for flags
value_properties = properties & 0x1ffce
# drop Broadcast (0x01), Notify (0x10), Indicate (0x20)- not used for flags
#
value_properties = properties & 0x1ffce
# add UUID128 flag for value handle
if uuid_size == 16:
@@ -342,7 +344,12 @@ def parseCharacteristic(fout, parts):
if add_client_characteristic_configuration(properties):
# replace GATT Characterstic Properties with READ|WRITE|READ_WITHOUT_AUTHENTICATION|DYNAMIC
ccc_properties = (properties & 0x1fc00) | property_flags['READ_WITHOUT_AUTHENTICATION'] | property_flags['READ'] | property_flags['WRITE'] | property_flags['DYNAMIC'];
ccc_properties = (properties & 0x1fc00) | \
property_flags['READ_WITHOUT_AUTHENTICATION'] | \
property_flags['READ'] | \
property_flags['WRITE'] | \
property_flags['DYNAMIC'] | \
property_flags['PERSISTENT_WRITE_CCC'];
size = 2 + 2 + 2 + 2 + 2
write_indent(fout)
fout.write('// 0x%04x CLIENT_CHARACTERISTIC_CONFIGURATION\n' % (handle))

0 comments on commit 8f8dd62

Please sign in to comment.