def on_gap_evt_sec_params_request(self, ble_driver, conn_handle, **kwargs): sec_params = BLEGapSecParams.from_c(kwargs['peer_params']) sec_params.io_caps = BLEGapIOCaps.display_only sec_params.min_key_size = 7 sec_params.kdist_own = BLEGapSecKDist(False, False, False, False) sec_params.kdist_peer = BLEGapSecKDist(False, False, False, False) self.adapter.driver.ble_gap_sec_params_reply(conn_handle, BLEGapSecStatus.success, sec_params=sec_params)
def on_gap_evt_sec_params_request(self, ble_driver, conn_handle, **kwargs): logger.info("Peripheral: on_gap_evt_sec_params_request.") sec_params = BLEGapSecParams.from_c(kwargs['peer_params']) sec_params.io_caps = BLEGapIOCaps.display_only sec_params.lesc = True sec_params.min_key_size = 7 sec_params.kdist_own = BLEGapSecKDist(True, True, False, False) sec_params.kdist_peer = BLEGapSecKDist(True, True, False, False) logger.debug( "Generate LE Secure Connection ECDH private and public key.") keyset = self.adapter.driver.generate_lesc_keyset() ble_driver.ble_gap_sec_params_reply(conn_handle, BLEGapSecStatus.success, sec_params, keyset)