def main(serial_port):
    print("Serial port used: {}".format(serial_port))
    driver = BLEDriver(serial_port=serial_port, baud_rate=1000000)
    observer = TimeoutObserver()
    adv_data = BLEAdvData(complete_local_name="pc_ble_driver_py")

    driver.observer_register(observer)
    driver.open()
    if config.__conn_ic_id__.upper() == "NRF51":
        driver.ble_enable(
            BLEEnableParams(
                vs_uuid_count=0,
                service_changed=0,
                periph_conn_count=1,
                central_conn_count=0,
                central_sec_count=0,
            )
        )
    elif config.__conn_ic_id__.upper() == "NRF52":
        driver.ble_enable()
    driver.ble_gap_adv_data_set(adv_data)
    driver.ble_gap_adv_start()
    observer.wait_for_timeout()

    print("Closing")
    driver.close()
def main(serial_port):
    print("Serial port used: {}".format(serial_port))
    driver = BLEDriver(serial_port=serial_port, auto_flash=True)
    observer = TimeoutObserver()
    adv_data = BLEAdvData(complete_local_name='Example')

    driver.observer_register(observer)
    driver.open()
    driver.ble_enable()
    driver.ble_gap_adv_data_set(adv_data)
    driver.ble_gap_adv_start()
    observer.wait_for_timeout()

    print("Closing")
    driver.close()
Exemple #3
0
 def start(self, adv_name):
     adv_data = BLEAdvData(complete_local_name=adv_name)
     self.adapter.driver.ble_gap_adv_data_set(adv_data)
     self.adapter.driver.ble_gap_adv_start()