Beispiel #1
0
def disconnectEDEN2():
    """Disonnect EDEN link 2"""
    LOG_INFO("Disonnect EDEN link 2", "EDEN")
    edenHost = EGSE.IF.s_edenClientConfiguration.edenHost
    edenPort2 = EGSE.IF.s_edenClientConfiguration.edenPort2
    if edenHost == "" or edenPort2 == "-1":
        LOG_ERROR("no EDEN link 2 configured", "EDEN")
        return
    s_client2.disconnectFromServer()
def disconnectNCTRS3():
    """Disonnect NCTRS Admin link"""
    LOG_INFO("Disonnect NCTRS Admin link", "NCTRS")
    nctrsHost = GRND.IF.s_clientConfiguration.nctrsHost
    nctrsAdminPort = GRND.IF.s_clientConfiguration.nctrsAdminPort
    if nctrsHost == "" or nctrsAdminPort == "-1":
        LOG_ERROR("no NCTRS Admin link configured", "NCTRS")
        return
    s_adminClient.disconnectFromServer()
Beispiel #3
0
 def pushMngPacket(self, tcPacketDu):
     """
 consumes a management telecommand packet:
 implementation of SPACE.IF.OnboardQueue.pushMngPacket
 """
     LOG_INFO("pushMngPacket", "OBQ")
     LOG("APID =    " + str(tcPacketDu.applicationProcessId), "OBQ")
     LOG("TYPE =    " + str(tcPacketDu.serviceType), "OBQ")
     LOG("SUBTYPE = " + str(tcPacketDu.serviceSubType), "OBQ")
     LOG("SSC =     " + str(tcPacketDu.sequenceControlCount), "OBQ")
     # check if the packet is a TT uplink command
     if tcPacketDu.serviceSubType in PUS.SERVICES.TC_OBQ_UPLINK_SUBTYPES:
         # extract the embedded TT packet from the TT uplink command
         # consider also the CRC (2 bytes)
         ttPacketMaxSize = len(tcPacketDu) - self.ttByteOffset - 2
         if ttPacketMaxSize <= CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE:
             LOG_ERROR("cannot extract TT packet, not enought bytes", "OBQ")
             LOG(str(tcPacketDu), "OBQ")
             return
         ttPacketData = tcPacketDu.getBytes(self.ttByteOffset,
                                            ttPacketMaxSize)
         ttPacketDu = PUS.PACKET.TCpacket(ttPacketData)
         ttPacketSize = CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE + ttPacketDu.packetLength + 1
         # consistency checks
         if ttPacketSize < CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE:
             LOG_ERROR("packetLength of TT packet too small", "OBQ")
             LOG(str(ttPacketDu), "OBQ")
             return
         if ttPacketSize > ttPacketMaxSize:
             LOG_ERROR("packetLength of TT packet too large", "OBQ")
             LOG(str(ttPacketDu), "OBQ")
             return
         # resize the ttPacketDu to match the packetLength
         ttPacketDu.setLen(ttPacketSize)
         if not ttPacketDu.checkChecksum():
             LOG_ERROR("invalid TT packet CRC", "OBQ")
             LOG(str(ttPacketDu), "OBQ")
             return
         # calculate the execution time
         obtExecTime = tcPacketDu.getTime(self.ttTimeByteOffset,
                                          self.ttTtimeFormat)
         ttExecTime = UTIL.TCO.correlateFromOBTmissionEpoch(obtExecTime)
         SPACE.IF.s_onboardQueue.insertTTpacket(ttExecTime, ttPacketDu)
Beispiel #4
0
 def connectCallback(self, socket, stateMask):
     """Callback when a client has connected"""
     # accept the client connection
     try:
         clientSocket, clientHost = self.connectSocket.accept()
     except Exception as ex:
         LOG_ERROR("Accept of the client connection failed: " + str(ex))
         return
     # delegate the remaing processing
     self.accepted(clientSocket)
