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;
556 #if FW_ENABLE_TEXT_LOGGING == 1 558 bool ComLoggerComponentBase ::
559 isConnected_LogText_OutputPort(
FwIndexType portNum)
562 (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
563 static_cast<FwAssertArgType>(portNum)
566 return this->m_LogText_OutputPort[portNum].isConnected();
576 static_cast<FwAssertArgType>(portNum)
579 return this->m_cmdRegOut_OutputPort[portNum].
isConnected();
587 static_cast<FwAssertArgType>(portNum)
590 return this->m_cmdResponseOut_OutputPort[portNum].
isConnected();
598 static_cast<FwAssertArgType>(portNum)
601 return this->m_logOut_OutputPort[portNum].
isConnected();
609 static_cast<FwAssertArgType>(portNum)
612 return this->m_timeCaller_OutputPort[portNum].
isConnected();
624 static_cast<FwAssertArgType>(portNum)
627 return this->m_pingOut_OutputPort[portNum].
isConnected();
646 static_cast<FwAssertArgType>(portNum)
655 ComponentIpcSerializableBuffer msg;
659 _status = msg.serializeFrom(
660 static_cast<FwEnumStoreType>(COMIN_COM)
664 static_cast<FwAssertArgType>(_status)
668 _status = msg.serializeFrom(portNum);
671 static_cast<FwAssertArgType>(_status)
675 _status = msg.serializeFrom(data);
678 static_cast<FwAssertArgType>(_status)
682 _status = msg.serializeFrom(context);
685 static_cast<FwAssertArgType>(_status)
694 static_cast<FwAssertArgType>(qStatus)
707 static_cast<FwAssertArgType>(portNum)
715 ComponentIpcSerializableBuffer msg;
719 _status = msg.serializeFrom(
720 static_cast<FwEnumStoreType>(PINGIN_PING)
724 static_cast<FwAssertArgType>(_status)
728 _status = msg.serializeFrom(portNum);
731 static_cast<FwAssertArgType>(_status)
735 _status = msg.serializeFrom(key);
738 static_cast<FwAssertArgType>(_status)
747 static_cast<FwAssertArgType>(qStatus)
790 static_cast<FwAssertArgType>(portNum)
794 this->m_pingOut_OutputPort[portNum].isConnected(),
795 static_cast<FwAssertArgType>(portNum)
797 this->m_pingOut_OutputPort[portNum].
invoke(
813 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
814 this->m_cmdResponseOut_OutputPort[0].
invoke(opCode, cmdSeq, response);
835 ComponentIpcSerializableBuffer msg;
839 _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
842 static_cast<FwAssertArgType>(_status)
848 _status = msg.serializeFrom(port);
851 static_cast<FwAssertArgType>(_status)
854 _status = msg.serializeFrom(opCode);
857 static_cast<FwAssertArgType>(_status)
860 _status = msg.serializeFrom(cmdSeq);
863 static_cast<FwAssertArgType>(_status)
866 _status = msg.serializeFrom(args);
869 static_cast<FwAssertArgType>(_status)
878 static_cast<FwAssertArgType>(qStatus)
913 if (this->m_timeCaller_OutputPort[0].isConnected()) {
914 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
922 if (this->m_logOut_OutputPort[0].isConnected()) {
926 #if FW_AMPCS_COMPATIBLE 931 static_cast<FwAssertArgType>(_status)
935 #if FW_AMPCS_COMPATIBLE 938 static_cast<U8>(
sizeof(U32))
942 static_cast<FwAssertArgType>(_status)
948 static_cast<FwAssertArgType>(_status)
954 static_cast<FwAssertArgType>(_status)
957 this->m_logOut_OutputPort[0].
invoke(
966 #if FW_ENABLE_TEXT_LOGGING 967 if (this->m_LogText_OutputPort[0].isConnected()) {
968 #if FW_OBJECT_NAMES == 1 969 const char* _formatString =
970 "(%s) %s: Error %" PRIu32
" opening file %s";
972 const char* _formatString =
973 "%s: Error %" PRIu32
" opening file %s";
980 this->m_objName.toChar(),
987 this->m_LogText_OutputPort[0].invoke(
1007 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1008 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1016 if (this->m_logOut_OutputPort[0].isConnected()) {
1020 #if FW_AMPCS_COMPATIBLE 1025 static_cast<FwAssertArgType>(_status)
1029 #if FW_AMPCS_COMPATIBLE 1032 static_cast<U8>(
sizeof(U32))
1036 static_cast<FwAssertArgType>(_status)
1042 static_cast<FwAssertArgType>(_status)
1045 #if FW_AMPCS_COMPATIBLE 1048 static_cast<U8>(
sizeof(U32))
1052 static_cast<FwAssertArgType>(_status)
1058 static_cast<FwAssertArgType>(_status)
1061 #if FW_AMPCS_COMPATIBLE 1064 static_cast<U8>(
sizeof(U32))
1068 static_cast<FwAssertArgType>(_status)
1074 static_cast<FwAssertArgType>(_status)
1080 static_cast<FwAssertArgType>(_status)
1083 this->m_logOut_OutputPort[0].
invoke(
1092 #if FW_ENABLE_TEXT_LOGGING 1093 if (this->m_LogText_OutputPort[0].isConnected()) {
1094 #if FW_OBJECT_NAMES == 1 1095 const char* _formatString =
1096 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1098 const char* _formatString =
1099 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1106 this->m_objName.toChar(),
1115 this->m_LogText_OutputPort[0].invoke(
1134 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1135 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1143 if (this->m_logOut_OutputPort[0].isConnected()) {
1147 #if FW_AMPCS_COMPATIBLE 1152 static_cast<FwAssertArgType>(_status)
1159 static_cast<FwAssertArgType>(_status)
1165 static_cast<FwAssertArgType>(_status)
1168 #if FW_AMPCS_COMPATIBLE 1171 static_cast<U8>(
sizeof(U32))
1175 static_cast<FwAssertArgType>(_status)
1181 static_cast<FwAssertArgType>(_status)
1184 this->m_logOut_OutputPort[0].
invoke(
1193 #if FW_ENABLE_TEXT_LOGGING 1194 if (this->m_LogText_OutputPort[0].isConnected()) {
1195 #if FW_OBJECT_NAMES == 1 1196 const char* _formatString =
1197 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1199 const char* _formatString =
1200 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1207 this->m_objName.toChar(),
1209 "FileValidationError ",
1215 this->m_LogText_OutputPort[0].invoke(
1230 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1231 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1239 if (this->m_logOut_OutputPort[0].isConnected()) {
1243 #if FW_AMPCS_COMPATIBLE 1248 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: File %s closed successfully.";
1273 const char* _formatString =
1274 "%s: File %s closed successfully.";
1281 this->m_objName.toChar(),
1287 this->m_LogText_OutputPort[0].invoke(
1305 this->m_FileNotInitializedThrottle++;
1310 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1311 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1319 if (this->m_logOut_OutputPort[0].isConnected()) {
1322 #if FW_AMPCS_COMPATIBLE 1328 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: Could not open ComLogger file. File not initialized";
1347 const char* _formatString =
1348 "%s: Could not open ComLogger file. File not initialized";
1355 this->m_objName.toChar(),
1357 "FileNotInitialized " 1360 this->m_LogText_OutputPort[0].invoke(
1378 this->m_FileNotInitializedThrottle = 0;
1388 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1390 this->m_timeCaller_OutputPort[0].
invoke(_time);
1405 ComponentIpcSerializableBuffer _msg;
1415 static_cast<FwAssertArgType>(_msgStatus)
1425 static_cast<FwAssertArgType>(_deserStatus)
1428 MsgTypeEnum _msgType =
static_cast<MsgTypeEnum
>(_desMsg);
1430 if (_msgType == COMLOGGER_COMPONENT_EXIT) {
1435 _deserStatus = _msg.deserializeTo(portNum);
1438 static_cast<FwAssertArgType>(_deserStatus)
1446 _deserStatus = _msg.deserializeTo(data);
1449 static_cast<FwAssertArgType>(_deserStatus)
1454 _deserStatus = _msg.deserializeTo(context);
1457 static_cast<FwAssertArgType>(_deserStatus)
1473 _deserStatus = _msg.deserializeTo(key);
1476 static_cast<FwAssertArgType>(_deserStatus)
1488 case CMD_CLOSEFILE: {
1491 _deserStatus = _msg.deserializeTo(_opCode);
1494 static_cast<FwAssertArgType>(_deserStatus)
1499 _deserStatus = _msg.deserializeTo(_cmdSeq);
1502 static_cast<FwAssertArgType>(_deserStatus)
1507 _deserStatus = _msg.deserializeTo(args);
1510 static_cast<FwAssertArgType>(_deserStatus)
1518 #if FW_CMD_CHECK_RESIDUAL 1520 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1545 void ComLoggerComponentBase ::
1557 const U32 idBase = callComp->
getIdBase();
1558 FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1561 switch (opCode - idBase) {
1563 compPtr->CloseFile_cmdHandlerBase(
1577 void ComLoggerComponentBase ::
1587 compPtr->comIn_handlerBase(
1594 void ComLoggerComponentBase ::
1603 compPtr->pingIn_handlerBase(
The ComLogger successfully closed a file on command.
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].
The ComLogger encountered an error writing the validation file.
FwIdType FwOpcodeType
The type of a command opcode.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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
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)
void invoke(U32 key) const
Invoke a port interface.
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
static constexpr FwIndexType getNum_pingIn_InputPorts()
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
Enum representing a command response.
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.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
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].
FwIdType FwEventIdType
The type of an event identifier.
The ComLogger encountered an error writing to a file.
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) ...
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)
Forces a close of the currently opened file.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
void addCallPort(InputPingPort *callPort)
Register an input port.
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() override
Reset deserialization pointer to beginning of buffer.
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].
static constexpr FwIndexType getNum_logOut_OutputPorts()
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
void init()
Initialization function.
uint8_t U8
8-bit unsigned integer
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
Command failed to deserialize.
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].
static constexpr FwIndexType getNum_comIn_InputPorts()
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.
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.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
message sent/received okay
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
message to exit active component task
Message will return with status when space is unavailable.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
Implementation of malloc based allocator.
The ComLogger encountered an error opening a file.
void init()
Initialization function.
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
Throttle reset count for FileNotInitialized.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.