diff --git a/example/le_streamer.c b/example/le_streamer.c index b164a459f..9675c2d4b 100644 --- a/example/le_streamer.c +++ b/example/le_streamer.c @@ -229,9 +229,19 @@ static void streamer(void){ /* LISTING_START(attWrite): ATT Write */ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){ - if (att_handle != ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE) return 0; - le_notification_enabled = little_endian_read_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION; - test_reset(); + // printf("att_write_callback att_handle %04x, transaction mode %u\n", att_handle, transaction_mode); + if (transaction_mode != ATT_TRANSACTION_MODE_NONE) return 0; + switch(att_handle){ + case ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE: + le_notification_enabled = little_endian_read_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION; + printf("Notifications enabled %u\n", le_notification_enabled); + test_reset(); + break; + case ATT_CHARACTERISTIC_0000FF12_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE: + printf("Write to ...FF12...: "); + printf_hexdump(buffer, buffer_size); + break; + } return 0; } /* LISTING_END */ diff --git a/example/le_streamer.gatt b/example/le_streamer.gatt index 7584dd82d..b801b417a 100644 --- a/example/le_streamer.gatt +++ b/example/le_streamer.gatt @@ -6,7 +6,9 @@ CHARACTERISTIC, GATT_SERVICE_CHANGED, READ, // Test Service PRIMARY_SERVICE, 0000FF10-0000-1000-8000-00805F9B34FB -// Test Characteristic, only with notify +// Test Characteristic, only notify CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, NOTIFY, +// Test Characterisitic, only write_without_response +CHARACTERISTIC, 0000FF12-0000-1000-8000-00805F9B34FB, WRITE_WITHOUT_RESPONSE | DYNAMIC,