11#if FW_ENABLE_TEXT_LOGGING
34 class ComponentIpcSerializableBuffer :
49 return sizeof(m_buff);
56 const U8* getBuffAddr()
const {
62 U8 m_buff[SERIALIZATION_SIZE];
71 void ComLoggerComponentBase ::
83 port < static_cast<PlatformIntType>(this->getNum_cmdIn_InputPorts());
86 this->m_cmdIn_InputPort[port].init();
87 this->m_cmdIn_InputPort[port].addCallComp(
91 this->m_cmdIn_InputPort[port].setPortNum(port);
93#if FW_OBJECT_NAMES == 1
102 this->m_cmdIn_InputPort[port].setObjName(portName);
109 port < static_cast<PlatformIntType>(this->getNum_comIn_InputPorts());
112 this->m_comIn_InputPort[port].init();
113 this->m_comIn_InputPort[port].addCallComp(
117 this->m_comIn_InputPort[port].setPortNum(port);
119#if FW_OBJECT_NAMES == 1
128 this->m_comIn_InputPort[port].setObjName(portName);
135 port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
138 this->m_pingIn_InputPort[port].init();
139 this->m_pingIn_InputPort[port].addCallComp(
143 this->m_pingIn_InputPort[port].setPortNum(port);
145#if FW_OBJECT_NAMES == 1
154 this->m_pingIn_InputPort[port].setObjName(portName);
158#if FW_ENABLE_TEXT_LOGGING == 1
162 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
165 this->m_LogText_OutputPort[port].init();
167#if FW_OBJECT_NAMES == 1
176 this->m_LogText_OutputPort[port].setObjName(portName);
184 port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
187 this->m_cmdRegOut_OutputPort[port].init();
189#if FW_OBJECT_NAMES == 1
198 this->m_cmdRegOut_OutputPort[port].setObjName(portName);
205 port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
208 this->m_cmdResponseOut_OutputPort[port].init();
210#if FW_OBJECT_NAMES == 1
219 this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
226 port < static_cast<PlatformIntType>(this->getNum_logOut_OutputPorts());
229 this->m_logOut_OutputPort[port].init();
231#if FW_OBJECT_NAMES == 1
240 this->m_logOut_OutputPort[port].setObjName(portName);
247 port < static_cast<PlatformIntType>(this->getNum_timeCaller_OutputPorts());
250 this->m_timeCaller_OutputPort[port].init();
252#if FW_OBJECT_NAMES == 1
261 this->m_timeCaller_OutputPort[port].setObjName(portName);
268 port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
271 this->m_pingOut_OutputPort[port].init();
273#if FW_OBJECT_NAMES == 1
282 this->m_pingOut_OutputPort[port].setObjName(portName);
288 ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
71 void ComLoggerComponentBase :: {
…}
304 portNum < this->getNum_cmdIn_InputPorts(),
308 return &this->m_cmdIn_InputPort[portNum];
319 portNum < this->getNum_comIn_InputPorts(),
323 return &this->m_comIn_InputPort[portNum];
330 portNum < this->getNum_pingIn_InputPorts(),
334 return &this->m_pingIn_InputPort[portNum];
341#if FW_ENABLE_TEXT_LOGGING == 1
343 void ComLoggerComponentBase ::
344 set_LogText_OutputPort(
350 portNum < this->getNum_LogText_OutputPorts(),
354 this->m_LogText_OutputPort[portNum].addCallPort(port);
359 void ComLoggerComponentBase ::
360 set_cmdRegOut_OutputPort(
366 portNum < this->getNum_cmdRegOut_OutputPorts(),
370 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
359 void ComLoggerComponentBase :: {
…}
373 void ComLoggerComponentBase ::
374 set_cmdResponseOut_OutputPort(
380 portNum < this->getNum_cmdResponseOut_OutputPorts(),
384 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
373 void ComLoggerComponentBase :: {
…}
387 void ComLoggerComponentBase ::
388 set_logOut_OutputPort(
394 portNum < this->getNum_logOut_OutputPorts(),
398 this->m_logOut_OutputPort[portNum].addCallPort(port);
387 void ComLoggerComponentBase :: {
…}
401 void ComLoggerComponentBase ::
402 set_timeCaller_OutputPort(
408 portNum < this->getNum_timeCaller_OutputPorts(),
412 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
401 void ComLoggerComponentBase :: {
…}
419 void ComLoggerComponentBase ::
420 set_pingOut_OutputPort(
426 portNum < this->getNum_pingOut_OutputPorts(),
430 this->m_pingOut_OutputPort[portNum].addCallPort(port);
419 void ComLoggerComponentBase :: {
…}
433#if FW_PORT_SERIALIZATION
439#if FW_ENABLE_TEXT_LOGGING == 1
441 void ComLoggerComponentBase ::
442 set_LogText_OutputPort(
444 Fw::InputSerializePort* port
448 portNum < this->getNum_LogText_OutputPorts(),
452 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
457 void ComLoggerComponentBase ::
458 set_cmdRegOut_OutputPort(
460 Fw::InputSerializePort* port
464 portNum < this->getNum_cmdRegOut_OutputPorts(),
468 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
471 void ComLoggerComponentBase ::
472 set_cmdResponseOut_OutputPort(
474 Fw::InputSerializePort* port
478 portNum < this->getNum_cmdResponseOut_OutputPorts(),
482 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
485 void ComLoggerComponentBase ::
486 set_logOut_OutputPort(
488 Fw::InputSerializePort* port
492 portNum < this->getNum_logOut_OutputPorts(),
496 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
499 void ComLoggerComponentBase ::
500 set_timeCaller_OutputPort(
502 Fw::InputSerializePort* port
506 portNum < this->getNum_timeCaller_OutputPorts(),
510 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
515#if FW_PORT_SERIALIZATION
521 void ComLoggerComponentBase ::
522 set_pingOut_OutputPort(
524 Fw::InputSerializePort* port
528 portNum < this->getNum_pingOut_OutputPorts(),
532 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
541 void ComLoggerComponentBase ::
544 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
546 this->m_cmdRegOut_OutputPort[0].invoke(
547 this->getIdBase() + OPCODE_CLOSEFILE
541 void ComLoggerComponentBase :: {
…}
555 ComLoggerComponentBase ::
556 ComLoggerComponentBase(
const char* compName) :
557 Fw::ActiveComponentBase(compName)
559 this->m_FileNotInitializedThrottle = 0;
555 ComLoggerComponentBase :: {
…}
562 ComLoggerComponentBase ::
563 ~ComLoggerComponentBase()
562 ComLoggerComponentBase :: {
…}
573 getNum_cmdIn_InputPorts()
583 getNum_comIn_InputPorts()
589 getNum_pingIn_InputPorts()
598#if FW_ENABLE_TEXT_LOGGING == 1
601 getNum_LogText_OutputPorts()
609 getNum_cmdRegOut_OutputPorts()
615 getNum_cmdResponseOut_OutputPorts()
621 getNum_logOut_OutputPorts()
627 getNum_timeCaller_OutputPorts()
637 getNum_pingOut_OutputPorts()
646#if FW_ENABLE_TEXT_LOGGING == 1
648 bool ComLoggerComponentBase ::
652 portNum < this->getNum_LogText_OutputPorts(),
656 return this->m_LogText_OutputPort[portNum].isConnected();
661 bool ComLoggerComponentBase ::
665 portNum < this->getNum_cmdRegOut_OutputPorts(),
669 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
661 bool ComLoggerComponentBase :: {
…}
672 bool ComLoggerComponentBase ::
676 portNum < this->getNum_cmdResponseOut_OutputPorts(),
680 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
672 bool ComLoggerComponentBase :: {
…}
683 bool ComLoggerComponentBase ::
687 portNum < this->getNum_logOut_OutputPorts(),
691 return this->m_logOut_OutputPort[portNum].isConnected();
683 bool ComLoggerComponentBase :: {
…}
694 bool ComLoggerComponentBase ::
698 portNum < this->getNum_timeCaller_OutputPorts(),
702 return this->m_timeCaller_OutputPort[portNum].isConnected();
694 bool ComLoggerComponentBase :: {
…}
709 bool ComLoggerComponentBase ::
713 portNum < this->getNum_pingOut_OutputPorts(),
717 return this->m_pingOut_OutputPort[portNum].isConnected();
709 bool ComLoggerComponentBase :: {
…}
726 void ComLoggerComponentBase ::
735 portNum < this->getNum_comIn_InputPorts(),
745 ComponentIpcSerializableBuffer msg;
749 _status = msg.serialize(
758 _status = msg.serialize(portNum);
765 _status = msg.serialize(data);
772 _status = msg.serialize(context);
726 void ComLoggerComponentBase :: {
…}
788 void ComLoggerComponentBase ::
796 portNum < this->getNum_pingIn_InputPorts(),
805 ComponentIpcSerializableBuffer msg;
809 _status = msg.serialize(
818 _status = msg.serialize(portNum);
825 _status = msg.serialize(key);
788 void ComLoggerComponentBase :: {
…}
849 void ComLoggerComponentBase ::
849 void ComLoggerComponentBase :: {
…}
859 void ComLoggerComponentBase ::
859 void ComLoggerComponentBase :: {
…}
872 void ComLoggerComponentBase ::
879 portNum < this->getNum_pingOut_OutputPorts(),
882 this->m_pingOut_OutputPort[portNum].invoke(
872 void ComLoggerComponentBase :: {
…}
891 void ComLoggerComponentBase ::
898 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
899 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
891 void ComLoggerComponentBase :: {
…}
908 void ComLoggerComponentBase ::
909 CloseFile_cmdHandlerBase(
916 this->CloseFile_preMsgHook(opCode,cmdSeq);
920 ComponentIpcSerializableBuffer msg;
933 _status = msg.serialize(port);
939 _status = msg.serialize(opCode);
945 _status = msg.serialize(cmdSeq);
951 _status = msg.serialize(args);
908 void ComLoggerComponentBase :: {
…}
975 void ComLoggerComponentBase ::
976 CloseFile_preMsgHook(
975 void ComLoggerComponentBase :: {
…}
988 void ComLoggerComponentBase ::
989 log_WARNING_HI_FileOpenError(
996 if (this->m_timeCaller_OutputPort[0].isConnected()) {
997 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1002 _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1005 if (this->m_logOut_OutputPort[0].isConnected()) {
1009#if FW_AMPCS_COMPATIBLE
1018#if FW_AMPCS_COMPATIBLE
1021 static_cast<U8>(
sizeof(U32))
1034 _status = file.
serialize(_logBuff, 240);
1040 this->m_logOut_OutputPort[0].invoke(
1049#if FW_ENABLE_TEXT_LOGGING
1050 if (this->m_LogText_OutputPort[0].isConnected()) {
1051#if FW_OBJECT_NAMES == 1
1052 const char* _formatString =
1053 "(%s) %s: Error %" PRIu32
" opening file %s";
1055 const char* _formatString =
1056 "%s: Error %" PRIu32
" opening file %s";
1076 this->m_LogText_OutputPort[0].invoke(
988 void ComLoggerComponentBase :: {
…}
1086 void ComLoggerComponentBase ::
1087 log_WARNING_HI_FileWriteError(
1096 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1097 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1102 _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1105 if (this->m_logOut_OutputPort[0].isConnected()) {
1109#if FW_AMPCS_COMPATIBLE
1118#if FW_AMPCS_COMPATIBLE
1121 static_cast<U8>(
sizeof(U32))
1134#if FW_AMPCS_COMPATIBLE
1137 static_cast<U8>(
sizeof(U32))
1144 _status = _logBuff.
serialize(bytesWritten);
1150#if FW_AMPCS_COMPATIBLE
1153 static_cast<U8>(
sizeof(U32))
1160 _status = _logBuff.
serialize(bytesToWrite);
1166 _status = file.
serialize(_logBuff, 240);
1172 this->m_logOut_OutputPort[0].invoke(
1181#if FW_ENABLE_TEXT_LOGGING
1182 if (this->m_LogText_OutputPort[0].isConnected()) {
1183#if FW_OBJECT_NAMES == 1
1184 const char* _formatString =
1185 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1187 const char* _formatString =
1188 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1210 this->m_LogText_OutputPort[0].invoke(
1086 void ComLoggerComponentBase :: {
…}
1220 void ComLoggerComponentBase ::
1221 log_WARNING_LO_FileValidationError(
1229 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1230 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1235 _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1238 if (this->m_logOut_OutputPort[0].isConnected()) {
1242#if FW_AMPCS_COMPATIBLE
1251 _status = validationFile.
serialize(_logBuff, 240);
1257 _status = file.
serialize(_logBuff, 240);
1263#if FW_AMPCS_COMPATIBLE
1266 static_cast<U8>(
sizeof(U32))
1279 this->m_logOut_OutputPort[0].invoke(
1288#if FW_ENABLE_TEXT_LOGGING
1289 if (this->m_LogText_OutputPort[0].isConnected()) {
1290#if FW_OBJECT_NAMES == 1
1291 const char* _formatString =
1292 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1294 const char* _formatString =
1295 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1307 "FileValidationError ",
1316 this->m_LogText_OutputPort[0].invoke(
1220 void ComLoggerComponentBase :: {
…}
1326 void ComLoggerComponentBase ::
1331 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1332 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1337 _id = this->getIdBase() + EVENTID_FILECLOSED;
1340 if (this->m_logOut_OutputPort[0].isConnected()) {
1344#if FW_AMPCS_COMPATIBLE
1353 _status = file.
serialize(_logBuff, 240);
1359 this->m_logOut_OutputPort[0].invoke(
1368#if FW_ENABLE_TEXT_LOGGING
1369 if (this->m_LogText_OutputPort[0].isConnected()) {
1370#if FW_OBJECT_NAMES == 1
1371 const char* _formatString =
1372 "(%s) %s: File %s closed successfully.";
1374 const char* _formatString =
1375 "%s: File %s closed successfully.";
1394 this->m_LogText_OutputPort[0].invoke(
1326 void ComLoggerComponentBase :: {
…}
1404 void ComLoggerComponentBase ::
1405 log_WARNING_LO_FileNotInitialized()
1408 if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1412 this->m_FileNotInitializedThrottle++;
1417 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1418 this->m_timeCaller_OutputPort[0].invoke(_logTime);
1423 _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1426 if (this->m_logOut_OutputPort[0].isConnected()) {
1429#if FW_AMPCS_COMPATIBLE
1439 this->m_logOut_OutputPort[0].invoke(
1448#if FW_ENABLE_TEXT_LOGGING
1449 if (this->m_LogText_OutputPort[0].isConnected()) {
1450#if FW_OBJECT_NAMES == 1
1451 const char* _formatString =
1452 "(%s) %s: Could not open ComLogger file. File not initialized";
1454 const char* _formatString =
1455 "%s: Could not open ComLogger file. File not initialized";
1467 "FileNotInitialized "
1473 this->m_LogText_OutputPort[0].invoke(
1404 void ComLoggerComponentBase :: {
…}
1487 void ComLoggerComponentBase ::
1488 log_WARNING_LO_FileNotInitialized_ThrottleClear()
1491 this->m_FileNotInitializedThrottle = 0;
1487 void ComLoggerComponentBase :: {
…}
1501 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1503 this->m_timeCaller_OutputPort[0].invoke(_time);
1518 ComponentIpcSerializableBuffer msg;
1541 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1543 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1544 return MSG_DISPATCH_EXIT;
1548 deserStatus = msg.deserialize(portNum);
1559 deserStatus = msg.deserialize(data);
1567 deserStatus = msg.deserialize(context);
1573 this->comIn_handler(
1586 deserStatus = msg.deserialize(key);
1592 this->pingIn_handler(
1601 case CMD_CLOSEFILE: {
1604 deserStatus = msg.deserialize(opCode);
1612 deserStatus = msg.deserialize(cmdSeq);
1620 deserStatus = msg.deserialize(args);
1631#if FW_CMD_CHECK_RESIDUAL
1633 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1642 this->CloseFile_cmdHandler(opCode, cmdSeq);
1648 return MSG_DISPATCH_ERROR;
1651 return MSG_DISPATCH_OK;
1658 void ComLoggerComponentBase ::
1668 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1670 const U32 idBase = callComp->
getIdBase();
1671 FW_ASSERT(opCode >= idBase, opCode, idBase);
1674 switch (opCode - idBase) {
1675 case OPCODE_CLOSEFILE: {
1676 compPtr->CloseFile_cmdHandlerBase(
1690 void ComLoggerComponentBase ::
1699 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1700 compPtr->comIn_handlerBase(
1707 void ComLoggerComponentBase ::
1715 ComLoggerComponentBase* compPtr =
static_cast<ComLoggerComponentBase*
>(callComp);
1716 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.