Exemplo n.º 1
0
 def test_nested_packets(self):
     handle = 123
     inside = hci_packets.ReadScanEnableBuilder()
     logging.debug(inside.Serialize())
     logging.debug("building outside")
     outside = hci_packets.AclPacketBuilder(
         handle,
         hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
         hci_packets.BroadcastFlag.POINT_TO_POINT, inside)
     logging.debug(outside.Serialize())
     logging.debug("Done!")
Exemplo n.º 2
0
 def test_l2cap_config_options(self):
     mtu_opt = l2cap_packets.MtuConfigurationOption()
     mtu_opt.mtu = 123
     fcs_opt = l2cap_packets.FrameCheckSequenceOption()
     fcs_opt.fcs_type = l2cap_packets.FcsType.DEFAULT
     request = l2cap_packets.ConfigurationRequestBuilder(
         0x1d,  # Command ID
         0xc1d,  # Channel ID
         l2cap_packets.Continuation.END,
         [mtu_opt, fcs_opt])
     request_b_frame = l2cap_packets.BasicFrameBuilder(0x01, request)
     handle = 123
     wrapped = hci_packets.AclPacketBuilder(
         handle,
         hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
         hci_packets.BroadcastFlag.POINT_TO_POINT, request_b_frame)
     # Size is ACL (4) + L2CAP (4) + Configure (8) + MTU (4) + FCS (3)
     asserts.assert_true(
         len(wrapped.Serialize()) == 23, "Packet serialized incorrectly")