Index: dialin/dg/alarms.py =================================================================== diff -u -radae506afce35a0063c6c2baf7e8580986f3bee7 -r115cccfba180844d47d6afd541f0af14043b8642 --- dialin/dg/alarms.py (.../alarms.py) (revision adae506afce35a0063c6c2baf7e8580986f3bee7) +++ dialin/dg/alarms.py (.../alarms.py) (revision 115cccfba180844d47d6afd541f0af14043b8642) @@ -92,6 +92,15 @@ """ return self.safety_shutdown_active + def clear_dialin_alarms(self): + """ + Clears the alarms states in Dialin. + + @return: none + """ + for x in range(500): + self.alarm_states[x] = False + @publish(["alarm_states"]) def _handler_alarm_activate(self, message): """ Index: dialin/dg/sw_config.py =================================================================== diff -u -r4b8f0afb5aafc2409327ec47aad264ab500e69f7 -r115cccfba180844d47d6afd541f0af14043b8642 --- dialin/dg/sw_config.py (.../sw_config.py) (revision 4b8f0afb5aafc2409327ec47aad264ab500e69f7) +++ dialin/dg/sw_config.py (.../sw_config.py) (revision 115cccfba180844d47d6afd541f0af14043b8642) @@ -36,6 +36,8 @@ # Maximum allowed bytes to be written to RTC RAM _RTC_RAM_MAX_BYTES_TO_WRITE = 64 _PAYLOAD_TRANSFER_DELAY_S = 0.2 + _FIRMWARE_STACK_NAME = 'DG' + _NON_VOLATILE_RECORD_NAME = 'SW_Config_Report' def __init__(self, can_interface, logger: Logger): """ @@ -242,5 +244,6 @@ return sw_configs, groups_byte_size - def cmd_get_dg_sw_config_record_into_excel(self): - pass \ No newline at end of file + def cmd_get_dg_sw_config_record(self): + + self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._NON_VOLATILE_RECORD_NAME) Index: dialin/utils/nv_ops_utils.py =================================================================== diff -u -r4b8f0afb5aafc2409327ec47aad264ab500e69f7 -r115cccfba180844d47d6afd541f0af14043b8642 --- dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision 4b8f0afb5aafc2409327ec47aad264ab500e69f7) +++ dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision 115cccfba180844d47d6afd541f0af14043b8642) @@ -19,8 +19,19 @@ from typing import List from collections import OrderedDict from .excel_ops import * +from dialin.utils.base import AbstractObserver +class Observer(AbstractObserver): + def __init__(self, prop): + self.received = False + self.prop = prop + + def update(self, message): + print("Message: {0}".format(message)) + self.received = message.get(self.prop, False) + + class NVOpsUtils: """ @@ -104,23 +115,48 @@ # of the group. self._temp_groups_data_to_calculate_crc = [] - def prepare_excel_report(self, firmware_stack: str, record_name: str, directory: str): + def _create_workspace(self, dir_name): """ + Publicly accessible function to get create a workspace for the script that is running. + + @param dir_name: Name of the workspace directory + + @return none + """ + # Get the root directory of the current script + scripts_root_dir = os.path.dirname(os.path.dirname(__file__)) + # Get the root directory of the entire scripts folder. The workspace that holds the + # code review reports and clones other scripts and repositories must be outside of the scripts + root_dir = os.path.dirname(os.path.dirname(scripts_root_dir)) + # Create the address of the workspace + self._workspace_dir = os.path.join(root_dir, dir_name) + # If the path does not exist, make it, otherwise, change to that directory + if not os.path.isdir(self._workspace_dir): + # Create the directory and go to it + os.mkdir(self._workspace_dir) + os.chdir(self._workspace_dir) + + def prepare_excel_report(self, firmware_stack: str, record_name: str, directory: str = None): + """ Publicly accessible function to prepare the excel report @param firmware_stack: (str) firmware stack name (e.g. "HD" or "DG") @param record_name: (str) record type to check such as calibration, system, ... - @param directory: (str) the directory in which to write the excel doc + @param directory: (str) the directory in which to write the excel document. The default is None @return none """ path = '' is_report_found = False - if not os.path.isdir(directory): + # If the + if not os.path.isdir(directory) and directory is not None: # Create the directory and go to it os.mkdir(directory) + self._workspace_dir = directory + else: + default_nv_directory = firmware_stack + 'NV_Records' + self._create_workspace(default_nv_directory) - self._workspace_dir = directory self._record_name = record_name self._firmware_stack = firmware_stack Index: tests/dg_tests.py =================================================================== diff -u -rb1332a9a27e5d7c47d378fef58afaf272cfeb7af -r115cccfba180844d47d6afd541f0af14043b8642 --- tests/dg_tests.py (.../dg_tests.py) (revision b1332a9a27e5d7c47d378fef58afaf272cfeb7af) +++ tests/dg_tests.py (.../dg_tests.py) (revision 115cccfba180844d47d6afd541f0af14043b8642) @@ -507,11 +507,11 @@ # cmd_set_disinfect_ui_screen() - # collect_treatment_data() + collect_treatment_data() # collect_hd_treatment() - test_fans_alarms() + # test_fans_alarms()