Ejemplo n.º 1
0
 def ble_gap_addr_get(self):
     addr = driver.ble_gap_addr_t()
     err_code = driver.sd_ble_gap_addr_get(self.rpc_adapter, addr)
     if err_code == driver.NRF_SUCCESS:
         addr = BLEGapAddr.from_c(addr)
     else:
         addr = None
     return err_code, addr
Ejemplo n.º 2
0
    def __init__(self):
        self.sec_keyset = driver.ble_gap_sec_keyset_t()
        keys_own = driver.ble_gap_sec_keys_t()
        self.sec_keyset.keys_own = keys_own

        keys_peer = driver.ble_gap_sec_keys_t()
        keys_peer.p_enc_key = driver.ble_gap_enc_key_t()
        keys_peer.p_enc_key.enc_info = driver.ble_gap_enc_info_t()
        keys_peer.p_enc_key.master_id = driver.ble_gap_master_id_t()
        keys_peer.p_id_key = driver.ble_gap_id_key_t()
        keys_peer.p_id_key.id_info = driver.ble_gap_irk_t()
        keys_peer.p_id_key.id_addr_info = driver.ble_gap_addr_t()
        # keys_peer.p_sign_key            = driver.ble_gap_sign_info_t()
        # keys_peer.p_pk                  = driver.ble_gap_lesc_p256_pk_t()
        self.sec_keyset.keys_peer = keys_peer
Ejemplo n.º 3
0
 def to_c(self):
     addr_array = util.list_to_uint8_array(self.addr[::-1])
     addr = driver.ble_gap_addr_t()
     addr.addr_type = self.addr_type.value
     addr.addr = addr_array.cast()
     return addr