Esempio n. 1
0
def init_scan_params():
    global scan_params
    scan_params = ble_driver.ble_gap_scan_params_t()
    scan_params.active = 1
    scan_params.interval = util.msec_to_units(200, util.UNIT_0_625_MS)
    scan_params.window = util.msec_to_units(150, util.UNIT_0_625_MS)
    scan_params.timeout = 0x1000
Esempio n. 2
0
def init_scan_params():
    global scan_params
    scan_params = ble_driver.ble_gap_scan_params_t()
    scan_params.active = 1
    scan_params.interval = util.msec_to_units(200, util.UNIT_0_625_MS)
    scan_params.window = util.msec_to_units(150, util.UNIT_0_625_MS)
    scan_params.timeout = 0x1000
Esempio n. 3
0
def init_connection_params():
    global connection_params
    connection_params = ble_driver.ble_gap_conn_params_t()
    connection_params.min_conn_interval = util.msec_to_units(30, util.UNIT_1_25_MS)
    connection_params.max_conn_interval = util.msec_to_units(60, util.UNIT_1_25_MS)
    connection_params.conn_sup_timeout = util.msec_to_units(4000, util.UNIT_10_MS)
    connection_params.slave_latency = 0
Esempio n. 4
0
def start_advertising():
    adv_params = ble_driver.ble_gap_adv_params_t()

    adv_params.type = ble_driver.BLE_GAP_ADV_TYPE_ADV_IND
    adv_params.p_peer_addr = None  # Undirected advertisement.
    adv_params.fp = ble_driver.BLE_GAP_ADV_FP_ANY
    adv_params.p_whitelist = None
    adv_params.interval = util.msec_to_units(40, util.UNIT_0_625_MS)
    adv_params.timeout = 180  # Advertising timeout 180 seconds

    error_code = ble_driver.sd_ble_gap_adv_start(adv_params)

    if error_code != ble_driver.NRF_SUCCESS:
        print "Failed to start advertising. Error code: 0x{0:02X}".format(error_code)
        return
    print "Started advertising"
Esempio n. 5
0
def start_advertising():
    adv_params = ble_driver.ble_gap_adv_params_t()

    adv_params.type = ble_driver.BLE_GAP_ADV_TYPE_ADV_IND
    adv_params.p_peer_addr = None  # Undirected advertisement.
    adv_params.fp = ble_driver.BLE_GAP_ADV_FP_ANY
    adv_params.p_whitelist = None
    adv_params.interval = util.msec_to_units(40, util.UNIT_0_625_MS)
    adv_params.timeout = 180  # Advertising timeout 180 seconds

    error_code = ble_driver.sd_ble_gap_adv_start(adv_params)

    if error_code != ble_driver.NRF_SUCCESS:
        print "Failed to start advertising. Error code: 0x{0:02X}".format(error_code)
        return

    print "Started advertising"
Esempio n. 6
0
def init_scan_params():
    global ble_scan_params
    ble_scan_params = ble_driver.ble_gap_scan_params_t()
    ble_scan_params.interval = util.msec_to_units(200, util.UNIT_0_625_MS)
    ble_scan_params.window = util.msec_to_units(150, util.UNIT_10_MS)