sipxmedialib  Version 3.3
Private Attributes | List of all members
MpSyncFlowgraphMsg Class Reference

Message used to communicate with a flowgraph with ability to wait for command completion and get its result. More...

#include <MpSyncFlowgraphMsg.h>

Inheritance diagram for MpSyncFlowgraphMsg:
Inheritance graph
[legend]
Collaboration diagram for MpSyncFlowgraphMsg:
Collaboration graph
[legend]

Public Member Functions

Creators
 MpSyncFlowgraphMsg (int msgType, OsEvent *pDoneEvent=NULL)
 Constructor. More...
 
 MpSyncFlowgraphMsg (const MpSyncFlowgraphMsg &rMsg)
 Copy constructor. More...
 
OsMsg * createCopy () const
 
 ~MpSyncFlowgraphMsg ()
 Destructor. More...
 
Manipulators
MpSyncFlowgraphMsgoperator= (const MpSyncFlowgraphMsg &rhs)
 Assignment operator. More...
 
Accessors
UtlSerialized & getData ()
 Get stored data. More...
 
OsEvent * getDoneEvent ()
 Get done-event. More...
 
- Public Member Functions inherited from MpFlowGraphMsg
 MpFlowGraphMsg (int msg, MpResource *pMsgDest=NULL, void *pPtr1=NULL, void *pPtr2=NULL, intptr_t int1=-1, intptr_t int2=-1)
 Constructor. More...
 
 MpFlowGraphMsg (const MpFlowGraphMsg &rMpFlowGraphMsg)
 Copy constructor. More...
 
virtual ~MpFlowGraphMsg ()
 Destructor. More...
 
MpFlowGraphMsgoperator= (const MpFlowGraphMsg &rhs)
 Assignment operator. More...
 
void setMsgDest (MpResource *pMsgDest)
 Set destination object of the message. More...
 
void setPtr1 (void *p)
 Sets pointer 1 (void*) of the media flow graph message. More...
 
void setPtr2 (void *p)
 Sets pointer 2 (void*) of the media flow graph message. More...
 
void setInt1 (intptr_t i)
 Sets integer 1 of the media flow graph message. More...
 
void setInt2 (intptr_t i)
 Sets integer 2 of the media flow graph message. More...
 
int getMsg (void) const
 Returns the type of the media flow graph message. More...
 
MpResourcegetMsgDest (void) const
 Get destination object of the message. More...
 
void * getPtr1 (void) const
 Return pointer 1 (void*) of the media flow graph message. More...
 
void * getPtr2 (void) const
 Return pointer 2 (void*) of the media flow graph message. More...
 
intptr_t getInt1 (void) const
 Return integer 1 of the media flow graph message. More...
 
intptr_t getInt2 (void) const
 Return integer 2 of the media flow graph message. More...
 

Private Attributes

OsEvent * mpDoneEvent
 
UtlSerialized mData
 Packed data to be passed to the resource,. More...
 

Additional Inherited Members

- Public Types inherited from MpFlowGraphMsg
enum  MpFlowGraphMsgType {
  FLOWGRAPH_ADD_LINK = 0, FLOWGRAPH_ADD_RESOURCE, FLOWGRAPH_DESTROY_RESOURCES, FLOWGRAPH_DISABLE,
  FLOWGRAPH_ENABLE, FLOWGRAPH_PROCESS_FRAME, FLOWGRAPH_REMOVE_CONNECTION, FLOWGRAPH_REMOVE_LINK,
  FLOWGRAPH_REMOVE_RESOURCE, FLOWGRAPH_DESTROY_RESOURCE, FLOWGRAPH_START, FLOWGRAPH_STOP,
  RESOURCE_DISABLE, RESOURCE_ENABLE, FLOWGRAPH_START_PLAY, FLOWGRAPH_START_TONE,
  FLOWGRAPH_STOP_PLAY, FLOWGRAPH_STOP_TONE, FLOWGRAPH_STOP_RECORD, FLOWGRAPH_SYNCHRONIZE,
  FLOWGRAPH_GET_LATENCY_FOR_PATH, RESOURCE_SPECIFIC_START = 100
}
 Phone set message types. More...
 

Detailed Description

Message used to communicate with a flowgraph with ability to wait for command completion and get its result.

This message does not own the event, thus it should be managed by some outside means. As a special case, you should use pointer to a static OsEvent variable with the great care. In this case you must wait infinitely until event fires - if you do timed wait, you leave an opportunity to leave scope of the event variable before it is fired, thus signal() will be called on the freed stack variable and will lead to segfault. Here is an example: OsEvent doneEvent; MpSyncFlowgraphMsg msg(MpFlowGraphMsg::FLOWGRAPH_GET_LATENCY_FOR_PATH, &doneEvent);

...

// Send the message stat = postMessage(msg); if (stat != OS_SUCCESS) { // handle error ... }

// Wait for result infinitely. stat = doneEvent.wait(OsTime::OS_INFINITY); if (stat != OS_SUCCESS) { // This mustn't happen, but just in case. ... }

// Retrieve result from the event. intptr_t tmp; doneEvent.getUserData(tmp); latency = tmp; doneEvent.getEventData(tmp); stat = (OsStatus)tmp;

return stat;

If you need a timed wait on done event, you must allocate event from heap and implement event hand off.

Constructor & Destructor Documentation

MpSyncFlowgraphMsg ( int  msgType,
OsEvent *  pDoneEvent = NULL 
)
inline

Constructor.

MpSyncFlowgraphMsg ( const MpSyncFlowgraphMsg rMsg)
inline

Copy constructor.

~MpSyncFlowgraphMsg ( )
inline

Destructor.

Member Function Documentation

OsMsg* createCopy ( void  ) const
inlinevirtual

Reimplemented from MpFlowGraphMsg.

MpSyncFlowgraphMsg & operator= ( const MpSyncFlowgraphMsg rhs)
inline

Assignment operator.

UtlSerialized & getData ( )
inline

Get stored data.

OsEvent * getDoneEvent ( )
inline

Get done-event.

Member Data Documentation

OsEvent* mpDoneEvent
private

Event to signal when command is finished and provide waiters with the result of operation. Event is not owned by this object.

UtlSerialized mData
private

Packed data to be passed to the resource,.