10#if FW_ENABLE_TEXT_LOGGING
34 class ComponentIpcSerializableBuffer :
44 MAX_DATA_SIZE =
sizeof(BuffUnion),
46 SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
50 return sizeof(m_buff);
57 const U8* getBuffAddr()
const {
63 U8 m_buff[SERIALIZATION_SIZE];
72 void ComLoggerComponentBase ::
84 port < static_cast<FwIndexType>(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
98 this->m_objName.toChar(),
101 this->m_cmdIn_InputPort[port].setObjName(portName.
toChar());
108 port < static_cast<FwIndexType>(this->getNum_comIn_InputPorts());
111 this->m_comIn_InputPort[port].init();
112 this->m_comIn_InputPort[port].addCallComp(
116 this->m_comIn_InputPort[port].setPortNum(port);
118#if FW_OBJECT_NAMES == 1
122 this->m_objName.toChar(),
125 this->m_comIn_InputPort[port].setObjName(portName.
toChar());
132 port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
135 this->m_pingIn_InputPort[port].init();
136 this->m_pingIn_InputPort[port].addCallComp(
140 this->m_pingIn_InputPort[port].setPortNum(port);
142#if FW_OBJECT_NAMES == 1
146 this->m_objName.toChar(),
149 this->m_pingIn_InputPort[port].setObjName(portName.
toChar());
153#if FW_ENABLE_TEXT_LOGGING == 1
157 port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
160 this->m_LogText_OutputPort[port].init();
162#if FW_OBJECT_NAMES == 1
166 this->m_objName.toChar(),
169 this->m_LogText_OutputPort[port].setObjName(portName.
toChar());
177 port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
180 this->m_cmdRegOut_OutputPort[port].init();
182#if FW_OBJECT_NAMES == 1
186 this->m_objName.toChar(),
189 this->m_cmdRegOut_OutputPort[port].setObjName(portName.
toChar());
196 port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
199 this->m_cmdResponseOut_OutputPort[port].init();
201#if FW_OBJECT_NAMES == 1
205 this->m_objName.toChar(),
208 this->m_cmdResponseOut_OutputPort[port].setObjName(portName.
toChar());
215 port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
218 this->m_logOut_OutputPort[port].init();
220#if FW_OBJECT_NAMES == 1
224 this->m_objName.toChar(),
227 this->m_logOut_OutputPort[port].setObjName(portName.
toChar());
234 port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
237 this->m_timeCaller_OutputPort[port].init();
239#if FW_OBJECT_NAMES == 1
243 this->m_objName.toChar(),
246 this->m_timeCaller_OutputPort[port].setObjName(portName.
toChar());
253 port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
256 this->m_pingOut_OutputPort[port].init();
258#if FW_OBJECT_NAMES == 1
262 this->m_objName.toChar(),
265 this->m_pingOut_OutputPort[port].setObjName(portName.
toChar());
272 static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
288 portNum < this->getNum_cmdIn_InputPorts(),
292 return &this->m_cmdIn_InputPort[portNum];
303 portNum < this->getNum_comIn_InputPorts(),
307 return &this->m_comIn_InputPort[portNum];
314 portNum < this->getNum_pingIn_InputPorts(),
318 return &this->m_pingIn_InputPort[portNum];
325#if FW_ENABLE_TEXT_LOGGING == 1
327 void ComLoggerComponentBase ::
328 set_LogText_OutputPort(
334 portNum < this->getNum_LogText_OutputPorts(),
338 this->m_LogText_OutputPort[portNum].addCallPort(port);
343 void ComLoggerComponentBase ::
344 set_cmdRegOut_OutputPort(
350 portNum < this->getNum_cmdRegOut_OutputPorts(),
354 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
357 void ComLoggerComponentBase ::
358 set_cmdResponseOut_OutputPort(
364 portNum < this->getNum_cmdResponseOut_OutputPorts(),
368 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
371 void ComLoggerComponentBase ::
372 set_logOut_OutputPort(
378 portNum < this->getNum_logOut_OutputPorts(),
382 this->m_logOut_OutputPort[portNum].addCallPort(port);
385 void ComLoggerComponentBase ::
386 set_timeCaller_OutputPort(
392 portNum < this->getNum_timeCaller_OutputPorts(),
396 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
403 void ComLoggerComponentBase ::
404 set_pingOut_OutputPort(
410 portNum < this->getNum_pingOut_OutputPorts(),
414 this->m_pingOut_OutputPort[portNum].addCallPort(port);
417#if FW_PORT_SERIALIZATION
423#if FW_ENABLE_TEXT_LOGGING == 1
425 void ComLoggerComponentBase ::
426 set_LogText_OutputPort(
428 Fw::InputSerializePort* port
432 portNum < this->getNum_LogText_OutputPorts(),
436 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
441 void ComLoggerComponentBase ::
442 set_cmdRegOut_OutputPort(
444 Fw::InputSerializePort* port
448 portNum < this->getNum_cmdRegOut_OutputPorts(),
452 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
455 void ComLoggerComponentBase ::
456 set_cmdResponseOut_OutputPort(
458 Fw::InputSerializePort* port
462 portNum < this->getNum_cmdResponseOut_OutputPorts(),
466 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
469 void ComLoggerComponentBase ::
470 set_logOut_OutputPort(
472 Fw::InputSerializePort* port
476 portNum < this->getNum_logOut_OutputPorts(),
480 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
483 void ComLoggerComponentBase ::
484 set_timeCaller_OutputPort(
486 Fw::InputSerializePort* port
490 portNum < this->getNum_timeCaller_OutputPorts(),
494 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
499#if FW_PORT_SERIALIZATION
505 void ComLoggerComponentBase ::
506 set_pingOut_OutputPort(
508 Fw::InputSerializePort* port
512 portNum < this->getNum_pingOut_OutputPorts(),
516 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
525 void ComLoggerComponentBase ::
528 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
530 this->m_cmdRegOut_OutputPort[0].invoke(
531 this->getIdBase() + OPCODE_CLOSEFILE
539 ComLoggerComponentBase ::
540 ComLoggerComponentBase(
const char* compName) :
541 Fw::ActiveComponentBase(compName)
543 this->m_FileNotInitializedThrottle = 0;
546 ComLoggerComponentBase ::
547 ~ComLoggerComponentBase()
557 getNum_cmdIn_InputPorts()
const
567 getNum_comIn_InputPorts()
const
573 getNum_pingIn_InputPorts()
const
582#if FW_ENABLE_TEXT_LOGGING == 1
585 getNum_LogText_OutputPorts()
const
593 getNum_cmdRegOut_OutputPorts()
const
599 getNum_cmdResponseOut_OutputPorts()
const
605 getNum_logOut_OutputPorts()
const
611 getNum_timeCaller_OutputPorts()
const
621 getNum_pingOut_OutputPorts()
const
630#if FW_ENABLE_TEXT_LOGGING == 1
632 bool ComLoggerComponentBase ::
633 isConnected_LogText_OutputPort(
FwIndexType portNum)
636 portNum < this->getNum_LogText_OutputPorts(),
640 return this->m_LogText_OutputPort[portNum].isConnected();
645 bool ComLoggerComponentBase ::
646 isConnected_cmdRegOut_OutputPort(
FwIndexType portNum)
649 portNum < this->getNum_cmdRegOut_OutputPorts(),
653 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
656 bool ComLoggerComponentBase ::
657 isConnected_cmdResponseOut_OutputPort(
FwIndexType portNum)
660 portNum < this->getNum_cmdResponseOut_OutputPorts(),
664 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
667 bool ComLoggerComponentBase ::
671 portNum < this->getNum_logOut_OutputPorts(),
675 return this->m_logOut_OutputPort[portNum].isConnected();
678 bool ComLoggerComponentBase ::
679 isConnected_timeCaller_OutputPort(
FwIndexType portNum)
682 portNum < this->getNum_timeCaller_OutputPorts(),
686 return this->m_timeCaller_OutputPort[portNum].isConnected();
693 bool ComLoggerComponentBase ::
694 isConnected_pingOut_OutputPort(
FwIndexType portNum)
697 portNum < this->getNum_pingOut_OutputPorts(),
701 return this->m_pingOut_OutputPort[portNum].isConnected();
710 void ComLoggerComponentBase ::
719 portNum < this->getNum_comIn_InputPorts(),
729 ComponentIpcSerializableBuffer msg;
733 _status = msg.serialize(
742 _status = msg.serialize(portNum);
749 _status = msg.serialize(data);
756 _status = msg.serialize(context);
772 void ComLoggerComponentBase ::
780 portNum < this->getNum_pingIn_InputPorts(),
789 ComponentIpcSerializableBuffer msg;
793 _status = msg.serialize(
802 _status = msg.serialize(portNum);
809 _status = msg.serialize(key);
833 void ComLoggerComponentBase ::
843 void ComLoggerComponentBase ::
856 void ComLoggerComponentBase ::
863 portNum < this->getNum_pingOut_OutputPorts(),
866 this->m_pingOut_OutputPort[portNum].invoke(
875 void ComLoggerComponentBase ::
882 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
883 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
892 void ComLoggerComponentBase ::
893 CloseFile_cmdHandlerBase(
900 this->CloseFile_preMsgHook(opCode,cmdSeq);
904 ComponentIpcSerializableBuffer msg;
917 _status = msg.serialize(port);
923 _status = msg.serialize(opCode);
929 _status = msg.serialize(cmdSeq);
935 _status = msg.serialize(args);
959 void ComLoggerComponentBase ::
960 CloseFile_preMsgHook(
974 void ComLoggerComponentBase ::
975 log_WARNING_HI_FileOpenError(
982 if (this->m_timeCaller_OutputPort[0].isConnected()) {
983 this->m_timeCaller_OutputPort[0].invoke(_logTime);
988 _id = this->getIdBase() + EVENTID_FILEOPENERROR;
991 if (this->m_logOut_OutputPort[0].isConnected()) {
995#if FW_AMPCS_COMPATIBLE
1004#if FW_AMPCS_COMPATIBLE
1007 static_cast<U8>(
sizeof(U32))
1026 this->m_logOut_OutputPort[0].invoke(
1035#if FW_ENABLE_TEXT_LOGGING
1036 if (this->m_LogText_OutputPort[0].isConnected()) {
1037#if FW_OBJECT_NAMES == 1
1038 const char* _formatString =
1039 "(%s) %s: Error %" PRIu32
" opening file %s";
1041 const char* _formatString =
1042 "%s: Error %" PRIu32
" opening file %s";
1049 this->m_objName.toChar(),
1056 this->m_LogText_OutputPort[0].invoke(
1066 void ComLoggerComponentBase ::
1067 log_WARNING_HI_FileWriteError(
1076 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1077 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1082 _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1085 if (this->m_logOut_OutputPort[0].isConnected()) {
1089#if FW_AMPCS_COMPATIBLE
1098#if FW_AMPCS_COMPATIBLE
1101 static_cast<U8>(
sizeof(U32))
1114#if FW_AMPCS_COMPATIBLE
1117 static_cast<U8>(
sizeof(U32))
1124 _status = _logBuff.
serialize(bytesWritten);
1130#if FW_AMPCS_COMPATIBLE
1133 static_cast<U8>(
sizeof(U32))
1140 _status = _logBuff.
serialize(bytesToWrite);
1152 this->m_logOut_OutputPort[0].invoke(
1161#if FW_ENABLE_TEXT_LOGGING
1162 if (this->m_LogText_OutputPort[0].isConnected()) {
1163#if FW_OBJECT_NAMES == 1
1164 const char* _formatString =
1165 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1167 const char* _formatString =
1168 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1175 this->m_objName.toChar(),
1184 this->m_LogText_OutputPort[0].invoke(
1194 void ComLoggerComponentBase ::
1195 log_WARNING_LO_FileValidationError(
1203 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1204 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1209 _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1212 if (this->m_logOut_OutputPort[0].isConnected()) {
1216#if FW_AMPCS_COMPATIBLE
1237#if FW_AMPCS_COMPATIBLE
1240 static_cast<U8>(
sizeof(U32))
1253 this->m_logOut_OutputPort[0].invoke(
1262#if FW_ENABLE_TEXT_LOGGING
1263 if (this->m_LogText_OutputPort[0].isConnected()) {
1264#if FW_OBJECT_NAMES == 1
1265 const char* _formatString =
1266 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1268 const char* _formatString =
1269 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1276 this->m_objName.toChar(),
1278 "FileValidationError ",
1284 this->m_LogText_OutputPort[0].invoke(
1294 void ComLoggerComponentBase ::
1299 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1300 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1305 _id = this->getIdBase() + EVENTID_FILECLOSED;
1308 if (this->m_logOut_OutputPort[0].isConnected()) {
1312#if FW_AMPCS_COMPATIBLE
1327 this->m_logOut_OutputPort[0].invoke(
1336#if FW_ENABLE_TEXT_LOGGING
1337 if (this->m_LogText_OutputPort[0].isConnected()) {
1338#if FW_OBJECT_NAMES == 1
1339 const char* _formatString =
1340 "(%s) %s: File %s closed successfully.";
1342 const char* _formatString =
1343 "%s: File %s closed successfully.";
1350 this->m_objName.toChar(),
1356 this->m_LogText_OutputPort[0].invoke(
1366 void ComLoggerComponentBase ::
1367 log_WARNING_LO_FileNotInitialized()
1370 if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1374 this->m_FileNotInitializedThrottle++;
1379 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1380 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1385 _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1388 if (this->m_logOut_OutputPort[0].isConnected()) {
1391#if FW_AMPCS_COMPATIBLE
1401 this->m_logOut_OutputPort[0].invoke(
1410#if FW_ENABLE_TEXT_LOGGING
1411 if (this->m_LogText_OutputPort[0].isConnected()) {
1412#if FW_OBJECT_NAMES == 1
1413 const char* _formatString =
1414 "(%s) %s: Could not open ComLogger file. File not initialized";
1416 const char* _formatString =
1417 "%s: Could not open ComLogger file. File not initialized";
1424 this->m_objName.toChar(),
1426 "FileNotInitialized "
1429 this->m_LogText_OutputPort[0].invoke(
1443 void ComLoggerComponentBase ::
1444 log_WARNING_LO_FileNotInitialized_ThrottleClear()
1447 this->m_FileNotInitializedThrottle = 0;
1457 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1459 this->m_timeCaller_OutputPort[0].invoke(_time);
1474 ComponentIpcSerializableBuffer msg;
1497 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1499 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1500 return MSG_DISPATCH_EXIT;
1504 deserStatus = msg.deserialize(portNum);
1515 deserStatus = msg.deserialize(data);
1523 deserStatus = msg.deserialize(context);
1529 this->comIn_handler(
1542 deserStatus = msg.deserialize(key);
1548 this->pingIn_handler(
1557 case CMD_CLOSEFILE: {
1560 deserStatus = msg.deserialize(opCode);
1568 deserStatus = msg.deserialize(cmdSeq);
1576 deserStatus = msg.deserialize(args);
1587#if FW_CMD_CHECK_RESIDUAL
1589 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1598 this->CloseFile_cmdHandler(opCode, cmdSeq);
1604 return MSG_DISPATCH_ERROR;
1607 return MSG_DISPATCH_OK;
1614 void ComLoggerComponentBase ::
1624 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1626 const U32 idBase = callComp->
getIdBase();
1630 switch (opCode - idBase) {
1631 case OPCODE_CLOSEFILE: {
1632 compPtr->CloseFile_cmdHandlerBase(
1646 void ComLoggerComponentBase ::
1655 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1656 compPtr->comIn_handlerBase(
1663 void ComLoggerComponentBase ::
1671 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1672 compPtr->pingIn_handlerBase(
#define FW_MIN(a, b)
MIN macro.
uint8_t U8
8-bit unsigned integer
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
PlatformAssertArgType FwAssertArgType
PlatformSizeType FwSizeType
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
PlatformQueuePriorityType FwQueuePriorityType
PlatformIndexType FwIndexType
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)/*#en...
@ 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.
void init()
Object initializer.
const char * toChar() const
NATIVE_UINT_TYPE SizeType
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
virtual const CHAR * toChar() const =0
@ BLOCKING
Message will block until space is available.
@ NONBLOCKING
Message will return with status when space is unavailable.
Status
status returned from the queue send function
@ OP_OK
message sent/received okay
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.