This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

unable to get the scan response data using pc_ble_driver_py

Hello,

I am trying to capture the advertisements of the surrounding BLE devices with NRF52840 Dongle using pc_ble_driver_py python library. I am successful in capturing the adv_data (Advertising data), but I am not able to capture the scan_rsp data (Scan Response data) from the BLE devices.

# the following code snippet is used for scanning

scan_duration = 120
params = BLEGapScanParams(interval_ms=200, window_ms=150, timeout_s=scan_duration)

self.adapter.driver.ble_gap_scan_start(scan_params=params)

# the following code snippet is used for printing the scanned packets

def on_gap_evt_adv_report(self, ble_driver, conn_handle, peer_addr, rssi, adv_type, adv_data):


   if BLEAdvData.Types.complete_local_name in adv_data.records:
        print(str(adv_data.records))

   elif BLEAdvData.Types.short_local_name in adv_data.records:
        print(str(adv_data.records))

   else:
        return

Kindly suggest suitable changes for getting the scan_rsp data.

Parents
  • Hi,

    How are you checking if the packet is a scan response packet? As far as I can see from the pc-ble-driver-py code, the adv_type is only set it the packet is _not_ a scan response packet, meaning that scan response packet will have the adv_type parameter set to 'None'. I used this to check scan response or not on received adv_reports:

    def on_gap_evt_adv_report(self, ble_driver, conn_handle, peer_addr, rssi, adv_type, adv_data):
        if adv_type == None:
            print("scan response")
        else:
            print("adv_data")

    Best regards,
    Jørgen

Reply
  • Hi,

    How are you checking if the packet is a scan response packet? As far as I can see from the pc-ble-driver-py code, the adv_type is only set it the packet is _not_ a scan response packet, meaning that scan response packet will have the adv_type parameter set to 'None'. I used this to check scan response or not on received adv_reports:

    def on_gap_evt_adv_report(self, ble_driver, conn_handle, peer_addr, rssi, adv_type, adv_data):
        if adv_type == None:
            print("scan response")
        else:
            print("adv_data")

    Best regards,
    Jørgen

Children
Related