def _handle_control_packet(self, l2cap_packet): packet_bytes = l2cap_packet.payload l2cap_view = l2cap_packets.BasicFrameView( bt_packets.PacketViewLittleEndian(list(packet_bytes))) if l2cap_view.GetChannelId() != 1: return l2cap_control_view = l2cap_packets.ControlView(l2cap_view.GetPayload()) fn = self.control_table.get(l2cap_control_view.GetCode()) if fn is not None: fn(l2cap_control_view)
def _basic_frame(packet): if packet is None: return None return l2cap_packets.BasicFrameView( bt_packets.PacketViewLittleEndian(list(packet.payload)))