TizenRT Public API  v2.0 M2
Messaging

Provides APIs for Messaging. More...

Files

file  messaging.h
 

Data Structures

struct  msg_send_data_s
 The structure of parameters which used for sending. More...
 
struct  msg_recv_buf_s
 The structure of parameters which used for receiving. More...
 
struct  msg_callback_info_s
 The structure of parameters which has callback information. More...
 

Macros

#define MSG_READ_YET   0
 These configs are used internally for getting receivers information before send. More...
 

Typedefs

typedef void(* msg_callback_t) (msg_reply_type_t msg_type, msg_recv_buf_t *recv_data, void *cb_data)
 Called when a message is received. More...
 

Enumerations

Functions

int messaging_send_sync (const char *port_name, msg_send_data_t *send_data, msg_recv_buf_t *reply_buf)
 Send(unicast) message with sync mode. More...
 
int messaging_send_async (const char *port_name, msg_send_data_t *send_data, msg_recv_buf_t *reply_buf, msg_callback_info_t *cb_info)
 Send(unicast) message with async mode. More...
 
int messaging_send (const char *port_name, msg_send_data_t *send_data)
 Send(unicast) message with noreply mode. More...
 
int messaging_reply (const char *port_name, pid_t sender_pid, msg_send_data_t *reply_data)
 Reply(unicast) message to specified message port. More...
 
int messaging_multicast (const char *port_name, msg_send_data_t *send_data)
 Send(multicast) message. More...
 
int messaging_recv_block (const char *port_name, msg_recv_buf_t *recv_buf)
 Wait to receive unicast message from specified message port. More...
 
int messaging_recv_nonblock (const char *port_name, msg_recv_buf_t *recv_buf, msg_callback_info_t *cb_info)
 Set the callback for receiving messages. More...
 
int messaging_cleanup (const char *port_name)
 Remove the messaging port information if this message port is not used anymore. More...
 

Detailed Description

Provides APIs for Messaging.

Macro Definition Documentation

#define MSG_READ_YET   0

These configs are used internally for getting receivers information before send.

MSG_READ_YET : There are more than CONFIG_MESSAGING_RECV_LIST_SIZE receivers, messaging f/w tries to read information again.
MSG_READ_ALL : All of the receivers' information is read for sending.

Definition at line 36 of file messaging.h.

Typedef Documentation

typedef void(* msg_callback_t) (msg_reply_type_t msg_type, msg_recv_buf_t *recv_data, void *cb_data)

Called when a message is received.

Definition at line 73 of file messaging.h.

Enumeration Type Documentation

The type of sending message.

MSG_REPLY_REQUIRED : Sender waits the reply until receiving reply from the receiver.
MSG_REPLY_NO_REQUIRED : Sender cannot receive the reply, and continues to run.

Definition at line 43 of file messaging.h.

Function Documentation

int messaging_cleanup ( const char *  port_name)

Remove the messaging port information if this message port is not used anymore.

#include <messaging/messaging.h>

Parameters
[in]port_nameThe message port name.
This API should be called from task/pthread who called
messaging_recv_nonblock or messaging_unicast_send_async.
If this API is not called, memory leak can happen.
Returns
On success, OK is returned. On failure, Error is returned.
Since
TizenRT v3.0
int messaging_multicast ( const char *  port_name,
msg_send_data_t send_data 
)

Send(multicast) message.

#include <messaging/messaging.h>
Sender sends the same message to multiple receiver who waits the same message port.

Parameters
[in]port_nameThe message port name to send.
[in]send_data
int messaging_recv_block ( const char *  port_name,
msg_recv_buf_t recv_buf 
)

Wait to receive unicast message from specified message port.

#include <messaging/messaging.h>

Parameters
[in]port_nameThe message port name to receive
recv_buf[out] buf : The message buffer to receive the message
[in] buflen : The length of message to receive
[out] sender_pid : The pid who sends this message
Returns
On success, Received message Type is returned. On failure, Error is returned.
Since
TizenRT v3.0
int messaging_recv_nonblock ( const char *  port_name,
msg_recv_buf_t recv_buf,
msg_callback_info_t cb_info 
)

Set the callback for receiving messages.

#include <messaging/messaging.h>

Parameters
[in]port_nameThe message port name to receive
recv_buf[out] buf : The message buffer to receive the message
[in] buflen : The length of message to receive
[out] sender_pid : The pid who sends this message
[in]
int messaging_reply ( const char *  port_name,
pid_t  sender_pid,
msg_send_data_t reply_data 
)

Reply(unicast) message to specified message port.

#include <messaging/messaging.h>
Receiver should pass sender_pid for replying.

Parameters
[in]port_nameThe message port name to send
This port name should be matched to original port name which received the message.
[in]reply_data
int messaging_send ( const char *  port_name,
msg_send_data_t send_data 
)

Send(unicast) message with noreply mode.

#include <messaging/messaging.h>
Sender sends the message, but cannot receive the reply. If receiver sends reply to this message port, messages are ignored.

Parameters
[in]port_nameThe message port name to send.
[in]send_data
int messaging_send_async ( const char *  port_name,
msg_send_data_t send_data,
msg_recv_buf_t reply_buf,
msg_callback_info_t cb_info 
)

Send(unicast) message with async mode.

#include <messaging/messaging.h>
Sender registers the reply callback and send the message.

Parameters
[in]port_nameThe message port name to send.
[in]send_data
int messaging_send_sync ( const char *  port_name,
msg_send_data_t send_data,
msg_recv_buf_t reply_buf 
)

Send(unicast) message with sync mode.

#include <messaging/messaging.h>
Sender waits after sending message until receiving the reply.

Parameters
[in]port_nameThe message port name to send.
[in]send_data