androidbluetooth-lowenergywiresharkpayloadhci

BLE interprete hci log wireshark


I am experimenting with BLE sniffing and wireshark to get the exchanged data. From the beginning: I have a manufacturer app that communicates with a device. This device, which is the server, has to be paired with my smartphone and this is done from within the app. So I made a quick ble connection app myself and compared the hci_log file for differences. Now I guess I have the data to be exchanged to get the pairing stuff done. Now the problem:I have the Service and Characteristic UUID and the value I want to sent. My intention was to build a statemachine because there are multiple commands to be sent to get this done. Here the extract from the sniff:

ATT 26 Sent Handle Value Notification, Handle: 0x0031 (Generic Access Profile: Central Address Resolution: Unknown)

Service UUID:0x1800 Characteristic_UUID:0x2006

value:18:00:17:00:22:00:12:2f:2f:77:2f:43:2f:55:53:47:58:32:44:ff

I don't know if i have to send is with a characteristic.Write() command or if I have to send to the notification/CCCD.I assume that I have to send it to the notification but I can't find a notification enable command in the log before. Is it possible to send data to the notification before enabeling it? Thanks for your help


Solution

  • If the device is not bonded, the client needs to write 0x0001 (the bytes 0x01 followed by 0x00) to the Client Characteristic Configuration Descriptor in order for the server to be allowed to send notifications. If the devices are disconnected and later connected again, the descriptor needs to be rewritten.

    If the devices are bonded, the client also needs to write to the descriptor but if they disconnect and reconnect, the server remembers the descriptor value so the client doesn't have to write it again.