def _information_request_with_type(packet, info_type): frame = L2capMatchers.control_frame_with_code(packet, CommandCode.INFORMATION_REQUEST) if frame is None: return None request = l2cap_packets.InformationRequestView(frame) if request.GetInfoType() != info_type: return None return request
def _on_information_request_default(self, l2cap_control_view): information_request = l2cap_packets.InformationRequestView( l2cap_control_view) sid = information_request.GetIdentifier() information_type = information_request.GetInfoType() if information_type == l2cap_packets.InformationRequestInfoType.CONNECTIONLESS_MTU: response = l2cap_packets.InformationResponseConnectionlessMtuBuilder( sid, l2cap_packets.InformationRequestResult.SUCCESS, 100) self.control_channel.send(response) return if information_type == l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED: response = l2cap_packets.InformationResponseExtendedFeaturesBuilder( sid, l2cap_packets.InformationRequestResult.SUCCESS, 0, 0, 0, self.support_ertm, 0, self.support_fcs, 0, 0, 0, 0, 0) self.control_channel.send(response) return if information_type == l2cap_packets.InformationRequestInfoType.FIXED_CHANNELS_SUPPORTED: response = l2cap_packets.InformationResponseFixedChannelsBuilder( sid, l2cap_packets.InformationRequestResult.SUCCESS, 2) self.control_channel.send(response) return