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];
87 this->m_cmdIn_InputPort[port].
init();
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());
111 this->m_comIn_InputPort[port].
init();
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());
135 this->m_pingIn_InputPort[port].
init();
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());
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());
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());
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());
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());
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)
276 static_cast<FwAssertArgType>(qStat)
289 static_cast<FwAssertArgType>(portNum)
292 return &this->m_cmdIn_InputPort[portNum];
304 static_cast<FwAssertArgType>(portNum)
307 return &this->m_comIn_InputPort[portNum];
315 static_cast<FwAssertArgType>(portNum)
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(),
335 static_cast<FwAssertArgType>(portNum)
338 this->m_LogText_OutputPort[portNum].addCallPort(port);
351 static_cast<FwAssertArgType>(portNum)
354 this->m_cmdRegOut_OutputPort[portNum].
addCallPort(port);
365 static_cast<FwAssertArgType>(portNum)
368 this->m_cmdResponseOut_OutputPort[portNum].
addCallPort(port);
379 static_cast<FwAssertArgType>(portNum)
382 this->m_logOut_OutputPort[portNum].
addCallPort(port);
393 static_cast<FwAssertArgType>(portNum)
396 this->m_timeCaller_OutputPort[portNum].
addCallPort(port);
411 static_cast<FwAssertArgType>(portNum)
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(),
433 static_cast<FwAssertArgType>(portNum)
436 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
444 Fw::InputSerializePort* port
449 static_cast<FwAssertArgType>(portNum)
452 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
458 Fw::InputSerializePort* port
463 static_cast<FwAssertArgType>(portNum)
466 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
472 Fw::InputSerializePort* port
477 static_cast<FwAssertArgType>(portNum)
480 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
486 Fw::InputSerializePort* port
491 static_cast<FwAssertArgType>(portNum)
494 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
499 #if FW_PORT_SERIALIZATION 508 Fw::InputSerializePort* port
513 static_cast<FwAssertArgType>(portNum)
516 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
528 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
530 this->m_cmdRegOut_OutputPort[0].
invoke(
541 Fw::ActiveComponentBase(compName)
543 this->m_FileNotInitializedThrottle = 0;
582 #if FW_ENABLE_TEXT_LOGGING == 1 585 getNum_LogText_OutputPorts()
const 630 #if FW_ENABLE_TEXT_LOGGING == 1 632 bool ComLoggerComponentBase ::
633 isConnected_LogText_OutputPort(
FwIndexType portNum)
636 portNum < this->getNum_LogText_OutputPorts(),
637 static_cast<FwAssertArgType>(portNum)
640 return this->m_LogText_OutputPort[portNum].isConnected();
650 static_cast<FwAssertArgType>(portNum)
653 return this->m_cmdRegOut_OutputPort[portNum].
isConnected();
661 static_cast<FwAssertArgType>(portNum)
664 return this->m_cmdResponseOut_OutputPort[portNum].
isConnected();
672 static_cast<FwAssertArgType>(portNum)
675 return this->m_logOut_OutputPort[portNum].
isConnected();
683 static_cast<FwAssertArgType>(portNum)
686 return this->m_timeCaller_OutputPort[portNum].
isConnected();
698 static_cast<FwAssertArgType>(portNum)
701 return this->m_pingOut_OutputPort[portNum].
isConnected();
720 static_cast<FwAssertArgType>(portNum)
729 ComponentIpcSerializableBuffer msg;
733 _status = msg.serialize(
734 static_cast<FwEnumStoreType>(COMIN_COM)
738 static_cast<FwAssertArgType>(_status)
742 _status = msg.serialize(portNum);
745 static_cast<FwAssertArgType>(_status)
749 _status = msg.serialize(data);
752 static_cast<FwAssertArgType>(_status)
756 _status = msg.serialize(context);
759 static_cast<FwAssertArgType>(_status)
768 static_cast<FwAssertArgType>(qStatus)
781 static_cast<FwAssertArgType>(portNum)
789 ComponentIpcSerializableBuffer msg;
793 _status = msg.serialize(
794 static_cast<FwEnumStoreType>(PINGIN_PING)
798 static_cast<FwAssertArgType>(_status)
802 _status = msg.serialize(portNum);
805 static_cast<FwAssertArgType>(_status)
809 _status = msg.serialize(key);
812 static_cast<FwAssertArgType>(_status)
821 static_cast<FwAssertArgType>(qStatus)
864 static_cast<FwAssertArgType>(portNum)
866 this->m_pingOut_OutputPort[portNum].
invoke(
882 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
883 this->m_cmdResponseOut_OutputPort[0].
invoke(opCode, cmdSeq, response);
904 ComponentIpcSerializableBuffer msg;
908 _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
911 static_cast<FwAssertArgType>(_status)
917 _status = msg.serialize(port);
920 static_cast<FwAssertArgType>(_status)
923 _status = msg.serialize(opCode);
926 static_cast<FwAssertArgType>(_status)
929 _status = msg.serialize(cmdSeq);
932 static_cast<FwAssertArgType>(_status)
935 _status = msg.serialize(args);
938 static_cast<FwAssertArgType>(_status)
947 static_cast<FwAssertArgType>(qStatus)
982 if (this->m_timeCaller_OutputPort[0].isConnected()) {
983 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
991 if (this->m_logOut_OutputPort[0].isConnected()) {
995 #if FW_AMPCS_COMPATIBLE 997 _status = _logBuff.
serialize(static_cast<U8>(2));
1000 static_cast<FwAssertArgType>(_status)
1004 #if FW_AMPCS_COMPATIBLE 1007 static_cast<U8>(
sizeof(U32))
1011 static_cast<FwAssertArgType>(_status)
1017 static_cast<FwAssertArgType>(_status)
1023 static_cast<FwAssertArgType>(_status)
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(
1076 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1077 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1085 if (this->m_logOut_OutputPort[0].isConnected()) {
1089 #if FW_AMPCS_COMPATIBLE 1091 _status = _logBuff.
serialize(static_cast<U8>(4));
1094 static_cast<FwAssertArgType>(_status)
1098 #if FW_AMPCS_COMPATIBLE 1101 static_cast<U8>(
sizeof(U32))
1105 static_cast<FwAssertArgType>(_status)
1111 static_cast<FwAssertArgType>(_status)
1114 #if FW_AMPCS_COMPATIBLE 1117 static_cast<U8>(
sizeof(U32))
1121 static_cast<FwAssertArgType>(_status)
1124 _status = _logBuff.
serialize(bytesWritten);
1127 static_cast<FwAssertArgType>(_status)
1130 #if FW_AMPCS_COMPATIBLE 1133 static_cast<U8>(
sizeof(U32))
1137 static_cast<FwAssertArgType>(_status)
1140 _status = _logBuff.
serialize(bytesToWrite);
1143 static_cast<FwAssertArgType>(_status)
1149 static_cast<FwAssertArgType>(_status)
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(
1203 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1204 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1212 if (this->m_logOut_OutputPort[0].isConnected()) {
1216 #if FW_AMPCS_COMPATIBLE 1218 _status = _logBuff.
serialize(static_cast<U8>(3));
1221 static_cast<FwAssertArgType>(_status)
1228 static_cast<FwAssertArgType>(_status)
1234 static_cast<FwAssertArgType>(_status)
1237 #if FW_AMPCS_COMPATIBLE 1240 static_cast<U8>(
sizeof(U32))
1244 static_cast<FwAssertArgType>(_status)
1250 static_cast<FwAssertArgType>(_status)
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(
1299 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1300 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1308 if (this->m_logOut_OutputPort[0].isConnected()) {
1312 #if FW_AMPCS_COMPATIBLE 1314 _status = _logBuff.
serialize(static_cast<U8>(1));
1317 static_cast<FwAssertArgType>(_status)
1324 static_cast<FwAssertArgType>(_status)
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(
1374 this->m_FileNotInitializedThrottle++;
1379 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1380 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1388 if (this->m_logOut_OutputPort[0].isConnected()) {
1391 #if FW_AMPCS_COMPATIBLE 1394 _status = _logBuff.
serialize(static_cast<U8>(0));
1397 static_cast<FwAssertArgType>(_status)
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(
1447 this->m_FileNotInitializedThrottle = 0;
1457 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1459 this->m_timeCaller_OutputPort[0].
invoke(_time);
1474 ComponentIpcSerializableBuffer msg;
1484 static_cast<FwAssertArgType>(msgStatus)
1494 static_cast<FwAssertArgType>(deserStatus)
1497 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1499 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1504 deserStatus = msg.deserialize(portNum);
1507 static_cast<FwAssertArgType>(deserStatus)
1515 deserStatus = msg.deserialize(data);
1518 static_cast<FwAssertArgType>(deserStatus)
1523 deserStatus = msg.deserialize(context);
1526 static_cast<FwAssertArgType>(deserStatus)
1542 deserStatus = msg.deserialize(key);
1545 static_cast<FwAssertArgType>(deserStatus)
1557 case CMD_CLOSEFILE: {
1560 deserStatus = msg.deserialize(opCode);
1563 static_cast<FwAssertArgType>(deserStatus)
1568 deserStatus = msg.deserialize(cmdSeq);
1571 static_cast<FwAssertArgType>(deserStatus)
1576 deserStatus = msg.deserialize(args);
1579 static_cast<FwAssertArgType>(deserStatus)
1587 #if FW_CMD_CHECK_RESIDUAL 1589 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1614 void ComLoggerComponentBase ::
1626 const U32 idBase = callComp->
getIdBase();
1627 FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1630 switch (opCode - idBase) {
1632 compPtr->CloseFile_cmdHandlerBase(
1646 void ComLoggerComponentBase ::
1656 compPtr->comIn_handlerBase(
1663 void ComLoggerComponentBase ::
1672 compPtr->pingIn_handlerBase(
Serialization/Deserialization operation was successful.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void addCallPort(InputTimePort *callPort)
Register an input port.
Forces a close of the currently opened file.
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file) const
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
PlatformSizeType FwSizeType
void invoke(U32 key) const
Invoke a port interface.
The ComLogger encountered an error opening a file.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
Enum representing a command response.
void regCommands()
Register commands with the Command Dispatcher.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
PlatformIndexType FwIndexType
Os::Queue m_queue
queue object for active component
Software diagnostic events.
void init()
Object initializer.
SerializeStatus
forward declaration for string
Message will block until space is available.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
The ComLogger encountered an error writing to a file.
FwIndexType getNum_pingOut_OutputPorts() const
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
The ComLogger successfully closed a file on command.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
virtual void CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CloseFile.
void log_WARNING_HI_FileOpenError(U32 errornum, const Fw::StringBase &file) const
#define FW_MIN(a, b)
MIN macro.
A less serious but recoverable event.
void init()
Initialization function.
void log_WARNING_LO_FileNotInitialized_ThrottleClear()
Reset throttle value for FileNotInitialized.
void invoke(Fw::Time &time) const
Invoke a port interface.
void CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Throttle reset count for FileNotInitialized.
const char * toChar() const
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
void addCallPort(InputPingPort *callPort)
Register an input port.
FwIndexType getNum_pingIn_InputPorts() const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
void resetDeser()
reset deserialization to beginning
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
void log_WARNING_HI_FileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file) const
virtual ~ComLoggerComponentBase()
Destroy ComLoggerComponentBase object.
A serious but recoverable event.
Errors dispatching messages.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
void init()
Initialization function.
FwIndexType getNum_cmdIn_InputPorts() const
uint8_t U8
8-bit unsigned integer
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
#define PRI_PlatformIntType
Command failed to deserialize.
FwIndexType getNum_comIn_InputPorts() const
void log_WARNING_LO_FileValidationError(const Fw::StringBase &validationFile, const Fw::StringBase &file, U32 status) const
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
PlatformQueuePriorityType FwQueuePriorityType
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
message to exit active component task
A message was sent requesting an exit of the loop.
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
FwIndexType getNum_timeCaller_OutputPorts() const
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
FwIndexType getNum_logOut_OutputPorts() const
void addCallPort(InputLogPort *callPort)
Register an input port.
void init()
Initialization function.
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
FwIndexType getNum_cmdRegOut_OutputPorts() const
message sent/received okay
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Message will return with status when space is unavailable.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void init()
Initialization function.
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
virtual const CHAR * toChar() const =0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
The ComLogger encountered an error writing the validation file.