Esempio n. 1
0
 def _extract_le_connection_complete(packet_bytes):
     event = hci_packets.LeConnectionCompleteView(
         HciMatchers._extract_matching_le_event(
             packet_bytes, hci_packets.SubeventCode.CONNECTION_COMPLETE))
     if event is not None:
         return event
     return hci_packets.LeEnhancedConnectionCompleteView(
         HciMatchers._extract_matching_le_event(
             packet_bytes,
             hci_packets.SubeventCode.ENHANCED_CONNECTION_COMPLETE))
 def get_handle(packet):
     packet_bytes = packet.payload
     nonlocal handle
     if b'\x3e\x13\x01\x00' in packet_bytes:
         cc_view = hci_packets.LeConnectionCompleteView(
             hci_packets.LeMetaEventView(
                 hci_packets.EventView(
                     bt_packets.PacketViewLittleEndian(
                         list(packet_bytes)))))
         handle = cc_view.GetConnectionHandle()
         return True
     if b'\x3e\x13\x0A\x00' in packet_bytes:
         cc_view = hci_packets.LeEnhancedConnectionCompleteView(
             hci_packets.LeMetaEventView(
                 hci_packets.EventView(
                     bt_packets.PacketViewLittleEndian(
                         list(packet_bytes)))))
         handle = cc_view.GetConnectionHandle()
         return True
     return False
Esempio n. 3
0
 def get_handle(packet):
     packet_bytes = packet.event
     nonlocal handle
     nonlocal address
     if b'\x3e\x13\x01\x00' in packet_bytes:
         cc_view = hci_packets.LeConnectionCompleteView(
             hci_packets.LeMetaEventView(
                 hci_packets.EventPacketView(
                     bt_packets.PacketViewLittleEndian(
                         list(packet_bytes)))))
         handle = cc_view.GetConnectionHandle()
         address = cc_view.GetPeerAddress()
         return True
     if b'\x3e\x13\x0A\x00' in packet_bytes:
         cc_view = hci_packets.LeEnhancedConnectionCompleteView(
             hci_packets.LeMetaEventView(
                 hci_packets.EventPacketView(
                     bt_packets.PacketViewLittleEndian(
                         list(packet_bytes)))))
         handle = cc_view.GetConnectionHandle()
         address = cc_view.GetPeerResolvablePrivateAddress()
         return True
     return False