Send a basic message
To send a message, you have to:
- Create a message variable
- Set the target_mode
- Set the target
- Set the cmd
- Set your data size
- Set your data
- Send it.
// Create and fill the message info
msg_t pub_msg;
pub_msg.header.target_mode = SERVICEID;
pub_msg.header.target = msg->header.source;
pub_msg.header.cmd = IO_STATE;
pub_msg.header.size = sizeof(char);
pub_msg.data[0] = 0x01;
Luos_SendMsg(service, &pub_msg);
infos
- The function Luos_SendMsg returns an error_status that informs the user whether the message was stored in a buffer and is ready to be sent. User can monitor the returned value to be sure that the message will be sent.
- The Luos_SendMsg function is non blocking. This function loads the message into a Luos engine memory and Luos engine, leaded by your hardware, will send it as soon as possible.