def test_parse(self):
        bytes = list(bytearray(self.valid_channel_header))

        for _ in xrange(AccessProfile.NUMBER_OF_SUB_PROFILES):
            bytes.extend(list(bytearray(SubProfile())))

        for _ in range(AccessProfile.MAX_NUMBER_OF_SUB_BANDS):
            bytes.extend(list(bytearray(SubBand())))

        ap = AccessProfile.parse(ConstBitStream(bytes=bytes))
        self.assertEqual(ap.channel_header.channel_band,
                         self.valid_channel_header.channel_band)
        self.assertEqual(ap.channel_header.channel_coding,
                         self.valid_channel_header.channel_coding)
        self.assertEqual(ap.channel_header.channel_class,
                         self.valid_channel_header.channel_class)
        self.assertEqual(len(ap.sub_bands),
                         AccessProfile.MAX_NUMBER_OF_SUB_BANDS)
        for sb in ap.sub_bands:
            self.assertEqual(sb.channel_index_start,
                             SubBand().channel_index_start)
            self.assertEqual(sb.channel_index_end, SubBand().channel_index_end)
            self.assertEqual(sb.cca, SubBand().cca)
            self.assertEqual(sb.duty, SubBand().duty)
            self.assertEqual(sb.eirp, SubBand().eirp)

        for sp in ap.sub_profiles:
            self.assertEqual(sp.subband_bitmap, SubProfile().subband_bitmap)
            self.assertEqual(sp.scan_automation_period.exp,
                             SubProfile().scan_automation_period.exp)
            self.assertEqual(sp.scan_automation_period.mant,
                             SubProfile().scan_automation_period.mant)

        self.assertEqual(len(ap.sub_profiles),
                         AccessProfile.NUMBER_OF_SUB_PROFILES)
Exemple #2
0
  def test_parse(self):
    bytes = [
       0b10000001,  # AP control: FG scan, UNC, 1 subband
       5,  # subnet
       0,  # scan automation period
       0,  # RFU
     ] + list(bytearray(self.valid_subband))

    ap = AccessProfile.parse(ConstBitStream(bytes=bytes))
    self.assertEqual(ap.scan_type_is_foreground, True)
    self.assertEqual(ap.csma_ca_mode, CsmaCaMode.UNC)
    self.assertEqual(ap.subnet, 5)
    self.assertEqual(ap.scan_automation_period.mant, CT(0).mant)
    self.assertEqual(ap.scan_automation_period.exp, CT(0).exp)
    self.assertEqual(len(ap.subbands), 1)
 def parse(s):
     return AccessProfileFile(
         access_specifier=0,
         access_profile=AccessProfile.parse(s))  # TODO access_specifier?
Exemple #4
0
 def parse(s):
   return AccessProfileFile(access_specifier=0, access_profile=AccessProfile.parse(s)) # TODO access_specifier?