def parse(s): channel_header = ChannelHeader.parse(s) channel_index = s.read("uint:16") rx_level = s.read("int:8") link_budget = s.read("uint:8") target_rx_level = s.read("uint:8") nls = s.read("bool") missed = s.read("bool") retry = s.read("bool") unicast = s.read("bool") _ = s.read("pad:4") fifo_token = s.read("uint:8") seq_nr = s.read("uint:8") response_to = CT.parse(s) addressee = Addressee.parse(s) return Status(channel_header=channel_header, channel_index=channel_index, rx_level=rx_level, link_budget=link_budget, target_rx_level=target_rx_level, nls=nls, missed=missed, retry=retry, unicast=unicast, fifo_token=fifo_token, seq_nr=seq_nr, response_to=response_to, addressee=addressee)
def parse_alp_interface_status_d7asp(self, s): channel_header = ChannelHeader.parse(s) channel_index = struct.unpack(">h", s.read("bytes:2"))[0] rx_level = s.read("int:8") link_budget = s.read("uint:8") target_rx_level = s.read("uint:8") nls = s.read("bool") missed = s.read("bool") retry = s.read("bool") unicast = s.read("bool") _ = s.read("pad:4") fifo_token = s.read("uint:8") seq_nr = s.read("uint:8") response_to = CT.parse(s) addressee = Addressee.parse(s) status = Status(channel_header=channel_header, channel_index=channel_index, rx_level=rx_level, link_budget=link_budget, target_rx_level=target_rx_level, nls=nls, missed=missed, retry=retry, unicast=unicast, fifo_token=fifo_token, seq_nr=seq_nr, response_to=response_to, addressee=addressee) return InterfaceStatus(operand=InterfaceStatusOperand( interface_id=0xd7, interface_status=status))
def test_parse(self): bytes = [0b00101000] ch = ChannelHeader.parse(ConstBitStream(bytes=bytes)) self.assertEqual(ch.channel_coding, ChannelCoding.PN9) self.assertEqual(ch.channel_class, ChannelClass.NORMAL_RATE) self.assertEqual(ch.channel_band, ChannelBand.BAND_433)
def test_parse(self): bytes = [ 0b00101000 ] ch = ChannelHeader.parse(ConstBitStream(bytes=bytes)) self.assertEqual(ch.channel_coding, ChannelCoding.PN9) self.assertEqual(ch.channel_class, ChannelClass.NORMAL_RATE) self.assertEqual(ch.channel_band, ChannelBand.BAND_433)
def parse(s): channel_header = ChannelHeader.parse(s) channel_index_start = struct.unpack("<h", s.read("bytes:2"))[0] channel_index_end = struct.unpack("<h", s.read("bytes:2"))[0] eirp = s.read("uint:8") ccao = s.read("uint:8") return Subband(channel_header=channel_header, channel_index_start=channel_index_start, channel_index_end=channel_index_end, eirp=eirp, ccao=ccao)
def parse(s): last_rx_packet_level = s.read("uint:8") last_rx_packet_link_budget = s.read("uint:8") noise_floor = s.read("uint:8") channel_header = ChannelHeader.parse(s) channel_index = s.read("uint:16") scan_timeout_ratio = s.read("uint:16") scan_count = s.read("uint:32") scan_timeout_count = s.read("uint:32") return DllStatusFile(last_rx_packet_level=last_rx_packet_level, last_rx_packet_link_budget=last_rx_packet_link_budget, noise_floor=noise_floor, channel_header=channel_header, channel_index=channel_index, scan_timeout_ratio=scan_timeout_ratio, scan_count=scan_count, scan_timeout_count=scan_timeout_count)
def parse(s): channel_header = ChannelHeader.parse(s) sub_profiles = [] for _ in range(AccessProfile.NUMBER_OF_SUB_PROFILES): sub_profiles.append(SubProfile.parse(s)) sub_bands = [] for _ in range(AccessProfile.MAX_NUMBER_OF_SUB_BANDS): sub_bands.append(SubBand.parse(s)) return AccessProfile(channel_header=channel_header, sub_bands=sub_bands, sub_profiles=sub_profiles)
def parse(s): channel_header = ChannelHeader.parse(s) channel_index = s.read("uint:16") return ChannelID(channel_header=channel_header, channel_index=channel_index)