Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BLESession.setNotifications: Lookup CCCD to start or stop notifications
Per Bluetooth Core Specification Vol.3, Part G, Section 3.3.1.1, if Notify property is set for a Characteristic, the Client Characteristic Configuration Descriptor, or CCCD, shall exist. As noted in section 3.3.3.3 of the specification, notification of the Characteristic is enabled or disabled by setting bit 0 of the CCCD. This CCCD exists within the characteristic definition following the Characteristic Value declaration, and section 3.3.3 of the specification warns that the order of characteristic declaration shall not be assumed. However, current pyscrlink code assumes that the CCCD comes just after the Characteristic Value and CCCD handle is obtained just adding 1 to the handle of the Characteristic Value. This works many of the BLE devices but does not work all of them. To get correct CCCD handle, look up descriptors of the Characteristic to find out the CCCD. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
- Loading branch information