Example #1
0
 def ConnectionRequestCapture():
     return Capture(
         HciMatchers.EventWithCode(
             hci_packets.EventCode.CONNECTION_REQUEST),
         lambda packet: hci_packets.ConnectionRequestView(
             HciMatchers.ExtractEventWithCode(
                 packet.event, hci_packets.EventCode.CONNECTION_REQUEST)))
Example #2
0
 def ConnectionCompleteCapture():
     return Capture(
         HciMatchers.EventWithCode(
             hci_packets.EventCode.CONNECTION_COMPLETE),
         lambda packet: hci_packets.ConnectionCompleteView(
             HciMatchers.ExtractEventWithCode(
                 packet.event, hci_packets.EventCode.CONNECTION_COMPLETE)))
Example #3
0
    def test_inquiry_from_dut(self):
        self.dut_hci.register_for_events(EventCode.INQUIRY_RESULT)

        self.cert_hal.enable_inquiry_and_page_scan()
        lap = Lap()
        lap.lap = 0x33
        self.dut_hci.send_command(InquiryBuilder(lap, 0x30, 0xff))
        assertThat(self.dut_hci.get_event_stream()).emits(
            HciMatchers.EventWithCode(EventCode.INQUIRY_RESULT))
Example #4
0
    def test_inquiry_from_dut(self):
        self.dut_hci.register_for_events(hci_packets.EventCode.INQUIRY_RESULT)

        self.send_hal_hci_command(
            hci_packets.WriteScanEnableBuilder(
                hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN))
        lap = hci_packets.Lap()
        lap.lap = 0x33
        self.dut_hci.send_command_with_status(
            hci_packets.InquiryBuilder(lap, 0x30, 0xff))
        assertThat(self.dut_hci.get_event_stream()).emits(
            HciMatchers.EventWithCode(hci_packets.EventCode.INQUIRY_RESULT))
Example #5
0
 def SimplePairingCompleteCapture():
     return Capture(HciMatchers.EventWithCode(hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE),
         lambda packet: hci_packets.SimplePairingCompleteView(
             HciMatchers.ExtractEventWithCode(packet.payload, hci_packets.EventCode.SIMPLE_PAIRING_COMPLETE)))
Example #6
0
 def DisconnectionCompleteCapture():
     return Capture(
         HciMatchers.EventWithCode(hci_packets.EventCode.DISCONNECTION_COMPLETE),
         lambda packet: hci_packets.DisconnectionCompleteView(
             HciMatchers.ExtractEventWithCode(packet.payload, hci_packets.EventCode.DISCONNECTION_COMPLETE)))
Example #7
0
 def input_passkey(self, address, passkey):
     """
         Pretend to answer the pairing dialog as a user
     """
     logging.info("Cert: Waiting for PASSKEY request")
     assertThat(self._hci_event_stream).emits(
         HciMatchers.EventWithCode(
             hci_packets.EventCode.USER_PASSKEY_REQUEST))
     logging.info("Cert: Send user input passkey %d for %s" %
                  (passkey, address))
     peer = address.decode('utf-8')
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.ENTRY_STARTED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.CLEARED), True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ERASED), True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.DIGIT_ENTERED),
         True)
     self._enqueue_hci_command(
         hci_packets.SendKeypressNotificationBuilder(
             peer, hci_packets.KeypressNotificationType.ENTRY_COMPLETED),
         True)
     self._enqueue_hci_command(
         hci_packets.UserPasskeyRequestReplyBuilder(peer, passkey), True)