The Command Interpreter provides structures and functions for parsing incoming messages.
Features:
The application provides a MessageId Table which contains all supported MessageIds together with their belonging handler functions. The MessageId Table is an array of Ucs_Cmd_MsgId_t elements. Each element contains a MessageId (0x0000 .. 0xFFFF) and a pointer to the belonging handler function.
The application announces the MessageId Table with the function Ucs_Cmd_AddMsgIdTable(). It The connection to the MessageId Table can be removed with the function Ucs_Cmd_RemoveMsgIdTable().
A received message is given to Ucs_Cmd_DecodeMsg(). This function retrieves the MessageId from the message and returns a pointer the belonging handler function. The application can then call the handler function. This functions returns a 16 bit value. The application defines the meaning of the possible return values.
The following code example shows how the Command Interpreter API function can be used: