def GetSinglePlotStatistics(self, statisticList): logger.info("Getting Single Plot Statistics ") methodString = "-m GetSinglePlotStatistics-1,1" result = self.SendCommandAndGetResponse(methodString) if result.Status.HasError(): logger.error( "Error in Sending Command to get Single Point Statistics") return result current = "current : " voltage = "voltage : " match = re.findall(current + '(.*?);', result.CmdResult.Output, re.DOTALL) if len(match) < 1: return StatusResult.Error("Could not read Current Value") # logger.info("Current : " + match[0]) current = match[0] match = re.findall(voltage + '(.*?);', result.CmdResult.Output, re.DOTALL) if len(match) < 1: return StatusResult.Error("Could not read Voltage Value") # logger.info("Voltage : " + match[0]) voltage = match[0] statisticList[0] = current statisticList[1] = voltage return StatusResult.Success()
def PingStatus(self, IpAddress): """ #------------------------------------------------------------------------------------------------------------------- # Name: PingStatus # Input: IpAddress # Description:Pings the machine (with IpAddress provided as an argument) # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ result = CommandLine.RunCommand('ping ' + IpAddress, 30) if result.Status.HasError(): logger.error("Error in pinging host {0} . {1}".format( IpAddress, result.CmdResult.Output)) return StatusResult.Error("Error in pinging host {0} . {1}".format( IpAddress, result.CmdResult.Output)) logger.info(result.CmdResult.Output) if ('unreachable.' in result.CmdResult.Output): #No route from the local system. Packets sent were never put on the wire. return StatusResult.Error('IpAddress is unreacheable. ' + result.CmdResult.Output) elif ('Ping request could not find host' in result.CmdResult.Output): return StatusResult.Error('host_not_found. ' + result.CmdResult.Output) elif ('Request timed out.' in result.CmdResult.Output): return StatusResult.Error('Connection time out' + result.CmdResult.Output) return StatusResult.Success()
def CopyUdasLogs(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: CopyUdasLogs # Input: Takes no argument # Description: Copy UDAS waveform from Default location to Logs location # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ self.udasDir = TestCaseConfig.ReportsPath + '\\UDAS' logger.info("UDAS Directory : " + self.udasDir) logger.info("Copying UDAS waveform from Default location to Logs location") try : os.makedirs(self.udasDir) except OSError : if not os.path.exists(self.udasDir) : return StatusResult.Error("Error in creating UDAS Directory on Automation PC : " + self.udasDir) try: files = os.listdir(self.logsPath) for file in files: shutil.copy(os.path.join(self.logsPath, file), os.path.join(self.udasDir, file)) except Exception as e: return StatusResult.Error('Failed to copy UDAS waveform : ', str(e)) logger.info("Copying UDAS waveform Completed") return StatusResult.Success()
def GetAcquisitionError(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: GetAcquisitionError # Description: Get Acquisition Error if encountered #------------------------------------------------------------------------------------------------------------------- """ logger.info("Getting Acquisition Error") commandToRun = "GetAcquisitionError()" result = self.SendCommandAndGetResponse(commandToRun, False) if result.HasError(): return result outputs = None if self.LastApiResponse: outputs = self.LastApiResponse.split(",") if (outputs == None or len(outputs) == 0): return StatusResult.Error( f"Incorrect response from Kratos while checking for Acquisition errors. Response: {self.LastApiResponse}" ) if (outputs[0] != "NO ERROR"): return StatusResult.Error( f"Error response from Kratos while checking for Acquisition errors. Response: {self.LastApiResponse}" ) return StatusResult.Success()
def startsystem(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: startsystem # Description: Start the system with the previously deployed template # Input: Takes no argument # Examples: # startsystem() # It will start TBSLTE sytem with the previously deployed template # and check if system is running at end # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: output = self._tbslte_handle.start_system() except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while starting the system: {e}" ) if output == 0: return StatusResult.Error("Failed to start the TBS system") elif output == 2: logger.debug( "TBSLTE system was already running before calling the 'startsystem' function" ) logger.info("TBSLTE system is up and running") return StatusResult.Success()
def stopsystem(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: stopsystem # Description: Stop the TBSLTE system and check system is in stopped mode at end # Input: Takes no argument # Examples: # stopsystem() # It will stop TBSLTE sytem # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: output = self._tbslte_handle.stop_system() except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while stopping the system: {e}" ) if output == 0: return StatusResult.Error("Failed to stop the TBS system") elif output == 2: logger.debug( "TBSLTE system was already stopped before calling the 'stopsystem' function" ) logger.info("TBSLTE system is stopped successfully") return StatusResult.Success()
def sendtbsltecomponentrawcommand(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: sendtbsltecomponentrawcommand # Description: This function allow user access any tbslte component module raw function directly # Input: Takes argument : # component_name (:class:`str`): : Required: Component name # tbslte.BMSC, tbslte.GW, tbslte.MME, tbslte.ENB, tbslte.CELL # componet_index (:class:`str`): : Required: Value can be 'all' # component or component index # method (:class:`str`): None: Required:TBS raw API, please use # go/tbsltedoc https://qct-artifactory.qualcomm.com/artifactory # /tbs-content-browsing-local/sphinx_docs.zip!/sphinx_docs/index.html for API detail # inputs (:class:`list`): : Required: TBS component raw API input # parameters. It supports multiple parameters # Example: # sendtbsltecomponentrawcommand({component_name='CELL', componet_index='all', method='set_mimo_ior',inputs=-50 }) # Send set_mimo_ior input -50 in all Panda Cell # sendtbsltecomponentrawcommand({component_name='CELL',componet_index= 'all', method= 'get_mimo_ior'}) # Send get_mimo_ior input None in all Panda Cell # sendtbsltecomponentrawcommand({component_name='CELL',componet_index= '1',method= 'get_mimo_ior'}) # Send get_mimo_ior input None in all Panda Cell index 1 # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: component_name = kwargs.get('component_name') componet_index = kwargs.get('componet_index') method = kwargs.get('method') inputs = kwargs.get('inputs') output = self._tbslte_handle.tbslte_component_dispatcher( component_name, component_index, method, inputs) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception during tbslte_component_dispatcher: {e}" ) if not output: return StatusResult.Error( f"Failed to run sendtbsltecomponentrawcommand for the input: {json.dumps(kwargs)}" ) logger.info( f"Successful in running sendtbsltecomponentrawcommand for the input: {json.dumps(kwargs)}" ) return StatusResult.Success()
def StartMeasurement(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: StartMeasurement # Input: Takes no argument # Description: Starts power measurement on ALPACA # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if self.boardHasEpm: if self.epm.getData: logger.warning('ALPACA : Measurement already running. Stopping previous measurement') result = self.StopMeasurement() if result.HasError(): logger.error('ALPACA : Error stopping previous measurement') return result logger.info('ALPACA : Starting measurement') try: self.epm.StartMeasurement() except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()
def SetDataCollectionPath(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: SetDataCollectionPath # Input: Takes no argument # Description: Sets up path to save UDAS waveform on automation PC # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ logger.info("Setting Logs Location for saving UDAS") if self.boardHasEpm: if self.epm.getData: logger.warning('ALPACA : Measurement already running. Stopping previous measurement') result = self.StopMeasurement() if result.HasError(): logger.error('ALPACA : Error stopping previous measurement') return result self.logsPath = "C:\\Automation\\Logs\\" + str(datetime.now().strftime('%Y-%m-%d_%H-%M-%S')) if self.boardHasEpm: try: logger.info('ALPACA : Log directory path : ' + self.logsPath) self.epm.SetLogDirectory(self.logsPath) except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()
def GetSinglePlotStatistics(self, statisticList): logger.info("Getting Single Plot Statistics ") for channel in ['CURRENT', 'VOLTAGE']: commandToRun = f"GetSinglePlotStatistics(0,{channel})" result = self.SendCommandAndGetResponse(commandToRun) if result.HasError(): logger.error(f"Error in reading battery {channel}") return result dataFields = None if self.LastApiResponse: dataFields = self.LastApiResponse.split(",") if (dataFields == None or len(dataFields) < 3): return StatusResult.Error( f"Kratos: Failed to parse response while reading battery {channel} value. Response: {self.LastApiResponse}" ) if channel == 'CURRENT': statisticList[0] = dataFields[2] else: statisticList[1] = dataFields[2] return StatusResult.Success()
def StartAcquisition(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: StartAcquisition # Description: Starts Acquisition on Kratos #------------------------------------------------------------------------------------------------------------------- """ logger.info("Starting Acquisition") commandToRun = "StartAcquisition()" result = self.SendCommandAndGetResponse(commandToRun, False) if (result.HasError()): return result status = KratosConstants.ExtAcquisitionStatus.UNKNOWN logger.info("Kratos: Waiting For Acquisition To Be Ready") # Wait for up to 60seconds for the waiting for trigger screen startTime = datetime.datetime.now() while (status != KratosConstants.ExtAcquisitionStatus.WAITING_FOR_TRIGGER and (datetime.datetime.now() - startTime).seconds < 60): time.sleep(2) status = self.GetExtAcquisitionStatus() if (status != KratosConstants.ExtAcquisitionStatus.WAITING_FOR_TRIGGER): return StatusResult.Error( "Kratos: Acquisition Is Not Ready. Check That A Measurement Can Be Performed Manually" ) return StatusResult.Success()
def SetupServerIperf(port, throughput): """ #------------------------------------------------------------------------------------------------------------------- # Name: SetupServerIperf # Input: Takes two arguments # argument1: port # argument2: throughput # Description: Function used start iPerf Server # Return: StatusResult result #------------------------------------------------------------------------------------------------------------------- """ logger.info("Calling SetupServerIperf function") logger.info("TBS: Starting Iperf Server") command = TbsIPerfActions.plinkstr + "iperf -s -p " + str( port) + " -u -i2 -w " + str(throughput) + "M " logger.info("TBS: " + str(command)) try: logger.info("Creating iPerfServer Thread") iPerfServerThread = Thread(target=CommandLine.RunCommand, args=[command, 15]) logger.info("Staring iPerfServer Thread") iPerfServerThread.start() except Exception as e: logger.error("Exception raised from SetupServerIperf function: " + str(e)) return StatusResult.Error( "Exception raised from SetupServerIperf function: " + str(e)) time.sleep(10) logger.info("SetupServerIperf function worked fine") return StatusResult.Success()
def sendtestabilitycommandonltetbs(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: sendtestabilitycommandonltetbs # Description: Sends testability command to tbslte station # Input: Takes argument : # command (:class:`str`): : Required: The testability command to execute # Example: # sendtestabilitycommandonltetbs({command="MME COMMAND GET MME_QUERY_STATE"}) # Send testability command MME COMMAND GET MME_QUERY_STATE to # the TBSLTE station # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: command = kwargs.get('command') output = self._tbslte_handle.send_testability_command(command) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while sending testability command to tbslte station: {e}" ) if output is None: return StatusResult.Error( 'Sending testability command failed, returned None') else: # TBSLTE returns dict include request_status. result_hash = str(command).split(' ')[0] + '_STATUS' if (result_hash in output.keys() and 'REQUEST_STATUS' in output[result_hash].keys() and output[result_hash]['REQUEST_STATUS']['ERROR'] == 0 and output[result_hash]['REQUEST_STATUS']['CAUSE'] == 'SUCCESS'): logger.info( "Successful in sending testability command to TBSLTE system" ) else: return StatusResult.Error( f'Sending testability command failed, returned output: {json.dumps(output)}' ) return StatusResult.Success()
def CheckCalibrationStatus(self, calibrationStatusList): """ #------------------------------------------------------------------------------------------------------------------- # Name: CheckCalibrationStatus # Description: Checks Status of Self Calibration, DMM Calibration & External Calibration #------------------------------------------------------------------------------------------------------------------- """ logger.info("Checking Calibration") methodString = "-m CheckCalibrationStatus-false,false,false" result = self.SendCommandAndGetResponse(methodString) if result.Status.HasError(): logger.error( "Error in Sending Command to get Single Point Statistics") return result selfCalibrationStatus = "selfCalOk : " dmmCalibrationStatus = "dmmCalOk : " externalCalibrationStatus = "extCalOk : " match = re.findall(selfCalibrationStatus + '(.*?);', result.CmdResult.Output, re.DOTALL) if len(match) < 1: return StatusResult.Error("Could not read Self Calibration Status") selfCalibrationStatus = match[0] match = re.findall(dmmCalibrationStatus + '(.*?);', result.CmdResult.Output, re.DOTALL) if len(match) < 1: return StatusResult.Error("Could not read DMM Calibration Status") dmmCalibrationStatus = match[0] match = re.findall(externalCalibrationStatus + '(.*?);', result.CmdResult.Output, re.DOTALL) if len(match) < 1: return StatusResult.Error( "Could not read External Calibration Status") externalCalibrationStatus = match[0] calibrationStatusList.append(selfCalibrationStatus) calibrationStatusList.append(dmmCalibrationStatus) calibrationStatusList.append(externalCalibrationStatus) return result
def setadditionalcablelost(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: setadditionalcablelost # Description: Set additional cable loss value for either downlink or uplink # Input: Takes argument : # link (:class:`str`): : Required: UPLINK or DOWNLINK # lost (:class:`float`): : Required: Loss in db to write at given antenna indices # antenna (:class:`int`): : Optional: Antenna at which the loss value is read # cell (:class:`int`): 0: Optional: Index of cell of base station # Example: # setadditionalcablelost({link:'downlink', lost: 25.0}) # Set downlink additional 25db cable lost on cell 0 all antenna # setadditionalcablelost({link : 'uplink', lost: 20.0, antenna : 1, cell:1}) # Set uplink additional 20db cable lost on cell 1 antenna 1 # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: link = kwargs.get('link') lost = kwargs.get('lost') antenna = kwargs.get('antenna') cell = kwargs.get('cell') output = self._tbslte_handle.set_cable_loss( link, lost, antenna, cell) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while setting cable losses: {e}" ) if not output: return StatusResult.Error( f"Setting additional cable losses failed for the input: {json.dumps(kwargs)}" ) logger.info( f"Setting additional cable losses successful for the input: {json.dumps(kwargs)}" ) return StatusResult.Success()
def configuretemplateonltetbs(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: configuretemplateonltetbs # Description: configure template for ltetbs # Input: Takes argument : # template_path (:class:`str`): : Required: The TBS server accessible # template file path. The template will be deployed to the system # regardless of its current state # Examples: # configuretemplateonltetbs({template_path: '/prj/qct/octopus/test/templates/Golden/LabOps/Wildcat_v27/BC01_EPN_4cell_20MHz_XOR_CAT11.xml'}) # It will configure and load /prj/qct/octopus/test/templates/Golden/LabOps/Wildcat_v27/BC01_EPN_4cell_20MHz_XOR_CAT11.xml # in tbslte station template and run system, make sure system running # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error(f"TBSLTEUtil handle not initialized") try: template_path = kwargs.get('template_path') logger.debug( f"Deploying template {template_path} on TBSLTE station {self._host_id}" ) output = self._tbslte_handle.deploy_template(template_path) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while deploying the template: {e}" ) if not output: return StatusResult.Error( f"Failed to deploy template {template_path}") logger.info( f"Template {template_path} is deployed successful and LTETBS is running" ) return StatusResult.Success()
def SetConfigurationFile(self, configFile): """ #------------------------------------------------------------------------------------------------------------------- # Name: SetConfigurationFile # Input: Takes one argument # configFile: json config filename for ALPACA # Description: Sets up configuration for ALPACA card # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ logger.info("Loading ALPACA Configuration : " + configFile) if not configFile.endswith('.json'): return StatusResult.Error('ALPACA : ', 'Incorrect Configuration file for ALPACA, JSON file needed') configFile = CommonApplicationUtilities._ResourcesConfigFilePath + '\\Alpaca\\' + configFile if self.boardHasEpm: if self.epm.getData: logger.warning('ALPACA : Measurement already running. Stopping previous measurement') result = self.StopMeasurement() if result.HasError(): logger.error('ALPACA : Error while stopping previous measurement') return result if not os.path.exists(configFile): return StatusResult.Error('ALPACA : ', 'Configuration file not found') if self.boardHasEpm: try: self.epm.SetConfigFile(configFile) except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()
def sendtbslterawcommand(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: sendtbslterawcommand # Description: This function allow user access any tbslte module raw function directly # Input: Takes argument : # method (:class:`str`) : : Required: An ltetbs function name # inputs (:class:`list`) : : Required: tbslte input parameters # Example: # sendtbslterawcommand({command: 'testability_command', inputs: ['MME COMMAND GET MME_QUERY_STATE']}) # Send testability_command input : MME COMMAND GET MME_QUERY_STATE' to tbslte station # sendtbslterawcommand({command: 'start_system'}) # Send start_system input : None to tbslte station # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: method = kwargs.get('method') inputs = kwargs.get('inputs') output = self._tbslte_handle.tbslte_dispatcher(method, inputs) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while trying to run the command {method} with input {inputs}: {e}" ) if not output: return StatusResult.Error( f"Failed to run sendtbslterawcommand for the input: {json.dumps(kwargs)}" ) logger.info( f"Successful in running sendtbslterawcommand for the input: {json.dumps(kwargs)}" ) return StatusResult.Success()
def GetTECComPort(): """ ------------------------------------------------------------------------------------------------------------------- Name: GetTECComPort Input: Takes no argument Description: Get the COM port number for TEC Return: StatusResult() object ------------------------------------------------------------------------------------------------------------------- """ port = WindowsComPort.GetComPort('prolific usb-to-serial comm port') if not port: return StatusResult.Error('TEC not detected!') logger.info("The COM port of the TEC is " + port.device) return StatusResult.Success()
def setpandaioronltetbs(self, **kwargs): """ #------------------------------------------------------------------------------------------------------------------- # Name: setpandaioronltetbs # Description: Set panda ior on tbslte station all cells all transmitters all receivers # Input: Takes argument : # ior (:class:`float`): : Required: PowerDbm value to set at a given # tx/rx index for a given cell # Example: # setpandaioronltetbs({ior=-25.5}) # Set panda all cells all transmitters all receivers ior to -25.5 # setpandaioronltetbs({ior=0.0}) # Set panda all cells all transmitters all receivers ior to 0 # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if not self._get_tbslteutil_handle(): return StatusResult.Error("TBSLTEUtil handle not initialized") try: ior = kwargs.get('ior') output = self._tbslte_handle.set_ior_on_cells(ior) except Exception as e: return StatusResult.Error( f"TBSLTEUtil threw an exception while setting Ior on cells: {e}" ) if not output: return StatusResult.Error( f"Setting Ior to {ior} failed on all cells for all transmitters, all receivers" ) logger.info( f"Setting Ior to {ior} successful on all cells for all transmitters, all receivers" ) return StatusResult.Success()
def ActivateBSECell(self): try: logger.info("Activating BSE Cell") result = self.SendCommandAndGetResponse( "-m ActivateBSECell-" + self.address + "," + UxmCallBoxHandler.protocolType) if result.Status.HasError(): return result ''' Logic to check if the operation performed is successfull It could be parsing the obtained console log ''' except Exception as ex: return StatusResult.Error("Failed To De Register UE From IMS : " + str(ex)) return StatusResult.Success()
def initialize_handler(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: initialize_handler # Description: Create TBSLTEUtility handle and connect to Qualcomm LTE(4G) Test Base Station based on key tbslte_host_id # Input: Takes no argument # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ self._host_id = TestSuiteConfig.TbsLteHostId if self._host_id is None: return StatusResult.Error("TbsLteHostId is not provisioned") logger.debug( f"TBSLTE Host ID {self._host_id} obtained from input XML key TbsLteHostId" ) return StatusResult.Success()
def UsbOn(self): """ ------------------------------------------------------------------------------------------------------------------- Name: UsbOn Input: Takes no argument Description: Enables USB Return: StatusResult() object ------------------------------------------------------------------------------------------------------------------- """ logger.info("Spiderboard: USB On") result = self.ExecuteCommand(SpiderBoard.usbOn) if result.HasError(): logger.error(result.ErrorMessage()) return StatusResult.Error("USB on with the Spiderboard failed! " + result.ErrorMessage()) return StatusResult.Success()
def Relay2Off(self): """ ------------------------------------------------------------------------------------------------------------------- Name: Relay2Off Input: Takes no argument Description: Disables Relay2 Return: StatusResult() object ------------------------------------------------------------------------------------------------------------------- """ logger.info("Spiderboard: Relay2 Off") result = self.ExecuteCommand(SpiderBoard.relay2Off) if result.HasError(): logger.error(result.ErrorMessage()) return StatusResult.Error( "Relay2 off with the Spiderboard failed! " + result.ErrorMessage()) return StatusResult.Success()
def RecallAgilentUXMRegister(self, register): try: logger.info("Recalling Agilent UXM Register : " + register) print("Recalling Agilent UXM Register : " + register) result = self.SendCommandAndGetResponse( "-m RecallAgilentUXMRegister-" + self.address + "," + register + "," + UxmCallBoxHandler.protocolType) if result.Status.HasError(): return result ''' Logic to check if the operation performed is successfull It could be parsing the obtained console log ''' except Exception as ex: return StatusResult.Error("Failed To De Register UE From IMS : " + str(ex)) return StatusResult.Success()
def initialize_scenario(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: initialize_scenario # Description: Initialize instance variables for a single scenario # Input: Takes no argument # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if self._tbslte_handle is None: try: self._tbslte_handle = TBSLTEUtil(self._host_id) except Exception as e: logger.error( 'Failed to initialize TBS module. Please make sure your TBS is running on Octopus 96 or above' ) return StatusResult.Error( f'Failed to create TBSLTEUtil object. Error: {e}') return StatusResult.Success()
def ReleaseTacPort(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: ReleaseTacPort # Input: Takes no argument # Description: close TAC port # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ if self.boardHasTac and hasattr(self.tac, 'ser'): try: logger.debug('Releasing TAC port') self.tac.ser.close() except Exception as e: logger.error('Failed to close TAC port') logger.error(str(e)) return StatusResult.Error('Failed to close TAC port : ', str(e)) return StatusResult.Success()
def UsbOff(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: UsbOff # Input: Takes no argument # Description: Disable USB on ALPACA # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ logger.info('ALPACA: USB OFF') if self.boardHasTac: try: self.tac.DisconnectUsb() except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()
def PowerOn(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: PowerOn # Input: Takes no argument # Description: Power On ALPACA card # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ logger.info("ALPACA: Power ON"); if self.boardHasTac: try: self.tac.On() except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()
def EdlSwitchOff(self): """ #------------------------------------------------------------------------------------------------------------------- # Name: EdlSwitchOff # Input: Takes no argument # Description: Switch OFF EDL on ALPACA card # Return: StatusResult() object #------------------------------------------------------------------------------------------------------------------- """ logger.info('ALPACA: EDL switch off') if self.boardHasTac: try: self.tac._write('edl', 0) except Exception as e: logger.error(str(e)) return StatusResult.Error('ALPACA : ', str(e)) return StatusResult.Success()