.. _label-section-ble-gap-analysis: BLE GAP Analysis ================ BLE GAP (Generic Access Profile) refers to the part of the BLE Specifications that deal with how BLE devices announce their presence and their capabilities. When shipped, the product does not advertise over BLE and the screen is turned off. As explained in the user manual, BLE can be activated by turning on the device, then performing a long press on the ON/OFF button. BLE is activated when the BLE icon appears on screen. BLE Advertisements ------------------ When BLE is turned ON, BLE Advertisements are sent at a rate of 1 packet per channel (37, 38, 39) per second. The advertise packet contains 3 sections of data: * Flags (0x01, mandatory) * 16-bit Service Class UUIDs (0x02, optional) * Device Name (0x09, optional) .. thumbnail:: _images/ble-advertise.png Flags """"" The Flags fields has a value of 0x06, a typical configuration for a BLE peripheral that has permanent advertising. 16-bit Service Class UUIDs """""""""""""""""""""""""" The 16-bit Service Class UUIDs is used to advertise which service is implemented by the GATT Server of this device. The reported value of 0xFF01 is not part of the list of `Bluetooth SIG-approved 16-bit UUID Assigned Numbers `_, so this is not compliant with the `Bluetooth Core Specifications `_. Indeed, the full specifications document mentions, in section 2.6: .. epigraph:: "*The Bluetooth SIG maintains a published set of assigned numbers on the Bluetooth SIG Assigned Numbers web page. These assigned numbers are grouped in various number spaces. Numbers assigned may overlap with other assigned numbers in different number spaces, but no number within a number space is ever reused. The various number spaces are defined in the specification that defines the usage of the assigned numbers.*" .. epigraph:: "*All assigned numbers within a given number space shall only be designated by the Bluetooth SIG and shall only be used for their intended purposes when used within a field, parameter, or other variable object defined to take on a value within that number space. All values not explicitly assigned within a given number space are Reserved for future use and subject to the requirements in Section 2.4.*" .. epigraph:: "*All 16-bit and 32-bit UUIDs as defined in [Vol 3] Part B, Section 2.5.1, are considered assigned numbers. All other UUID values may be used in any context where a UUID is permitted provided they are generated according to the recommendations in ITU-T Rec. X.667(10/2012), alternatively known as ISO/IEC 9834.8:2014.*" Device Name """"""""""" The device name field contains a fixed value of ``BLE-YC01``, which is the product name and identical on all units. The device name alone is thus not sufficient to differentiate one unit from another. BLE Scan Response ----------------- The BLE Scan Response is sent by a BLE Peripheral when a BLE Central performs an active scan. This allows to attached more information to a BLE Advertise (which has a limit of 31 bytes), with the advantage that it is only sent when there is something listening, saving some energy in low-density environments where there are few scanners. The scan response of BLE-YC01 contains the Manufacturer Specific Data option, which most likely contains information related to the current sensor measurements. .. thumbnail:: _images/ble-scan-response.png For this particular scan response, the Manufacturer Specifica Data is: * Company ID: 0xFFFF * Data: ``c0 00 00 00 ae 00 66 ff 03 04 00`` The company ID of 0xFFFF should really only be used for testing / development purposes, but not for commercial purposes. To be compliant, one should register for a company ID at the Bluetooth SIG and use that one instead of 0xFFFF. Just sayin'...