Beispiel #5
0
 def connectToServer(self, serverHost, serverPort):
     """Connects to the server"""
     # create the data socket
     try:
         dataSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     except Exception as ex:
         LOG_ERROR("Creation of data socket failed: " + str(ex))
         return None
     # connect the data socket to the server
     try:
         dataSocket.connect((serverHost, serverPort))
     except Exception as ex:
         LOG_ERROR("Connection to server " + str(serverPort) + "@" +
                   serverHost + " failed: " + str(ex))
         return None
     # use the data socket
     self.enableDataSocket(dataSocket)
     # call the hook
     self.connected()
     return dataSocket
Beispiel #6
0
class TMclient(UTIL.TCP.SingleServerReceivingClient):
    """CNC TM interface - CCS side"""

    # connectToServer and disconnectFromServer are inherited
    # and must be handled in a proper way from the application
    # ---------------------------------------------------------------------------
    def __init__(self):
        """Initialise attributes only"""
        modelTask = UTIL.TASK.s_processingTask
        UTIL.TCP.SingleServerReceivingClient.__init__(self, modelTask)

    # ---------------------------------------------------------------------------
    def receiveCallback(self, socket, stateMask):
        """Callback when the SCOE has send data"""
        # read the packet header from the data socket
        try:
            packetHeader = self.dataSocket.recv(
                CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE)
        except Exception, ex:
            self.disconnectFromServer()
            self.notifyConnectionClosed(str(ex))
            return
        # consistency check
        packetHeaderLen = len(packetHeader)
        if packetHeaderLen == 0:
            # client termination
            self.disconnectFromServer()
            self.notifyConnectionClosed("empty data read")
            return
        if packetHeaderLen != CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE:
            LOG_ERROR("Read of CCSDS packet header failed: invalid size: " +
                      str(pduHeaderLen))
            return
        ccsdsTMpacketDU = CCSDS.PACKET.TMpacket(packetHeader)
        # read the data field for the packet from the data socket
        dataFieldLength = ccsdsTMpacketDU.packetLength + 1
        try:
            dataField = self.dataSocket.recv(dataFieldLength)
        except Exception, ex:
            LOG_ERROR("Read of packet dataField failed: " + str(ex))
            return
Beispiel #7
0
 def receiveCallback(self, socket, stateMask):
     """Callback when NCTRS has send data"""
     # read the admin message unit header
     messageHeader = self.recv(GRND.NCTRSDU.MESSAGE_HEADER_BYTE_SIZE)
     if messageHeader == None:
         # failure handling was done automatically by derived logic
         return
     # consistency check
     messageHeaderLen = len(messageHeader)
     if messageHeaderLen != GRND.NCTRSDU.MESSAGE_HEADER_BYTE_SIZE:
         LOG_ERROR(
             "Read of admin message DU header failed: invalid size: " +
             str(messageHeaderLen), "NCTRS")
         self.disconnectFromServer()
         return
     messageDu = GRND.NCTRSDU.AdminMessageDataUnit(messageHeader)
     # consistency check
     packetSize = messageDu.packetSize
     remainingSizeExpected = packetSize - GRND.NCTRSDU.MESSAGE_HEADER_BYTE_SIZE
     if remainingSizeExpected <= 0:
         LOG_ERROR(
             "Read of admin message DU header failed: invalid packet size field: "
             + str(remainingSizeExpected), "NCTRS")
         self.disconnectFromServer()
         return
     # read the remaining bytes for the TC data unit
     messageRemaining = self.recv(remainingSizeExpected)
     if messageRemaining == None:
         # failure handling was done automatically by derived logic
         return
     # consistency check
     remainingSizeRead = len(messageRemaining)
     if remainingSizeRead != remainingSizeExpected:
         LOG_ERROR(
             "Read of remaining admin message DU failed: invalid remaining size: "
             + str(remainingSizeRead), "NCTRS")
         self.disconnectFromServer()
         return
     # set the message
     messageDu.setMessage(messageRemaining)
     self.notifyAdminMessageDataUnit(messageDu)
