Skip to contentSkip to conversation

GATT Notification not sending

DISCUSSION Nathan Jozwiak 2 participants 3 messages Oct 14, 2014 – Oct 15, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm trying to send a notification to a client when a characteristic value is updated by the server.

Here is the characteristics creation in the GATT server:

    /* Notification characteristic */
    bt_uuid16_create(&uuid, GATT_CHARAC_UUID);
    atval[0] = GATT_CHR_PROP_READ | GATT_CHR_PROP_NOTIFY;
    put_le16(h + 1, &atval[1]);
    put_le16(UUID_NOTIFY, &atval[3]);
    attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE, 

ATT_NOT_PERMITTED, atval, 5);

    /* Notification value */
    bt_uuid16_create(&uuid, UUID_NOTIFY);
    ekey_valid_handle = h;
    atval[0] = 0x00;
    attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE, 

ATT_NOT_PERMITTED, atval, 1);

    /* Notification Client Characteristic Config (CCC) */
    bt_uuid16_create(&uuid, GATT_CLIENT_CHARAC_CFG_UUID);
    atval[0] = 0x00;
    attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE, ATT_NONE, 

atval, 1);

I am connecting to the GATT server using the gatttool on another Linux system.

	[CON][00:02:72:C9:5E:0F][LE]> char-desc 0x18
	handle: 0x0018, uuid: 2803
	handle: 0x0019, uuid: f005
	handle: 0x001a, uuid: 2902
	[CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x1a
	Characteristic value/descriptor: 00 01
	[CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x19
	Characteristic value/descriptor: 00

Should the CCC init to 0x01? That doesn't make sense to me. Wouldn't that indicate the client was already setup for notifications?

I have an application that communicates with bluetoothd over TCP sockets. So when I send bluetoothd a command it will forward it, my application will process it, and respond to bluetoothd which will then update the Notification characteristic value depending on the success/failure of processing. I then need to notify the client of the change so it can reread the value to see if the command was successful.

	[CON][00:02:72:C9:5E:0F][LE]> char-write-cmd 0x000b 0x1234567890
	[CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x19
	Characteristic value/descriptor: ff

The update of the characteristic value worked fine. But I am using btmon to monitor traffic between the two devices and I see no messages going out from the server to the client.

Thanks,
Nate

#1 lore raw

Update: I downloaded the LightBlue app from the Apple Store. The app allows you to connect to a GATT server and select available services to interact with. My notification characteristic showed up properly with an initial value of 0x00 and a CCC value of 0. But when attempted to register with the notification I saw this error from my bluetoothd output:

bluetoothd[8754]: Refusing storage path for private addressed device /org/bluez/hci0/dev_59_F2_63_47_1D_90 bluetoothd[8754]: Unable to get ccc storage path for device
bluetoothd[8754]: attrib/gattrib.c:g_attrib_ref() 0xa073bd8: ref=3
bluetoothd[8754]: attrib/gattrib.c:g_attrib_unref() 0xa073bd8: ref=2

Unfortunately, I do not know the command LightBlue was sending to set the CCC, but I figured this might be a clue for someone.

Am I not properly setting up the notification characteristic? I followed the same logic as the power level characteristic setup in profiles/proximity/reporter.c register_tx_power().

Thanks
Nate

Quoted 66 lines · Nathan Jozwiak

Hi all,

I'm trying to send a notification to a client when a characteristic value is updated by the server.

Here is the characteristics creation in the GATT server:

     /* Notification characteristic */
     bt_uuid16_create(&uuid, GATT_CHARAC_UUID);
     atval[0] = GATT_CHR_PROP_READ | GATT_CHR_PROP_NOTIFY;
     put_le16(h + 1, &atval[1]);
     put_le16(UUID_NOTIFY, &atval[3]);
     attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE,

ATT_NOT_PERMITTED, atval, 5);

     /* Notification value */
     bt_uuid16_create(&uuid, UUID_NOTIFY);
     ekey_valid_handle = h;
     atval[0] = 0x00;
     attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE,

ATT_NOT_PERMITTED, atval, 1);

     /* Notification Client Characteristic Config (CCC) */
     bt_uuid16_create(&uuid, GATT_CLIENT_CHARAC_CFG_UUID);
     atval[0] = 0x00;
     attrib_db_add(adapter->adapter, h++, &uuid, ATT_NONE, ATT_NONE,

atval, 1);

I am connecting to the GATT server using the gatttool on another Linux system.

     [CON][00:02:72:C9:5E:0F][LE]> char-desc 0x18
     handle: 0x0018, uuid: 2803
     handle: 0x0019, uuid: f005
     handle: 0x001a, uuid: 2902
     [CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x1a
     Characteristic value/descriptor: 00 01
     [CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x19
     Characteristic value/descriptor: 00

Should the CCC init to 0x01? That doesn't make sense to me. Wouldn't that indicate the client was already setup for notifications?

I have an application that communicates with bluetoothd over TCP sockets. So when I send bluetoothd a command it will forward it, my application will process it, and respond to bluetoothd which will then update the Notification characteristic value depending on the success/failure of processing. I then need to notify the client of the change so it can reread the value to see if the command was successful.

     [CON][00:02:72:C9:5E:0F][LE]> char-write-cmd 0x000b 0x1234567890
     [CON][00:02:72:C9:5E:0F][LE]> char-read-hnd 0x19
     Characteristic value/descriptor: ff

The update of the characteristic value worked fine. But I am using btmon to monitor traffic between the two devices and I see no messages going out from the server to the client.

Thanks,
Nate
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Nathan Jozwiak
MapleLeaf Software, Inc.
858-598-4814
#2 lore raw

Hi Nathan,

Quoted 6 lines · Nathan Jozwiak

Update: I downloaded the LightBlue app from the Apple Store. The app allows you to connect to a GATT server and select available services to interact with. My notification characteristic showed up properly with an initial value of 0x00 and a CCC value of 0. But when attempted to register with the notification I saw this error from my bluetoothd output:

Quoted 8 lines

bluetoothd[8754]: Refusing storage path for private addressed device /org/bluez/hci0/dev_59_F2_63_47_1D_90
bluetoothd[8754]: Unable to get ccc storage path for device bluetoothd[8754]: attrib/gattrib.c:g_attrib_ref() 0xa073bd8: ref=3 bluetoothd[8754]: attrib/gattrib.c:g_attrib_unref() 0xa073bd8: ref=2

Unfortunately, I do not know the command LightBlue was sending to set the CCC, but I figured this might be a clue for someone.

Unfortunately this isn't related to your main issue. It just means that you're running a kernel version that doesn't support LE Privacy. Because of this the kernel has not been able to notify user space of the Identity Address of the remote device so that information about it could be stored persistently (iOS is one of the few implementations out there actively using Random Private Addresses).

Johan