예제 #1
0
 def test_parse_nested(self):
     struct = BitStruct("foo", BitField("a", 3), Flag("b"), Padding(3),
                        Nibble("c"), Struct(
                            "bar",
                            Nibble("d"),
                            Bit("e"),
                        ))
     self.assertEqual(
         struct.parse(b"\xe1\x1f"),
         Container(a=7, b=False, bar=Container(d=15, e=1), c=8))
예제 #2
0
 def test_nested(self):
     struct = BitStruct("bitstruct", BitField("a", 3), Flag("b"),
                        Padding(3), Nibble("c"),
                        Struct(
                            "sub",
                            Nibble("d"),
                            Bit("e"),
                        ))
     self.assertEqual(
         struct.parse(b"\xe1\x1f"),
         Container(a=7)(b=False)(c=8)(sub=Container(d=15)(e=1)))
     self.assertEqual(
         struct.build(
             Container(a=7)(b=False)(c=8)(sub=Container(d=15)(e=1))),
         b"\xe1\x1f")
예제 #3
0
                UBInt8("op"))

HELLO = Struct("hello",
               UBInt32("padding"))

CAPS_C = Struct("cells",
                UBInt16("pci"),
                UBInt32("cap"),
                UBInt16("DL_earfcn"),
                UBInt8("DL_prbs"),
                UBInt16("UL_earfcn"),
                UBInt8("UL_prbs"))

CAPS_RESPONSE = Struct("caps_response",
                       BitStruct("flags", Padding(30),
                                 Bit("ue_measure"),
                                 Bit("ue_report")),
                       UBInt32("nof_cells"),
                       Array(lambda ctx: ctx.nof_cells, CAPS_C))

UE_R = Struct("ues",
              UBInt16("pci"),
              Bytes("plmn_id", 4),
              UBInt16("rnti"),
              UBInt64("imsi"))

UE_REPORT_RESPONSE = Struct("ue_report_response",
                            UBInt32("nof_ues"),
                            Array(lambda ctx: ctx.nof_ues, UE_R))

CAPS_REQUEST = Struct("caps_request",
예제 #4
0
           Bytes("wtp", 6),
           Bytes("sta", 6),
           Bytes("bssid", 6),
           Bytes("hwaddr", 6),
           UBInt8("channel"),
           UBInt8("band"),
           UBInt8("supported_band"),
           Bytes("ssid", lambda ctx: ctx.length - 37))

ASSOC_RESPONSE = Struct("assoc_response", UBInt8("version"), UBInt8("type"),
                        UBInt32("length"), UBInt32("seq"), Bytes("sta", 6))

ADD_LVAP = Struct(
    "add_lvap", UBInt8("version"), UBInt8("type"), UBInt32("length"),
    UBInt32("seq"), UBInt32("module_id"),
    BitStruct("flags", Padding(13), Bit("set_mask"), Bit("associated"),
              Bit("authenticated")), UBInt16("assoc_id"), Bytes("hwaddr", 6),
    UBInt8("channel"), UBInt8("band"), UBInt8("supported_band"),
    Bytes("sta", 6), Bytes("encap", 6), Bytes("net_bssid", 6),
    Bytes("lvap_bssid", 6), SSIDS)

DEL_LVAP = Struct("del_lvap", UBInt8("version"), UBInt8("type"),
                  UBInt32("length"), UBInt32("seq"), UBInt32("module_id"),
                  Bytes("sta", 6), Bytes("target_hwaddr", 6),
                  UBInt8("target_channel"), UBInt8("tagert_band"),
                  UBInt8("csa_switch_mode"), UBInt8("csa_switch_count"))