Beispiel #8
0
    def tcpConnectCallback(self, socket, stateMask):
        """Callback when a TCP/IP client (e.g. TECO) has connected"""
        # accept the client connection
        try:
            clientSocket, clientHost = self.connectSocket.accept()
        except:
            LOG_ERROR("accept of the client connection failed!")
            return
        self.clientSocket = clientSocket

        # delegate the remaing processing
        self.connected()
Beispiel #9
0
 def pushTMpacket(self, tmPacketDu, ertUTC):
     """
 consumes a telemetry packet:
 implementation of LINK.IF.PacketLink.pushTMpacket
 """
     tmFrameDu = LINK.IF.s_tmFrameGenerator.getTMframe(tmPacketDu)
     if tmFrameDu == None:
         LOG_ERROR("cannot determine frame for packet", "LINK")
     # put the TM frame into the downlink queue to simulate the downlink delay
     receptionTime = UTIL.TIME.getActualTime() + DOWNLINK_DELAY_SEC
     self.downlinkQueue[receptionTime] = (tmFrameDu, ertUTC)
     UTIL.TASK.s_processingTask.notifyGUItask("TM_FRAME")
Beispiel #10
0
 def stopFrameRecorder(self):
     """
 stops TM frame recording:
 implementation of GROUND.IF.TMmcsLink.stopFrameRecorder
 """
     # open the TM frame recording file
     try:
         GRND.IF.s_configuration.frameRecordFile.close()
         GRND.IF.s_configuration.frameRecordFile = None
     except:
         LOG_ERROR("cannot close frame recording file", "GRND")
     # notify the GUI
     UTIL.TASK.s_processingTask.notifyGUItask("FRAME_REC_STOPPED")
 def receiveCallback(self, socket, stateMask):
   """Callback when a server has send data"""
   LOG("*** receiveCallback ***")
   # read the next set of byte from the data socket
   tcpLineBuffer = self.tcpLineBuffer
   try:
     tcpLineBuffer += self.dataSocket.recv(LINEBUFFERLEN);
     LOG("tcpLineBuffer: " + tcpLineBuffer)
   except Exception, ex:
     # read failed
     LOG_ERROR("Read failed: " + str(ex))
     self.disconnectClient()
     return
Beispiel #12
0
 def sendFTH_MonitorProUST(self):
     """sends the FTH_MonitorProUST TM packet to CCS"""
     pktMnemonic = "FTH_MonitorProUST"
     params = EPWR_FTH_OP
     values = self.operationMode
     tmPacketData = SPACE.IF.s_definitions.getTMpacketInjectData(
         pktMnemonic, params, values)
     # check the TM packet data
     if tmPacketData == None:
         LOG_ERROR("TM packet creation failed for " + pktMnemonic, "SPACE")
         return False
     # send the TM packet
     return SPACE.IF.s_onboardComputer.generateTMpacket(tmPacketData)
Beispiel #13
0
 def receiveCallback(self, socket, stateMask):
     """Callback when the SCOE has send data"""
     # read the packet header from the data socket
     packetHeader = self.recv(CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE)
     if packetHeader == None:
         # failure handling was done automatically by derived logic
         return
     # consistency check
     packetHeaderLen = len(packetHeader)
     if packetHeaderLen != CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE:
         LOG_ERROR(
             "Read of CCSDS packet header failed: invalid size: " +
             str(packetHeaderLen), "CNC")
         self.disconnectFromServer()
         return
     ccsdsTMpacketDU = CCSDS.PACKET.TMpacket(packetHeader)
     # read the data field for the packet from the data socket
     dataFieldLength = ccsdsTMpacketDU.packetLength + 1
     dataField = self.recv(dataFieldLength)
     if dataField == None:
         # failure handling was done automatically by derived logic
         return
     # consistency check
     remainingSizeRead = len(dataField)
     if remainingSizeRead != dataFieldLength:
         LOG_ERROR(
             "Read of remaining packet failed: invalid remaining size: " +
             str(remainingSizeRead), "CNC")
         self.disconnectFromServer()
         return
     ccsdsTMpacketDU.append(dataField)
     # dispatch the CCSDS tm packet
     try:
         LOG_INFO("CNC.TMclient.receiveCallback(TM packet)", "CNC")
         self.notifyTMpacket(ccsdsTMpacketDU.getBuffer())
     except Exception as ex:
         LOG_ERROR("Processing of received TM packet failed: " + str(ex),
                   "CNC")
         self.disconnectFromServer()
