OPAL  Version 3.10.10
OpalPresentityWithCommandThread Class Reference

#include <pres_ent.h>

Inheritance diagram for OpalPresentityWithCommandThread:
OpalPresentity

Public Member Functions

Overrides from OpalPresentity
virtual bool SendCommand (OpalPresentityCommand *cmd)
 
new functions
void StartThread (bool startQueue=true)
 
void StopThread ()
 
void StartQueue (bool startQueue=true)
 
- Public Member Functions inherited from OpalPresentity
virtual void SetAOR (const PURL &aor)
 
void Internal_SendMessageToCommand (const OpalSendMessageToCommand &cmd)
 
virtual bool Open ()
 
virtual bool IsOpen () const
 
virtual bool Close ()
 
 ~OpalPresentity ()
 
PStringOptions & GetAttributes ()
 < Get the attributes for this presentity. More...
 
virtual PStringArray GetAttributeNames () const =0
 Get all attribute types for this presentity class. More...
 
virtual PStringArray GetAttributeTypes () const =0
 
const PURL & GetAOR () const
 
virtual bool SubscribeToPresence (const PURL &presentity, bool subscribe=true, const PString &note=PString::Empty())
 
virtual bool UnsubscribeFromPresence (const PURL &presentity)
 
virtual bool SetPresenceAuthorisation (const PURL &presentity, Authorisation authorisation)
 
virtual bool SetLocalPresence (OpalPresenceInfo::State state, const PString &note=PString::Empty())
 
virtual bool GetLocalPresence (OpalPresenceInfo::State &state, PString &note)
 
template<class cls >
__inline cls * CreateCommand ()
 
virtual void OnAuthorisationRequest (const AuthorisationRequest &request)
 
void SetAuthorisationRequestNotifier (const AuthorisationRequestNotifier &notifier)
 Set the notifier for the OnAuthorisationRequest() function. More...
 
virtual void OnPresenceChange (const OpalPresenceInfo &info)
 
void SetPresenceChangeNotifier (const PresenceChangeNotifier &notifier)
 Set the notifier for the OnPresenceChange() function. More...
 
virtual BuddyStatus GetBuddyListEx (BuddyList &buddies)
 
virtual bool GetBuddyList (BuddyList &buddies)
 
virtual BuddyStatus SetBuddyListEx (const BuddyList &buddies)
 
virtual bool SetBuddyList (const BuddyList &buddies)
 
virtual BuddyStatus DeleteBuddyListEx ()
 
virtual bool DeleteBuddyList ()
 
virtual BuddyStatus GetBuddyEx (BuddyInfo &buddy)
 
virtual bool GetBuddy (BuddyInfo &buddy)
 
virtual BuddyStatus SetBuddyEx (const BuddyInfo &buddy)
 
virtual bool SetBuddy (const BuddyInfo &buddy)
 
virtual BuddyStatus DeleteBuddyEx (const PURL &presentity)
 
virtual bool DeleteBuddy (const PURL &presentity)
 
virtual BuddyStatus SubscribeBuddyListEx (PINDEX &successfulCount, bool subscribe=true)
 
virtual bool SubscribeBuddyList (bool subscribe=true)
 
virtual BuddyStatus UnsubscribeBuddyListEx ()
 
virtual bool UnsubscribeBuddyList ()
 
virtual bool SendMessageTo (const OpalIM &message)
 
virtual void OnReceivedMessage (const OpalIM &message)
 
void SetReceivedMessageNotifier (const ReceivedMessageNotifier &notifier)
 Set the notifier for the OnPresenceChange() function. More...
 

Protected Types

typedef std::queue< OpalPresentityCommand * > CommandQueue
 

Protected Member Functions

void ThreadMain ()
 
- Protected Member Functions inherited from OpalPresentity
OpalPresentityCommandInternalCreateCommand (const char *cmdName)
 
 OpalPresentity ()
 Construct the presentity class. More...
 
 OpalPresentity (const OpalPresentity &other)
 

Protected Attributes

CommandQueue m_commandQueue
 
PMutex m_commandQueueMutex
 
PAtomicInteger m_commandSequence
 
PSyncPoint m_commandQueueSync
 
bool m_threadRunning
 
bool m_queueRunning
 
PThread * m_thread
 
- Protected Attributes inherited from OpalPresentity
OpalManagerm_manager
 
PGloballyUniqueID m_guid
 
PURL m_aor
 
PStringOptions m_attributes
 
AuthorisationRequestNotifier m_onAuthorisationRequestNotifier
 
PresenceChangeNotifier m_onPresenceChangeNotifier
 
ReceivedMessageNotifier m_onReceivedMessageNotifier
 
PAtomicBoolean m_open
 
PMutex m_notificationMutex
 
bool m_temporarilyUnavailable
 
OpalPresenceInfo::State m_localState
 our presentity state More...
 
PString m_localStateNote
 Additional note attached to the. More...
 

