Hello
I used the pc-ble-driver-py to advertise Apple ibeacons, but it seems that they're advertised as connectable undirected packets which is not good in my case, as I filter in NRF52 firmware packets based on packet type (1- not scan response 2- not connectable packet).
ble_gap_adv_start() method do have adv_params argument but it's just for interval and timeout. while the packet type is specified as following (I think)
def ble_gap_adv_start(self, adv_params=None):
if not adv_params:
adv_params = self.adv_params_setup()
assert isinstance(adv_params, BLEGapAdvParams), 'Invalid argument type'
return driver.sd_ble_gap_adv_start(self.rpc_adapter, adv_params.to_c())
....
def to_c(self):
adv_params = driver.ble_gap_adv_params_t()
adv_params.type = BLEGapAdvType.connectable_undirected.value
adv_params.p_peer_addr = None # Undirected advertisement.
adv_params.fp = driver.BLE_GAP_ADV_FP_ANY
adv_params.p_whitelist = None
adv_params.interval = util.msec_to_units(self.interval_ms,
util.UNIT_0_625_MS)
adv_params.timeout = self.timeout_s
My other question is regards how to switch between scan and adv in pc-ble-driver-py. When I do setup like:
self.driver = BLEDriver(serial_port=self.serial_port, auto_flash=False) self.driver.observer_register(self) self.adapter.driver.observer_register(self) self.driver.open() self.driver.ble_enable()
When I do scan alone it works, and when I do adv alone it works, but when the same program change from scan<->adv based on same setup, I get errors like
pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_gap_adv_start. Error code: 18
or can't start scan according to switch case.