gap_scan advertisement format
Received GAP advertisements are formatted as a dictionary, whose entries are as follows:
- address: The BLE MAC address of the received advertisement. Formatted as a bytes object.
- addr_type: The type of address contained in the address field. The possible values are defined as constants on the digi.ble module:
Constants | Applicable firmwares |
---|---|
ble.ADDR_TYPE_PUBLIC | 802.15.4, Zigbee, DigiMesh, BLU, Cellular devices |
ble.ADDR_TYPE_RANDOM | 802.15.4, Zigbee, DigiMesh, BLU, Cellular devices |
ble.ADDR_TYPE_PUBLIC_IDENTITY * | 802.15.4, Zigbee, DigiMesh, BLU, Cellular devices |
ble.ADDR_TYPE_RANDOM_IDENTITY * | 802.15.4, Zigbee, DigiMesh, BLU, Cellular devices |
* ble.ADDR_TYPE_PUBLIC_IDENTITY and ble.ADDR_TYPE_RANDOM_IDENTITY are removed in 802.15.4’s 0x200B release and removed in Zigbee’s 0x300B release. These constants are going to be removed from future releases of DigiMesh and Cellular firmwares so we do not advise using them. |
- connectable: True if the advertising device indicates that BLE central-mode devices may connect to it, False otherwise.
- rssi: The received signal strength of the advertisement, in dBm.
- payload: The raw advertisement payload. Formatted as a bytes object.
Extended advertisements also provide a few additional fields of data:
-
tx_power: The TX power value in the received packet header in dBm. Value 127 indicates the TX power information is unavailable.
-
periodic_interval: The periodic advertising interval in milliseconds. A zero indicates no periodic advertising.
-
adv_sid: The advertising set identifier. Used in periodic advertising.
-
data_completeness: The data completeness status.
-
If zero, indicates all advertisement data has been reported.
-
If one, indicates the advertising data is incomplete and more data will come in new events.
-
If two, indicates the advertising data is incomplete and more data will not come in new events.
-
-
secondary_phy: The PHY advertising packets are transmitted on the secondary advertising channels.
-
primary_phy: The PHY advertising packets are transmitted on the primary advertising channels.
Fields included in periodic advertisements are as follows:
-
tx_power: The TX power value in the received packet header in dBm. Value 127 indicates the TX power information is unavailable.
-
data_completeness: The data completeness status. If zero, indicates all advertisement data has been reported. If one, indicates the advertising data is incomplete and more data will come in new events. If two, indicates the advertising data is incomplete/truncated and no more data will come.
-
sync_handle: The periodic advertising synchronization handle.
-
counter: The sequence number of the periodic advertisement. An increasing counter that wraps from 255 to 0. This is used to detect if one or more advertising packets have been created by the stack but have been dropped due to problems such as temporarily running out of resources before the advertisement was received.
-
rssi: The received signal strength of the advertisement, in dBm.
-
payload: The raw advertisement payload. Formatted as a bytes object.