282 #define E_MSG_TYPE_UNKNOWN ( E_MSG + 0x01 )
283 #define E_MSG_TYPE_UNKNOWN_DESCR "Unknown message"
284 #define E_MSG_FUNCTION ( E_MSG + 0x02 )
285 #define E_MSG_FUNCTION_DESCR "Function error"
286 #define E_MSG_CLASS_UNSUPPORT ( E_MSG + 0x03 )
287 #define E_MSG_CLASS_UNSUPPORT_DESCR "Class not supported"
367 bool msgTxError(
MsgId *
id,
int errCode,
const char * errMsg,
const char * name);
441 #define MSG_CMD(CMD_TYPE, CMD_STUB) \
442 bool _msg ## CMD_STUB (MsgId * id, DataBuffer * buf);
448 #define MSG_EVT(EVT_TYPE, EVT_STUB) \
449 void _evt ## EVT_STUB (MsgId * id, DataBuffer * buf);
void msgGetEvtTarget(SockAddr *sockAddr)
Returns the event target address.
void _msgTx(SockAddr *addr, uint8_t *data, int len)
Stub function, invoked by RMT when sending a MCF packet.
bool msgStopStoreCmds()
Stops the storage of commands.
bool msgTxEvent(int msgType, DataBuffer *buf)
Invoked to send an event.
Message Container Format formatter / parser.
void _msgRxCmd(MsgId id, DataBuffer *buf)
Invoked when a command is received.
const char * errGetDescr()
Returns the last error description, if any, else null.
bool msgStartStoreCmds(SockAddr *client, DataBuffer *target)
Indicates that the next commands received should be stored.
static bool msgTxCurError(MsgId *id)
Invoke to reply the current global error.
Defines a DataBuffer structure.
uint16_t msgType
the message type
void msgSetEvtTarget(SockAddr *sockAddr)
Set the target for all events, or pass NULL to unset.
Combination of IP address and port.
Manages the global system error.
#define MSG_COMMANDS
List containing all commands.
bool msgTxReply(MsgId *id, DataBuffer *buf)
Invoke to send a reply.
DataBuffer reads and writes data into a buffer in the same format as defined in the data Java DataOut...
bool msgTxError(MsgId *id, int errCode, const char *errMsg, const char *name)
Invoke to send an error response.
void msgRx(SockAddr *addr, uint8_t *data, int len)
Receive a packet with data as a command.
void errClear()
Clears the current error.
bool msgRxBufCheck(DataBuffer *buf)
Checks the received buffer, and logs an error if there is something wrong.
#define MSG_EVENTS
List containing all events.
uint32_t errGet()
Returns the last error code, or null.
This module is responsible for distributing error codes.
Defines all remote commands.
SockAddr addr
the address of the sender
If defined, events will not require an acknowledge.
const char * errGetName()
Returns the last error cause name, or null.
static bool msgTxReplyAck(MsgId *id)
Replies a simple ACK with no content.
uint16_t msgId
the message identifier
bool msgExecCmds(SockAddr client, DataBuffer *commands, DataBuffer *replies)
Executes the given commands in the databuffer as if they where send by the 'client' address...