11#if FW_ENABLE_TEXT_LOGGING
35 class ComponentIpcSerializableBuffer :
50 return sizeof(m_buff);
57 const U8* getBuffAddr()
const {
63 U8 m_buff[SERIALIZATION_SIZE];
72 void ComLoggerComponentBase ::
84 port < static_cast<PlatformIntType>(this->getNum_cmdIn_InputPorts());
87 this->m_cmdIn_InputPort[port].init();
88 this->m_cmdIn_InputPort[port].addCallComp(
92 this->m_cmdIn_InputPort[port].setPortNum(port);
94#if FW_OBJECT_NAMES == 1
103 this->m_cmdIn_InputPort[port].setObjName(portName);
110 port < static_cast<PlatformIntType>(this->getNum_comIn_InputPorts());
113 this->m_comIn_InputPort[port].init();
114 this->m_comIn_InputPort[port].addCallComp(
118 this->m_comIn_InputPort[port].setPortNum(port);
120#if FW_OBJECT_NAMES == 1
129 this->m_comIn_InputPort[port].setObjName(portName);
136 port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
139 this->m_pingIn_InputPort[port].init();
140 this->m_pingIn_InputPort[port].addCallComp(
144 this->m_pingIn_InputPort[port].setPortNum(port);
146#if FW_OBJECT_NAMES == 1
155 this->m_pingIn_InputPort[port].setObjName(portName);
159#if FW_ENABLE_TEXT_LOGGING == 1
163 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
166 this->m_LogText_OutputPort[port].init();
168#if FW_OBJECT_NAMES == 1
177 this->m_LogText_OutputPort[port].setObjName(portName);
185 port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
188 this->m_cmdRegOut_OutputPort[port].init();
190#if FW_OBJECT_NAMES == 1
199 this->m_cmdRegOut_OutputPort[port].setObjName(portName);
206 port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
209 this->m_cmdResponseOut_OutputPort[port].init();
211#if FW_OBJECT_NAMES == 1
220 this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
227 port < static_cast<PlatformIntType>(this->getNum_logOut_OutputPorts());
230 this->m_logOut_OutputPort[port].init();
232#if FW_OBJECT_NAMES == 1
241 this->m_logOut_OutputPort[port].setObjName(portName);
248 port < static_cast<PlatformIntType>(this->getNum_timeCaller_OutputPorts());
251 this->m_timeCaller_OutputPort[port].init();
253#if FW_OBJECT_NAMES == 1
262 this->m_timeCaller_OutputPort[port].setObjName(portName);
269 port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
272 this->m_pingOut_OutputPort[port].init();
274#if FW_OBJECT_NAMES == 1
283 this->m_pingOut_OutputPort[port].setObjName(portName);
289 ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
72 void ComLoggerComponentBase :: {
…}
305 portNum < this->getNum_cmdIn_InputPorts(),
309 return &this->m_cmdIn_InputPort[portNum];
320 portNum < this->getNum_comIn_InputPorts(),
324 return &this->m_comIn_InputPort[portNum];
331 portNum < this->getNum_pingIn_InputPorts(),
335 return &this->m_pingIn_InputPort[portNum];
342#if FW_ENABLE_TEXT_LOGGING == 1
344 void ComLoggerComponentBase ::
345 set_LogText_OutputPort(
351 portNum < this->getNum_LogText_OutputPorts(),
355 this->m_LogText_OutputPort[portNum].addCallPort(port);
360 void ComLoggerComponentBase ::
361 set_cmdRegOut_OutputPort(
367 portNum < this->getNum_cmdRegOut_OutputPorts(),
371 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
360 void ComLoggerComponentBase :: {
…}
374 void ComLoggerComponentBase ::
375 set_cmdResponseOut_OutputPort(
381 portNum < this->getNum_cmdResponseOut_OutputPorts(),
385 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
374 void ComLoggerComponentBase :: {
…}
388 void ComLoggerComponentBase ::
389 set_logOut_OutputPort(
395 portNum < this->getNum_logOut_OutputPorts(),
399 this->m_logOut_OutputPort[portNum].addCallPort(port);
388 void ComLoggerComponentBase :: {
…}
402 void ComLoggerComponentBase ::
403 set_timeCaller_OutputPort(
409 portNum < this->getNum_timeCaller_OutputPorts(),
413 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
402 void ComLoggerComponentBase :: {
…}
420 void ComLoggerComponentBase ::
421 set_pingOut_OutputPort(
427 portNum < this->getNum_pingOut_OutputPorts(),
431 this->m_pingOut_OutputPort[portNum].addCallPort(port);
420 void ComLoggerComponentBase :: {
…}
434#if FW_PORT_SERIALIZATION
440#if FW_ENABLE_TEXT_LOGGING == 1
442 void ComLoggerComponentBase ::
443 set_LogText_OutputPort(
445 Fw::InputSerializePort* port
449 portNum < this->getNum_LogText_OutputPorts(),
453 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
458 void ComLoggerComponentBase ::
459 set_cmdRegOut_OutputPort(
461 Fw::InputSerializePort* port
465 portNum < this->getNum_cmdRegOut_OutputPorts(),
469 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
472 void ComLoggerComponentBase ::
473 set_cmdResponseOut_OutputPort(
475 Fw::InputSerializePort* port
479 portNum < this->getNum_cmdResponseOut_OutputPorts(),
483 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
486 void ComLoggerComponentBase ::
487 set_logOut_OutputPort(
489 Fw::InputSerializePort* port
493 portNum < this->getNum_logOut_OutputPorts(),
497 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
500 void ComLoggerComponentBase ::
501 set_timeCaller_OutputPort(
503 Fw::InputSerializePort* port
507 portNum < this->getNum_timeCaller_OutputPorts(),
511 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
516#if FW_PORT_SERIALIZATION
522 void ComLoggerComponentBase ::
523 set_pingOut_OutputPort(
525 Fw::InputSerializePort* port
529 portNum < this->getNum_pingOut_OutputPorts(),
533 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
542 void ComLoggerComponentBase ::
545 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
547 this->m_cmdRegOut_OutputPort[0].invoke(
548 this->getIdBase() + OPCODE_CLOSEFILE
542 void ComLoggerComponentBase :: {
…}
556 ComLoggerComponentBase ::
557 ComLoggerComponentBase(
const char* compName) :
558 Fw::ActiveComponentBase(compName)
560 this->m_FileNotInitializedThrottle = 0;
556 ComLoggerComponentBase :: {
…}
563 ComLoggerComponentBase ::
564 ~ComLoggerComponentBase()
563 ComLoggerComponentBase :: {
…}
574 getNum_cmdIn_InputPorts()
const
584 getNum_comIn_InputPorts()
const
590 getNum_pingIn_InputPorts()
const
599#if FW_ENABLE_TEXT_LOGGING == 1
602 getNum_LogText_OutputPorts()
const
610 getNum_cmdRegOut_OutputPorts()
const
616 getNum_cmdResponseOut_OutputPorts()
const
622 getNum_logOut_OutputPorts()
const
628 getNum_timeCaller_OutputPorts()
const
638 getNum_pingOut_OutputPorts()
const
647#if FW_ENABLE_TEXT_LOGGING == 1
649 bool ComLoggerComponentBase ::
653 portNum < this->getNum_LogText_OutputPorts(),
657 return this->m_LogText_OutputPort[portNum].isConnected();
662 bool ComLoggerComponentBase ::
666 portNum < this->getNum_cmdRegOut_OutputPorts(),
670 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
662 bool ComLoggerComponentBase :: {
…}
673 bool ComLoggerComponentBase ::
677 portNum < this->getNum_cmdResponseOut_OutputPorts(),
681 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
673 bool ComLoggerComponentBase :: {
…}
684 bool ComLoggerComponentBase ::
688 portNum < this->getNum_logOut_OutputPorts(),
692 return this->m_logOut_OutputPort[portNum].isConnected();
684 bool ComLoggerComponentBase :: {
…}
695 bool ComLoggerComponentBase ::
699 portNum < this->getNum_timeCaller_OutputPorts(),
703 return this->m_timeCaller_OutputPort[portNum].isConnected();
695 bool ComLoggerComponentBase :: {
…}
710 bool ComLoggerComponentBase ::
714 portNum < this->getNum_pingOut_OutputPorts(),
718 return this->m_pingOut_OutputPort[portNum].isConnected();
710 bool ComLoggerComponentBase :: {
…}
727 void ComLoggerComponentBase ::
736 portNum < this->getNum_comIn_InputPorts(),
746 ComponentIpcSerializableBuffer msg;
750 _status = msg.serialize(
759 _status = msg.serialize(portNum);
766 _status = msg.serialize(data);
773 _status = msg.serialize(context);
727 void ComLoggerComponentBase :: {
…}
789 void ComLoggerComponentBase ::
797 portNum < this->getNum_pingIn_InputPorts(),
806 ComponentIpcSerializableBuffer msg;
810 _status = msg.serialize(
819 _status = msg.serialize(portNum);
826 _status = msg.serialize(key);
789 void ComLoggerComponentBase :: {
…}
850 void ComLoggerComponentBase ::
850 void ComLoggerComponentBase :: {
…}
860 void ComLoggerComponentBase ::
860 void ComLoggerComponentBase :: {
…}
873 void ComLoggerComponentBase ::
880 portNum < this->getNum_pingOut_OutputPorts(),
883 this->m_pingOut_OutputPort[portNum].invoke(
873 void ComLoggerComponentBase :: {
…}
892 void ComLoggerComponentBase ::
899 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
900 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
892 void ComLoggerComponentBase :: {
…}
909 void ComLoggerComponentBase ::
910 CloseFile_cmdHandlerBase(
917 this->CloseFile_preMsgHook(opCode,cmdSeq);
921 ComponentIpcSerializableBuffer msg;
934 _status = msg.serialize(port);
940 _status = msg.serialize(opCode);
946 _status = msg.serialize(cmdSeq);
952 _status = msg.serialize(args);
909 void ComLoggerComponentBase :: {
…}
976 void ComLoggerComponentBase ::
977 CloseFile_preMsgHook(
976 void ComLoggerComponentBase :: {
…}
989 void ComLoggerComponentBase ::
990 log_WARNING_HI_FileOpenError(
997 if (this->m_timeCaller_OutputPort[0].isConnected()) {
998 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1003 _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1006 if (this->m_logOut_OutputPort[0].isConnected()) {
1010#if FW_AMPCS_COMPATIBLE
1019#if FW_AMPCS_COMPATIBLE
1022 static_cast<U8>(
sizeof(U32))
1035 _status = file.
serialize(_logBuff, 240);
1041 this->m_logOut_OutputPort[0].invoke(
1050#if FW_ENABLE_TEXT_LOGGING
1051 if (this->m_LogText_OutputPort[0].isConnected()) {
1052#if FW_OBJECT_NAMES == 1
1053 const char* _formatString =
1054 "(%s) %s: Error %" PRIu32
" opening file %s";
1056 const char* _formatString =
1057 "%s: Error %" PRIu32
" opening file %s";
1077 this->m_LogText_OutputPort[0].invoke(
989 void ComLoggerComponentBase :: {
…}
1087 void ComLoggerComponentBase ::
1088 log_WARNING_HI_FileWriteError(
1097 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1098 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1103 _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1106 if (this->m_logOut_OutputPort[0].isConnected()) {
1110#if FW_AMPCS_COMPATIBLE
1119#if FW_AMPCS_COMPATIBLE
1122 static_cast<U8>(
sizeof(U32))
1135#if FW_AMPCS_COMPATIBLE
1138 static_cast<U8>(
sizeof(U32))
1145 _status = _logBuff.
serialize(bytesWritten);
1151#if FW_AMPCS_COMPATIBLE
1154 static_cast<U8>(
sizeof(U32))
1161 _status = _logBuff.
serialize(bytesToWrite);
1167 _status = file.
serialize(_logBuff, 240);
1173 this->m_logOut_OutputPort[0].invoke(
1182#if FW_ENABLE_TEXT_LOGGING
1183 if (this->m_LogText_OutputPort[0].isConnected()) {
1184#if FW_OBJECT_NAMES == 1
1185 const char* _formatString =
1186 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1188 const char* _formatString =
1189 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1211 this->m_LogText_OutputPort[0].invoke(
1087 void ComLoggerComponentBase :: {
…}
1221 void ComLoggerComponentBase ::
1222 log_WARNING_LO_FileValidationError(
1230 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1231 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1236 _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1239 if (this->m_logOut_OutputPort[0].isConnected()) {
1243#if FW_AMPCS_COMPATIBLE
1252 _status = validationFile.
serialize(_logBuff, 240);
1258 _status = file.
serialize(_logBuff, 240);
1264#if FW_AMPCS_COMPATIBLE
1267 static_cast<U8>(
sizeof(U32))
1280 this->m_logOut_OutputPort[0].invoke(
1289#if FW_ENABLE_TEXT_LOGGING
1290 if (this->m_LogText_OutputPort[0].isConnected()) {
1291#if FW_OBJECT_NAMES == 1
1292 const char* _formatString =
1293 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1295 const char* _formatString =
1296 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1308 "FileValidationError ",
1317 this->m_LogText_OutputPort[0].invoke(
1221 void ComLoggerComponentBase :: {
…}
1327 void ComLoggerComponentBase ::
1332 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1333 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1338 _id = this->getIdBase() + EVENTID_FILECLOSED;
1341 if (this->m_logOut_OutputPort[0].isConnected()) {
1345#if FW_AMPCS_COMPATIBLE
1354 _status = file.
serialize(_logBuff, 240);
1360 this->m_logOut_OutputPort[0].invoke(
1369#if FW_ENABLE_TEXT_LOGGING
1370 if (this->m_LogText_OutputPort[0].isConnected()) {
1371#if FW_OBJECT_NAMES == 1
1372 const char* _formatString =
1373 "(%s) %s: File %s closed successfully.";
1375 const char* _formatString =
1376 "%s: File %s closed successfully.";
1395 this->m_LogText_OutputPort[0].invoke(
1327 void ComLoggerComponentBase :: {
…}
1405 void ComLoggerComponentBase ::
1406 log_WARNING_LO_FileNotInitialized()
1409 if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1413 this->m_FileNotInitializedThrottle++;
1418 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1419 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1424 _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1427 if (this->m_logOut_OutputPort[0].isConnected()) {
1430#if FW_AMPCS_COMPATIBLE
1440 this->m_logOut_OutputPort[0].invoke(
1449#if FW_ENABLE_TEXT_LOGGING
1450 if (this->m_LogText_OutputPort[0].isConnected()) {
1451#if FW_OBJECT_NAMES == 1
1452 const char* _formatString =
1453 "(%s) %s: Could not open ComLogger file. File not initialized";
1455 const char* _formatString =
1456 "%s: Could not open ComLogger file. File not initialized";
1468 "FileNotInitialized "
1474 this->m_LogText_OutputPort[0].invoke(
1405 void ComLoggerComponentBase :: {
…}
1488 void ComLoggerComponentBase ::
1489 log_WARNING_LO_FileNotInitialized_ThrottleClear()
1492 this->m_FileNotInitializedThrottle = 0;
1488 void ComLoggerComponentBase :: {
…}
1502 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1504 this->m_timeCaller_OutputPort[0].invoke(_time);
1519 ComponentIpcSerializableBuffer msg;
1542 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1544 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1545 return MSG_DISPATCH_EXIT;
1549 deserStatus = msg.deserialize(portNum);
1560 deserStatus = msg.deserialize(data);
1568 deserStatus = msg.deserialize(context);
1574 this->comIn_handler(
1587 deserStatus = msg.deserialize(key);
1593 this->pingIn_handler(
1602 case CMD_CLOSEFILE: {
1605 deserStatus = msg.deserialize(opCode);
1613 deserStatus = msg.deserialize(cmdSeq);
1621 deserStatus = msg.deserialize(args);
1632#if FW_CMD_CHECK_RESIDUAL
1634 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1643 this->CloseFile_cmdHandler(opCode, cmdSeq);
1649 return MSG_DISPATCH_ERROR;
1652 return MSG_DISPATCH_OK;
1659 void ComLoggerComponentBase ::
1669 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1671 const U32 idBase = callComp->
getIdBase();
1672 FW_ASSERT(opCode >= idBase, opCode, idBase);
1675 switch (opCode - idBase) {
1676 case OPCODE_CLOSEFILE: {
1677 compPtr->CloseFile_cmdHandlerBase(
1691 void ComLoggerComponentBase ::
1700 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1701 compPtr->comIn_handlerBase(
1708 void ComLoggerComponentBase ::
1716 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1717 compPtr->pingIn_handlerBase(
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
PlatformUIntType NATIVE_UINT_TYPE
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
PlatformAssertArgType FwAssertArgType
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ WARNING_HI
A serious but recoverable event.
@ WARNING_LO
A less serious but recoverable event.
@ DIAGNOSTIC
Software diagnostic events.
const char * toChar() const override
SerializeStatus serialize(SerializeBufferBase &buffer) const override
serialization function
void init()
Object initializer.
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
void resetDeser()
reset deserialization to beginning
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
@ QUEUE_OK
message sent/received okay
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.