Public Member Functions | |
Messenger () | |
Default constructor. | |
Messenger (const Handler *pcHandler, const Looper *pcLooper=NULL) | |
Construct a messenger targeting a looper and optionally a specific handler. | |
Messenger (const Messenger &cMessenger) | |
Copy contructor. | |
Messenger (port_id hPort) | |
Construct a messenger from a loopers message port. | |
Messenger (const char *pzPort) | |
Construct a messenger for a named message port. | |
~Messenger () | |
Destructor. | |
Handler * | GetTarget (Looper **ppcLooper) const |
Get a pointer to the handler targeted by this handler. | |
bool | IsTargetLocal (void) const |
Check if the targeted handler/looper lives in the calling process. | |
bool | IsValid (void) const |
Check if the messenger is fully initialized. | |
status_t | LockTarget (void) const |
Lock the destination looper. | |
status_t | SendMessage (Message *pcMessage, Message *pcReply, bigtime_t nSendTimeOut=INFINITE_TIMEOUT, bigtime_t nReplyTimeOut=INFINITE_TIMEOUT) const |
Deliver a message syncronously. | |
status_t | SendMessage (Message *pcMessage, Handler *pcReplyHandler=NULL, bigtime_t nTimeOut=INFINITE_TIMEOUT) const |
Deliver message asyncronously. | |
status_t | SendMessage (int nCode, Message *pcReply=NULL) const |
Short for SendMessage( &Message( nCode ), pcReply ). | |
status_t | SendMessage (int nCode, Handler *pcReplyHandler) const |
Short for SendMessage( &Message( nCode ), pcReplyHandler ). | |
Messenger & | operator= (const Messenger &cMessenger) |
Copy the target from another messenger. | |
bool | operator== (const Messenger &cMessenger) const |
Compare two messengers. | |
Friends | |
class | Message |
class | ::SrvWidget |
class | ::SrvWindow |
class | ::SrvApplication |
class | ::SrvEvents |
class | NodeMonitor |
class | Event |
Messenger::Messenger | ( | ) |
pcHandler
is NULL the messenger will not have a specific target. Messages will be sendt to pcLooper
and it will be dispatched to the currently default Handler in that looper. If the looper don't have a default handler the message will be handled by the loopers own HandleMessage() member. pcHandler
is non-NULL the message will always be sent directly to this handler independent of which handler is active. In this case the target looper will be the looper pcHandler
is a member of and the pcLooper
parameter should be NULL. This means that only a handler that is added to a looper already can be targeted by a messenger. pcHandler | If non-NULL this specify the handler that will receive messages sendt by this messenger. The handler must already be added to a Looper with os::Looper::AddHandler(). | |
pcLooper | If pcHandler is NULL this parameter must point to valid os::Looper object. The looper will then receive the messages sendt and it will be dispatched to the current default handler or handled by the looper itself if there is no default handler. |
Messenger::Messenger | ( | const Messenger & | cMessenger | ) |
cMessenger | The messenger to copy. |
Messenger::Messenger | ( | port_id | hPort | ) |
hPort | The message port this messanger should send messages through. This will primarily come from os::Looper::GetMsgPort(). |
Messenger::Messenger | ( | const char * | pzPort | ) |
pzPort | The name of the message port this messenger should send messages through. |
Messenger::~Messenger | ( | ) |
ppcLooper | If non-NULL a pointer to the looper owning the target will be written here. |
bool Messenger::IsTargetLocal | ( | void | ) | const |
bool Messenger::IsValid | ( | void | ) | const |
status_t Messenger::LockTarget | ( | void | ) | const |
status_t Messenger::SendMessage | ( | Message * | pcMsg, | |
Message * | pcReply, | |||
bigtime_t | nSendTimeOut = INFINITE_TIMEOUT , |
|||
bigtime_t | nReplyTimeOut = INFINITE_TIMEOUT | |||
) | const |
pcReply
argument is non-NULL, this function will not return until we receive a reply from the target or the nReplyTimeOut occure. The messenger will create a temporary message port from which it receives the reply. If pcReply is NULL the member will return as soon as the pcMsg message is delivered. pcMsg | The message to deliver. The messages will be copyed and the caller keep ownership over the object. | |
pcReply | The message to fill out with the reply or NULL to skip waiting for a reply. | |
nSendTimeOut | Time to wait for a free slot in the receiving port before failing with errno == ETIME | |
nReplyTimeOut | Time to wait for reply before failing with errno == ETIME |
status_t Messenger::SendMessage | ( | Message * | pcMsg, | |
Handler * | pcReplyHandler = NULL , |
|||
bigtime_t | nTimeOut = INFINITE_TIMEOUT | |||
) | const |
pcMsg | The message to deliver. The messages will be copyed and the caller keep ownership over the object. | |
pcReplyHandler | The handler that should handle the reply or NULL if no reply is required. | |
nTimeOut | Time to wait for a free slot in the receiving port before failing with errno == ETIME |
status_t Messenger::SendMessage | ( | int | nCode, | |
Message * | pcReply = NULL | |||
) | const |
status_t Messenger::SendMessage | ( | int | nCode, | |
Handler * | pcReplyHandler | |||
) | const |
bool Messenger::operator== | ( | const Messenger & | cMessenger | ) | const |
Returns true if they target the same handler.
friend class Message [friend] |
friend class ::SrvWidget [friend] |
friend class ::SrvWindow [friend] |
friend class ::SrvApplication [friend] |
friend class ::SrvEvents [friend] |
friend class NodeMonitor [friend] |
friend class Event [friend] |