STATUS_LVAP = Struct(
    "status_lvap", UBInt8("version"), UBInt8("type"), UBInt32("length"),
    UBInt32("seq"),
    BitStruct("flags", Padding(13), Bit("set_mask"), Bit("associated"),
예제 #5
0
from empower.core.app import EmpowerApp
from empower.datatypes.etheraddress import EtherAddress
from empower.core.cellpool import Cell
from empower.vbsp.vbspserver import ModuleVBSPWorker
from empower.core.module import ModuleTrigger
from empower.vbsp import E_TYPE_TRIG
from empower.vbsp import EP_OPERATION_ADD

from empower.main import RUNTIME

EP_ACT_MAC_REPORTS = 0x06

MAC_REPORTS_REQ = Struct("mac_reports_request", UBInt8("type"),
                         UBInt8("version"), Bytes("enbid", 8),
                         UBInt16("cellid"), UBInt32("xid"),
                         BitStruct("flags", Padding(15), Bit("dir")),
                         UBInt32("seq"), UBInt16("length"), UBInt16("action"),
                         UBInt8("opcode"), UBInt16("deadline"))

MAC_REPORTS_RESP = Struct("mac_reports_resp", UBInt8("dl_prbs_total"),
                          UBInt32("dl_prbs_used"), UBInt8("ul_prbs_total"),
                          UBInt32("ul_prbs_used"))


class MACReports(ModuleTrigger):
    """ LVAPStats object. """

    MODULE_NAME = "mac_reports"
    REQUIRED = ['module_type', 'worker', 'tenant_id', 'cell', 'deadline']

    def __init__(self):
예제 #6
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.time_orbit = Struct(
            "time_orbit", self.timestamp, SBInt8("quality_indicator"),
            Padding(3), MicroDeg(SBInt32("latitude")),
            MicroDeg(SBInt32("longitude")), UBInt32("source_packet_counter"),
            UBInt32("instrument_mode_id"),
            BitStruct("measurement_confidence_data", Array(32, Bit("flag"))),
            MilliMeter(UBInt32("altitude")),
            Array(20, MilliMeter(SBInt16("18hz_altitude_differences"))),
            MilliMeter(SBInt16("instantaneous_altitude_rate")), Padding(50))

        self.range_information = Struct(
            "range_information",
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_ku"))),
            Padding(80), UBInt32("map_valid_points_tracker_ku"), Padding(4),
            MilliMeter(UBInt32("ocean_range_ku")), Padding(580),
            Array(20, TenMicroDeg(SBInt16("18hz_latitude_differences"))),
            Array(20, TenMicroDeg(SBInt16("18hz_longitude_differences"))))

        self.range_correction = Struct(
            "range_correction",
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_instrumental"))),
            Padding(40), Array(20,
                               MilliMeter(SBInt16("18Hz_ku_range_doppler"))),
            Padding(40),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler_slope"))),
            Padding(40), MilliMeter(SBInt16("dry_troposphere")),
            MilliMeter(SBInt16("inverse_barometric")),
            MilliMeter(SBInt16("wet_troposphere_model")),
            MilliMeter(SBInt16("wet_troposphere_mwr")),
            MilliMeter(SBInt16("ra2_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("doris_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("model_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("sea_state_bias_ku")), Padding(2),
            MilliMeter(SBInt16("dib_hf")), Padding(10))

        self.significant_wave_height = Padding(268)

        self.backscatter = Struct(
            "backscatter", Padding(340),
            Array(20, OneHundredthDecibel(SBInt16("18hz_sea_ice_sigma_ku"))),
            Padding(40))

        self.backscatter_correction = Padding(12)

        self.off_nadir_information = Padding(364)

        self.geophysical_information = Struct(
            "geophysical_information",
            MilliMeter(SBInt32("mean_sea_surface_height")),
            MilliMeter(SBInt32("geoid_height")),
            MilliMeter(SBInt32("ocean_depth_land_elevation")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_1")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_2")),
            MilliMeter(SBInt16("ocean_tide_long_period")),
            MilliMeter(SBInt16("ocean_loading_tide_2")),
            MilliMeter(SBInt16("solid_earth_tide")),
            MilliMeter(SBInt16("geocentric_polar_tide")),
            TenPascal(SBInt16("model_surface_atmospheric_pressure")),
            OneHundredth(SBInt16("mwr_water_vapour_content")),
            OneHundredth(SBInt16("mwr_liquid_water_content")),
            OneTenths(SBInt16("ra2_total_electron_content")),
            MilliMeter(SBInt16("ra2_wind_speed")),
            MilliMeter(SBInt16("model_wind_vector_u")),
            MilliMeter(SBInt16("model_wind_vector_v")),
            MilliMeter(SBInt16("ocean_loading_tide_1")), Padding(8))

        self.mwr_information = Padding(10)

        self.flags = Struct("flag", UBInt16("average_ku_chirp_band"),
                            Padding(112), UBInt16("altimeter_surface_type"),
                            UBInt16("radiometer_land_ocean"), Padding(6),
                            UBInt8("sea_ice"), Padding(5))

        self.mds_record = Struct("mds_record", self.time_orbit,
                                 self.range_information, self.range_correction,
                                 self.significant_wave_height,
                                 self.backscatter, self.backscatter_correction,
                                 self.off_nadir_information,
                                 self.geophysical_information,
                                 self.mwr_information, self.flags)

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
예제 #7
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.time_orbit = Struct(
            "time_orbit", self.timestamp, SBInt8("quality_indicator"),
            Padding(3), MicroDeg(SBInt32("latitude")),
            MicroDeg(SBInt32("longitude")), UBInt32("source_packet_counter"),
            UBInt32("instrument_mode_id"),
            BitStruct("measurement_confidence_data", Array(32, Bit("flag"))),
            MilliMeter(UBInt32("altitude")),
            Array(20, MilliMeter(SBInt16("18hz_altitude_differences"))),
            MilliMeter(SBInt16("instantaneous_altitude_rate")), Padding(50))

        self.range_information = Struct(
            "range_information",
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_ku"))),
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_s"))),
            UBInt32("map_valid_points_tracker_ku"), Padding(4),
            MilliMeter(UBInt32("ocean_range_ku")),
            MilliMeter(UBInt32("band_ocean_range_s")),
            Array(20, MilliMeter(UBInt32("18hz_ocean_range_ku"))),
            Array(20, MilliMeter(UBInt32("18hz_ocean_range_s"))),
            MilliMeter(UBInt16("sd_18hz_ocean_range_ku")),
            MilliMeter(UBInt16("sd_18hz_ocean_range_s")),
            UBInt16("18hz_n_valid_ocean_ku"), UBInt16("18hz_n_valid_ocean_s"),
            BitStruct("18hz_valid_points_ocean_ku", Array(32, Bit("flag"))),
            BitStruct("18hz_valid_points_ocean_s", Array(32, Bit("flag"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice1_range_ku"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice1_range_s"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice2_range_ku"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice2_range_s"))),
            Array(20, MilliMeter(UBInt32("18Hz_sea_ice_range_ku"))),
            Array(20, TenMicroDeg(SBInt16("18hz_latitude_differences"))),
            Array(20, TenMicroDeg(SBInt16("18hz_longitude_differences"))))

        self.range_correction = Struct(
            "range_correction",
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_instrumental"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_instrumental"))),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_doppler"))),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler_slope"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_doppler_slope"))),
            MilliMeter(SBInt16("dry_troposphere")),
            MilliMeter(SBInt16("inverse_barometric")),
            MilliMeter(SBInt16("wet_troposphere_model")),
            MilliMeter(SBInt16("wet_troposphere_mwr")),
            MilliMeter(SBInt16("ra2_ionosphere_ku")),
            MilliMeter(SBInt16("ra2_ionosphere_s")),
            MilliMeter(SBInt16("doris_ionosphere_ku")),
            MilliMeter(SBInt16("doris_ionosphere_s")),
            MilliMeter(SBInt16("model_ionosphere_ku")),
            MilliMeter(SBInt16("model_ionosphere_s")),
            MilliMeter(SBInt16("sea_state_bias_ku")),
            MilliMeter(SBInt16("sea_state_bias_s")),
            MilliMeter(SBInt16("dib_hf")), Padding(10))

        self.significant_wave_height = Struct(
            "significant_wave_height", MilliMeter(SBInt32("swh_square_ku")),
            MilliMeter(SBInt32("swh_square_s")), MilliMeter(SBInt16("swh_ku")),
            MilliMeter(SBInt16("swh_s")),
            MilliMeter(SBInt16("swh_sd_18hz_ku")),
            MilliMeter(SBInt16("swh_sd_18hz_s")),
            UBInt16("shw_18hz_n_valid_ku"), UBInt16("shw_18hz_n_valid_s"),
            BitStruct("slope_model_present", Array(32, Bit("flag"))),
            Centimeter(SBInt32("1hz_elevation_echo_point")),
            Array(20, Centimeter(SBInt16("18hz_elevation_difference"))),
            Array(20, TenMicroDeg(SBInt16("18hz_slope_latitude_diff"))),
            Array(20, TenMicroDeg(SBInt16("18hz_slope_longitude_diff"))),
            Array(20, MilliMeter(SBInt16("18hz_ice2_leading_edge_width_ku"))),
            Array(20, MilliMeter(SBInt16("18hz_ice2_leading_edge_width_s"))),
            Padding(40))

        self.backscatter = Struct(
            "backscatter",
            Array(20, OneHundredthDecibel(SBInt16("18hz_ku_k_cal_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_s_k_cal_s"))),
            BitStruct("map_valid_k_cal_ku", Array(32, Bit("flag"))),
            Padding(4), OneHundredthDecibel(SBInt16("ocean_sigma_corr_ku")),
            OneHundredthDecibel(SBInt16("ocean_sigma_corr_s")),
            OneHundredthDecibel(SBInt16("sd_18hz_ocean_sigma_ku")),
            OneHundredthDecibel(SBInt16("sd_18hz_ocean_sigma_s")),
            UBInt16("n_valid_18hz_ocean_sigma_ku"),
            UBInt16("n_valid_18hz_ocean_sigma_s"),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice1_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice1_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_le_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_le_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_sea_ice_sigma_ku"))),
            Padding(40))

        self.backscatter_correction = Struct(
            "backscatter_correction",
            OneHundredthDecibel(SBInt16("agc_net_instrumental_ku")),
            OneHundredthDecibel(SBInt16("agc_net_instrumental_s")),
            OneHundredthDecibel(SBInt16("atmospheric_attenuation_ku")),
            OneHundredthDecibel(SBInt16("atmospheric_attenuation_s")),
            OneHundredthDecibel(SBInt32("rain_attenuation_ku")))

        self.off_nadir_information = Struct(
            "off_nadir_angle",
            TenThousands(SBInt16("square_angle_from_platform_data")),
            TenThousands(SBInt16("square_angle_from_waveform_data")),
            Array(20, SBInt32("slope_ice2_first_trailing_edge_ku")),
            Array(20, SBInt32("slope_ice2_first_trailing_edge_s")),
            Array(20, SBInt32("slope_ice2_second_trailing_edge_ku")),
            Array(20, SBInt32("slope_ice2_second_trailing_edge_s")),
            Padding(40))

        self.geophysical_information = Struct(
            "geophysical_information",
            MilliMeter(SBInt32("mean_sea_surface_height")),
            MilliMeter(SBInt32("geoid_height")),
            MilliMeter(SBInt32("ocean_depth_land_elevation")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_1")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_2")),
            MilliMeter(SBInt16("ocean_tide_long_period")),
            MilliMeter(SBInt16("ocean_loading_tide_2")),
            MilliMeter(SBInt16("solid_earth_tide")),
            MilliMeter(SBInt16("geocentric_polar_tide")),
            TenPascal(SBInt16("model_surface_atmospheric_pressure")),
            OneHundredth(SBInt16("mwr_water_vapour_content")),
            OneHundredth(SBInt16("mwr_liquid_water_content")),
            OneTenths(SBInt16("ra2_total_electron_content")),
            MilliMeter(SBInt16("ra2_wind_speed")),
            MilliMeter(SBInt16("model_wind_vector_u")),
            MilliMeter(SBInt16("model_wind_vector_v")),
            MilliMeter(SBInt16("ocean_loading_tide_1")), Padding(8))

        self.mwr_information = Struct(
            "mwr_information",
            OneHundredth(SBInt16("mwr_brightness_temp_23_8ghz")),
            OneHundredth(SBInt16("mwr_brightness_temp_36_5ghz")),
            OneHundredth(SBInt16("mwr_sd_brightness_temp_23_8ghz")),
            OneHundredth(SBInt16("mwr_sd_brightness_temp_36_5ghz")),
            Padding(2))

        self.flags = Struct(
            "flag", UBInt16("average_ku_chirp_band"),
            BitStruct("ku_chirp_band_id", Array(64, Bit("flag"))),
            BitStruct("error_chirp_band_id", Array(32, Bit("flag"))),
            BitStruct("instrument", Array(32, Bit("flag"))),
            BitStruct("fault_identifier", Array(64, Bit("flag"))), Padding(8),
            BitStruct("waveform_fault_identifier", Array(64, Bit("flag"))),
            BitStruct("instrument_mode_id", Array(96, Bit("flag"))),
            UBInt16("n_measures_flight_calibration_s"),
            UBInt16("n_measures_flight_calibration_ku"),
            BitStruct("mwr_instrument_quality", Array(16, Bit("flag"))),
            Padding(6), Padding(8), Padding(8),
            BitStruct("ocean_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ocean_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("ice1_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ice1_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("ice2_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ice2_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("sea_ice_retracking_quality_ku", Array(32, Bit("flag"))),
            OneThousands(UBInt16("1hz_pulse_peakiness_ku")),
            OneThousands(UBInt16("1hz_pulse_peakiness_s")),
            UBInt16("altimeter_surface_type"),
            UBInt16("radiometer_land_ocean"),
            UBInt16("mwr_quality_interpolation"), UBInt16("altimeter_rain"),
            UBInt16("interpolation"), UBInt8("sea_ice"),
            BitStruct("membership_01", Array(8, Bit("flag"))),
            BitStruct("membership_02", Array(8, Bit("flag"))),
            BitStruct("membership_03", Array(8, Bit("flag"))),
            BitStruct("membership_04", Array(8, Bit("flag"))), Padding(1))

        self.mds_record = Struct("mds_record", self.time_orbit,
                                 self.range_information, self.range_correction,
                                 self.significant_wave_height,
                                 self.backscatter, self.backscatter_correction,
                                 self.off_nadir_information,
                                 self.geophysical_information,
                                 self.mwr_information, self.flags)

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
예제 #8
0
                     UBInt32("seq"),
                     UBInt32("module_id"),
                     Bytes("addr", 6),
                     Bytes("hwaddr", 6),
                     UBInt8("channel"),
                     UBInt8("band"),
                     SBInt16("limit"),
                     UBInt16("period"))

SUMMARY_ENTRY = Sequence("frames",
                         Bytes("ra", 6),
                         Bytes("ta", 6),
                         UBInt64("tsft"),
                         BitStruct("flags",
                                   Padding(6),
                                   Bit("mcs"),
                                   Padding(9)),
                         UBInt16("seq"),
                         SBInt8("rssi"),
                         UBInt8("rate"),
                         UBInt8("type"),
                         UBInt8("subtype"),
                         UBInt32("length"))

SUMMARY_TRIGGER = Struct("summary", UBInt8("version"),
                         UBInt8("type"),
                         UBInt32("length"),
                         UBInt32("seq"),
                         UBInt32("module_id"),
                         Bytes("wtp", 6),
                         UBInt16("nb_entries"),
예제 #9
0
from empower.core.resourcepool import BT_L20
from empower.core.app import EmpowerApp
from empower.datatypes.etheraddress import EtherAddress
from empower.lvapp.lvappserver import ModuleLVAPPWorker
from empower.core.module import ModulePeriodic
from empower.lvapp import PT_VERSION

from empower.main import RUNTIME

PT_NIF_REQUEST = 0x90
PT_NIF_RESPONSE = 0x91

NIF_STATS_ENTRY = Sequence(
    "rates", UBInt8("rate"),
    BitStruct("flags", Padding(6), Bit("mcs"), Padding(9)), UBInt32("prob"),
    UBInt32("cur_prob"), UBInt64("hist_successes"), UBInt64("hist_attempts"),
    UBInt32("last_successes"), UBInt32("last_attempts"),
    UBInt64("last_acked_bytes"), UBInt64("hist_acked_bytes"))

NIF_STATS_REQUEST = Struct("nif_request", UBInt8("version"), UBInt8("type"),
                           UBInt32("length"), UBInt32("seq"),
                           UBInt32("module_id"), Bytes("sta", 6))

NIF_STATS_RESPONSE = Struct("nif_response", UBInt8("version"), UBInt8("type"),
                            UBInt32("length"), UBInt32("seq"),
                            UBInt32("module_id"), Bytes("wtp", 6),
                            UBInt16("nb_entries"),
                            Array(lambda ctx: ctx.nb_entries, NIF_STATS_ENTRY))

예제 #10
0
from empower.core.module import ModuleScheduled

from empower.main import RUNTIME

PT_ADD_SUMMARY = 0x23
PT_SUMMARY = 0x24
PT_DEL_SUMMARY = 0x25

ADD_SUMMARY = Struct("add_summary", UBInt8("version"), UBInt8("type"),
                     UBInt32("length"), UBInt32("seq"), UBInt32("module_id"),
                     Bytes("addr", 6), Bytes("hwaddr", 6), UBInt8("channel"),
                     UBInt8("band"), SBInt16("limit"), UBInt16("period"))

SUMMARY_ENTRY = Sequence(
    "frames", Bytes("ra", 6), Bytes("ta", 6), UBInt64("tsft"),
    BitStruct("flags", Padding(6), Bit("mcs"), Padding(9)), UBInt16("seq"),
    SBInt8("rssi"), UBInt8("rate"), UBInt8("type"), UBInt8("subtype"),
    UBInt32("length"))

SUMMARY_TRIGGER = Struct("summary", UBInt8("version"), UBInt8("type"),
                         UBInt32("length"), UBInt32("seq"),
                         UBInt32("module_id"), Bytes("wtp", 6),
                         UBInt16("nb_entries"),
                         Array(lambda ctx: ctx.nb_entries, SUMMARY_ENTRY))

DEL_SUMMARY = Struct("del_summary", UBInt8("version"), UBInt8("type"),
                     UBInt32("length"), UBInt32("seq"), UBInt32("module_id"))


class Summary(ModuleScheduled):
    """ Summary object. """
예제 #11
0
    def get_mds_parser(self):

        self.mdsr_timestamp = Struct(
            "tai_timestamp",
            SBInt32("day"),
            UBInt32("sec"),
            UBInt32("msec"))

        self.time_orbit_group = Struct(
            "time_orbit",
            self.mdsr_timestamp,
            UBInt16("uso_corr"),
            UBInt32("mode_id"),
            UBInt16("source_sequence_counter"),
            UBInt32("instrument_configuration"),
            UBInt32("burst_counter"),
            OneTenthMicroDeg(SBInt32("latitude")),
            OneTenthMicroDeg(SBInt32("longitude")),
            MilliMeter(SBInt32("altitude")),
            MilliMeter(SBInt32("altitude_rate")),
            Array(3, MilliMeter(SBInt32("satellite_velocity"))),
            Array(3, Micrometer(SBInt32("real_beam"))),
            Array(3, Micrometer(SBInt32("interferometry_baseline"))),
            UBInt16("star_tracker_usage"),
            OneTenthMicroDeg(SBInt32("antenna_roll")),
            OneTenthMicroDeg(SBInt32("antenna_pitch")),
            OneTenthMicroDeg(SBInt32("antenna_yaw")),
            UBInt32("fbr_confidence_flag"),
            Padding(4))

        self.measurement_group = Struct(
            "measurement",
            PicoSecond(SBInt64("window_delay")),
            SBInt32("h0"),
            SBInt32("cor2"),
            SBInt32("lai"),
            SBInt32("fai"),
            OneHundredthDecibel(SBInt32("agc_1")),
            OneHundredthDecibel(SBInt32("agc_2")),
            OneHundredthDecibel(SBInt32("fixed_gain_1")),
            OneHundredthDecibel(SBInt32("fixed_gain_2")),
            MicroWatts(SBInt32("tx_power")),
            MilliMeter(SBInt32("doppler_range_correction")),
            MilliMeter(SBInt32("instrument_range_correction_txrx")),
            MilliMeter(SBInt32("instrument_range_correction_rx")),
            OneHundredthDecibel(SBInt32("instrument_gain_correction_txrx")),
            OneHundredthDecibel(SBInt32("instrument_gain_correction_rx")),
            MicroRadians(SBInt32("phase_correction_internal")),
            MicroRadians(SBInt32("phase_correction_external")),
            OneHundredthDecibel(SBInt32("noise_power")),
            MicroRadians(SBInt32("phase_slope_correction")),
            Padding(4))

        self.corrections_group = Struct(
            "corrections",
            MilliMeter(SBInt32("dry_troposphere")),
            MilliMeter(SBInt32("wet_troposphere")),
            MilliMeter(SBInt32("inverse_barometric")),
            MilliMeter(SBInt32("dynamic_atmosphere")),
            MilliMeter(SBInt32("ionospheric_gim")),
            MilliMeter(SBInt32("ionospheric_mod")),
            MilliMeter(SBInt32("ocean_tide_elastic")),
            MilliMeter(SBInt32("ocean_tide_long_period")),
            MilliMeter(SBInt32("ocean_loading_tide")),
            MilliMeter(SBInt32("solid_earth_tide")),
            MilliMeter(SBInt32("geocentric_polar_tide")),
            UBInt32("surface_type"),
            Padding(4),
            UBInt32("correction_status"),
            UBInt32("correction_error"),
            Padding(4))

        self.onehz_waveform_group = Struct(
            "avg_waveform",
            self.mdsr_timestamp,
            OneTenthMicroDeg(SBInt32("latitude")),
            OneTenthMicroDeg(SBInt32("longitude")),
            MilliMeter(SBInt32("altitude")),
            PicoSecond(UBInt64("window_delay")),
            Array(512, UBInt16("wfm")),
            SBInt32("linear_scale"),
            SBInt32("power_scale"),
            UBInt16("num_avg_echoes"),
            UBInt16("flags"))

        self.waveform_flag_group = BitStruct(
            "flag",
            Bit("approximate_beam_steering"),
            Bit("exact_beam_steering"),
            Bit("doppler_weighting_computed"),
            Bit("dopple_weighting_applied_before_stack"),
            Bit("multi_look_incomplete"),
            Bit("beam_angle_steering_error"),
            Bit("anti_aliased_power_echoes"),
            Bit("auto_beam_steering"),
            Padding(8))

        self.waveform_beam_group = Struct(
            "beam",
            OneHundredth(UBInt16("stack_standard_deviation")),
            OneHundredth(UBInt16("stack_centre")),
            OneHundredthDecibel(SBInt16("stack_scaled_amplitude")),
            OneHundredth(SBInt16("stack_skewness")),
            OneHundredth(SBInt16("stack_kurtosis")),
            MicroRadians(SBInt16("stack_standard_deviation_boresight")),
            MicroRadians(SBInt16("stack_centre_angle")),
            OneTenthMicroRadians(SBInt32("doppler_angle_start")),
            OneTenthMicroRadians(SBInt32("doppler_angle_stop")),
            OneTenthMicroRadians(SBInt32("look_angle_start")),
            OneTenthMicroRadians(SBInt32("look_angle_stop")),
            UBInt16("n_beams_after_weighing"),
            UBInt16("n_beams_before_weighing"),
            Padding(66))

        self.waveform_group = Struct(
            "waveform",
            Array(1024, UBInt16("wfm")),
            SBInt32("linear_scale"),
            SBInt32("power_scale"),
            UBInt16("num_avg_echoes"),
            self.waveform_flag_group,
            self.waveform_beam_group,
            Array(1024, UBInt16("coherence")),
            Array(1024, SBInt32("phase_difference")))

        self.mds_record = Struct(
            "mds_record",
            Array(self.n_blocks, self.time_orbit_group),
            Array(self.n_blocks, self.measurement_group),
            self.corrections_group,
            self.onehz_waveform_group,
            Array(self.n_blocks, self.waveform_group))

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
예제 #12
0
EP_ACT_CAPS = 2
EP_ACT_UE_REPORT = 4
EP_ACT_HANDOVER = 7
EP_ACT_RAN_SETUP = 9
EP_ACT_RAN_MAC_SLICE = 10

E_TYPE_SINGLE = 0x01
E_TYPE_SCHED = 0x02
E_TYPE_TRIG = 0x03

OPTIONS = Struct("options", UBInt16("type"), UBInt16("length"),
                 Field("data", lambda ctx: ctx.length))

HEADER = Struct("header", UBInt8("type"), UBInt8("version"), Bytes("enbid", 8),
                UBInt16("cellid"), UBInt32("xid"),
                BitStruct("flags", Padding(15), Bit("dir")), UBInt32("seq"),
                UBInt16("length"))

E_SCHED = Struct("e_sched", UBInt16("action"), UBInt8("opcode"),
                 UBInt32("interval"))

E_SINGLE = Struct("e_single", UBInt16("action"), UBInt8("opcode"))

E_TRIG = Struct("e_trig", UBInt16("action"), UBInt8("opcode"))

HELLO = Struct("hello", UBInt32("padding"))

CAPS_REQUEST = Struct("caps_request", UBInt8("type"), UBInt8("version"),
                      Bytes("enbid", 8), UBInt16("cellid"), UBInt32("xid"),
                      BitStruct("flags", Padding(15), Bit("dir")),
                      UBInt32("seq"), UBInt16("length"), UBInt16("action"),
예제 #13
0
EP_ACT_CAPS = 2
EP_ACT_UE_REPORT = 4
EP_ACT_HANDOVER = 7
EP_ACT_RAN_SETUP = 9
EP_ACT_RAN_MAC_SLICE = 10

E_TYPE_SINGLE = 0x01
E_TYPE_SCHED = 0x02
E_TYPE_TRIG = 0x03

OPTIONS = Struct("options", UBInt16("type"), UBInt16("length"),
                 Field("data", lambda ctx: ctx.length))

HEADER = Struct("header", UBInt8("type"), UBInt8("version"), Bytes("enbid", 8),
                UBInt16("cellid"), UBInt32("xid"),
                BitStruct("flags", Padding(15), Bit("dir")), UBInt32("seq"),
                UBInt16("length"))

E_SCHED = Struct("e_sched", UBInt16("action"), UBInt8("opcode"),
                 UBInt32("interval"))

E_SINGLE = Struct("e_single", UBInt16("action"), UBInt8("opcode"))

E_TRIG = Struct("e_trig", UBInt16("action"), UBInt8("opcode"))

HELLO = Struct("hello", UBInt32("padding"))

ENB_CAPS_REQUEST = Struct("caps_request", UBInt8("type"), UBInt8("version"),
                          Bytes("enbid", 8), UBInt16("cellid"), UBInt32("xid"),
                          BitStruct("flags", Padding(15), Bit("dir")),
                          UBInt32("seq"), UBInt16("length"), UBInt16("action"),
예제 #14
0
from construct import Bit

from empower.core.resourcepool import BT_L20
from empower.core.app import EmpowerApp
from empower.datatypes.etheraddress import EtherAddress
from empower.lvapp.lvappserver import ModuleLVAPPWorker
from empower.core.module import ModulePeriodic
from empower.lvapp import PT_VERSION

from empower.main import RUNTIME

PT_RATES_REQUEST = 0x30
PT_RATES_RESPONSE = 0x31

RATES_ENTRY = Sequence("rates", UBInt8("rate"),
                       BitStruct("flags", Padding(6), Bit("mcs"), Padding(9)),
                       UBInt32("prob"), UBInt32("cur_prob"))

RATES_REQUEST = Struct("rates_request", UBInt8("version"), UBInt8("type"),
                       UBInt32("length"), UBInt32("seq"), UBInt32("module_id"),
                       Bytes("sta", 6))

RATES_RESPONSE = Struct("rates_response", UBInt8("version"), UBInt8("type"),
                        UBInt32("length"), UBInt32("seq"),
                        UBInt32("module_id"), Bytes("wtp", 6),
                        UBInt16("nb_entries"),
                        Array(lambda ctx: ctx.nb_entries, RATES_ENTRY))


class LVAPStats(ModulePeriodic):
    """ LVAPStats object. """
예제 #15
0
from empower.main import RUNTIME

PT_TRQ_STATS_REQUEST = 0x59
PT_TRQ_STATS_RESPONSE = 0x60

TRQ_STATS_REQUEST = Struct("trq_stats_request", UBInt8("version"),
                           UBInt8("type"), UBInt32("length"), UBInt32("seq"),
                           UBInt32("module_id"), Bytes("hwaddr", 6),
                           UBInt8("channel"), UBInt8("band"), UBInt8("dscp"),
                           Bytes("ssid", lambda ctx: ctx.length - 23))

TRQ_STATS_RESPONSE = Struct(
    "trq_stats_response", UBInt8("version"), UBInt8("type"), UBInt32("length"),
    UBInt32("seq"), UBInt32("module_id"), Bytes("wtp", 6),
    BitStruct("flags", Padding(15), Bit("amsdu_aggregation")),
    UBInt32("deficit_used"), UBInt32("tx_pkts"), UBInt32("tx_bytes"),
    UBInt32("max_queue_length"))


class TRQStats(ModulePeriodic):
    """ TRStats object. """

    MODULE_NAME = "trq_stats"
    REQUIRED = ['module_type', 'worker', 'tenant_id', 'dscp', 'block']

    def __init__(self):

        super().__init__()

        # parameters