Beispiel #14
0
def createTMdataUnit(binaryString=None):
    """creates a NCTRS TM data unit according to the NCTRS_TM_DU_VERSION"""
    tmDUtype = getTMdataUnitType()
    if s_tmDUtype == GRND.NCTRSDU.TM_V0_ERT_FORMAT:
        return GRND.NCTRSDU.TMdataUnitV0(binaryString)
    elif s_tmDUtype == GRND.NCTRSDU.TM_V1_CDS1_ERT_FORMAT:
        return GRND.NCTRSDU.TMdataUnitV1CDS1(binaryString)
    elif s_tmDUtype == GRND.NCTRSDU.TM_V1_CDS2_ERT_FORMAT:
        return GRND.NCTRSDU.TMdataUnitV1CDS2(binaryString)
    elif s_tmDUtype == GRND.NCTRSDU.TM_V1_CDS3_ERT_FORMAT:
        return GRND.NCTRSDU.TMdataUnitV1CDS3(binaryString)
    LOG_ERROR("Invalid s_tmDUtype " + str(s_tmDUtype), "NCTRS")
    sys.exit(-1)
 def receiveCallback(self, socket, stateMask):
     """Callback when a server has send data"""
     LOG("*** receiveCallback ***")
     # read the next set of byte from the data socket
     data = self.recv(LINEBUFFERLEN)
     if data == None:
         # client is automatically disconnected
         return
     tcpLineBuffer = self.tcpLineBuffer
     tcpLineBuffer += data.decode("ascii")
     # handle the input: extract the lines from the line buffer
     lines = tcpLineBuffer.split("\n")
     # the last line has to be handled in a special way and can not be
     # processed directly
     lastLine = lines[-1]
     lines = lines[:-1]
     if lastLine == "":
         # read of the data was complete (incl. "\n")
         pass
     else:
         # last line was cutt off and the rest should come with the next read
         self.tcpLineBuffer = lastLine
     for line in lines:
         # remove a terminating "\r" for clients like telnet
         if line[-1] == "\r":
             line = line[:-1]
         # terminate the client connection if exit has been entered (case insensitive)
         upperLine = line.upper()
         if (upperLine == "X") or (upperLine == "EXIT"):
             LOG("Exit requested")
             # terminate the server connection
             self.disconnectFromServer()
             return
         if (upperLine == "Q") or (upperLine == "QUIT"):
             LOG("Quit requested")
             # terminate the server connection
             self.disconnectFromServer()
             sys.exit(0)
         # delegate the input
         pstatus = self.processLine(line)
         if pstatus == 0:
             LOG("OK")
             # send the OK response back to the TECO
             retString = "OK\n"
             self.send(retString.encode())
         else:
             LOG_ERROR(str(pstatus))
             # set the Error response back to the client:
             retString = "Error: execution failed (see log)!\n"
             self.send(retString.encode())
 def generatePacketsFromCRYOSATframes(self, frameDumpFile):
     """Extracts CCSDS TM packets from CRYOSAT TM transfer frames"""
     frameNumber = 1
     while True:
         cryosatHeader = frameDumpFile.read(
             GRND.CRYOSATDU.TM_FRAME_DU_HEADER_BYTE_SIZE)
         if len(cryosatHeader) == 0:
             # end of file reached
             return
         elif len(cryosatHeader
                  ) != GRND.CRYOSATDU.TM_FRAME_DU_HEADER_BYTE_SIZE:
             LOG_ERROR("frameDumpFile has incomplete CRYOSAT frame " +
                       str(frameNumber))
             sys.exit(-1)
         # cryosatHeader completely read --> read CCSDS frame
         ccsdsFrame = frameDumpFile.read(self.frameSize)
         if len(ccsdsFrame) != self.frameSize:
             LOG_ERROR("frameDumpFile has incomplete CCSDS frame " +
                       str(frameNumber))
             sys.exit(-1)
         self.generatePacketsFromCCSDSframe(ccsdsFrame, frameNumber)
         # prepare read of next frame
         frameNumber += 1