Construction

 OpalPresentityWithCommandThread ()
 Construct the presentity class that uses a command thread. More...
 
 OpalPresentityWithCommandThread (const OpalPresentityWithCommandThread &other)
 
 ~OpalPresentityWithCommandThread ()
 

Additional Inherited Members

- Public Types inherited from OpalPresentity
enum  Authorisation {
  AuthorisationPermitted, AuthorisationDenied, AuthorisationDeniedPolitely, AuthorisationConfirming,
  AuthorisationRemove, NumAuthorisations
}
 Authorisation modes for SetPresenceAuthorisation() More...
 
typedef PNotifierTemplate< const AuthorisationRequest & > AuthorisationRequestNotifier
 
typedef PNotifierTemplate< const OpalPresenceInfo & > PresenceChangeNotifier
 
enum  BuddyStatus {
  BuddyStatus_GenericFailure = -1, BuddyStatus_OK = 0, BuddyStatus_SpecifiedBuddyNotFound, BuddyStatus_ListFeatureNotImplemented,
  BuddyStatus_ListTemporarilyUnavailable, BuddyStatus_ListMayBeIncomplete, BuddyStatus_BadBuddySpecification, BuddyStatus_ListSubscribeFailed,
  BuddyStatus_AccountNotLoggedIn
}
 
typedef std::list< BuddyInfoBuddyList
 
typedef PNotifierTemplate< const OpalIM & > ReceivedMessageNotifier
 
- Static Public Member Functions inherited from OpalPresentity
static OpalPresentityCreate (OpalManager &manager, const PURL &url, const PString &scheme=PString::Empty())
 
static const PCaselessString & AuthNameKey ()
 Key for authentication name attribute. More...
 
static const PCaselessString & AuthPasswordKey ()
 Key for authentication password attribute. More...
 
static const PCaselessString & TimeToLiveKey ()
 Key for Time-To-Live attribute, in seconds for underlying protocol. More...
 

Detailed Description

Representation of a presence identity that uses a background thread to process commands.

Member Typedef Documentation

◆ CommandQueue

Constructor & Destructor Documentation

◆ OpalPresentityWithCommandThread() [1/2]

OpalPresentityWithCommandThread::OpalPresentityWithCommandThread ( )
protected

Construct the presentity class that uses a command thread.

◆ OpalPresentityWithCommandThread() [2/2]

OpalPresentityWithCommandThread::OpalPresentityWithCommandThread ( const OpalPresentityWithCommandThread other)
protected

◆ ~OpalPresentityWithCommandThread()

OpalPresentityWithCommandThread::~OpalPresentityWithCommandThread ( )

Destory the presentity class that uses a command thread. Note this will block until the background thread has stopped.

Member Function Documentation

◆ SendCommand()

virtual bool OpalPresentityWithCommandThread::SendCommand ( OpalPresentityCommand cmd)
virtual

Lowlevel function to send a command to the presentity handler. All commands are asynchronous. They will usually initiate an action for which an indication (callback) will give a result.

The default implementation queues the command for the background thread to handle.

Returns true if the command was queued. Note that this does not mean the command succeeded, only that the underlying protocol is processing commands, that is the backgrund thread is running

Parameters
cmdCommand to execute

Reimplemented from OpalPresentity.

◆ StartQueue()

void OpalPresentityWithCommandThread::StartQueue ( bool  startQueue = true)

Start/resume processing of queue commands

◆ StartThread()

void OpalPresentityWithCommandThread::StartThread ( bool  startQueue = true)

Start the background thread to handle commands. This is typically called from the concrete classes Open() function.

If the argument is true (the default) then the thread starts processing queue entries ASAP.

If the argument is false, the thread is still created and still runs, but it does not process queue entries. This allows for presenties that may need to allow commands to be paused, for example during initialisation

◆ StopThread()

void OpalPresentityWithCommandThread::StopThread ( )

Stop the background thread to handle commands. This is typically called from the concrete classes Close() function. It is also called fro the destructor to be sure the thread has stopped before the object is destroyed.

◆ ThreadMain()

void OpalPresentityWithCommandThread::ThreadMain ( )
protected

Field Documentation

◆ m_commandQueue

CommandQueue OpalPresentityWithCommandThread::m_commandQueue
protected

◆ m_commandQueueMutex

PMutex OpalPresentityWithCommandThread::m_commandQueueMutex
protected

◆ m_commandQueueSync

PSyncPoint OpalPresentityWithCommandThread::m_commandQueueSync
protected

◆ m_commandSequence

PAtomicInteger OpalPresentityWithCommandThread::m_commandSequence
protected

◆ m_queueRunning

bool OpalPresentityWithCommandThread::m_queueRunning
protected

◆ m_thread

PThread* OpalPresentityWithCommandThread::m_thread
protected

◆ m_threadRunning

bool OpalPresentityWithCommandThread::m_threadRunning
protected

The documentation for this class was generated from the following file: