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
101 char portName[2*FW_OBJ_NAME_MAX_SIZE];
109 this->m_cmdIn_InputPort[port].setObjName(portName);
116 port < static_cast<PlatformIntType>(this->getNum_comIn_InputPorts());
119 this->m_comIn_InputPort[port].init();
120 this->m_comIn_InputPort[port].addCallComp(
124 this->m_comIn_InputPort[port].setPortNum(port);
126#if FW_OBJECT_NAMES == 1
133 char portName[2*FW_OBJ_NAME_MAX_SIZE];
141 this->m_comIn_InputPort[port].setObjName(portName);
148 port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
151 this->m_pingIn_InputPort[port].init();
152 this->m_pingIn_InputPort[port].addCallComp(
156 this->m_pingIn_InputPort[port].setPortNum(port);
158#if FW_OBJECT_NAMES == 1
165 char portName[2*FW_OBJ_NAME_MAX_SIZE];
173 this->m_pingIn_InputPort[port].setObjName(portName);
177#if FW_ENABLE_TEXT_LOGGING == 1
181 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
184 this->m_LogText_OutputPort[port].init();
186#if FW_OBJECT_NAMES == 1
193 char portName[2*FW_OBJ_NAME_MAX_SIZE];
201 this->m_LogText_OutputPort[port].setObjName(portName);
209 port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
212 this->m_cmdRegOut_OutputPort[port].init();
214#if FW_OBJECT_NAMES == 1
221 char portName[2*FW_OBJ_NAME_MAX_SIZE];
229 this->m_cmdRegOut_OutputPort[port].setObjName(portName);
236 port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
239 this->m_cmdResponseOut_OutputPort[port].init();
241#if FW_OBJECT_NAMES == 1
248 char portName[2*FW_OBJ_NAME_MAX_SIZE];
256 this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
263 port < static_cast<PlatformIntType>(this->getNum_logOut_OutputPorts());
266 this->m_logOut_OutputPort[port].init();
268#if FW_OBJECT_NAMES == 1
275 char portName[2*FW_OBJ_NAME_MAX_SIZE];
283 this->m_logOut_OutputPort[port].setObjName(portName);
290 port < static_cast<PlatformIntType>(this->getNum_timeCaller_OutputPorts());
293 this->m_timeCaller_OutputPort[port].init();
295#if FW_OBJECT_NAMES == 1
302 char portName[2*FW_OBJ_NAME_MAX_SIZE];
310 this->m_timeCaller_OutputPort[port].setObjName(portName);
317 port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
320 this->m_pingOut_OutputPort[port].init();
322#if FW_OBJECT_NAMES == 1
329 char portName[2*FW_OBJ_NAME_MAX_SIZE];
337 this->m_pingOut_OutputPort[port].setObjName(portName);
343 ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
72 void ComLoggerComponentBase :: {
…}
359 portNum < this->getNum_cmdIn_InputPorts(),
363 return &this->m_cmdIn_InputPort[portNum];
374 portNum < this->getNum_comIn_InputPorts(),
378 return &this->m_comIn_InputPort[portNum];
385 portNum < this->getNum_pingIn_InputPorts(),
389 return &this->m_pingIn_InputPort[portNum];
396#if FW_ENABLE_TEXT_LOGGING == 1
398 void ComLoggerComponentBase ::
399 set_LogText_OutputPort(
405 portNum < this->getNum_LogText_OutputPorts(),
409 this->m_LogText_OutputPort[portNum].addCallPort(port);
414 void ComLoggerComponentBase ::
415 set_cmdRegOut_OutputPort(
421 portNum < this->getNum_cmdRegOut_OutputPorts(),
425 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
414 void ComLoggerComponentBase :: {
…}
428 void ComLoggerComponentBase ::
429 set_cmdResponseOut_OutputPort(
435 portNum < this->getNum_cmdResponseOut_OutputPorts(),
439 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
428 void ComLoggerComponentBase :: {
…}
442 void ComLoggerComponentBase ::
443 set_logOut_OutputPort(
449 portNum < this->getNum_logOut_OutputPorts(),
453 this->m_logOut_OutputPort[portNum].addCallPort(port);
442 void ComLoggerComponentBase :: {
…}
456 void ComLoggerComponentBase ::
457 set_timeCaller_OutputPort(
463 portNum < this->getNum_timeCaller_OutputPorts(),
467 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
456 void ComLoggerComponentBase :: {
…}
474 void ComLoggerComponentBase ::
475 set_pingOut_OutputPort(
481 portNum < this->getNum_pingOut_OutputPorts(),
485 this->m_pingOut_OutputPort[portNum].addCallPort(port);
474 void ComLoggerComponentBase :: {
…}
488#if FW_PORT_SERIALIZATION
494#if FW_ENABLE_TEXT_LOGGING == 1
496 void ComLoggerComponentBase ::
497 set_LogText_OutputPort(
499 Fw::InputSerializePort* port
503 portNum < this->getNum_LogText_OutputPorts(),
507 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
512 void ComLoggerComponentBase ::
513 set_cmdRegOut_OutputPort(
515 Fw::InputSerializePort* port
519 portNum < this->getNum_cmdRegOut_OutputPorts(),
523 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
526 void ComLoggerComponentBase ::
527 set_cmdResponseOut_OutputPort(
529 Fw::InputSerializePort* port
533 portNum < this->getNum_cmdResponseOut_OutputPorts(),
537 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
540 void ComLoggerComponentBase ::
541 set_logOut_OutputPort(
543 Fw::InputSerializePort* port
547 portNum < this->getNum_logOut_OutputPorts(),
551 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
554 void ComLoggerComponentBase ::
555 set_timeCaller_OutputPort(
557 Fw::InputSerializePort* port
561 portNum < this->getNum_timeCaller_OutputPorts(),
565 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
570#if FW_PORT_SERIALIZATION
576 void ComLoggerComponentBase ::
577 set_pingOut_OutputPort(
579 Fw::InputSerializePort* port
583 portNum < this->getNum_pingOut_OutputPorts(),
587 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
596 void ComLoggerComponentBase ::
599 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
601 this->m_cmdRegOut_OutputPort[0].invoke(
602 this->getIdBase() + OPCODE_CLOSEFILE
596 void ComLoggerComponentBase :: {
…}
610 ComLoggerComponentBase ::
611 ComLoggerComponentBase(
const char* compName) :
612 Fw::ActiveComponentBase(compName)
614 this->m_FileNotInitializedThrottle = 0;
610 ComLoggerComponentBase :: {
…}
617 ComLoggerComponentBase ::
618 ~ComLoggerComponentBase()
617 ComLoggerComponentBase :: {
…}
628 getNum_cmdIn_InputPorts()
const
638 getNum_comIn_InputPorts()
const
644 getNum_pingIn_InputPorts()
const
653#if FW_ENABLE_TEXT_LOGGING == 1
656 getNum_LogText_OutputPorts()
const
664 getNum_cmdRegOut_OutputPorts()
const
670 getNum_cmdResponseOut_OutputPorts()
const
676 getNum_logOut_OutputPorts()
const
682 getNum_timeCaller_OutputPorts()
const
692 getNum_pingOut_OutputPorts()
const
701#if FW_ENABLE_TEXT_LOGGING == 1
703 bool ComLoggerComponentBase ::
707 portNum < this->getNum_LogText_OutputPorts(),
711 return this->m_LogText_OutputPort[portNum].isConnected();
716 bool ComLoggerComponentBase ::
720 portNum < this->getNum_cmdRegOut_OutputPorts(),
724 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
716 bool ComLoggerComponentBase :: {
…}
727 bool ComLoggerComponentBase ::
731 portNum < this->getNum_cmdResponseOut_OutputPorts(),
735 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
727 bool ComLoggerComponentBase :: {
…}
738 bool ComLoggerComponentBase ::
742 portNum < this->getNum_logOut_OutputPorts(),
746 return this->m_logOut_OutputPort[portNum].isConnected();
738 bool ComLoggerComponentBase :: {
…}
749 bool ComLoggerComponentBase ::
753 portNum < this->getNum_timeCaller_OutputPorts(),
757 return this->m_timeCaller_OutputPort[portNum].isConnected();
749 bool ComLoggerComponentBase :: {
…}
764 bool ComLoggerComponentBase ::
768 portNum < this->getNum_pingOut_OutputPorts(),
772 return this->m_pingOut_OutputPort[portNum].isConnected();
764 bool ComLoggerComponentBase :: {
…}
781 void ComLoggerComponentBase ::
790 portNum < this->getNum_comIn_InputPorts(),
800 ComponentIpcSerializableBuffer msg;
804 _status = msg.serialize(
813 _status = msg.serialize(portNum);
820 _status = msg.serialize(data);
827 _status = msg.serialize(context);
781 void ComLoggerComponentBase :: {
…}
843 void ComLoggerComponentBase ::
851 portNum < this->getNum_pingIn_InputPorts(),
860 ComponentIpcSerializableBuffer msg;
864 _status = msg.serialize(
873 _status = msg.serialize(portNum);
880 _status = msg.serialize(key);
843 void ComLoggerComponentBase :: {
…}
904 void ComLoggerComponentBase ::
904 void ComLoggerComponentBase :: {
…}
914 void ComLoggerComponentBase ::
914 void ComLoggerComponentBase :: {
…}
927 void ComLoggerComponentBase ::
934 portNum < this->getNum_pingOut_OutputPorts(),
937 this->m_pingOut_OutputPort[portNum].invoke(
927 void ComLoggerComponentBase :: {
…}
946 void ComLoggerComponentBase ::
953 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
954 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
946 void ComLoggerComponentBase :: {
…}
963 void ComLoggerComponentBase ::
964 CloseFile_cmdHandlerBase(
971 this->CloseFile_preMsgHook(opCode,cmdSeq);
975 ComponentIpcSerializableBuffer msg;
988 _status = msg.serialize(port);
994 _status = msg.serialize(opCode);
1000 _status = msg.serialize(cmdSeq);
1006 _status = msg.serialize(args);
963 void ComLoggerComponentBase :: {
…}
1030 void ComLoggerComponentBase ::
1031 CloseFile_preMsgHook(
1030 void ComLoggerComponentBase :: {
…}
1045 void ComLoggerComponentBase ::
1046 log_WARNING_HI_FileOpenError(
1053 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1054 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1059 _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1062 if (this->m_logOut_OutputPort[0].isConnected()) {
1066#if FW_AMPCS_COMPATIBLE
1075#if FW_AMPCS_COMPATIBLE
1078 static_cast<U8>(
sizeof(U32))
1091 _status = file.
serialize(_logBuff, 240);
1097 this->m_logOut_OutputPort[0].invoke(
1106#if FW_ENABLE_TEXT_LOGGING
1107 if (this->m_LogText_OutputPort[0].isConnected()) {
1108#if FW_OBJECT_NAMES == 1
1109 const char* _formatString =
1110 "(%s) %s: Error %" PRIu32
" opening file %s";
1112 const char* _formatString =
1113 "%s: Error %" PRIu32
" opening file %s";
1133 this->m_LogText_OutputPort[0].invoke(
1045 void ComLoggerComponentBase :: {
…}
1143 void ComLoggerComponentBase ::
1144 log_WARNING_HI_FileWriteError(
1153 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1154 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1159 _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1162 if (this->m_logOut_OutputPort[0].isConnected()) {
1166#if FW_AMPCS_COMPATIBLE
1175#if FW_AMPCS_COMPATIBLE
1178 static_cast<U8>(
sizeof(U32))
1191#if FW_AMPCS_COMPATIBLE
1194 static_cast<U8>(
sizeof(U32))
1201 _status = _logBuff.
serialize(bytesWritten);
1207#if FW_AMPCS_COMPATIBLE
1210 static_cast<U8>(
sizeof(U32))
1217 _status = _logBuff.
serialize(bytesToWrite);
1223 _status = file.
serialize(_logBuff, 240);
1229 this->m_logOut_OutputPort[0].invoke(
1238#if FW_ENABLE_TEXT_LOGGING
1239 if (this->m_LogText_OutputPort[0].isConnected()) {
1240#if FW_OBJECT_NAMES == 1
1241 const char* _formatString =
1242 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1244 const char* _formatString =
1245 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1267 this->m_LogText_OutputPort[0].invoke(
1143 void ComLoggerComponentBase :: {
…}
1277 void ComLoggerComponentBase ::
1278 log_WARNING_LO_FileValidationError(
1286 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1287 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1292 _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1295 if (this->m_logOut_OutputPort[0].isConnected()) {
1299#if FW_AMPCS_COMPATIBLE
1308 _status = validationFile.
serialize(_logBuff, 240);
1314 _status = file.
serialize(_logBuff, 240);
1320#if FW_AMPCS_COMPATIBLE
1323 static_cast<U8>(
sizeof(U32))
1336 this->m_logOut_OutputPort[0].invoke(
1345#if FW_ENABLE_TEXT_LOGGING
1346 if (this->m_LogText_OutputPort[0].isConnected()) {
1347#if FW_OBJECT_NAMES == 1
1348 const char* _formatString =
1349 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1351 const char* _formatString =
1352 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1364 "FileValidationError ",
1373 this->m_LogText_OutputPort[0].invoke(
1277 void ComLoggerComponentBase :: {
…}
1383 void ComLoggerComponentBase ::
1388 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1389 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1394 _id = this->getIdBase() + EVENTID_FILECLOSED;
1397 if (this->m_logOut_OutputPort[0].isConnected()) {
1401#if FW_AMPCS_COMPATIBLE
1410 _status = file.
serialize(_logBuff, 240);
1416 this->m_logOut_OutputPort[0].invoke(
1425#if FW_ENABLE_TEXT_LOGGING
1426 if (this->m_LogText_OutputPort[0].isConnected()) {
1427#if FW_OBJECT_NAMES == 1
1428 const char* _formatString =
1429 "(%s) %s: File %s closed successfully.";
1431 const char* _formatString =
1432 "%s: File %s closed successfully.";
1451 this->m_LogText_OutputPort[0].invoke(
1383 void ComLoggerComponentBase :: {
…}
1461 void ComLoggerComponentBase ::
1462 log_WARNING_LO_FileNotInitialized()
1465 if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1469 this->m_FileNotInitializedThrottle++;
1474 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1475 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1480 _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1483 if (this->m_logOut_OutputPort[0].isConnected()) {
1486#if FW_AMPCS_COMPATIBLE
1496 this->m_logOut_OutputPort[0].invoke(
1505#if FW_ENABLE_TEXT_LOGGING
1506 if (this->m_LogText_OutputPort[0].isConnected()) {
1507#if FW_OBJECT_NAMES == 1
1508 const char* _formatString =
1509 "(%s) %s: Could not open ComLogger file. File not initialized";
1511 const char* _formatString =
1512 "%s: Could not open ComLogger file. File not initialized";
1524 "FileNotInitialized "
1530 this->m_LogText_OutputPort[0].invoke(
1461 void ComLoggerComponentBase :: {
…}
1544 void ComLoggerComponentBase ::
1545 log_WARNING_LO_FileNotInitialized_ThrottleClear()
1548 this->m_FileNotInitializedThrottle = 0;
1544 void ComLoggerComponentBase :: {
…}
1558 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1560 this->m_timeCaller_OutputPort[0].invoke(_time);
1575 ComponentIpcSerializableBuffer msg;
1598 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1600 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1601 return MSG_DISPATCH_EXIT;
1605 deserStatus = msg.deserialize(portNum);
1616 deserStatus = msg.deserialize(data);
1624 deserStatus = msg.deserialize(context);
1630 this->comIn_handler(
1643 deserStatus = msg.deserialize(key);
1649 this->pingIn_handler(
1658 case CMD_CLOSEFILE: {
1661 deserStatus = msg.deserialize(opCode);
1669 deserStatus = msg.deserialize(cmdSeq);
1677 deserStatus = msg.deserialize(args);
1688#if FW_CMD_CHECK_RESIDUAL
1690 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1699 this->CloseFile_cmdHandler(opCode, cmdSeq);
1705 return MSG_DISPATCH_ERROR;
1708 return MSG_DISPATCH_OK;
1715 void ComLoggerComponentBase ::
1725 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1727 const U32 idBase = callComp->
getIdBase();
1728 FW_ASSERT(opCode >= idBase, opCode, idBase);
1731 switch (opCode - idBase) {
1732 case OPCODE_CLOSEFILE: {
1733 compPtr->CloseFile_cmdHandlerBase(
1747 void ComLoggerComponentBase ::
1756 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1757 compPtr->comIn_handlerBase(
1764 void ComLoggerComponentBase ::
1772 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1773 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.