wiliot-certificate 1.3.0a1__py3-none-any.whl → 1.4.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brg_certificate/__init__.py +0 -0
- brg_certificate/ag/energous_v0_defines.py +925 -0
- brg_certificate/ag/energous_v1_defines.py +931 -0
- brg_certificate/ag/energous_v2_defines.py +925 -0
- brg_certificate/ag/energous_v3_defines.py +925 -0
- brg_certificate/ag/energous_v4_defines.py +925 -0
- brg_certificate/ag/fanstel_lan_v0_defines.py +925 -0
- brg_certificate/ag/fanstel_lte_v0_defines.py +925 -0
- brg_certificate/ag/fanstel_wifi_v0_defines.py +925 -0
- brg_certificate/ag/minew_lte_v0_defines.py +925 -0
- brg_certificate/ag/wlt_cmd_if.html +102 -0
- brg_certificate/ag/wlt_types.html +6114 -0
- brg_certificate/ag/wlt_types_ag.py +7840 -0
- brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +142 -0
- brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +785 -0
- brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +139 -0
- brg_certificate/ag/wlt_types_ag_jsons/calibration.json +394 -0
- brg_certificate/ag/wlt_types_ag_jsons/custom.json +515 -0
- brg_certificate/ag/wlt_types_ag_jsons/datapath.json +672 -0
- brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +550 -0
- brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +595 -0
- brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +598 -0
- brg_certificate/ag/wlt_types_ag_jsons/interface.json +938 -0
- brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +1234 -0
- brg_certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +105 -0
- brg_certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +77 -0
- brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +61 -0
- brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +110 -0
- brg_certificate/brg_certificate.py +191 -0
- brg_certificate/brg_certificate_cli.py +47 -0
- brg_certificate/cert_common.py +828 -0
- brg_certificate/cert_config.py +395 -0
- brg_certificate/cert_data_sim.py +188 -0
- brg_certificate/cert_defines.py +337 -0
- brg_certificate/cert_gw_sim.py +285 -0
- brg_certificate/cert_mqtt.py +373 -0
- brg_certificate/cert_prints.py +181 -0
- brg_certificate/cert_protobuf.py +88 -0
- brg_certificate/cert_results.py +300 -0
- brg_certificate/cert_utils.py +358 -0
- brg_certificate/certificate_sanity_test_list.txt +36 -0
- brg_certificate/certificate_test_list.txt +43 -0
- brg_certificate/config/eclipse.json +10 -0
- brg_certificate/config/hivemq.json +10 -0
- brg_certificate/config/mosquitto.json +10 -0
- brg_certificate/config/mosquitto.md +95 -0
- brg_certificate/config/wiliot-dev.json +10 -0
- brg_certificate/restore_brg.py +59 -0
- brg_certificate/tests/calibration/interval_test/interval_test.json +13 -0
- brg_certificate/tests/calibration/interval_test/interval_test.py +28 -0
- brg_certificate/tests/calibration/output_power_test/output_power_test.json +13 -0
- brg_certificate/tests/calibration/output_power_test/output_power_test.py +28 -0
- brg_certificate/tests/calibration/pattern_test/pattern_test.json +13 -0
- brg_certificate/tests/calibration/pattern_test/pattern_test.py +70 -0
- brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.json +13 -0
- brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +76 -0
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +13 -0
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +83 -0
- brg_certificate/tests/datapath/output_power_test/output_power_test.json +13 -0
- brg_certificate/tests/datapath/output_power_test/output_power_test.py +27 -0
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +13 -0
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +43 -0
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +13 -0
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +63 -0
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +13 -0
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +50 -0
- brg_certificate/tests/datapath/pattern_test/pattern_test.json +13 -0
- brg_certificate/tests/datapath/pattern_test/pattern_test.py +28 -0
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +13 -0
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +51 -0
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +13 -0
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +54 -0
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +13 -0
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +55 -0
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +13 -0
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +73 -0
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +13 -0
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +41 -0
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +21 -0
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +184 -0
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +21 -0
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +210 -0
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +30 -0
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +203 -0
- brg_certificate/tests/datapath/stress_test/stress_test.json +30 -0
- brg_certificate/tests/datapath/stress_test/stress_test.py +210 -0
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +13 -0
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +113 -0
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +13 -0
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +79 -0
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +13 -0
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +432 -0
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +13 -0
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +94 -0
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +13 -0
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +87 -0
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +13 -0
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +210 -0
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +13 -0
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +83 -0
- brg_certificate/tests/edge_mgmt/stat_test/stat_test.json +13 -0
- brg_certificate/tests/edge_mgmt/stat_test/stat_test.py +48 -0
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +13 -0
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +26 -0
- brg_certificate/tests/energy2400/output_power_test/output_power_test.json +13 -0
- brg_certificate/tests/energy2400/output_power_test/output_power_test.py +27 -0
- brg_certificate/tests/energy2400/pattern_test/pattern_test.json +13 -0
- brg_certificate/tests/energy2400/pattern_test/pattern_test.py +28 -0
- brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +13 -0
- brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +398 -0
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +13 -0
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +153 -0
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +13 -0
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +264 -0
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +13 -0
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +27 -0
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +13 -0
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +26 -0
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +13 -0
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +397 -0
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +13 -0
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +27 -0
- brg_certificate/wltPb_pb2.py +72 -0
- brg_certificate/wltPb_pb2.pyi +227 -0
- brg_certificate/wlt_types.py +114 -0
- gw_certificate/api/extended_api.py +7 -1531
- gw_certificate/api_if/200/data.json +106 -0
- gw_certificate/api_if/200/logs.json +12 -0
- gw_certificate/api_if/200/status.json +47 -0
- gw_certificate/api_if/201/data.json +98 -0
- gw_certificate/api_if/201/logs.json +12 -0
- gw_certificate/api_if/201/status.json +53 -0
- gw_certificate/api_if/202/data.json +83 -0
- gw_certificate/api_if/202/logs.json +12 -0
- gw_certificate/api_if/202/status.json +60 -0
- gw_certificate/api_if/203/data.json +85 -0
- gw_certificate/api_if/203/logs.json +12 -0
- gw_certificate/api_if/203/status.json +63 -0
- gw_certificate/api_if/204/data.json +85 -0
- gw_certificate/api_if/204/logs.json +12 -0
- gw_certificate/api_if/204/status.json +63 -0
- gw_certificate/api_if/205/data.json +85 -0
- gw_certificate/api_if/205/logs.json +12 -0
- gw_certificate/api_if/205/status.json +63 -0
- gw_certificate/api_if/api_validation.py +0 -2
- gw_certificate/common/analysis_data_bricks.py +18 -1413
- gw_certificate/common/debug.py +0 -21
- gw_certificate/common/utils.py +1 -212
- gw_certificate/common/utils_defines.py +0 -87
- gw_certificate/gw_certificate.py +9 -7
- gw_certificate/gw_certificate_cli.py +39 -23
- gw_certificate/interface/4.4.52_app.zip +0 -0
- gw_certificate/interface/4.4.52_sd_bl_app.zip +0 -0
- gw_certificate/interface/ble_simulator.py +0 -32
- gw_certificate/interface/if_defines.py +1 -0
- gw_certificate/interface/mqtt.py +96 -19
- gw_certificate/interface/nrfutil-linux +0 -0
- gw_certificate/interface/nrfutil-mac +0 -0
- gw_certificate/interface/nrfutil.exe +0 -0
- gw_certificate/interface/pkt_generator.py +0 -82
- gw_certificate/interface/uart_if.py +73 -43
- gw_certificate/templates/results.html +1 -1
- gw_certificate/tests/__init__.py +1 -2
- gw_certificate/tests/actions.py +134 -9
- gw_certificate/tests/connection.py +10 -5
- gw_certificate/tests/downlink.py +2 -4
- gw_certificate/tests/generic.py +62 -12
- gw_certificate/tests/registration.py +78 -27
- gw_certificate/tests/static/generated_packet_table.py +12 -48
- gw_certificate/tests/static/packet_table.csv +10048 -10048
- gw_certificate/tests/static/references.py +2 -1
- gw_certificate/tests/static/uplink_defines.py +0 -7
- gw_certificate/tests/throughput.py +7 -12
- gw_certificate/tests/uplink.py +83 -43
- {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/METADATA +59 -8
- wiliot_certificate-1.4.0a1.dist-info/RECORD +198 -0
- {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/WHEEL +1 -1
- wiliot_certificate-1.4.0a1.dist-info/entry_points.txt +3 -0
- wiliot_certificate-1.4.0a1.dist-info/top_level.txt +2 -0
- gw_certificate/interface/packet_error.py +0 -22
- wiliot_certificate-1.3.0a1.dist-info/RECORD +0 -51
- wiliot_certificate-1.3.0a1.dist-info/entry_points.txt +0 -2
- wiliot_certificate-1.3.0a1.dist-info/top_level.txt +0 -1
- {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
# This is an auto generated file! Don't edit this file manually!!!
|
|
2
|
+
|
|
3
|
+
import bitstruct
|
|
4
|
+
import binascii
|
|
5
|
+
import tabulate
|
|
6
|
+
from brg_certificate.ag.wlt_types_ag import API_VERSION_V0, API_VERSION_V1, API_VERSION_V2, API_VERSION_V5, API_VERSION_V6, API_VERSION_V7, API_VERSION_V8, API_VERSION_V9, API_VERSION_V10, API_VERSION_V11, API_VERSION_V12, API_VERSION_LATEST, MODULE_EMPTY, MODULE_GLOBAL, MODULE_IF, MODULE_DATAPATH, MODULE_ENERGY_2400, MODULE_ENERGY_SUB1G, MODULE_CALIBRATION, MODULE_PWR_MGMT, MODULE_EXT_SENSORS, MODULE_CUSTOM, SUB1G_ENERGY_PATTERN_NO_ENERGIZING, SUB1G_ENERGY_PATTERN_SINGLE_TONE_915000, SUB1G_ENERGY_PATTERN_FCC_HOPPING, SUB1G_ENERGY_PATTERN_JAPAN_1W, SUB1G_ENERGY_PATTERN_JAPAN_350MW, SUB1G_ENERGY_PATTERN_KOREA, SUB1G_ENERGY_PATTERN_SINGLE_TONE_916300, SUB1G_ENERGY_PATTERN_SINGLE_TONE_917500, SUB1G_ENERGY_PATTERN_AUSTRALIA, SUB1G_ENERGY_PATTERN_ISRAEL, SUB1G_ENERGY_PATTERN_NZ_HOPPING, SUB1G_ENERGY_PATTERN_LAST, CHANNEL_FREQ_37, CHANNEL_FREQ_38, CHANNEL_FREQ_39, CHANNEL_37, CHANNEL_38, CHANNEL_39, OUTPUT_POWER_2_4_NEG_12, OUTPUT_POWER_2_4_NEG_8, OUTPUT_POWER_2_4_NEG_4, OUTPUT_POWER_2_4_POS_0, OUTPUT_POWER_2_4_POS_2, OUTPUT_POWER_2_4_POS_3, OUTPUT_POWER_2_4_POS_4, OUTPUT_POWER_2_4_POS_5, OUTPUT_POWER_2_4_POS_6, OUTPUT_POWER_2_4_POS_7, OUTPUT_POWER_2_4_POS_8, RX_CHANNEL_37, RX_CHANNEL_38, RX_CHANNEL_39, RX_CHANNEL_10_250K, RX_CHANNEL_10_500K, RX_CHANNEL_V11_37, RX_CHANNEL_V11_38, RX_CHANNEL_V11_39, RX_CHANNEL_V11_4_1MBPS, RX_CHANNEL_V11_10_1MBPS, RX_CHANNEL_V11_4_2MBPS, RX_CHANNEL_V11_10_2MBPS, SECONDARY_RX_CHANNEL_10, SUB1G_OUTPUT_POWER_11, SUB1G_OUTPUT_POWER_14, SUB1G_OUTPUT_POWER_17, SUB1G_OUTPUT_POWER_19, SUB1G_OUTPUT_POWER_20, SUB1G_OUTPUT_POWER_23, SUB1G_OUTPUT_POWER_25, SUB1G_OUTPUT_POWER_26, SUB1G_OUTPUT_POWER_27, SUB1G_OUTPUT_POWER_29, SUB1G_OUTPUT_POWER_32, SUB1G_OUTPUT_POWER_PROFILE_14, SUB1G_OUTPUT_POWER_PROFILE_17, SUB1G_OUTPUT_POWER_PROFILE_20, SUB1G_OUTPUT_POWER_PROFILE_23, SUB1G_OUTPUT_POWER_PROFILE_26, SUB1G_OUTPUT_POWER_PROFILE_29, SUB1G_OUTPUT_POWER_PROFILE_32, SIGNAL_INDICATOR_REP_1, SIGNAL_INDICATOR_REP_2, SIGNAL_INDICATOR_REP_3, SIGNAL_INDICATOR_REP_4, SIGNAL_INDICATOR_SUB1G_REP_1, SIGNAL_INDICATOR_SUB1G_REP_2, SIGNAL_INDICATOR_SUB1G_REP_3, SIGNAL_INDICATOR_SUB1G_REP_4, SIGNAL_INDICATOR_REP_PROFILE_1, SIGNAL_INDICATOR_REP_PROFILE_2, SIGNAL_INDICATOR_REP_PROFILE_3, SIGNAL_INDICATOR_REP_PROFILE_4, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_1, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_2, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_3, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_4, BRG_DEFAULT_CALIBRATION_INTERVAL, BRG_DEFAULT_CALIBRATION_OUTPUT_POWER, BRG_DEFAULT_CALIBRATION_PATTERN, BRG_DEFAULT_DATAPATH_PATTERN, BRG_DEFAULT_PKT_FILTER, BRG_DEFAULT_RX_CHANNEL_OR_FREQ, BRG_DEFAULT_DATAPATH_OUTPUT_POWER, BRG_DEFAULT_TX_REPETITION, BRG_DEFAULT_PACER_INTERVAL, BRG_DEFAULT_RSSI_THRESHOLD, BRG_DEFAULT_RX_CHANNEL, BRG_DEFAULT_ENERGY_PATTERN_2_4, BRG_DEFAULT_ENERGY_DUTY_CYCLE_2_4, BRG_DEFAULT_OUTPUT_POWER_2_4, BRG_DEFAULT_SIGNAL_INDICATOR_REP, BRG_DEFAULT_SIGNAL_INDICATOR_REP_PROFILE, BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, BRG_DEFAULT_SUB1G_DUTY_CYCLE, BRG_DEFAULT_OUTPUT_POWER_SUB1G, BRG_DEFAULT_OUTPUT_POWER_SUB1G_PROFILE, BRG_DEFAULT_SUB1G_ENERGY_PATTERN, BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_REP, BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_REP_PROFILE, BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_CYCLE, BRG_DEFAULT_EXTERNAL_SENSOR_CFG, BRG_DEFAULT_TX_PERIOD, BRG_DEFAULT_TRANSMIT_TIME_SUB1G, BRG_DEFAULT_SUB1G_FREQ, BRG_DEFAULT_SUB1G_FREQ_PROFILE, BRG_DEFAULT_ENERGY_PATTERN_IDX_OLD, BRG_DEFAULT_RXTX_PERIOD, BRG_DEFAULT_PKT_TYPES_MASK, BRG_MGMT_MSG_TYPE_CFG_INFO, BRG_MGMT_MSG_TYPE_OTA_UPDATE, BRG_MGMT_MSG_TYPE_HB, BRG_MGMT_MSG_TYPE_REBOOT, BRG_MGMT_MSG_TYPE_LED_BLINK, BRG_MGMT_MSG_TYPE_CFG_SET, BRG_MGMT_MSG_TYPE_ACTION, BRG_MGMT_MSG_TYPE_BRG2BRG, BRG_MGMT_MSG_TYPE_HB_SLEEP, PWR_MGMT_DEFAULTS_LEDS_ON, PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD, PWR_MGMT_DEFAULTS_KEEP_ALIVE_SCAN, PWR_MGMT_DEFAULTS_ON_DURATION, PWR_MGMT_DEFAULTS_SLEEP_DURATION, LIS2DW12_DEFAULTS_PACKET_VERSION, LIS2DW12_DEFAULTS_STATE_THRESHOLD, LIS2DW12_DEFAULTS_WAKE_UP_DURATION, LIS2DW12_DEFAULTS_SLEEP_DURATION
|
|
7
|
+
|
|
8
|
+
# Board Overwritten defines
|
|
9
|
+
BRG_DEFAULT_RX_CHANNEL_OR_FREQ = CHANNEL_39
|
|
10
|
+
BRG_DEFAULT_DATAPATH_OUTPUT_POWER = OUTPUT_POWER_2_4_POS_8
|
|
11
|
+
BRG_DEFAULT_RX_CHANNEL = RX_CHANNEL_39
|
|
12
|
+
|
|
13
|
+
class ModuleIfV12():
|
|
14
|
+
def __init__(self, raw='', module_type=MODULE_IF, msg_type=BRG_MGMT_MSG_TYPE_CFG_INFO, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, board_type=0, bl_version=0, major_ver=0, minor_ver=0, patch_ver=0, sup_cap_glob=0, sup_cap_datapath=0, sup_cap_energy2400=0, sup_cap_energy_sub1g=0, sup_cap_calibration=0, sup_cap_pwr_mgmt=0, sup_cap_sensors=0, sup_cap_custom=0, cfg_hash=0, unused0=0):
|
|
15
|
+
self.module_type = module_type
|
|
16
|
+
self.msg_type = msg_type
|
|
17
|
+
self.api_version = api_version
|
|
18
|
+
self.seq_id = seq_id
|
|
19
|
+
self.brg_mac = brg_mac
|
|
20
|
+
self.board_type = board_type
|
|
21
|
+
self.bl_version = bl_version
|
|
22
|
+
self.major_ver = major_ver
|
|
23
|
+
self.minor_ver = minor_ver
|
|
24
|
+
self.patch_ver = patch_ver
|
|
25
|
+
self.sup_cap_glob = sup_cap_glob
|
|
26
|
+
self.sup_cap_datapath = sup_cap_datapath
|
|
27
|
+
self.sup_cap_energy2400 = sup_cap_energy2400
|
|
28
|
+
self.sup_cap_energy_sub1g = sup_cap_energy_sub1g
|
|
29
|
+
self.sup_cap_calibration = sup_cap_calibration
|
|
30
|
+
self.sup_cap_pwr_mgmt = sup_cap_pwr_mgmt
|
|
31
|
+
self.sup_cap_sensors = sup_cap_sensors
|
|
32
|
+
self.sup_cap_custom = sup_cap_custom
|
|
33
|
+
self.cfg_hash = cfg_hash
|
|
34
|
+
self.unused0 = unused0
|
|
35
|
+
if raw:
|
|
36
|
+
self.set(raw)
|
|
37
|
+
|
|
38
|
+
def __repr__(self) -> str:
|
|
39
|
+
return "\n==> Packet module_if_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['board_type', f"0x{self.board_type:X} ({self.board_type})"],['bl_version', f"0x{self.bl_version:X} ({self.bl_version})"],['major_ver', f"0x{self.major_ver:X} ({self.major_ver})"],['minor_ver', f"0x{self.minor_ver:X} ({self.minor_ver})"],['patch_ver', f"0x{self.patch_ver:X} ({self.patch_ver})"],['sup_cap_glob', f"0x{self.sup_cap_glob:X} ({self.sup_cap_glob})"],['sup_cap_datapath', f"0x{self.sup_cap_datapath:X} ({self.sup_cap_datapath})"],['sup_cap_energy2400', f"0x{self.sup_cap_energy2400:X} ({self.sup_cap_energy2400})"],['sup_cap_energy_sub1g', f"0x{self.sup_cap_energy_sub1g:X} ({self.sup_cap_energy_sub1g})"],['sup_cap_calibration', f"0x{self.sup_cap_calibration:X} ({self.sup_cap_calibration})"],['sup_cap_pwr_mgmt', f"0x{self.sup_cap_pwr_mgmt:X} ({self.sup_cap_pwr_mgmt})"],['sup_cap_sensors', f"0x{self.sup_cap_sensors:X} ({self.sup_cap_sensors})"],['sup_cap_custom', f"0x{self.sup_cap_custom:X} ({self.sup_cap_custom})"],['cfg_hash', f"0x{self.cfg_hash:X} ({self.cfg_hash})"]], tablefmt="texttable")
|
|
40
|
+
|
|
41
|
+
def __eq__(self, other):
|
|
42
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
43
|
+
return (
|
|
44
|
+
self.module_type == other.module_type and
|
|
45
|
+
self.msg_type == other.msg_type and
|
|
46
|
+
self.api_version == other.api_version and
|
|
47
|
+
self.brg_mac == other.brg_mac and
|
|
48
|
+
self.board_type == other.board_type and
|
|
49
|
+
self.bl_version == other.bl_version and
|
|
50
|
+
self.major_ver == other.major_ver and
|
|
51
|
+
self.minor_ver == other.minor_ver and
|
|
52
|
+
self.patch_ver == other.patch_ver and
|
|
53
|
+
self.sup_cap_glob == other.sup_cap_glob and
|
|
54
|
+
self.sup_cap_datapath == other.sup_cap_datapath and
|
|
55
|
+
self.sup_cap_energy2400 == other.sup_cap_energy2400 and
|
|
56
|
+
self.sup_cap_energy_sub1g == other.sup_cap_energy_sub1g and
|
|
57
|
+
self.sup_cap_calibration == other.sup_cap_calibration and
|
|
58
|
+
self.sup_cap_pwr_mgmt == other.sup_cap_pwr_mgmt and
|
|
59
|
+
self.sup_cap_sensors == other.sup_cap_sensors and
|
|
60
|
+
self.sup_cap_custom == other.sup_cap_custom and
|
|
61
|
+
self.cfg_hash == other.cfg_hash
|
|
62
|
+
)
|
|
63
|
+
return False
|
|
64
|
+
|
|
65
|
+
def dump(self):
|
|
66
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u8u8u1u1u1u1u1u1u1u1u32u40", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.board_type, self.bl_version, self.major_ver, self.minor_ver, self.patch_ver, self.sup_cap_glob, self.sup_cap_datapath, self.sup_cap_energy2400, self.sup_cap_energy_sub1g, self.sup_cap_calibration, self.sup_cap_pwr_mgmt, self.sup_cap_sensors, self.sup_cap_custom, self.cfg_hash, self.unused0)
|
|
67
|
+
return string.hex().upper()
|
|
68
|
+
|
|
69
|
+
def set(self, string):
|
|
70
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u8u8u1u1u1u1u1u1u1u1u32u40", binascii.unhexlify(string))
|
|
71
|
+
self.module_type = d[0]
|
|
72
|
+
self.msg_type = d[1]
|
|
73
|
+
self.api_version = d[2]
|
|
74
|
+
self.seq_id = d[3]
|
|
75
|
+
self.brg_mac = d[4]
|
|
76
|
+
self.board_type = d[5]
|
|
77
|
+
self.bl_version = d[6]
|
|
78
|
+
self.major_ver = d[7]
|
|
79
|
+
self.minor_ver = d[8]
|
|
80
|
+
self.patch_ver = d[9]
|
|
81
|
+
self.sup_cap_glob = d[10]
|
|
82
|
+
self.sup_cap_datapath = d[11]
|
|
83
|
+
self.sup_cap_energy2400 = d[12]
|
|
84
|
+
self.sup_cap_energy_sub1g = d[13]
|
|
85
|
+
self.sup_cap_calibration = d[14]
|
|
86
|
+
self.sup_cap_pwr_mgmt = d[15]
|
|
87
|
+
self.sup_cap_sensors = d[16]
|
|
88
|
+
self.sup_cap_custom = d[17]
|
|
89
|
+
self.cfg_hash = d[18]
|
|
90
|
+
self.unused0 = d[19]
|
|
91
|
+
|
|
92
|
+
class ModuleIfV11():
|
|
93
|
+
def __init__(self, raw='', module_type=MODULE_IF, msg_type=BRG_MGMT_MSG_TYPE_CFG_INFO, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, board_type=0, bl_version=0, major_ver=0, minor_ver=0, patch_ver=0, sup_cap_glob=0, sup_cap_datapath=0, sup_cap_energy2400=0, sup_cap_energy_sub1g=0, sup_cap_calibration=0, sup_cap_pwr_mgmt=0, sup_cap_sensors=0, sup_cap_custom=0, cfg_hash=0, unused0=0):
|
|
94
|
+
self.module_type = module_type
|
|
95
|
+
self.msg_type = msg_type
|
|
96
|
+
self.api_version = api_version
|
|
97
|
+
self.seq_id = seq_id
|
|
98
|
+
self.brg_mac = brg_mac
|
|
99
|
+
self.board_type = board_type
|
|
100
|
+
self.bl_version = bl_version
|
|
101
|
+
self.major_ver = major_ver
|
|
102
|
+
self.minor_ver = minor_ver
|
|
103
|
+
self.patch_ver = patch_ver
|
|
104
|
+
self.sup_cap_glob = sup_cap_glob
|
|
105
|
+
self.sup_cap_datapath = sup_cap_datapath
|
|
106
|
+
self.sup_cap_energy2400 = sup_cap_energy2400
|
|
107
|
+
self.sup_cap_energy_sub1g = sup_cap_energy_sub1g
|
|
108
|
+
self.sup_cap_calibration = sup_cap_calibration
|
|
109
|
+
self.sup_cap_pwr_mgmt = sup_cap_pwr_mgmt
|
|
110
|
+
self.sup_cap_sensors = sup_cap_sensors
|
|
111
|
+
self.sup_cap_custom = sup_cap_custom
|
|
112
|
+
self.cfg_hash = cfg_hash
|
|
113
|
+
self.unused0 = unused0
|
|
114
|
+
if raw:
|
|
115
|
+
self.set(raw)
|
|
116
|
+
|
|
117
|
+
def __repr__(self) -> str:
|
|
118
|
+
return "\n==> Packet module_if_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['board_type', f"0x{self.board_type:X} ({self.board_type})"],['bl_version', f"0x{self.bl_version:X} ({self.bl_version})"],['major_ver', f"0x{self.major_ver:X} ({self.major_ver})"],['minor_ver', f"0x{self.minor_ver:X} ({self.minor_ver})"],['patch_ver', f"0x{self.patch_ver:X} ({self.patch_ver})"],['sup_cap_glob', f"0x{self.sup_cap_glob:X} ({self.sup_cap_glob})"],['sup_cap_datapath', f"0x{self.sup_cap_datapath:X} ({self.sup_cap_datapath})"],['sup_cap_energy2400', f"0x{self.sup_cap_energy2400:X} ({self.sup_cap_energy2400})"],['sup_cap_energy_sub1g', f"0x{self.sup_cap_energy_sub1g:X} ({self.sup_cap_energy_sub1g})"],['sup_cap_calibration', f"0x{self.sup_cap_calibration:X} ({self.sup_cap_calibration})"],['sup_cap_pwr_mgmt', f"0x{self.sup_cap_pwr_mgmt:X} ({self.sup_cap_pwr_mgmt})"],['sup_cap_sensors', f"0x{self.sup_cap_sensors:X} ({self.sup_cap_sensors})"],['sup_cap_custom', f"0x{self.sup_cap_custom:X} ({self.sup_cap_custom})"],['cfg_hash', f"0x{self.cfg_hash:X} ({self.cfg_hash})"]], tablefmt="texttable")
|
|
119
|
+
|
|
120
|
+
def __eq__(self, other):
|
|
121
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
122
|
+
return (
|
|
123
|
+
self.module_type == other.module_type and
|
|
124
|
+
self.msg_type == other.msg_type and
|
|
125
|
+
self.api_version == other.api_version and
|
|
126
|
+
self.brg_mac == other.brg_mac and
|
|
127
|
+
self.board_type == other.board_type and
|
|
128
|
+
self.bl_version == other.bl_version and
|
|
129
|
+
self.major_ver == other.major_ver and
|
|
130
|
+
self.minor_ver == other.minor_ver and
|
|
131
|
+
self.patch_ver == other.patch_ver and
|
|
132
|
+
self.sup_cap_glob == other.sup_cap_glob and
|
|
133
|
+
self.sup_cap_datapath == other.sup_cap_datapath and
|
|
134
|
+
self.sup_cap_energy2400 == other.sup_cap_energy2400 and
|
|
135
|
+
self.sup_cap_energy_sub1g == other.sup_cap_energy_sub1g and
|
|
136
|
+
self.sup_cap_calibration == other.sup_cap_calibration and
|
|
137
|
+
self.sup_cap_pwr_mgmt == other.sup_cap_pwr_mgmt and
|
|
138
|
+
self.sup_cap_sensors == other.sup_cap_sensors and
|
|
139
|
+
self.sup_cap_custom == other.sup_cap_custom and
|
|
140
|
+
self.cfg_hash == other.cfg_hash
|
|
141
|
+
)
|
|
142
|
+
return False
|
|
143
|
+
|
|
144
|
+
def dump(self):
|
|
145
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u8u8u1u1u1u1u1u1u1u1u32u40", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.board_type, self.bl_version, self.major_ver, self.minor_ver, self.patch_ver, self.sup_cap_glob, self.sup_cap_datapath, self.sup_cap_energy2400, self.sup_cap_energy_sub1g, self.sup_cap_calibration, self.sup_cap_pwr_mgmt, self.sup_cap_sensors, self.sup_cap_custom, self.cfg_hash, self.unused0)
|
|
146
|
+
return string.hex().upper()
|
|
147
|
+
|
|
148
|
+
def set(self, string):
|
|
149
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u8u8u1u1u1u1u1u1u1u1u32u40", binascii.unhexlify(string))
|
|
150
|
+
self.module_type = d[0]
|
|
151
|
+
self.msg_type = d[1]
|
|
152
|
+
self.api_version = d[2]
|
|
153
|
+
self.seq_id = d[3]
|
|
154
|
+
self.brg_mac = d[4]
|
|
155
|
+
self.board_type = d[5]
|
|
156
|
+
self.bl_version = d[6]
|
|
157
|
+
self.major_ver = d[7]
|
|
158
|
+
self.minor_ver = d[8]
|
|
159
|
+
self.patch_ver = d[9]
|
|
160
|
+
self.sup_cap_glob = d[10]
|
|
161
|
+
self.sup_cap_datapath = d[11]
|
|
162
|
+
self.sup_cap_energy2400 = d[12]
|
|
163
|
+
self.sup_cap_energy_sub1g = d[13]
|
|
164
|
+
self.sup_cap_calibration = d[14]
|
|
165
|
+
self.sup_cap_pwr_mgmt = d[15]
|
|
166
|
+
self.sup_cap_sensors = d[16]
|
|
167
|
+
self.sup_cap_custom = d[17]
|
|
168
|
+
self.cfg_hash = d[18]
|
|
169
|
+
self.unused0 = d[19]
|
|
170
|
+
|
|
171
|
+
class ModuleCalibrationV12():
|
|
172
|
+
def __init__(self, raw='', module_type=MODULE_CALIBRATION, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, interval=BRG_DEFAULT_CALIBRATION_INTERVAL, output_power=BRG_DEFAULT_OUTPUT_POWER_2_4, pattern=BRG_DEFAULT_CALIBRATION_PATTERN, unused0=0, unused1=0):
|
|
173
|
+
self.module_type = module_type
|
|
174
|
+
self.msg_type = msg_type
|
|
175
|
+
self.api_version = api_version
|
|
176
|
+
self.seq_id = seq_id
|
|
177
|
+
self.brg_mac = brg_mac
|
|
178
|
+
self.interval = interval
|
|
179
|
+
self.output_power = output_power
|
|
180
|
+
self.pattern = pattern
|
|
181
|
+
self.unused0 = unused0
|
|
182
|
+
self.unused1 = unused1
|
|
183
|
+
if raw:
|
|
184
|
+
self.set(raw)
|
|
185
|
+
|
|
186
|
+
def __repr__(self) -> str:
|
|
187
|
+
return "\n==> Packet module_calibration_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['interval', f"0x{self.interval:X} ({self.interval})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"]], tablefmt="texttable")
|
|
188
|
+
|
|
189
|
+
def __eq__(self, other):
|
|
190
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
191
|
+
return (
|
|
192
|
+
self.module_type == other.module_type and
|
|
193
|
+
self.msg_type == other.msg_type and
|
|
194
|
+
self.api_version == other.api_version and
|
|
195
|
+
self.brg_mac == other.brg_mac and
|
|
196
|
+
self.interval == other.interval and
|
|
197
|
+
self.output_power == other.output_power and
|
|
198
|
+
self.pattern == other.pattern
|
|
199
|
+
)
|
|
200
|
+
return False
|
|
201
|
+
|
|
202
|
+
def dump(self):
|
|
203
|
+
string = bitstruct.pack("u4u4u8u8u48u8s8u4u4u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.interval, self.output_power, self.pattern, self.unused0, self.unused1)
|
|
204
|
+
return string.hex().upper()
|
|
205
|
+
|
|
206
|
+
def set(self, string):
|
|
207
|
+
d = bitstruct.unpack("u4u4u8u8u48u8s8u4u4u96", binascii.unhexlify(string))
|
|
208
|
+
self.module_type = d[0]
|
|
209
|
+
self.msg_type = d[1]
|
|
210
|
+
self.api_version = d[2]
|
|
211
|
+
self.seq_id = d[3]
|
|
212
|
+
self.brg_mac = d[4]
|
|
213
|
+
self.interval = d[5]
|
|
214
|
+
self.output_power = d[6]
|
|
215
|
+
self.pattern = d[7]
|
|
216
|
+
self.unused0 = d[8]
|
|
217
|
+
self.unused1 = d[9]
|
|
218
|
+
|
|
219
|
+
class ModuleCalibrationV11():
|
|
220
|
+
def __init__(self, raw='', module_type=MODULE_CALIBRATION, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, interval=BRG_DEFAULT_CALIBRATION_INTERVAL, output_power=BRG_DEFAULT_OUTPUT_POWER_2_4, pattern=BRG_DEFAULT_CALIBRATION_PATTERN, unused0=0, unused1=0):
|
|
221
|
+
self.module_type = module_type
|
|
222
|
+
self.msg_type = msg_type
|
|
223
|
+
self.api_version = api_version
|
|
224
|
+
self.seq_id = seq_id
|
|
225
|
+
self.brg_mac = brg_mac
|
|
226
|
+
self.interval = interval
|
|
227
|
+
self.output_power = output_power
|
|
228
|
+
self.pattern = pattern
|
|
229
|
+
self.unused0 = unused0
|
|
230
|
+
self.unused1 = unused1
|
|
231
|
+
if raw:
|
|
232
|
+
self.set(raw)
|
|
233
|
+
|
|
234
|
+
def __repr__(self) -> str:
|
|
235
|
+
return "\n==> Packet module_calibration_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['interval', f"0x{self.interval:X} ({self.interval})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"]], tablefmt="texttable")
|
|
236
|
+
|
|
237
|
+
def __eq__(self, other):
|
|
238
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
239
|
+
return (
|
|
240
|
+
self.module_type == other.module_type and
|
|
241
|
+
self.msg_type == other.msg_type and
|
|
242
|
+
self.api_version == other.api_version and
|
|
243
|
+
self.brg_mac == other.brg_mac and
|
|
244
|
+
self.interval == other.interval and
|
|
245
|
+
self.output_power == other.output_power and
|
|
246
|
+
self.pattern == other.pattern
|
|
247
|
+
)
|
|
248
|
+
return False
|
|
249
|
+
|
|
250
|
+
def dump(self):
|
|
251
|
+
string = bitstruct.pack("u4u4u8u8u48u8s8u4u4u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.interval, self.output_power, self.pattern, self.unused0, self.unused1)
|
|
252
|
+
return string.hex().upper()
|
|
253
|
+
|
|
254
|
+
def set(self, string):
|
|
255
|
+
d = bitstruct.unpack("u4u4u8u8u48u8s8u4u4u96", binascii.unhexlify(string))
|
|
256
|
+
self.module_type = d[0]
|
|
257
|
+
self.msg_type = d[1]
|
|
258
|
+
self.api_version = d[2]
|
|
259
|
+
self.seq_id = d[3]
|
|
260
|
+
self.brg_mac = d[4]
|
|
261
|
+
self.interval = d[5]
|
|
262
|
+
self.output_power = d[6]
|
|
263
|
+
self.pattern = d[7]
|
|
264
|
+
self.unused0 = d[8]
|
|
265
|
+
self.unused1 = d[9]
|
|
266
|
+
|
|
267
|
+
class ModuleDatapathV12():
|
|
268
|
+
def __init__(self, raw='', module_type=MODULE_DATAPATH, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, rssi_threshold=BRG_DEFAULT_RSSI_THRESHOLD, pacer_interval=BRG_DEFAULT_PACER_INTERVAL, pkt_filter=BRG_DEFAULT_PKT_FILTER, tx_repetition=BRG_DEFAULT_TX_REPETITION, output_power=BRG_DEFAULT_DATAPATH_OUTPUT_POWER, pattern=BRG_DEFAULT_DATAPATH_PATTERN, rx_channel=BRG_DEFAULT_RX_CHANNEL, unused0=0):
|
|
269
|
+
self.module_type = module_type
|
|
270
|
+
self.msg_type = msg_type
|
|
271
|
+
self.api_version = api_version
|
|
272
|
+
self.seq_id = seq_id
|
|
273
|
+
self.brg_mac = brg_mac
|
|
274
|
+
self.rssi_threshold = rssi_threshold
|
|
275
|
+
self.pacer_interval = pacer_interval
|
|
276
|
+
self.pkt_filter = pkt_filter
|
|
277
|
+
self.tx_repetition = tx_repetition
|
|
278
|
+
self.output_power = output_power
|
|
279
|
+
self.pattern = pattern
|
|
280
|
+
self.rx_channel = rx_channel
|
|
281
|
+
self.unused0 = unused0
|
|
282
|
+
if raw:
|
|
283
|
+
self.set(raw)
|
|
284
|
+
|
|
285
|
+
def __repr__(self) -> str:
|
|
286
|
+
return "\n==> Packet module_datapath_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['rssi_threshold', f"0x{self.rssi_threshold:X} ({self.rssi_threshold})"],['pacer_interval', f"0x{self.pacer_interval:X} ({self.pacer_interval})"],['pkt_filter', f"0x{self.pkt_filter:X} ({self.pkt_filter})"],['tx_repetition', f"0x{self.tx_repetition:X} ({self.tx_repetition})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"],['rx_channel', f"0x{self.rx_channel:X} ({self.rx_channel})"]], tablefmt="texttable")
|
|
287
|
+
|
|
288
|
+
def __eq__(self, other):
|
|
289
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
290
|
+
return (
|
|
291
|
+
self.module_type == other.module_type and
|
|
292
|
+
self.msg_type == other.msg_type and
|
|
293
|
+
self.api_version == other.api_version and
|
|
294
|
+
self.brg_mac == other.brg_mac and
|
|
295
|
+
self.rssi_threshold == other.rssi_threshold and
|
|
296
|
+
self.pacer_interval == other.pacer_interval and
|
|
297
|
+
self.pkt_filter == other.pkt_filter and
|
|
298
|
+
self.tx_repetition == other.tx_repetition and
|
|
299
|
+
self.output_power == other.output_power and
|
|
300
|
+
self.pattern == other.pattern and
|
|
301
|
+
self.rx_channel == other.rx_channel
|
|
302
|
+
)
|
|
303
|
+
return False
|
|
304
|
+
|
|
305
|
+
def dump(self):
|
|
306
|
+
string = bitstruct.pack("u4u4u8u8u48s8u16u5u3s8u4u4u72", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, ((self.rssi_threshold-0)//-1), self.pacer_interval, self.pkt_filter, self.tx_repetition, self.output_power, self.pattern, self.rx_channel, self.unused0)
|
|
307
|
+
return string.hex().upper()
|
|
308
|
+
|
|
309
|
+
def set(self, string):
|
|
310
|
+
d = bitstruct.unpack("u4u4u8u8u48s8u16u5u3s8u4u4u72", binascii.unhexlify(string))
|
|
311
|
+
self.module_type = d[0]
|
|
312
|
+
self.msg_type = d[1]
|
|
313
|
+
self.api_version = d[2]
|
|
314
|
+
self.seq_id = d[3]
|
|
315
|
+
self.brg_mac = d[4]
|
|
316
|
+
self.rssi_threshold = ((d[5]*-1)+0)
|
|
317
|
+
self.pacer_interval = d[6]
|
|
318
|
+
self.pkt_filter = d[7]
|
|
319
|
+
self.tx_repetition = d[8]
|
|
320
|
+
self.output_power = d[9]
|
|
321
|
+
self.pattern = d[10]
|
|
322
|
+
self.rx_channel = d[11]
|
|
323
|
+
self.unused0 = d[12]
|
|
324
|
+
|
|
325
|
+
class ModuleDatapathV11():
|
|
326
|
+
def __init__(self, raw='', module_type=MODULE_DATAPATH, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, unused1=0, unused0=0, adaptive_pacer=0, unified_echo_pkt=1, pacer_interval=BRG_DEFAULT_PACER_INTERVAL, pkt_filter=BRG_DEFAULT_PKT_FILTER, tx_repetition=BRG_DEFAULT_TX_REPETITION, output_power=BRG_DEFAULT_DATAPATH_OUTPUT_POWER, pattern=BRG_DEFAULT_DATAPATH_PATTERN, rx_channel=BRG_DEFAULT_RX_CHANNEL, unused2=0):
|
|
327
|
+
self.module_type = module_type
|
|
328
|
+
self.msg_type = msg_type
|
|
329
|
+
self.api_version = api_version
|
|
330
|
+
self.seq_id = seq_id
|
|
331
|
+
self.brg_mac = brg_mac
|
|
332
|
+
self.unused1 = unused1
|
|
333
|
+
self.unused0 = unused0
|
|
334
|
+
self.adaptive_pacer = adaptive_pacer
|
|
335
|
+
self.unified_echo_pkt = unified_echo_pkt
|
|
336
|
+
self.pacer_interval = pacer_interval
|
|
337
|
+
self.pkt_filter = pkt_filter
|
|
338
|
+
self.tx_repetition = tx_repetition
|
|
339
|
+
self.output_power = output_power
|
|
340
|
+
self.pattern = pattern
|
|
341
|
+
self.rx_channel = rx_channel
|
|
342
|
+
self.unused2 = unused2
|
|
343
|
+
if raw:
|
|
344
|
+
self.set(raw)
|
|
345
|
+
|
|
346
|
+
def __repr__(self) -> str:
|
|
347
|
+
return "\n==> Packet module_datapath_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['adaptive_pacer', f"0x{self.adaptive_pacer:X} ({self.adaptive_pacer})"],['unified_echo_pkt', f"0x{self.unified_echo_pkt:X} ({self.unified_echo_pkt})"],['pacer_interval', f"0x{self.pacer_interval:X} ({self.pacer_interval})"],['pkt_filter', f"0x{self.pkt_filter:X} ({self.pkt_filter})"],['tx_repetition', f"0x{self.tx_repetition:X} ({self.tx_repetition})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"],['rx_channel', f"0x{self.rx_channel:X} ({self.rx_channel})"]], tablefmt="texttable")
|
|
348
|
+
|
|
349
|
+
def __eq__(self, other):
|
|
350
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
351
|
+
return (
|
|
352
|
+
self.module_type == other.module_type and
|
|
353
|
+
self.msg_type == other.msg_type and
|
|
354
|
+
self.api_version == other.api_version and
|
|
355
|
+
self.brg_mac == other.brg_mac and
|
|
356
|
+
self.adaptive_pacer == other.adaptive_pacer and
|
|
357
|
+
self.unified_echo_pkt == other.unified_echo_pkt and
|
|
358
|
+
self.pacer_interval == other.pacer_interval and
|
|
359
|
+
self.pkt_filter == other.pkt_filter and
|
|
360
|
+
self.tx_repetition == other.tx_repetition and
|
|
361
|
+
self.output_power == other.output_power and
|
|
362
|
+
self.pattern == other.pattern and
|
|
363
|
+
self.rx_channel == other.rx_channel
|
|
364
|
+
)
|
|
365
|
+
return False
|
|
366
|
+
|
|
367
|
+
def dump(self):
|
|
368
|
+
string = bitstruct.pack("u4u4u8u8u48u4u2u1u1u16u5u3s8u4u4u72", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.unused1, self.unused0, self.adaptive_pacer, self.unified_echo_pkt, self.pacer_interval, self.pkt_filter, self.tx_repetition, self.output_power, self.pattern, self.rx_channel, self.unused2)
|
|
369
|
+
return string.hex().upper()
|
|
370
|
+
|
|
371
|
+
def set(self, string):
|
|
372
|
+
d = bitstruct.unpack("u4u4u8u8u48u4u2u1u1u16u5u3s8u4u4u72", binascii.unhexlify(string))
|
|
373
|
+
self.module_type = d[0]
|
|
374
|
+
self.msg_type = d[1]
|
|
375
|
+
self.api_version = d[2]
|
|
376
|
+
self.seq_id = d[3]
|
|
377
|
+
self.brg_mac = d[4]
|
|
378
|
+
self.unused1 = d[5]
|
|
379
|
+
self.unused0 = d[6]
|
|
380
|
+
self.adaptive_pacer = d[7]
|
|
381
|
+
self.unified_echo_pkt = d[8]
|
|
382
|
+
self.pacer_interval = d[9]
|
|
383
|
+
self.pkt_filter = d[10]
|
|
384
|
+
self.tx_repetition = d[11]
|
|
385
|
+
self.output_power = d[12]
|
|
386
|
+
self.pattern = d[13]
|
|
387
|
+
self.rx_channel = d[14]
|
|
388
|
+
self.unused2 = d[15]
|
|
389
|
+
|
|
390
|
+
MODULE_ENERGY_2400_V12_SIGNAL_INDICATOR_REP_ENC = {SIGNAL_INDICATOR_REP_1:0, SIGNAL_INDICATOR_REP_2:1, SIGNAL_INDICATOR_REP_3:2, SIGNAL_INDICATOR_REP_4:3}
|
|
391
|
+
MODULE_ENERGY_2400_V12_SIGNAL_INDICATOR_REP_DEC = {0:SIGNAL_INDICATOR_REP_1, 1:SIGNAL_INDICATOR_REP_2, 2:SIGNAL_INDICATOR_REP_3, 3:SIGNAL_INDICATOR_REP_4}
|
|
392
|
+
class ModuleEnergy2400V12():
|
|
393
|
+
def __init__(self, raw='', module_type=MODULE_ENERGY_2400, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, duty_cycle=BRG_DEFAULT_ENERGY_DUTY_CYCLE_2_4, pattern=BRG_DEFAULT_ENERGY_PATTERN_2_4, output_power=BRG_DEFAULT_OUTPUT_POWER_2_4, signal_indicator_cycle=BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, signal_indicator_rep=BRG_DEFAULT_SIGNAL_INDICATOR_REP, unused0=0):
|
|
394
|
+
self.module_type = module_type
|
|
395
|
+
self.msg_type = msg_type
|
|
396
|
+
self.api_version = api_version
|
|
397
|
+
self.seq_id = seq_id
|
|
398
|
+
self.brg_mac = brg_mac
|
|
399
|
+
self.duty_cycle = duty_cycle
|
|
400
|
+
self.pattern = pattern
|
|
401
|
+
self.output_power = output_power
|
|
402
|
+
self.signal_indicator_cycle = signal_indicator_cycle
|
|
403
|
+
self.signal_indicator_rep = signal_indicator_rep
|
|
404
|
+
self.unused0 = unused0
|
|
405
|
+
if raw:
|
|
406
|
+
self.set(raw)
|
|
407
|
+
|
|
408
|
+
def __repr__(self) -> str:
|
|
409
|
+
return "\n==> Packet module_energy_2400_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['duty_cycle', f"0x{self.duty_cycle:X} ({self.duty_cycle})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['signal_indicator_cycle', f"0x{self.signal_indicator_cycle:X} ({self.signal_indicator_cycle})"],['signal_indicator_rep', f"0x{self.signal_indicator_rep:X} ({self.signal_indicator_rep})"]], tablefmt="texttable")
|
|
410
|
+
|
|
411
|
+
def __eq__(self, other):
|
|
412
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
413
|
+
return (
|
|
414
|
+
self.module_type == other.module_type and
|
|
415
|
+
self.msg_type == other.msg_type and
|
|
416
|
+
self.api_version == other.api_version and
|
|
417
|
+
self.brg_mac == other.brg_mac and
|
|
418
|
+
self.duty_cycle == other.duty_cycle and
|
|
419
|
+
self.pattern == other.pattern and
|
|
420
|
+
self.output_power == other.output_power and
|
|
421
|
+
self.signal_indicator_cycle == other.signal_indicator_cycle and
|
|
422
|
+
self.signal_indicator_rep == other.signal_indicator_rep
|
|
423
|
+
)
|
|
424
|
+
return False
|
|
425
|
+
|
|
426
|
+
def dump(self):
|
|
427
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8s8u14u2u80", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.duty_cycle, self.pattern, self.output_power, self.signal_indicator_cycle, MODULE_ENERGY_2400_V12_SIGNAL_INDICATOR_REP_ENC[self.signal_indicator_rep], self.unused0)
|
|
428
|
+
return string.hex().upper()
|
|
429
|
+
|
|
430
|
+
def set(self, string):
|
|
431
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8s8u14u2u80", binascii.unhexlify(string))
|
|
432
|
+
self.module_type = d[0]
|
|
433
|
+
self.msg_type = d[1]
|
|
434
|
+
self.api_version = d[2]
|
|
435
|
+
self.seq_id = d[3]
|
|
436
|
+
self.brg_mac = d[4]
|
|
437
|
+
self.duty_cycle = d[5]
|
|
438
|
+
self.pattern = d[6]
|
|
439
|
+
self.output_power = d[7]
|
|
440
|
+
self.signal_indicator_cycle = d[8]
|
|
441
|
+
self.signal_indicator_rep = MODULE_ENERGY_2400_V12_SIGNAL_INDICATOR_REP_DEC[d[9]]
|
|
442
|
+
self.unused0 = d[10]
|
|
443
|
+
|
|
444
|
+
MODULE_ENERGY_2400_V11_SIGNAL_INDICATOR_REP_ENC = {SIGNAL_INDICATOR_REP_1:0, SIGNAL_INDICATOR_REP_2:1, SIGNAL_INDICATOR_REP_3:2, SIGNAL_INDICATOR_REP_4:3}
|
|
445
|
+
MODULE_ENERGY_2400_V11_SIGNAL_INDICATOR_REP_DEC = {0:SIGNAL_INDICATOR_REP_1, 1:SIGNAL_INDICATOR_REP_2, 2:SIGNAL_INDICATOR_REP_3, 3:SIGNAL_INDICATOR_REP_4}
|
|
446
|
+
class ModuleEnergy2400V11():
|
|
447
|
+
def __init__(self, raw='', module_type=MODULE_ENERGY_2400, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, duty_cycle=BRG_DEFAULT_ENERGY_DUTY_CYCLE_2_4, pattern=BRG_DEFAULT_ENERGY_PATTERN_2_4, output_power=BRG_DEFAULT_OUTPUT_POWER_2_4, signal_indicator_cycle=BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, signal_indicator_rep=BRG_DEFAULT_SIGNAL_INDICATOR_REP, unused0=0):
|
|
448
|
+
self.module_type = module_type
|
|
449
|
+
self.msg_type = msg_type
|
|
450
|
+
self.api_version = api_version
|
|
451
|
+
self.seq_id = seq_id
|
|
452
|
+
self.brg_mac = brg_mac
|
|
453
|
+
self.duty_cycle = duty_cycle
|
|
454
|
+
self.pattern = pattern
|
|
455
|
+
self.output_power = output_power
|
|
456
|
+
self.signal_indicator_cycle = signal_indicator_cycle
|
|
457
|
+
self.signal_indicator_rep = signal_indicator_rep
|
|
458
|
+
self.unused0 = unused0
|
|
459
|
+
if raw:
|
|
460
|
+
self.set(raw)
|
|
461
|
+
|
|
462
|
+
def __repr__(self) -> str:
|
|
463
|
+
return "\n==> Packet module_energy_2400_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['duty_cycle', f"0x{self.duty_cycle:X} ({self.duty_cycle})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['signal_indicator_cycle', f"0x{self.signal_indicator_cycle:X} ({self.signal_indicator_cycle})"],['signal_indicator_rep', f"0x{self.signal_indicator_rep:X} ({self.signal_indicator_rep})"]], tablefmt="texttable")
|
|
464
|
+
|
|
465
|
+
def __eq__(self, other):
|
|
466
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
467
|
+
return (
|
|
468
|
+
self.module_type == other.module_type and
|
|
469
|
+
self.msg_type == other.msg_type and
|
|
470
|
+
self.api_version == other.api_version and
|
|
471
|
+
self.brg_mac == other.brg_mac and
|
|
472
|
+
self.duty_cycle == other.duty_cycle and
|
|
473
|
+
self.pattern == other.pattern and
|
|
474
|
+
self.output_power == other.output_power and
|
|
475
|
+
self.signal_indicator_cycle == other.signal_indicator_cycle and
|
|
476
|
+
self.signal_indicator_rep == other.signal_indicator_rep
|
|
477
|
+
)
|
|
478
|
+
return False
|
|
479
|
+
|
|
480
|
+
def dump(self):
|
|
481
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8s8u14u2u80", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.duty_cycle, self.pattern, self.output_power, self.signal_indicator_cycle, MODULE_ENERGY_2400_V11_SIGNAL_INDICATOR_REP_ENC[self.signal_indicator_rep], self.unused0)
|
|
482
|
+
return string.hex().upper()
|
|
483
|
+
|
|
484
|
+
def set(self, string):
|
|
485
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8s8u14u2u80", binascii.unhexlify(string))
|
|
486
|
+
self.module_type = d[0]
|
|
487
|
+
self.msg_type = d[1]
|
|
488
|
+
self.api_version = d[2]
|
|
489
|
+
self.seq_id = d[3]
|
|
490
|
+
self.brg_mac = d[4]
|
|
491
|
+
self.duty_cycle = d[5]
|
|
492
|
+
self.pattern = d[6]
|
|
493
|
+
self.output_power = d[7]
|
|
494
|
+
self.signal_indicator_cycle = d[8]
|
|
495
|
+
self.signal_indicator_rep = MODULE_ENERGY_2400_V11_SIGNAL_INDICATOR_REP_DEC[d[9]]
|
|
496
|
+
self.unused0 = d[10]
|
|
497
|
+
|
|
498
|
+
MODULE_ENERGY_SUB1G_V12_SIGNAL_INDICATOR_REP_ENC = {SIGNAL_INDICATOR_SUB1G_REP_1:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_1, SIGNAL_INDICATOR_SUB1G_REP_2:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_2, SIGNAL_INDICATOR_SUB1G_REP_3:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_3, SIGNAL_INDICATOR_SUB1G_REP_4:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_4}
|
|
499
|
+
MODULE_ENERGY_SUB1G_V12_SIGNAL_INDICATOR_REP_DEC = {SIGNAL_INDICATOR_SUB1G_REP_PROFILE_1:SIGNAL_INDICATOR_SUB1G_REP_1, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_2:SIGNAL_INDICATOR_SUB1G_REP_2, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_3:SIGNAL_INDICATOR_SUB1G_REP_3, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_4:SIGNAL_INDICATOR_SUB1G_REP_4}
|
|
500
|
+
class ModuleEnergySub1GV12():
|
|
501
|
+
def __init__(self, raw='', module_type=MODULE_ENERGY_SUB1G, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, pattern=BRG_DEFAULT_SUB1G_ENERGY_PATTERN, duty_cycle=BRG_DEFAULT_SUB1G_DUTY_CYCLE, signal_indicator_cycle=BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_CYCLE, signal_indicator_rep=BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_REP, unused0=0):
|
|
502
|
+
self.module_type = module_type
|
|
503
|
+
self.msg_type = msg_type
|
|
504
|
+
self.api_version = api_version
|
|
505
|
+
self.seq_id = seq_id
|
|
506
|
+
self.brg_mac = brg_mac
|
|
507
|
+
self.pattern = pattern
|
|
508
|
+
self.duty_cycle = duty_cycle
|
|
509
|
+
self.signal_indicator_cycle = signal_indicator_cycle
|
|
510
|
+
self.signal_indicator_rep = signal_indicator_rep
|
|
511
|
+
self.unused0 = unused0
|
|
512
|
+
if raw:
|
|
513
|
+
self.set(raw)
|
|
514
|
+
|
|
515
|
+
def __repr__(self) -> str:
|
|
516
|
+
return "\n==> Packet module_energy_sub1g_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['pattern', f"0x{self.pattern:X} ({self.pattern})"],['duty_cycle', f"0x{self.duty_cycle:X} ({self.duty_cycle})"],['signal_indicator_cycle', f"0x{self.signal_indicator_cycle:X} ({self.signal_indicator_cycle})"],['signal_indicator_rep', f"0x{self.signal_indicator_rep:X} ({self.signal_indicator_rep})"]], tablefmt="texttable")
|
|
517
|
+
|
|
518
|
+
def __eq__(self, other):
|
|
519
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
520
|
+
return (
|
|
521
|
+
self.module_type == other.module_type and
|
|
522
|
+
self.msg_type == other.msg_type and
|
|
523
|
+
self.api_version == other.api_version and
|
|
524
|
+
self.brg_mac == other.brg_mac and
|
|
525
|
+
self.pattern == other.pattern and
|
|
526
|
+
self.duty_cycle == other.duty_cycle and
|
|
527
|
+
self.signal_indicator_cycle == other.signal_indicator_cycle and
|
|
528
|
+
self.signal_indicator_rep == other.signal_indicator_rep
|
|
529
|
+
)
|
|
530
|
+
return False
|
|
531
|
+
|
|
532
|
+
def dump(self):
|
|
533
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u14u2u88", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.pattern, self.duty_cycle, self.signal_indicator_cycle, MODULE_ENERGY_SUB1G_V12_SIGNAL_INDICATOR_REP_ENC[self.signal_indicator_rep], self.unused0)
|
|
534
|
+
return string.hex().upper()
|
|
535
|
+
|
|
536
|
+
def set(self, string):
|
|
537
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u14u2u88", binascii.unhexlify(string))
|
|
538
|
+
self.module_type = d[0]
|
|
539
|
+
self.msg_type = d[1]
|
|
540
|
+
self.api_version = d[2]
|
|
541
|
+
self.seq_id = d[3]
|
|
542
|
+
self.brg_mac = d[4]
|
|
543
|
+
self.pattern = d[5]
|
|
544
|
+
self.duty_cycle = d[6]
|
|
545
|
+
self.signal_indicator_cycle = d[7]
|
|
546
|
+
self.signal_indicator_rep = MODULE_ENERGY_SUB1G_V12_SIGNAL_INDICATOR_REP_DEC[d[8]]
|
|
547
|
+
self.unused0 = d[9]
|
|
548
|
+
|
|
549
|
+
MODULE_ENERGY_SUB1G_V11_OUTPUT_POWER_ENC = {SUB1G_OUTPUT_POWER_14:SUB1G_OUTPUT_POWER_PROFILE_14, SUB1G_OUTPUT_POWER_17:SUB1G_OUTPUT_POWER_PROFILE_17, SUB1G_OUTPUT_POWER_20:SUB1G_OUTPUT_POWER_PROFILE_20, SUB1G_OUTPUT_POWER_23:SUB1G_OUTPUT_POWER_PROFILE_23, SUB1G_OUTPUT_POWER_26:SUB1G_OUTPUT_POWER_PROFILE_26, SUB1G_OUTPUT_POWER_29:SUB1G_OUTPUT_POWER_PROFILE_29, SUB1G_OUTPUT_POWER_32:SUB1G_OUTPUT_POWER_PROFILE_32}
|
|
550
|
+
MODULE_ENERGY_SUB1G_V11_OUTPUT_POWER_DEC = {SUB1G_OUTPUT_POWER_PROFILE_14:SUB1G_OUTPUT_POWER_14, SUB1G_OUTPUT_POWER_PROFILE_17:SUB1G_OUTPUT_POWER_17, SUB1G_OUTPUT_POWER_PROFILE_20:SUB1G_OUTPUT_POWER_20, SUB1G_OUTPUT_POWER_PROFILE_23:SUB1G_OUTPUT_POWER_23, SUB1G_OUTPUT_POWER_PROFILE_26:SUB1G_OUTPUT_POWER_26, SUB1G_OUTPUT_POWER_PROFILE_29:SUB1G_OUTPUT_POWER_29, SUB1G_OUTPUT_POWER_PROFILE_32:SUB1G_OUTPUT_POWER_32}
|
|
551
|
+
MODULE_ENERGY_SUB1G_V11_SIGNAL_INDICATOR_REP_ENC = {SIGNAL_INDICATOR_SUB1G_REP_1:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_1, SIGNAL_INDICATOR_SUB1G_REP_2:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_2, SIGNAL_INDICATOR_SUB1G_REP_3:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_3, SIGNAL_INDICATOR_SUB1G_REP_4:SIGNAL_INDICATOR_SUB1G_REP_PROFILE_4}
|
|
552
|
+
MODULE_ENERGY_SUB1G_V11_SIGNAL_INDICATOR_REP_DEC = {SIGNAL_INDICATOR_SUB1G_REP_PROFILE_1:SIGNAL_INDICATOR_SUB1G_REP_1, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_2:SIGNAL_INDICATOR_SUB1G_REP_2, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_3:SIGNAL_INDICATOR_SUB1G_REP_3, SIGNAL_INDICATOR_SUB1G_REP_PROFILE_4:SIGNAL_INDICATOR_SUB1G_REP_4}
|
|
553
|
+
class ModuleEnergySub1GV11():
|
|
554
|
+
def __init__(self, raw='', module_type=MODULE_ENERGY_SUB1G, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, output_power=BRG_DEFAULT_OUTPUT_POWER_SUB1G, sub1g_energy_pattern=BRG_DEFAULT_SUB1G_ENERGY_PATTERN, cycle=15, duty_cycle=BRG_DEFAULT_SUB1G_DUTY_CYCLE, signal_indicator_cycle=BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_CYCLE, signal_indicator_rep=BRG_DEFAULT_SIGNAL_INDICATOR_SUB1G_REP, unused0=0):
|
|
555
|
+
self.module_type = module_type
|
|
556
|
+
self.msg_type = msg_type
|
|
557
|
+
self.api_version = api_version
|
|
558
|
+
self.seq_id = seq_id
|
|
559
|
+
self.brg_mac = brg_mac
|
|
560
|
+
self.output_power = output_power
|
|
561
|
+
self.sub1g_energy_pattern = sub1g_energy_pattern
|
|
562
|
+
self.cycle = cycle
|
|
563
|
+
self.duty_cycle = duty_cycle
|
|
564
|
+
self.signal_indicator_cycle = signal_indicator_cycle
|
|
565
|
+
self.signal_indicator_rep = signal_indicator_rep
|
|
566
|
+
self.unused0 = unused0
|
|
567
|
+
if raw:
|
|
568
|
+
self.set(raw)
|
|
569
|
+
|
|
570
|
+
def __repr__(self) -> str:
|
|
571
|
+
return "\n==> Packet module_energy_sub1g_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['output_power', f"0x{self.output_power:X} ({self.output_power})"],['sub1g_energy_pattern', f"0x{self.sub1g_energy_pattern:X} ({self.sub1g_energy_pattern})"],['cycle', f"0x{self.cycle:X} ({self.cycle})"],['duty_cycle', f"0x{self.duty_cycle:X} ({self.duty_cycle})"],['signal_indicator_cycle', f"0x{self.signal_indicator_cycle:X} ({self.signal_indicator_cycle})"],['signal_indicator_rep', f"0x{self.signal_indicator_rep:X} ({self.signal_indicator_rep})"]], tablefmt="texttable")
|
|
572
|
+
|
|
573
|
+
def __eq__(self, other):
|
|
574
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
575
|
+
return (
|
|
576
|
+
self.module_type == other.module_type and
|
|
577
|
+
self.msg_type == other.msg_type and
|
|
578
|
+
self.api_version == other.api_version and
|
|
579
|
+
self.brg_mac == other.brg_mac and
|
|
580
|
+
self.output_power == other.output_power and
|
|
581
|
+
self.sub1g_energy_pattern == other.sub1g_energy_pattern and
|
|
582
|
+
self.cycle == other.cycle and
|
|
583
|
+
self.duty_cycle == other.duty_cycle and
|
|
584
|
+
self.signal_indicator_cycle == other.signal_indicator_cycle and
|
|
585
|
+
self.signal_indicator_rep == other.signal_indicator_rep
|
|
586
|
+
)
|
|
587
|
+
return False
|
|
588
|
+
|
|
589
|
+
def dump(self):
|
|
590
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u8u14u2u72", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, MODULE_ENERGY_SUB1G_V11_OUTPUT_POWER_ENC[self.output_power], self.sub1g_energy_pattern, self.cycle, self.duty_cycle, self.signal_indicator_cycle, MODULE_ENERGY_SUB1G_V11_SIGNAL_INDICATOR_REP_ENC[self.signal_indicator_rep], self.unused0)
|
|
591
|
+
return string.hex().upper()
|
|
592
|
+
|
|
593
|
+
def set(self, string):
|
|
594
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u8u14u2u72", binascii.unhexlify(string))
|
|
595
|
+
self.module_type = d[0]
|
|
596
|
+
self.msg_type = d[1]
|
|
597
|
+
self.api_version = d[2]
|
|
598
|
+
self.seq_id = d[3]
|
|
599
|
+
self.brg_mac = d[4]
|
|
600
|
+
self.output_power = MODULE_ENERGY_SUB1G_V11_OUTPUT_POWER_DEC[d[5]]
|
|
601
|
+
self.sub1g_energy_pattern = d[6]
|
|
602
|
+
self.cycle = d[7]
|
|
603
|
+
self.duty_cycle = d[8]
|
|
604
|
+
self.signal_indicator_cycle = d[9]
|
|
605
|
+
self.signal_indicator_rep = MODULE_ENERGY_SUB1G_V11_SIGNAL_INDICATOR_REP_DEC[d[10]]
|
|
606
|
+
self.unused0 = d[11]
|
|
607
|
+
|
|
608
|
+
class ModulePwrMgmtV12():
|
|
609
|
+
def __init__(self, raw='', module_type=MODULE_PWR_MGMT, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, static_leds_on=PWR_MGMT_DEFAULTS_LEDS_ON, static_keep_alive_period=PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD, static_keep_alive_scan=PWR_MGMT_DEFAULTS_KEEP_ALIVE_SCAN, static_on_duration=PWR_MGMT_DEFAULTS_ON_DURATION, static_sleep_duration=PWR_MGMT_DEFAULTS_SLEEP_DURATION, dynamic_leds_on=PWR_MGMT_DEFAULTS_LEDS_ON, dynamic_keep_alive_period=PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD, dynamic_keep_alive_scan=PWR_MGMT_DEFAULTS_KEEP_ALIVE_SCAN, dynamic_on_duration=PWR_MGMT_DEFAULTS_ON_DURATION, dynamic_sleep_duration=PWR_MGMT_DEFAULTS_SLEEP_DURATION, unused0=0):
|
|
610
|
+
self.module_type = module_type
|
|
611
|
+
self.msg_type = msg_type
|
|
612
|
+
self.api_version = api_version
|
|
613
|
+
self.seq_id = seq_id
|
|
614
|
+
self.brg_mac = brg_mac
|
|
615
|
+
self.static_leds_on = static_leds_on
|
|
616
|
+
self.static_keep_alive_period = static_keep_alive_period # 5sec resolution
|
|
617
|
+
self.static_keep_alive_scan = static_keep_alive_scan # 10msec resolution
|
|
618
|
+
self.static_on_duration = static_on_duration # 30sec resolution
|
|
619
|
+
self.static_sleep_duration = static_sleep_duration # 60sec resolution
|
|
620
|
+
self.dynamic_leds_on = dynamic_leds_on
|
|
621
|
+
self.dynamic_keep_alive_period = dynamic_keep_alive_period # 5sec resolution
|
|
622
|
+
self.dynamic_keep_alive_scan = dynamic_keep_alive_scan # 10msec resolution
|
|
623
|
+
self.dynamic_on_duration = dynamic_on_duration # 30sec resolution
|
|
624
|
+
self.dynamic_sleep_duration = dynamic_sleep_duration # 60sec resolution
|
|
625
|
+
self.unused0 = unused0
|
|
626
|
+
if raw:
|
|
627
|
+
self.set(raw)
|
|
628
|
+
|
|
629
|
+
def __repr__(self) -> str:
|
|
630
|
+
return "\n==> Packet module_pwr_mgmt_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['static_leds_on', f"0x{self.static_leds_on:X} ({self.static_leds_on})"],['static_keep_alive_period', f"0x{self.static_keep_alive_period:X} ({self.static_keep_alive_period})"],['static_keep_alive_scan', f"0x{self.static_keep_alive_scan:X} ({self.static_keep_alive_scan})"],['static_on_duration', f"0x{self.static_on_duration:X} ({self.static_on_duration})"],['static_sleep_duration', f"0x{self.static_sleep_duration:X} ({self.static_sleep_duration})"],['dynamic_leds_on', f"0x{self.dynamic_leds_on:X} ({self.dynamic_leds_on})"],['dynamic_keep_alive_period', f"0x{self.dynamic_keep_alive_period:X} ({self.dynamic_keep_alive_period})"],['dynamic_keep_alive_scan', f"0x{self.dynamic_keep_alive_scan:X} ({self.dynamic_keep_alive_scan})"],['dynamic_on_duration', f"0x{self.dynamic_on_duration:X} ({self.dynamic_on_duration})"],['dynamic_sleep_duration', f"0x{self.dynamic_sleep_duration:X} ({self.dynamic_sleep_duration})"]], tablefmt="texttable")
|
|
631
|
+
|
|
632
|
+
def __eq__(self, other):
|
|
633
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
634
|
+
return (
|
|
635
|
+
self.module_type == other.module_type and
|
|
636
|
+
self.msg_type == other.msg_type and
|
|
637
|
+
self.api_version == other.api_version and
|
|
638
|
+
self.brg_mac == other.brg_mac and
|
|
639
|
+
self.static_leds_on == other.static_leds_on and
|
|
640
|
+
self.static_keep_alive_period == other.static_keep_alive_period and
|
|
641
|
+
self.static_keep_alive_scan == other.static_keep_alive_scan and
|
|
642
|
+
self.static_on_duration == other.static_on_duration and
|
|
643
|
+
self.static_sleep_duration == other.static_sleep_duration and
|
|
644
|
+
self.dynamic_leds_on == other.dynamic_leds_on and
|
|
645
|
+
self.dynamic_keep_alive_period == other.dynamic_keep_alive_period and
|
|
646
|
+
self.dynamic_keep_alive_scan == other.dynamic_keep_alive_scan and
|
|
647
|
+
self.dynamic_on_duration == other.dynamic_on_duration and
|
|
648
|
+
self.dynamic_sleep_duration == other.dynamic_sleep_duration
|
|
649
|
+
)
|
|
650
|
+
return False
|
|
651
|
+
|
|
652
|
+
def dump(self):
|
|
653
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u8u16u8u8u8u8u16u24", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.static_leds_on, ((self.static_keep_alive_period-0)//5), ((self.static_keep_alive_scan-0)//10), ((self.static_on_duration-0)//30), ((self.static_sleep_duration-0)//60), self.dynamic_leds_on, ((self.dynamic_keep_alive_period-0)//5), ((self.dynamic_keep_alive_scan-0)//10), ((self.dynamic_on_duration-0)//30), ((self.dynamic_sleep_duration-0)//60), self.unused0)
|
|
654
|
+
return string.hex().upper()
|
|
655
|
+
|
|
656
|
+
def set(self, string):
|
|
657
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u8u16u8u8u8u8u16u24", binascii.unhexlify(string))
|
|
658
|
+
self.module_type = d[0]
|
|
659
|
+
self.msg_type = d[1]
|
|
660
|
+
self.api_version = d[2]
|
|
661
|
+
self.seq_id = d[3]
|
|
662
|
+
self.brg_mac = d[4]
|
|
663
|
+
self.static_leds_on = d[5]
|
|
664
|
+
self.static_keep_alive_period = ((d[6]*5)+0)
|
|
665
|
+
self.static_keep_alive_scan = ((d[7]*10)+0)
|
|
666
|
+
self.static_on_duration = ((d[8]*30)+0)
|
|
667
|
+
self.static_sleep_duration = ((d[9]*60)+0)
|
|
668
|
+
self.dynamic_leds_on = d[10]
|
|
669
|
+
self.dynamic_keep_alive_period = ((d[11]*5)+0)
|
|
670
|
+
self.dynamic_keep_alive_scan = ((d[12]*10)+0)
|
|
671
|
+
self.dynamic_on_duration = ((d[13]*30)+0)
|
|
672
|
+
self.dynamic_sleep_duration = ((d[14]*60)+0)
|
|
673
|
+
self.unused0 = d[15]
|
|
674
|
+
|
|
675
|
+
class ModulePwrMgmtV11():
|
|
676
|
+
def __init__(self, raw='', module_type=MODULE_PWR_MGMT, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, static_leds_on=PWR_MGMT_DEFAULTS_LEDS_ON, static_keep_alive_period=PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD, static_keep_alive_scan=PWR_MGMT_DEFAULTS_KEEP_ALIVE_SCAN, static_on_duration=PWR_MGMT_DEFAULTS_ON_DURATION, static_sleep_duration=PWR_MGMT_DEFAULTS_SLEEP_DURATION, dynamic_leds_on=PWR_MGMT_DEFAULTS_LEDS_ON, dynamic_keep_alive_period=PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD, dynamic_keep_alive_scan=PWR_MGMT_DEFAULTS_KEEP_ALIVE_SCAN, dynamic_on_duration=PWR_MGMT_DEFAULTS_ON_DURATION, dynamic_sleep_duration=PWR_MGMT_DEFAULTS_SLEEP_DURATION, unused0=0):
|
|
677
|
+
self.module_type = module_type
|
|
678
|
+
self.msg_type = msg_type
|
|
679
|
+
self.api_version = api_version
|
|
680
|
+
self.seq_id = seq_id
|
|
681
|
+
self.brg_mac = brg_mac
|
|
682
|
+
self.static_leds_on = static_leds_on
|
|
683
|
+
self.static_keep_alive_period = static_keep_alive_period # 5sec resolution
|
|
684
|
+
self.static_keep_alive_scan = static_keep_alive_scan # 10msec resolution
|
|
685
|
+
self.static_on_duration = static_on_duration # 30sec resolution
|
|
686
|
+
self.static_sleep_duration = static_sleep_duration # 60sec resolution
|
|
687
|
+
self.dynamic_leds_on = dynamic_leds_on
|
|
688
|
+
self.dynamic_keep_alive_period = dynamic_keep_alive_period # 5sec resolution
|
|
689
|
+
self.dynamic_keep_alive_scan = dynamic_keep_alive_scan # 10msec resolution
|
|
690
|
+
self.dynamic_on_duration = dynamic_on_duration # 30sec resolution
|
|
691
|
+
self.dynamic_sleep_duration = dynamic_sleep_duration # 60sec resolution
|
|
692
|
+
self.unused0 = unused0
|
|
693
|
+
if raw:
|
|
694
|
+
self.set(raw)
|
|
695
|
+
|
|
696
|
+
def __repr__(self) -> str:
|
|
697
|
+
return "\n==> Packet module_pwr_mgmt_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['static_leds_on', f"0x{self.static_leds_on:X} ({self.static_leds_on})"],['static_keep_alive_period', f"0x{self.static_keep_alive_period:X} ({self.static_keep_alive_period})"],['static_keep_alive_scan', f"0x{self.static_keep_alive_scan:X} ({self.static_keep_alive_scan})"],['static_on_duration', f"0x{self.static_on_duration:X} ({self.static_on_duration})"],['static_sleep_duration', f"0x{self.static_sleep_duration:X} ({self.static_sleep_duration})"],['dynamic_leds_on', f"0x{self.dynamic_leds_on:X} ({self.dynamic_leds_on})"],['dynamic_keep_alive_period', f"0x{self.dynamic_keep_alive_period:X} ({self.dynamic_keep_alive_period})"],['dynamic_keep_alive_scan', f"0x{self.dynamic_keep_alive_scan:X} ({self.dynamic_keep_alive_scan})"],['dynamic_on_duration', f"0x{self.dynamic_on_duration:X} ({self.dynamic_on_duration})"],['dynamic_sleep_duration', f"0x{self.dynamic_sleep_duration:X} ({self.dynamic_sleep_duration})"]], tablefmt="texttable")
|
|
698
|
+
|
|
699
|
+
def __eq__(self, other):
|
|
700
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
701
|
+
return (
|
|
702
|
+
self.module_type == other.module_type and
|
|
703
|
+
self.msg_type == other.msg_type and
|
|
704
|
+
self.api_version == other.api_version and
|
|
705
|
+
self.brg_mac == other.brg_mac and
|
|
706
|
+
self.static_leds_on == other.static_leds_on and
|
|
707
|
+
self.static_keep_alive_period == other.static_keep_alive_period and
|
|
708
|
+
self.static_keep_alive_scan == other.static_keep_alive_scan and
|
|
709
|
+
self.static_on_duration == other.static_on_duration and
|
|
710
|
+
self.static_sleep_duration == other.static_sleep_duration and
|
|
711
|
+
self.dynamic_leds_on == other.dynamic_leds_on and
|
|
712
|
+
self.dynamic_keep_alive_period == other.dynamic_keep_alive_period and
|
|
713
|
+
self.dynamic_keep_alive_scan == other.dynamic_keep_alive_scan and
|
|
714
|
+
self.dynamic_on_duration == other.dynamic_on_duration and
|
|
715
|
+
self.dynamic_sleep_duration == other.dynamic_sleep_duration
|
|
716
|
+
)
|
|
717
|
+
return False
|
|
718
|
+
|
|
719
|
+
def dump(self):
|
|
720
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u8u16u8u8u8u8u16u24", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.static_leds_on, ((self.static_keep_alive_period-0)//5), ((self.static_keep_alive_scan-0)//10), ((self.static_on_duration-0)//30), ((self.static_sleep_duration-0)//60), self.dynamic_leds_on, ((self.dynamic_keep_alive_period-0)//5), ((self.dynamic_keep_alive_scan-0)//10), ((self.dynamic_on_duration-0)//30), ((self.dynamic_sleep_duration-0)//60), self.unused0)
|
|
721
|
+
return string.hex().upper()
|
|
722
|
+
|
|
723
|
+
def set(self, string):
|
|
724
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u8u16u8u8u8u8u16u24", binascii.unhexlify(string))
|
|
725
|
+
self.module_type = d[0]
|
|
726
|
+
self.msg_type = d[1]
|
|
727
|
+
self.api_version = d[2]
|
|
728
|
+
self.seq_id = d[3]
|
|
729
|
+
self.brg_mac = d[4]
|
|
730
|
+
self.static_leds_on = d[5]
|
|
731
|
+
self.static_keep_alive_period = ((d[6]*5)+0)
|
|
732
|
+
self.static_keep_alive_scan = ((d[7]*10)+0)
|
|
733
|
+
self.static_on_duration = ((d[8]*30)+0)
|
|
734
|
+
self.static_sleep_duration = ((d[9]*60)+0)
|
|
735
|
+
self.dynamic_leds_on = d[10]
|
|
736
|
+
self.dynamic_keep_alive_period = ((d[11]*5)+0)
|
|
737
|
+
self.dynamic_keep_alive_scan = ((d[12]*10)+0)
|
|
738
|
+
self.dynamic_on_duration = ((d[13]*30)+0)
|
|
739
|
+
self.dynamic_sleep_duration = ((d[14]*60)+0)
|
|
740
|
+
self.unused0 = d[15]
|
|
741
|
+
|
|
742
|
+
class ModuleExtSensorsV12():
|
|
743
|
+
def __init__(self, raw='', module_type=MODULE_EXT_SENSORS, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, sensor0=BRG_DEFAULT_EXTERNAL_SENSOR_CFG, sensor1=BRG_DEFAULT_EXTERNAL_SENSOR_CFG, rssi_threshold=BRG_DEFAULT_RSSI_THRESHOLD, sub1g_rssi_threshold=BRG_DEFAULT_RSSI_THRESHOLD, unused=0):
|
|
744
|
+
self.module_type = module_type
|
|
745
|
+
self.msg_type = msg_type
|
|
746
|
+
self.api_version = api_version
|
|
747
|
+
self.seq_id = seq_id
|
|
748
|
+
self.brg_mac = brg_mac
|
|
749
|
+
self.sensor0 = sensor0
|
|
750
|
+
self.sensor1 = sensor1
|
|
751
|
+
self.rssi_threshold = rssi_threshold
|
|
752
|
+
self.sub1g_rssi_threshold = sub1g_rssi_threshold
|
|
753
|
+
self.unused = unused
|
|
754
|
+
if raw:
|
|
755
|
+
self.set(raw)
|
|
756
|
+
|
|
757
|
+
def __repr__(self) -> str:
|
|
758
|
+
return "\n==> Packet module_ext_sensors_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['sensor0', f"0x{self.sensor0:X} ({self.sensor0})"],['sensor1', f"0x{self.sensor1:X} ({self.sensor1})"],['rssi_threshold', f"0x{self.rssi_threshold:X} ({self.rssi_threshold})"],['sub1g_rssi_threshold', f"0x{self.sub1g_rssi_threshold:X} ({self.sub1g_rssi_threshold})"]], tablefmt="texttable")
|
|
759
|
+
|
|
760
|
+
def __eq__(self, other):
|
|
761
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
762
|
+
return (
|
|
763
|
+
self.module_type == other.module_type and
|
|
764
|
+
self.msg_type == other.msg_type and
|
|
765
|
+
self.api_version == other.api_version and
|
|
766
|
+
self.brg_mac == other.brg_mac and
|
|
767
|
+
self.sensor0 == other.sensor0 and
|
|
768
|
+
self.sensor1 == other.sensor1 and
|
|
769
|
+
self.rssi_threshold == other.rssi_threshold and
|
|
770
|
+
self.sub1g_rssi_threshold == other.sub1g_rssi_threshold
|
|
771
|
+
)
|
|
772
|
+
return False
|
|
773
|
+
|
|
774
|
+
def dump(self):
|
|
775
|
+
string = bitstruct.pack("u4u4u8u8u48u32u32s8s8u40", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.sensor0, self.sensor1, ((self.rssi_threshold-0)//-1), ((self.sub1g_rssi_threshold-0)//-1), self.unused)
|
|
776
|
+
return string.hex().upper()
|
|
777
|
+
|
|
778
|
+
def set(self, string):
|
|
779
|
+
d = bitstruct.unpack("u4u4u8u8u48u32u32s8s8u40", binascii.unhexlify(string))
|
|
780
|
+
self.module_type = d[0]
|
|
781
|
+
self.msg_type = d[1]
|
|
782
|
+
self.api_version = d[2]
|
|
783
|
+
self.seq_id = d[3]
|
|
784
|
+
self.brg_mac = d[4]
|
|
785
|
+
self.sensor0 = d[5]
|
|
786
|
+
self.sensor1 = d[6]
|
|
787
|
+
self.rssi_threshold = ((d[7]*-1)+0)
|
|
788
|
+
self.sub1g_rssi_threshold = ((d[8]*-1)+0)
|
|
789
|
+
self.unused = d[9]
|
|
790
|
+
|
|
791
|
+
class ModuleExtSensorsV11():
|
|
792
|
+
def __init__(self, raw='', module_type=MODULE_EXT_SENSORS, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, sensor0=BRG_DEFAULT_EXTERNAL_SENSOR_CFG, sensor1=BRG_DEFAULT_EXTERNAL_SENSOR_CFG, unused=0):
|
|
793
|
+
self.module_type = module_type
|
|
794
|
+
self.msg_type = msg_type
|
|
795
|
+
self.api_version = api_version
|
|
796
|
+
self.seq_id = seq_id
|
|
797
|
+
self.brg_mac = brg_mac
|
|
798
|
+
self.sensor0 = sensor0
|
|
799
|
+
self.sensor1 = sensor1
|
|
800
|
+
self.unused = unused
|
|
801
|
+
if raw:
|
|
802
|
+
self.set(raw)
|
|
803
|
+
|
|
804
|
+
def __repr__(self) -> str:
|
|
805
|
+
return "\n==> Packet module_ext_sensors_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['sensor0', f"0x{self.sensor0:X} ({self.sensor0})"],['sensor1', f"0x{self.sensor1:X} ({self.sensor1})"]], tablefmt="texttable")
|
|
806
|
+
|
|
807
|
+
def __eq__(self, other):
|
|
808
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
809
|
+
return (
|
|
810
|
+
self.module_type == other.module_type and
|
|
811
|
+
self.msg_type == other.msg_type and
|
|
812
|
+
self.api_version == other.api_version and
|
|
813
|
+
self.brg_mac == other.brg_mac and
|
|
814
|
+
self.sensor0 == other.sensor0 and
|
|
815
|
+
self.sensor1 == other.sensor1
|
|
816
|
+
)
|
|
817
|
+
return False
|
|
818
|
+
|
|
819
|
+
def dump(self):
|
|
820
|
+
string = bitstruct.pack("u4u4u8u8u48u32u32u56", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, self.sensor0, self.sensor1, self.unused)
|
|
821
|
+
return string.hex().upper()
|
|
822
|
+
|
|
823
|
+
def set(self, string):
|
|
824
|
+
d = bitstruct.unpack("u4u4u8u8u48u32u32u56", binascii.unhexlify(string))
|
|
825
|
+
self.module_type = d[0]
|
|
826
|
+
self.msg_type = d[1]
|
|
827
|
+
self.api_version = d[2]
|
|
828
|
+
self.seq_id = d[3]
|
|
829
|
+
self.brg_mac = d[4]
|
|
830
|
+
self.sensor0 = d[5]
|
|
831
|
+
self.sensor1 = d[6]
|
|
832
|
+
self.unused = d[7]
|
|
833
|
+
|
|
834
|
+
class ModuleCustomV12():
|
|
835
|
+
def __init__(self, raw='', module_type=MODULE_CUSTOM, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, state_threshold=LIS2DW12_DEFAULTS_STATE_THRESHOLD, wake_up_duration=LIS2DW12_DEFAULTS_WAKE_UP_DURATION, sleep_duration=LIS2DW12_DEFAULTS_SLEEP_DURATION, unused1=0):
|
|
836
|
+
self.module_type = module_type
|
|
837
|
+
self.msg_type = msg_type
|
|
838
|
+
self.api_version = api_version
|
|
839
|
+
self.seq_id = seq_id
|
|
840
|
+
self.brg_mac = brg_mac
|
|
841
|
+
self.state_threshold = state_threshold # 31 [mg] resolution
|
|
842
|
+
self.wake_up_duration = wake_up_duration # 3 [sec] resolution
|
|
843
|
+
self.sleep_duration = sleep_duration # 5 [sec] resolution
|
|
844
|
+
self.unused1 = unused1
|
|
845
|
+
if raw:
|
|
846
|
+
self.set(raw)
|
|
847
|
+
|
|
848
|
+
def __repr__(self) -> str:
|
|
849
|
+
return "\n==> Packet module_custom_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['state_threshold', f"0x{self.state_threshold:X} ({self.state_threshold})"],['wake_up_duration', f"0x{self.wake_up_duration:X} ({self.wake_up_duration})"],['sleep_duration', f"0x{self.sleep_duration:X} ({self.sleep_duration})"]], tablefmt="texttable")
|
|
850
|
+
|
|
851
|
+
def __eq__(self, other):
|
|
852
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
853
|
+
return (
|
|
854
|
+
self.module_type == other.module_type and
|
|
855
|
+
self.msg_type == other.msg_type and
|
|
856
|
+
self.api_version == other.api_version and
|
|
857
|
+
self.brg_mac == other.brg_mac and
|
|
858
|
+
self.state_threshold == other.state_threshold and
|
|
859
|
+
self.wake_up_duration == other.wake_up_duration and
|
|
860
|
+
self.sleep_duration == other.sleep_duration
|
|
861
|
+
)
|
|
862
|
+
return False
|
|
863
|
+
|
|
864
|
+
def dump(self):
|
|
865
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, ((self.state_threshold-0)//31), ((self.wake_up_duration-0)//3), ((self.sleep_duration-0)//5), self.unused1)
|
|
866
|
+
return string.hex().upper()
|
|
867
|
+
|
|
868
|
+
def set(self, string):
|
|
869
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u96", binascii.unhexlify(string))
|
|
870
|
+
self.module_type = d[0]
|
|
871
|
+
self.msg_type = d[1]
|
|
872
|
+
self.api_version = d[2]
|
|
873
|
+
self.seq_id = d[3]
|
|
874
|
+
self.brg_mac = d[4]
|
|
875
|
+
self.state_threshold = ((d[5]*31)+0)
|
|
876
|
+
self.wake_up_duration = ((d[6]*3)+0)
|
|
877
|
+
self.sleep_duration = ((d[7]*5)+0)
|
|
878
|
+
self.unused1 = d[8]
|
|
879
|
+
|
|
880
|
+
class ModuleCustomV11():
|
|
881
|
+
def __init__(self, raw='', module_type=MODULE_CUSTOM, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V11, seq_id=0, brg_mac=0, state_threshold=LIS2DW12_DEFAULTS_STATE_THRESHOLD, wake_up_duration=LIS2DW12_DEFAULTS_WAKE_UP_DURATION, sleep_duration=LIS2DW12_DEFAULTS_SLEEP_DURATION, unused1=0):
|
|
882
|
+
self.module_type = module_type
|
|
883
|
+
self.msg_type = msg_type
|
|
884
|
+
self.api_version = api_version
|
|
885
|
+
self.seq_id = seq_id
|
|
886
|
+
self.brg_mac = brg_mac
|
|
887
|
+
self.state_threshold = state_threshold # 31 [mg] resolution
|
|
888
|
+
self.wake_up_duration = wake_up_duration # 3 [sec] resolution
|
|
889
|
+
self.sleep_duration = sleep_duration # 5 [sec] resolution
|
|
890
|
+
self.unused1 = unused1
|
|
891
|
+
if raw:
|
|
892
|
+
self.set(raw)
|
|
893
|
+
|
|
894
|
+
def __repr__(self) -> str:
|
|
895
|
+
return "\n==> Packet module_custom_v11 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['state_threshold', f"0x{self.state_threshold:X} ({self.state_threshold})"],['wake_up_duration', f"0x{self.wake_up_duration:X} ({self.wake_up_duration})"],['sleep_duration', f"0x{self.sleep_duration:X} ({self.sleep_duration})"]], tablefmt="texttable")
|
|
896
|
+
|
|
897
|
+
def __eq__(self, other):
|
|
898
|
+
if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
|
|
899
|
+
return (
|
|
900
|
+
self.module_type == other.module_type and
|
|
901
|
+
self.msg_type == other.msg_type and
|
|
902
|
+
self.api_version == other.api_version and
|
|
903
|
+
self.brg_mac == other.brg_mac and
|
|
904
|
+
self.state_threshold == other.state_threshold and
|
|
905
|
+
self.wake_up_duration == other.wake_up_duration and
|
|
906
|
+
self.sleep_duration == other.sleep_duration
|
|
907
|
+
)
|
|
908
|
+
return False
|
|
909
|
+
|
|
910
|
+
def dump(self):
|
|
911
|
+
string = bitstruct.pack("u4u4u8u8u48u8u8u8u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, ((self.state_threshold-0)//31), ((self.wake_up_duration-0)//3), ((self.sleep_duration-0)//5), self.unused1)
|
|
912
|
+
return string.hex().upper()
|
|
913
|
+
|
|
914
|
+
def set(self, string):
|
|
915
|
+
d = bitstruct.unpack("u4u4u8u8u48u8u8u8u96", binascii.unhexlify(string))
|
|
916
|
+
self.module_type = d[0]
|
|
917
|
+
self.msg_type = d[1]
|
|
918
|
+
self.api_version = d[2]
|
|
919
|
+
self.seq_id = d[3]
|
|
920
|
+
self.brg_mac = d[4]
|
|
921
|
+
self.state_threshold = ((d[5]*31)+0)
|
|
922
|
+
self.wake_up_duration = ((d[6]*3)+0)
|
|
923
|
+
self.sleep_duration = ((d[7]*5)+0)
|
|
924
|
+
self.unused1 = d[8]
|
|
925
|
+
|