Beispiel #17
0
 def generateEmptyTMpacket(self, pktMnemonic):
     """
 generates an empty TM packet (all parameters are zero):
 implementation of SPACE.IF.OnboardComputer.generateTMpacket
 """
     params = ""
     values = ""
     tmPacketData = SPACE.IF.s_definitions.getTMpacketInjectData(
         pktMnemonic, params, values)
     # check the TM packet data
     if tmPacketData == None:
         LOG_ERROR("TM packet creation failed for " + pktMnemonic, "SPACE")
         return False
     # send the TM packet
     return self.generateTMpacket(tmPacketData)
Beispiel #18
0
 def startReplay(self, replayFileName, frameRateMs):
   """starts reading NCTRS frames from a replay file"""
   LOG_WARNING("startReplay(" + replayFileName + ")", "FRAME")
   # read the NCTRS frames file
   try:
     self.nctrsFramesFile = open(replayFileName, "rb")
   except:
     LOG_ERROR("cannot read " + replayFileName, "FRAME")
     return False
   self.frameRateMs = frameRateMs
   self.running = True
   self.frameNr = 0
   UTIL.TASK.s_processingTask.notifyGUItask("UPDATE_REPLAY")
   # read the first frame, other frames are read automatically
   self.readFrame()
Beispiel #19
0
 def sendRT_SelfTestResponse(self, bus, errorId):
     """implementation of ApplicationSoftwareImpl.sendRT_SelfTestResponse"""
     if bus == SPACE.IF.MIL_BUS_PF:
         pktMnemonic = "XPSTMPK10131"
         parErrorId = "XPSM184X"
     else:
         pktMnemonic = "XPSTMPK10631"
         parErrorId = "XPSM684X"
     tmPacketData = SPACE.IF.s_definitions.getTMpacketInjectData(
         pktMnemonic, parErrorId, str(errorId))
     # check the TM packet data
     if tmPacketData == None:
         LOG_ERROR("TM packet creation failed for " + pktMnemonic, "SPACE")
         return False
     # send the TM packet
     return SPACE.IF.s_onboardComputer.generateTMpacket(tmPacketData)
Beispiel #20
0
 def receiveTCframe(self, tcFrameDu):
     """TC frame received"""
     sequenceNumber = tcFrameDu.sequenceNumber
     if LINK.IF.s_configuration.enableCLCW:
         # set the sequenceNumber for the next CLCWs that are sent to ground
         # (e.g. with TC acknowledgements)
         sequenceNumber = (sequenceNumber + 1) % 256
         LINK.IF.s_tmFrameGenerator.setCLCWcount(sequenceNumber)
     # used to update the GUI
     UTIL.TASK.s_processingTask.notifyGUItask("TC_FRAME")
     # extract the segment from the frame
     try:
         segment = tcFrameDu.getSegment()
     except Exception, ex:
         LOG_ERROR("segment extraction failed: " + str(ex), "LINK")
         return
Beispiel #21
0
 def listPacketsCmd(self, argv):
     """Decoded listPackets command"""
     self.logMethod("listPacketsCmd", "SPACE")
     # consistency check
     if len(argv) != 1:
         LOG_WARNING("invalid parameters passed", "SPACE")
         return False
     # read the MIB
     try:
         for tmPktDef in SPACE.IF.s_definitions.getTMpktDefs():
             LOG(
                 tmPktDef.pktName + " (SPID = " + str(tmPktDef.pktSPID) +
                 ") - " + tmPktDef.pktDescr, "SPACE")
     except Exception, ex:
         LOG_ERROR("MIB Error: " + str(ex), "SPACE")
         return False
