Public Member Functions | |
Event () | |
Creates a new event. | |
~Event () | |
Deletes an event. | |
status_t | SetToRemote (String zID, int nIndex=0) |
Sets the object to a specific event. | |
void | Unset () |
Unsets the event. | |
bool | IsRemote () |
Returns whether the object is set to a remote event. | |
status_t | GetRemoteInfo (proc_id *pnProcess, port_id *phPort, int *pnMessageCode, os::String *pzDesc) |
Returns information about a remote event. | |
status_t | GetRemoteChildren (std::vector< os::String > *pacList) |
Returns a list of children. | |
status_t | SetMonitorEnabled (bool bEnabled, Handler *pcTarget=NULL, int nMessageCode=-1) |
Enables/Disables a monitor to an id string. | |
bool | IsMonitorEnabled () |
Returns whether monitoring of the event is enabled. | |
status_t | PostEvent (Message *pcData, Handler *pcReplyHandler=NULL, int nReplyCode=M_REPLY) |
Posts an event. | |
status_t | GetLastEventMessage (os::Message *cReply) |
Returns the last message sent to the monitors. | |
Static Public Member Functions | |
static Event * | Register (String zID, String zDescription, Handler *pcTarget, int nMessageCode, uint32 nFlags=0) |
Registers an event. | |
Classes | |
class | Private |
m_pcTestEvent = new os::Event(); m_pcTestEvent->Register( "app/TestApp/GetTestString", "This is a test event" (description), this (handler), MSG_GET_TEST_STRING );
case MSG_GET_TEST_STRING: { if( !pcMessage->IsSourceWaiting() ) break; int32 nCode; pcMessage->FindInt32( "reply_code", &nCode ); os::Message cReply( nCode ); cReply.AddString( "test_string", "This is a test" ); pcMessage->SendReply( &cReply ); break; }
delete( m_pcTestEvent );
os::Event cEvent; if( cEvent.SetToRemote( "app/TestApp/GetTestString", 0 (index) ) == 0 ) { os::Message cMsg; cEvent.PostEvent( &cMsg, this (reply handler), MSG_REPLY (reply message code) ); }
case MSG_REPLY: { os::String zTestString; if( pcMessage->FindString( "test_string", &zTestString ) != 0 ) break; ... break; }
m_pcMonitorEvent = new os::Event(); m_pcMonitorEvent->SetToRemote( "app/TestApp/GetTestString", -1 ); m_pcMonitorEvent->SetMonitorEnabled( true, this (handler), MSG_EVENT_CHANGED (code) );
Event::Event | ( | ) |
Event::~Event | ( | ) |
Event * Event::Register | ( | String | zID, | |
String | zDescription, | |||
os::Handler * | pcTarget, | |||
int | nMessageCode, | |||
uint32 | nFlags = 0 | |||
) | [static] |
zID | - ID string. | |
zDescription | - Description of the call. | |
pcTarget | - Handler that will receive the calls. It needs to be added to a handler. | |
nMessageCode | - The code of the message that will be sent to the looper. The message can include additional data provided by the caller. | |
nFlags | - Flags. |
status_t Event::SetToRemote | ( | String | zID, | |
int | nIndex = 0 | |||
) |
zID | - ID string. | |
nIndex | - Index of the string. |
void Event::Unset | ( | ) |
bool Event::IsRemote | ( | ) |
status_t Event::GetRemoteInfo | ( | proc_id * | pnProcess, | |
port_id * | phPort, | |||
int * | pnMessageCode, | |||
os::String * | pzDesc | |||
) |
status_t Event::GetRemoteChildren | ( | std::vector< os::String > * | pacList | ) |
status_t Event::SetMonitorEnabled | ( | bool | bEnabled, | |
os::Handler * | pcTarget = NULL , |
|||
int | nMessageCode = -1 | |||
) |
bEnabled | - Enables/Disables the monitor. | |
pcTarget | - Handler that should receive the monitor messages. | |
nMessageCode | - The code of the message that will be sent to the looper. The message can include additional data provided by the caller. |
bool Event::IsMonitorEnabled | ( | ) |
status_t Event::PostEvent | ( | Message * | pcData, | |
Handler * | pcReplyHandler = NULL , |
|||
int | nReplyCode = M_REPLY | |||
) |
pcData | - Data that will be submitted. | |
pcReplyHandler | - Handler for the reply message. Can be NULL for remote calls and has to be NULL if you have registered the event. | |
nReplyCode | - The code for the reply. |
status_t Event::GetLastEventMessage | ( | os::Message * | cReply | ) |
pcReply | - The message content will be copied to this message. |