9 #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 (0 <= portNum) && (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 (0 <= portNum) && (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 (0 <= portNum) && (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.serializeFrom(
734 static_cast<FwEnumStoreType>(COMIN_COM)
738 static_cast<FwAssertArgType>(_status)
742 _status = msg.serializeFrom(portNum);
745 static_cast<FwAssertArgType>(_status)
749 _status = msg.serializeFrom(data);
752 static_cast<FwAssertArgType>(_status)
756 _status = msg.serializeFrom(context);
759 static_cast<FwAssertArgType>(_status)
768 static_cast<FwAssertArgType>(qStatus)
781 static_cast<FwAssertArgType>(portNum)
789 ComponentIpcSerializableBuffer msg;
793 _status = msg.serializeFrom(
794 static_cast<FwEnumStoreType>(PINGIN_PING)
798 static_cast<FwAssertArgType>(_status)
802 _status = msg.serializeFrom(portNum);
805 static_cast<FwAssertArgType>(_status)
809 _status = msg.serializeFrom(key);
812 static_cast<FwAssertArgType>(_status)
821 static_cast<FwAssertArgType>(qStatus)
864 static_cast<FwAssertArgType>(portNum)
868 this->m_pingOut_OutputPort[portNum].isConnected(),
869 static_cast<FwAssertArgType>(portNum)
871 this->m_pingOut_OutputPort[portNum].
invoke(
887 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
888 this->m_cmdResponseOut_OutputPort[0].
invoke(opCode, cmdSeq, response);
909 ComponentIpcSerializableBuffer msg;
913 _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
916 static_cast<FwAssertArgType>(_status)
922 _status = msg.serializeFrom(port);
925 static_cast<FwAssertArgType>(_status)
928 _status = msg.serializeFrom(opCode);
931 static_cast<FwAssertArgType>(_status)
934 _status = msg.serializeFrom(cmdSeq);
937 static_cast<FwAssertArgType>(_status)
940 _status = msg.serializeFrom(args);
943 static_cast<FwAssertArgType>(_status)
952 static_cast<FwAssertArgType>(qStatus)
987 if (this->m_timeCaller_OutputPort[0].isConnected()) {
988 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
996 if (this->m_logOut_OutputPort[0].isConnected()) {
1000 #if FW_AMPCS_COMPATIBLE 1005 static_cast<FwAssertArgType>(_status)
1009 #if FW_AMPCS_COMPATIBLE 1012 static_cast<U8>(
sizeof(U32))
1016 static_cast<FwAssertArgType>(_status)
1022 static_cast<FwAssertArgType>(_status)
1028 static_cast<FwAssertArgType>(_status)
1031 this->m_logOut_OutputPort[0].
invoke(
1040 #if FW_ENABLE_TEXT_LOGGING 1041 if (this->m_LogText_OutputPort[0].isConnected()) {
1042 #if FW_OBJECT_NAMES == 1 1043 const char* _formatString =
1044 "(%s) %s: Error %" PRIu32
" opening file %s";
1046 const char* _formatString =
1047 "%s: Error %" PRIu32
" opening file %s";
1054 this->m_objName.toChar(),
1061 this->m_LogText_OutputPort[0].invoke(
1081 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1082 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1090 if (this->m_logOut_OutputPort[0].isConnected()) {
1094 #if FW_AMPCS_COMPATIBLE 1099 static_cast<FwAssertArgType>(_status)
1103 #if FW_AMPCS_COMPATIBLE 1106 static_cast<U8>(
sizeof(U32))
1110 static_cast<FwAssertArgType>(_status)
1116 static_cast<FwAssertArgType>(_status)
1119 #if FW_AMPCS_COMPATIBLE 1122 static_cast<U8>(
sizeof(U32))
1126 static_cast<FwAssertArgType>(_status)
1132 static_cast<FwAssertArgType>(_status)
1135 #if FW_AMPCS_COMPATIBLE 1138 static_cast<U8>(
sizeof(U32))
1142 static_cast<FwAssertArgType>(_status)
1148 static_cast<FwAssertArgType>(_status)
1154 static_cast<FwAssertArgType>(_status)
1157 this->m_logOut_OutputPort[0].
invoke(
1166 #if FW_ENABLE_TEXT_LOGGING 1167 if (this->m_LogText_OutputPort[0].isConnected()) {
1168 #if FW_OBJECT_NAMES == 1 1169 const char* _formatString =
1170 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1172 const char* _formatString =
1173 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1180 this->m_objName.toChar(),
1189 this->m_LogText_OutputPort[0].invoke(
1208 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1209 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1217 if (this->m_logOut_OutputPort[0].isConnected()) {
1221 #if FW_AMPCS_COMPATIBLE 1226 static_cast<FwAssertArgType>(_status)
1233 static_cast<FwAssertArgType>(_status)
1239 static_cast<FwAssertArgType>(_status)
1242 #if FW_AMPCS_COMPATIBLE 1245 static_cast<U8>(
sizeof(U32))
1249 static_cast<FwAssertArgType>(_status)
1255 static_cast<FwAssertArgType>(_status)
1258 this->m_logOut_OutputPort[0].
invoke(
1267 #if FW_ENABLE_TEXT_LOGGING 1268 if (this->m_LogText_OutputPort[0].isConnected()) {
1269 #if FW_OBJECT_NAMES == 1 1270 const char* _formatString =
1271 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1273 const char* _formatString =
1274 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1281 this->m_objName.toChar(),
1283 "FileValidationError ",
1289 this->m_LogText_OutputPort[0].invoke(
1304 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1305 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1313 if (this->m_logOut_OutputPort[0].isConnected()) {
1317 #if FW_AMPCS_COMPATIBLE 1322 static_cast<FwAssertArgType>(_status)
1329 static_cast<FwAssertArgType>(_status)
1332 this->m_logOut_OutputPort[0].
invoke(
1341 #if FW_ENABLE_TEXT_LOGGING 1342 if (this->m_LogText_OutputPort[0].isConnected()) {
1343 #if FW_OBJECT_NAMES == 1 1344 const char* _formatString =
1345 "(%s) %s: File %s closed successfully.";
1347 const char* _formatString =
1348 "%s: File %s closed successfully.";
1355 this->m_objName.toChar(),
1361 this->m_LogText_OutputPort[0].invoke(
1379 (void) this->m_FileNotInitializedThrottle.fetch_add(1);
1384 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1385 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1393 if (this->m_logOut_OutputPort[0].isConnected()) {
1396 #if FW_AMPCS_COMPATIBLE 1402 static_cast<FwAssertArgType>(_status)
1406 this->m_logOut_OutputPort[0].
invoke(
1415 #if FW_ENABLE_TEXT_LOGGING 1416 if (this->m_LogText_OutputPort[0].isConnected()) {
1417 #if FW_OBJECT_NAMES == 1 1418 const char* _formatString =
1419 "(%s) %s: Could not open ComLogger file. File not initialized";
1421 const char* _formatString =
1422 "%s: Could not open ComLogger file. File not initialized";
1429 this->m_objName.toChar(),
1431 "FileNotInitialized " 1434 this->m_LogText_OutputPort[0].invoke(
1452 this->m_FileNotInitializedThrottle = 0;
1462 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1464 this->m_timeCaller_OutputPort[0].
invoke(_time);
1479 ComponentIpcSerializableBuffer _msg;
1489 static_cast<FwAssertArgType>(_msgStatus)
1499 static_cast<FwAssertArgType>(_deserStatus)
1502 MsgTypeEnum _msgType =
static_cast<MsgTypeEnum
>(_desMsg);
1504 if (_msgType == COMLOGGER_COMPONENT_EXIT) {
1509 _deserStatus = _msg.deserializeTo(portNum);
1512 static_cast<FwAssertArgType>(_deserStatus)
1520 _deserStatus = _msg.deserializeTo(data);
1523 static_cast<FwAssertArgType>(_deserStatus)
1528 _deserStatus = _msg.deserializeTo(context);
1531 static_cast<FwAssertArgType>(_deserStatus)
1547 _deserStatus = _msg.deserializeTo(key);
1550 static_cast<FwAssertArgType>(_deserStatus)
1562 case CMD_CLOSEFILE: {
1565 _deserStatus = _msg.deserializeTo(_opCode);
1568 static_cast<FwAssertArgType>(_deserStatus)
1573 _deserStatus = _msg.deserializeTo(_cmdSeq);
1576 static_cast<FwAssertArgType>(_deserStatus)
1581 _deserStatus = _msg.deserializeTo(args);
1584 static_cast<FwAssertArgType>(_deserStatus)
1592 #if FW_CMD_CHECK_RESIDUAL 1594 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1619 void ComLoggerComponentBase ::
1631 const U32 idBase = callComp->
getIdBase();
1632 FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1635 switch (opCode - idBase) {
1637 compPtr->CloseFile_cmdHandlerBase(
1651 void ComLoggerComponentBase ::
1661 compPtr->comIn_handlerBase(
1668 void ComLoggerComponentBase ::
1677 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.
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
FwIdType FwOpcodeType
The type of a command opcode.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
FwIdType getIdBase() const
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
PlatformSizeType FwSizeType
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file) const
Status
status returned from the queue send function
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
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)
The ComLogger encountered an error writing to a file.
void invoke(U32 key) const
Invoke a port interface.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
Enum representing a command response.
Forces a close of the currently opened file.
No time base has been established (Required)
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.
Os::Queue m_queue
queue object for active component
Software diagnostic events.
void init()
Object initializer.
Throttle reset count for FileNotInitialized.
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].
FwIdType FwEventIdType
The type of an event identifier.
FwIndexType getNum_pingOut_OutputPorts() const
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
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)
const char * toChar() const
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
void addCallPort(InputPingPort *callPort)
Register an input port.
FwIndexType getNum_pingIn_InputPorts() const
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
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)
SerializeStatus serializeTo(SerializeBufferBase &buffer) const override
serialize contents to buffer
Command failed to deserialize.
FwIndexType getNum_comIn_InputPorts() const
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
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].
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
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.
RateGroupDivider component implementation.
FwIndexType getNum_cmdRegOut_OutputPorts() const
message sent/received okay
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
message to exit active component task
The ComLogger encountered an error writing the validation file.
Message will return with status when space is unavailable.
void init()
Initialization function.
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
The ComLogger successfully closed a file on command.
virtual const CHAR * toChar() const =0
The ComLogger encountered an error opening a file.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.