Beispiel #22
0
def getTMdataUnitType():
    """returns the NCTRS TM data unit type according to NCTRS_TM_DU_VERSION"""
    global s_tmDUtype
    if s_tmDUtype == None:
        nctrsTMversion = UTIL.SYS.s_configuration.NCTRS_TM_DU_VERSION
        if nctrsTMversion == "V0":
            s_tmDUtype = GRND.NCTRSDU.TM_V0_ERT_FORMAT
        elif nctrsTMversion == "V1_CDS1":
            s_tmDUtype = GRND.NCTRSDU.TM_V1_CDS1_ERT_FORMAT
        elif nctrsTMversion == "V1_CDS2":
            s_tmDUtype = GRND.NCTRSDU.TM_V1_CDS2_ERT_FORMAT
        elif nctrsTMversion == "V1_CDS3":
            s_tmDUtype = GRND.NCTRSDU.TM_V1_CDS3_ERT_FORMAT
        else:
            LOG_ERROR("Invalid NCTRS_TM_DU_VERSION " + nctrsTMversion, "NCTRS")
            sys.exit(-1)
    return s_tmDUtype
Beispiel #23
0
 def processFunctionService(self, apid, tcFunctionId, tcPacketDu):
     """
 processes PUS Service (8,1) telecommand packet
 implementation of ApplicationSoftwareImpl.processFunctionService
 """
     if tcFunctionId == BS_Initialize:
         LOG_INFO("*** BS_Initialize ***", "SPACE")
         LOG("push HKTM", "SPACE")
         return self.sendBS_Monitor()
     elif tcFunctionId == BS_SetLocal:
         LOG_INFO("*** BS_SetLocal ***", "SPACE")
         LOG("set the SCOE into the LOCAL commanding mode", "SPACE")
         self.commandingMode = EPWR_CMD_LOCAL
     elif tcFunctionId == BS_SetRemote:
         LOG_INFO("*** BS_SetRemote ***", "SPACE")
         LOG("set the SCOE into the REMOTE commanding mode", "SPACE")
         self.commandingMode = EPWR_CMD_REMOTE
     elif tcFunctionId == BS_LockInstruments:
         LOG_INFO("*** BS_LockInstruments ***", "SPACE")
         LOG("not used for simulation", "SPACE")
     elif tcFunctionId == BS_UnlockInstruments:
         LOG_INFO("*** BS_UnlockInstruments ***", "SPACE")
         LOG("not used for simulation", "SPACE")
     elif tcFunctionId == BS_SetOnline:
         LOG_INFO("*** BS_SetOnline ***", "SPACE")
         LOG("set the SCOE into the ONLINE operation mode", "SPACE")
         self.operationMode = EPWR_OP_ONLINE
         return self.sendBS_Monitor()
     elif tcFunctionId == BS_SetOffline:
         LOG_INFO("*** BS_SetOffline ***", "SPACE")
         LOG("set the SCOE into the OFFLINE operation mode", "SPACE")
         self.operationMode = EPWR_OP_OFFLINE
         return self.sendBS_Monitor()
     elif tcFunctionId == BS_SelfTest:
         LOG_INFO("*** BS_SelfTest ***", "SPACE")
         # the SELFTEST is only allowed in OFFLINE mode
         if self.operationMode == EPWR_OP_ONLINE:
             LOG_ERROR("SELFTEST not allowed when system is ONLINE",
                       "SPACE")
             return False
     else:
         # unexpected Function ID
         LOG_WARNING(
             "no simulation for Function ID " + str(tcFunctionId) +
             " implemented", "SPACE")
     return True
