Ejemplo n.º 1
0
 def verify_security_connection(self):
     """
     Verify that we get a connection and a link key request
     """
     assertThat(self.get_security_connection_event_stream()).emits(
         lambda event: event.event_type ==
         LinkSecurityInterfaceCallbackEventType.ON_CONNECTED)
     assertThat(self._hci.get_event_stream()).emits(
         HciMatchers.LinkKeyRequest())
Ejemplo n.º 2
0
 def accept_pairing(self, dut_address, reply_boolean):
     """
         Here we handle the pairing events at the HCI level
     """
     logging.info("Cert: Waiting for LINK_KEY_REQUEST")
     assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyRequest())
     logging.info("Cert: Sending LINK_KEY_REQUEST_NEGATIVE_REPLY")
     self._enqueue_hci_command(
         hci_packets.LinkKeyRequestNegativeReplyBuilder(
             dut_address.decode('utf8')), True)
     logging.info("Cert: Waiting for IO_CAPABILITY_REQUEST")
     assertThat(self._hci_event_stream).emits(
         HciMatchers.IoCapabilityRequest())
     logging.info("Cert: Sending IO_CAPABILITY_REQUEST_REPLY")
     self._enqueue_hci_command(
         hci_packets.IoCapabilityRequestReplyBuilder(
             dut_address.decode('utf8'), self._io_caps, self._oob_data,
             self._auth_reqs), True)
     logging.info("Cert: Waiting for USER_CONFIRMATION_REQUEST")
     assertThat(self._hci_event_stream).emits(
         HciMatchers.UserConfirmationRequest())
     logging.info("Cert: Sending Simulated User Response '%s'" %
                  reply_boolean)
     if reply_boolean:
         logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_REPLY")
         self._enqueue_hci_command(
             hci_packets.UserConfirmationRequestReplyBuilder(
                 dut_address.decode('utf8')), True)
         logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE")
         assertThat(self._hci_event_stream).emits(
             HciMatchers.SimplePairingComplete())
         logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION")
         assertThat(self._hci_event_stream).emits(
             HciMatchers.LinkKeyNotification())
     else:
         logging.info(
             "Cert: Sending USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY")
         self._enqueue_hci_command(
             hci_packets.UserConfirmationRequestNegativeReplyBuilder(
                 dut_address.decode('utf8')), True)
         logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE")
         assertThat(self._hci_event_stream).emits(
             HciMatchers.SimplePairingComplete())