Index: leahi_dialin/dd/modules/dd_test_configs.py =================================================================== diff -u -r3f4937e339925dde0b95f08e49969f8983c5cba4 -rba415df9f8e76d6b0f21e8f69ba99346e42f7b09 --- leahi_dialin/dd/modules/dd_test_configs.py (.../dd_test_configs.py) (revision 3f4937e339925dde0b95f08e49969f8983c5cba4) +++ leahi_dialin/dd/modules/dd_test_configs.py (.../dd_test_configs.py) (revision ba415df9f8e76d6b0f21e8f69ba99346e42f7b09) @@ -18,7 +18,8 @@ from logging import Logger # Project imports -from leahi_dialin.common.constants import NO_RESET +from leahi_dialin.common.constants import NO_RESET, MSG_HEADER_SIZE +from leahi_dialin.common.generic_defs import DataTypes from leahi_dialin.common.msg_ids import MsgIds from leahi_dialin.common.override_templates import cmd_generic_override from leahi_dialin.common.test_config_defs import DDFPTestConfigOptions @@ -48,19 +49,26 @@ function = self._handler_dd_test_config_sync) self.dd_test_configs_response_timestamp = 0.0 #: The timestamp of the latest message - self.dd_test_configs = dict() #: The Test Config data in dictionary format + self.dd_test_configs = {} - def get_test_config_status(self, config: int): - """ - Returns the status of a test config - @param config: (int) Test config to set - @return: the status of a test config +# ============================================================ Properties ============================================================ + @property + def dd_test_configs(self) -> dict: """ - return self.dd_test_configs[DDFPTestConfigOptions(config).name] + The current Test Configs data + """ + return self._test_configs + @dd_test_configs.setter + def dd_test_configs(self, value): + self._test_configs = value + + +# ============================================================ Handlers ============================================================ + @publish(['msg_id_dd_send_test_config', 'dd_test_configs', 'dd_test_configs_response_timestamp']) def _handler_dd_test_config_sync(self, message, timestamp=0.0): """ @@ -70,17 +78,29 @@ @param message: published DD test configurations message @return: None """ - payload = message['message'] - index = MsgFieldPositions.START_POS_FIELD_1 + msg_list = [] + for config in DDFPTestConfigOptions: + if config != DDFPTestConfigOptions.NUM_OF_TEST_CONFIGS: + msg_list.append(self.dd_test_configs, config, DataTypes.U08) - for config in DDFPTestConfigOptions.__members__: - if 'NUM_OF_TEST_CONFIGS' not in config: - config_value, index = bytearray_to_integer(payload, index, False) - self.dd_test_configs[config] = config_value - + self.process_into_vars(decoder_list = msg_list, message = message) self.dd_test_configs_response_timestamp = timestamp + +# ============================================================ Support ============================================================ + def get_test_config_status(self, config: int): + """ + Returns the status of a test config + + @param config: (int) Test config to set + @return: the status of a test config + """ + return self.dd_test_configs[DDFPTestConfigOptions(config).name] + + + +# ============================================================ Overrides and Requests ============================================================ def cmd_set_test_config(self, config: int, reset: int = NO_RESET): """ Constructs and sends the DD test config