Beispiel #24
0
 def sendFTH_MonitorProUST_withStringParam(self, paramName, paramValue,
                                           paramSize):
     """sends the FTH_MonitorProUST TM packet to CCS"""
     pktMnemonic = "FTH_MonitorProUST"
     params = ""
     values = ""
     tmPacketData = SPACE.IF.s_definitions.getTMpacketInjectData(
         pktMnemonic, params, values)
     # check the TM packet data
     if tmPacketData == None:
         LOG_ERROR("TM packet creation failed for " + pktMnemonic, "SPACE")
         return False
     # force the correct parameter size and add the parameter
     paramValue = (paramValue + (' ' * paramSize))[0:paramSize]
     tmPacketData.parameterValuesList.append([paramName, paramValue])
     # send the TM packet
     return SPACE.IF.s_onboardComputer.generateTMpacket(tmPacketData)
Beispiel #25
0
 def generateCmd(self, argv):
     """Decoded generate command"""
     self.logMethod("generateCmd", "SPACE")
     # consistency check
     if len(argv) != 1:
         LOG_WARNING("invalid parameters passed", "SPACE")
         return False
     # generate the testdata.sim file
     definitionFileName = SCOS.ENV.s_environment.definitionFileName()
     LOG("generate to " + definitionFileName, "SPACE")
     try:
         # update the TM definitions to ensure an actual testdata.sim
         SPACE.IF.s_definitions.createDefinitions()
         LOG(definitionFileName + " generated", "SPACE")
     except Exception, ex:
         LOG_ERROR("Generation Error: " + str(ex), "SPACE")
         return False
Beispiel #26
0
 def listPacketsCmd(self, argv):
   """Decoded listPackets command"""
   self.logMethod("listPacketsCmd", "SPACE")
   # consistency check
   if len(argv) != 1:
     LOG_WARNING("invalid parameters passed", "SPACE")
     return False
   # dump the packet definitions
   try:
     for tmPktDef in SUPP.IF.s_definitions.getTMpktDefs():
       LOG("TM: " + tmPktDef.pktName + " (SPID = " + str(tmPktDef.pktSPID) + ") - " + tmPktDef.pktDescr, "SPACE")
     for tcPktDef in SUPP.IF.s_definitions.getTCpktDefs():
       LOG("TC: " + tcPktDef.pktName + " (APID = " + str(tcPktDef.pktAPID) + ", TYPE = " + str(tcPktDef.pktType) + ", STPYE = " + str(tcPktDef.pktSType) + ") - " + tcPktDef.pktDescr, "SPACE")
   except Exception as ex:
     LOG_ERROR("MIB Error: " + str(ex), "SPACE")
     return False
   return True
Beispiel #27
0
 def sendTc_eScoe(self, tcSpacePDU, telecommandEchoStatus):
     """Send a (TC_E,SCOE) PDU to the CCS"""
     if EGSE.IF.s_serverConfiguration.egseAck1 == EGSE.IF.ENABLE_ACK:
         # normal processing
         if telecommandEchoStatus == 0:
             LOG_INFO("EDEN.Server.sendTc_eScoe(OK)")
         else:
             LOG_ERROR("EDEN.Server.sendTc_eScoe(ERROR)")
     elif EGSE.IF.s_serverConfiguration.egseAck1 == EGSE.IF.ENABLE_NAK:
         LOG_WARNING("force ERROR for (TC_E,SCOE)")
         telecommandEchoStatus = 1
     else:
         LOG_WARNING("suppress (TC_E,SCOE)")
         return
     tc_eScoePDU = EGSE.EDENPDU.TC_Escoe(tcSpacePDU.buffer)
     tc_eScoePDU.telecommandEchoStatus = telecommandEchoStatus
     self.sendPDU(tc_eScoePDU)
