10 #if FW_ENABLE_TEXT_LOGGING
34 class ComponentIpcSerializableBuffer :
49 return sizeof(m_buff);
56 const U8* getBuffAddr()
const {
62 U8 m_buff[SERIALIZATION_SIZE];
86 this->m_cmdIn_InputPort[port].
init();
91 this->m_cmdIn_InputPort[port].
setPortNum(port);
93 #if FW_OBJECT_NAMES == 1
97 this->m_objName.toChar(),
100 this->m_cmdIn_InputPort[port].setObjName(portName.
toChar());
110 this->m_comIn_InputPort[port].
init();
115 this->m_comIn_InputPort[port].
setPortNum(port);
117 #if FW_OBJECT_NAMES == 1
121 this->m_objName.toChar(),
124 this->m_comIn_InputPort[port].setObjName(portName.
toChar());
134 this->m_pingIn_InputPort[port].
init();
139 this->m_pingIn_InputPort[port].
setPortNum(port);
141 #if FW_OBJECT_NAMES == 1
145 this->m_objName.toChar(),
148 this->m_pingIn_InputPort[port].setObjName(portName.
toChar());
152 #if FW_ENABLE_TEXT_LOGGING == 1
156 port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
159 this->m_LogText_OutputPort[port].
init();
161 #if FW_OBJECT_NAMES == 1
165 this->m_objName.toChar(),
168 this->m_LogText_OutputPort[port].setObjName(portName.
toChar());
179 this->m_cmdRegOut_OutputPort[port].
init();
181 #if FW_OBJECT_NAMES == 1
185 this->m_objName.toChar(),
188 this->m_cmdRegOut_OutputPort[port].setObjName(portName.
toChar());
198 this->m_cmdResponseOut_OutputPort[port].
init();
200 #if FW_OBJECT_NAMES == 1
204 this->m_objName.toChar(),
207 this->m_cmdResponseOut_OutputPort[port].setObjName(portName.
toChar());
217 this->m_logOut_OutputPort[port].
init();
219 #if FW_OBJECT_NAMES == 1
223 this->m_objName.toChar(),
226 this->m_logOut_OutputPort[port].setObjName(portName.
toChar());
236 this->m_timeCaller_OutputPort[port].
init();
238 #if FW_OBJECT_NAMES == 1
242 this->m_objName.toChar(),
245 this->m_timeCaller_OutputPort[port].setObjName(portName.
toChar());
255 this->m_pingOut_OutputPort[port].
init();
257 #if FW_OBJECT_NAMES == 1
261 this->m_objName.toChar(),
264 this->m_pingOut_OutputPort[port].setObjName(portName.
toChar());
270 static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
290 return &this->m_cmdIn_InputPort[portNum];
305 return &this->m_comIn_InputPort[portNum];
316 return &this->m_pingIn_InputPort[portNum];
323 #if FW_ENABLE_TEXT_LOGGING == 1
325 void ComLoggerComponentBase ::
326 set_LogText_OutputPort(
332 portNum < this->getNum_LogText_OutputPorts(),
336 this->m_LogText_OutputPort[portNum].addCallPort(port);
352 this->m_cmdRegOut_OutputPort[portNum].
addCallPort(port);
366 this->m_cmdResponseOut_OutputPort[portNum].
addCallPort(port);
380 this->m_logOut_OutputPort[portNum].
addCallPort(port);
394 this->m_timeCaller_OutputPort[portNum].
addCallPort(port);
412 this->m_pingOut_OutputPort[portNum].
addCallPort(port);
415 #if FW_PORT_SERIALIZATION
421 #if FW_ENABLE_TEXT_LOGGING == 1
423 void ComLoggerComponentBase ::
424 set_LogText_OutputPort(
426 Fw::InputSerializePort* port
430 portNum < this->getNum_LogText_OutputPorts(),
434 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
442 Fw::InputSerializePort* port
450 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
456 Fw::InputSerializePort* port
464 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
470 Fw::InputSerializePort* port
478 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
484 Fw::InputSerializePort* port
492 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
497 #if FW_PORT_SERIALIZATION
506 Fw::InputSerializePort* port
514 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
526 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
528 this->m_cmdRegOut_OutputPort[0].
invoke(
539 Fw::ActiveComponentBase(compName)
541 this->m_FileNotInitializedThrottle = 0;
580 #if FW_ENABLE_TEXT_LOGGING == 1
583 getNum_LogText_OutputPorts()
const
628 #if FW_ENABLE_TEXT_LOGGING == 1
630 bool ComLoggerComponentBase ::
631 isConnected_LogText_OutputPort(
FwIndexType portNum)
634 portNum < this->getNum_LogText_OutputPorts(),
638 return this->m_LogText_OutputPort[portNum].isConnected();
651 return this->m_cmdRegOut_OutputPort[portNum].
isConnected();
662 return this->m_cmdResponseOut_OutputPort[portNum].
isConnected();
673 return this->m_logOut_OutputPort[portNum].
isConnected();
684 return this->m_timeCaller_OutputPort[portNum].
isConnected();
699 return this->m_pingOut_OutputPort[portNum].
isConnected();
727 ComponentIpcSerializableBuffer msg;
731 _status = msg.serialize(
740 _status = msg.serialize(portNum);
747 _status = msg.serialize(data);
754 _status = msg.serialize(context);
787 ComponentIpcSerializableBuffer msg;
791 _status = msg.serialize(
800 _status = msg.serialize(portNum);
807 _status = msg.serialize(key);
864 this->m_pingOut_OutputPort[portNum].
invoke(
880 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
881 this->m_cmdResponseOut_OutputPort[0].
invoke(opCode, cmdSeq, response);
902 ComponentIpcSerializableBuffer msg;
915 _status = msg.serialize(port);
921 _status = msg.serialize(opCode);
927 _status = msg.serialize(cmdSeq);
933 _status = msg.serialize(args);
980 if (this->m_timeCaller_OutputPort[0].isConnected()) {
981 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
989 if (this->m_logOut_OutputPort[0].isConnected()) {
993 #if FW_AMPCS_COMPATIBLE
1002 #if FW_AMPCS_COMPATIBLE
1005 static_cast<U8>(
sizeof(U32))
1024 this->m_logOut_OutputPort[0].
invoke(
1033 #if FW_ENABLE_TEXT_LOGGING
1034 if (this->m_LogText_OutputPort[0].isConnected()) {
1035 #if FW_OBJECT_NAMES == 1
1036 const char* _formatString =
1037 "(%s) %s: Error %" PRIu32
" opening file %s";
1039 const char* _formatString =
1040 "%s: Error %" PRIu32
" opening file %s";
1047 this->m_objName.toChar(),
1054 this->m_LogText_OutputPort[0].invoke(
1074 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1075 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1083 if (this->m_logOut_OutputPort[0].isConnected()) {
1087 #if FW_AMPCS_COMPATIBLE
1096 #if FW_AMPCS_COMPATIBLE
1099 static_cast<U8>(
sizeof(U32))
1112 #if FW_AMPCS_COMPATIBLE
1115 static_cast<U8>(
sizeof(U32))
1122 _status = _logBuff.
serialize(bytesWritten);
1128 #if FW_AMPCS_COMPATIBLE
1131 static_cast<U8>(
sizeof(U32))
1138 _status = _logBuff.
serialize(bytesToWrite);
1150 this->m_logOut_OutputPort[0].
invoke(
1159 #if FW_ENABLE_TEXT_LOGGING
1160 if (this->m_LogText_OutputPort[0].isConnected()) {
1161 #if FW_OBJECT_NAMES == 1
1162 const char* _formatString =
1163 "(%s) %s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1165 const char* _formatString =
1166 "%s: Error %" PRIu32
" while writing %" PRIu32
" of %" PRIu32
" bytes to %s";
1173 this->m_objName.toChar(),
1182 this->m_LogText_OutputPort[0].invoke(
1201 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1202 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1210 if (this->m_logOut_OutputPort[0].isConnected()) {
1214 #if FW_AMPCS_COMPATIBLE
1235 #if FW_AMPCS_COMPATIBLE
1238 static_cast<U8>(
sizeof(U32))
1251 this->m_logOut_OutputPort[0].
invoke(
1260 #if FW_ENABLE_TEXT_LOGGING
1261 if (this->m_LogText_OutputPort[0].isConnected()) {
1262 #if FW_OBJECT_NAMES == 1
1263 const char* _formatString =
1264 "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1266 const char* _formatString =
1267 "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32
".";
1274 this->m_objName.toChar(),
1276 "FileValidationError ",
1282 this->m_LogText_OutputPort[0].invoke(
1297 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1298 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1306 if (this->m_logOut_OutputPort[0].isConnected()) {
1310 #if FW_AMPCS_COMPATIBLE
1325 this->m_logOut_OutputPort[0].
invoke(
1334 #if FW_ENABLE_TEXT_LOGGING
1335 if (this->m_LogText_OutputPort[0].isConnected()) {
1336 #if FW_OBJECT_NAMES == 1
1337 const char* _formatString =
1338 "(%s) %s: File %s closed successfully.";
1340 const char* _formatString =
1341 "%s: File %s closed successfully.";
1348 this->m_objName.toChar(),
1354 this->m_LogText_OutputPort[0].invoke(
1372 this->m_FileNotInitializedThrottle++;
1377 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1378 this->m_timeCaller_OutputPort[0].
invoke(_logTime);
1386 if (this->m_logOut_OutputPort[0].isConnected()) {
1389 #if FW_AMPCS_COMPATIBLE
1399 this->m_logOut_OutputPort[0].
invoke(
1408 #if FW_ENABLE_TEXT_LOGGING
1409 if (this->m_LogText_OutputPort[0].isConnected()) {
1410 #if FW_OBJECT_NAMES == 1
1411 const char* _formatString =
1412 "(%s) %s: Could not open ComLogger file. File not initialized";
1414 const char* _formatString =
1415 "%s: Could not open ComLogger file. File not initialized";
1422 this->m_objName.toChar(),
1424 "FileNotInitialized "
1427 this->m_LogText_OutputPort[0].invoke(
1445 this->m_FileNotInitializedThrottle = 0;
1455 if (this->m_timeCaller_OutputPort[0].isConnected()) {
1457 this->m_timeCaller_OutputPort[0].
invoke(_time);
1472 ComponentIpcSerializableBuffer msg;
1495 MsgTypeEnum msgType =
static_cast<MsgTypeEnum
>(desMsg);
1497 if (msgType == COMLOGGER_COMPONENT_EXIT) {
1502 deserStatus = msg.deserialize(portNum);
1521 deserStatus = msg.deserialize(context);
1540 deserStatus = msg.deserialize(key);
1555 case CMD_CLOSEFILE: {
1558 deserStatus = msg.deserialize(opCode);
1566 deserStatus = msg.deserialize(cmdSeq);
1585 #if FW_CMD_CHECK_RESIDUAL
1587 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1612 void ComLoggerComponentBase ::
1624 const U32 idBase = callComp->
getIdBase();
1628 switch (opCode - idBase) {
1630 compPtr->CloseFile_cmdHandlerBase(
1644 void ComLoggerComponentBase ::
1654 compPtr->comIn_handlerBase(
1661 void ComLoggerComponentBase ::
1670 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)
@ 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
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode)
Invoke a port interface.
void init()
Initialization function.
void init()
Initialization function.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Invoke a port interface.
void init()
Initialization function.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
void addCallPort(InputLogPort *callPort)
Register an input port.
void addCallPort(InputTimePort *callPort)
Register an input port.
void invoke(Fw::Time &time)
Invoke a port interface.
void init()
Initialization function.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
Os::Queue m_queue
queue object for active component
@ MSG_DISPATCH_OK
Dispatch was normal.
@ MSG_DISPATCH_EXIT
A message was sent requesting an exit of the loop.
@ MSG_DISPATCH_ERROR
Errors dispatching messages.
NATIVE_UINT_TYPE SizeType
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
virtual const CHAR * toChar() const =0
void format(const CHAR *formatString,...)
write formatted string to buffer
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
@ 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
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void log_WARNING_HI_FileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file)
FwIndexType getNum_pingOut_OutputPorts() const
virtual ~ComLoggerComponentBase()
Destroy ComLoggerComponentBase object.
void log_WARNING_HI_FileOpenError(U32 errornum, const Fw::StringBase &file)
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void log_WARNING_LO_FileValidationError(const Fw::StringBase &validationFile, const Fw::StringBase &file, U32 status)
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file)
bool isConnected_logOut_OutputPort(FwIndexType portNum)
@ EVENTID_FILENOTINITIALIZED_THROTTLE
Throttle reset count for FileNotInitialized.
FwIndexType getNum_cmdIn_InputPorts() const
FwIndexType getNum_cmdRegOut_OutputPorts() const
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
@ OPCODE_CLOSEFILE
Forces a close of the currently opened file.
void CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_logOut_OutputPorts() const
void regCommands()
Register commands with the Command Dispatcher.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
@ EVENTID_FILECLOSED
The ComLogger successfully closed a file on command.
@ EVENTID_FILENOTINITIALIZED
@ EVENTID_FILEWRITEERROR
The ComLogger encountered an error writing to a file.
@ EVENTID_FILEVALIDATIONERROR
The ComLogger encountered an error writing the validation file.
@ EVENTID_FILEOPENERROR
The ComLogger encountered an error opening a file.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
FwIndexType getNum_comIn_InputPorts() const
virtual void CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CloseFile.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
FwIndexType getNum_cmdResponseOut_OutputPorts() const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
FwIndexType getNum_pingIn_InputPorts() const
FwIndexType getNum_timeCaller_OutputPorts() const
void log_WARNING_LO_FileNotInitialized_ThrottleClear()
Reset throttle value for FileNotInitialized.
void invoke(U32 key)
Invoke a port interface.
void init()
Initialization function.
void addCallPort(InputPingPort *callPort)
Register an input port.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ OP_OK
Operation succeeded.