Beispiel #28
0
def init():
    # initialise singleton(s)
    mission = UTIL.SYS.s_configuration.ASW_MISSION
    if mission == "MTG":
        SPACE.IF.s_applicationSoftware = MTGapplicationSoftwareImpl()
    elif mission == "S4":
        SPACE.IF.s_applicationSoftware = S4applicationSoftwareImpl()
    elif mission == "EUCLID_BS":
        SPACE.IF.s_applicationSoftware = EUCLIDpowerFEEsim_BS()
    elif mission == "EUCLID_FTH":
        SPACE.IF.s_applicationSoftware = EUCLIDpowerFEEsim_FTH()
    elif mission == "EUCLID_LPSN":
        SPACE.IF.s_applicationSoftware = EUCLIDpowerFEEsim_LPS_SAS(True)
    elif mission == "EUCLID_LPSR":
        SPACE.IF.s_applicationSoftware = EUCLIDpowerFEEsim_LPS_SAS(False)
    else:
        LOG_ERROR("No ASW implementation for mission " + mission + " present",
                  "SPACE")
Beispiel #29
0
    def generateEmptyTMpacketBySPID(self, spid):
        """
    generates an empty TM packet (all parameters are zero):
    implementation of SPACE.IF.OnboardComputer.generateEmptyTMpacketBySPID
    """
        params = ""
        values = ""
        tmStruct = None
        tmPacketData = SUPP.IF.s_definitions.getTMpacketInjectDataBySPID(
            spid, params, values, tmStruct)

        # check the TM packet data
        if tmPacketData == None:
            LOG_ERROR("TM packet creation failed for SPID " + str(spid),
                      "SPACE")
            return False
        # send the TM packet
        return self.generateTMpacket(tmPacketData)
Beispiel #30
0
 def pushTMpacket(self, tmPacketDu, ertUTC):
   """
   consumes a telemetry packet:
   implementation of MC.IF.TMmodel.pushTMpacket
   """
   LOG_INFO("pushTMpacket", "TM")
   # other packet info
   LOG("APID =    " + str(tmPacketDu.applicationProcessId), "TM")
   LOG("SSC =     " + str(tmPacketDu.sequenceControlCount), "TM")
   if PUS.PACKET.isPUSpacketDU(tmPacketDu):
     # PUS packet
     object.__setattr__(tmPacketDu, "attributeMap2", PUS.PACKET.TM_PACKET_DATAFIELD_HEADER_ATTRIBUTES)
     LOG("TYPE =    " + str(tmPacketDu.serviceType), "TM")
     LOG("SUBTYPE = " + str(tmPacketDu.serviceSubType), "TM")
     # the existence of a CRC for PUS packets is mission dependant
     # for SCOS-2000 compatibility we expect a CRC
     if not tmPacketDu.checkChecksum():
       LOG_ERROR("invalid TM packet CRC", "TM")
   else:
     # CCSDS packet
     LOG("non-PUS packet", "TM")
     LOG("tmPacketDu = " + str(tmPacketDu), "TM")
   try:
     # try to decode the packet
     tmPacketKey = SUPP.IF.s_definitions.getTMpacketKey(tmPacketDu)
     LOG("KEY =     " + str(tmPacketKey), "TM")
     tmPktDef = SUPP.IF.s_definitions.getTMpktDefBySPID(tmPacketKey)
     if tmPktDef == None:
       LOG_WARNING("packet cannot be identified - don't decode it", "TM")
     else:
       tmStructDef = tmPktDef.tmStructDef
       structBitPos = (CCSDS.PACKET.PRIMARY_HEADER_BYTE_SIZE + tmPktDef.pktDFHsize) << 3
       tmStruct = PUS.VP.Struct(tmStructDef)
       tmStruct.decode(tmPacketDu, structBitPos)
       LOG("tmStruct =" + str(tmStruct), "TM")
   except Exception as ex:
     LOG_WARNING("packet cannot be decoded: " + str(ex), "TM")
   # processing of PUS telecommands
   if PUS.PACKET.isPUSpacketDU(tmPacketDu) and tmPacketDu.serviceType == PUS.SERVICES.TC_ACK_TYPE:
     # packet is a PUS TC Acknowledgement command
     MC.IF.s_tcModel.notifyTCack(tmPacketDu.serviceSubType)
   # forward the TM packet also to the TM recorder
   # where the packet is recorded on demand
   SUPP.IF.s_tmRecorder.pushTMpacket(tmPacketDu, ertUTC)