pres_ent.h

Go to the documentation of this file.
00001 /*
00002  * prese_ent.h
00003  *
00004  * Presence Entity classes for Opal
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  *
00008  * Copyright (c) 2009 Post Increment
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open Phone Abstraction Library.
00021  *
00022  * The Initial Developer of the Original Code is Post Increment
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Revision: 22858 $
00027  * $Author: csoutheren $
00028  * $Date: 2009-06-12 22:50:19 +1000 (Fri, 12 Jun 2009) $
00029  */
00030 
00031 #ifndef OPAL_IM_PRES_ENT_H
00032 #define OPAL_IM_PRES_ENT_H
00033 
00034 #include <ptlib.h>
00035 #include <opal/buildopts.h>
00036 
00037 #include <opal/manager.h>
00038 #include <ptclib/url.h>
00039 #include <sip/sipep.h>
00040 
00042 
00043 class OpalPresEntity : public PSafeObject
00044 {
00045   public:
00046     static const char * AddressOfRecordKey;
00047     static const char * AuthNameKey;
00048     static const char * AuthPasswordKey;
00049     static const char * FullNameKey;
00050     static const char * TimeToLiveKey;
00051 
00052     enum State {
00053       // basic states (from RFC 3863) - must be same order as SIPPresenceInfo::BasicStates
00054       Unknown         = SIPPresenceInfo::Unknown,
00055       Available,
00056       NotAvailable,
00057       Unchanged,
00058 
00059       // extended states (from RFC 4480) - must be same order as SIPPresenceInfo::ExtendedStates
00060       ExtendedBase    = 100,
00061       UnknownExtended = ExtendedBase + SIPPresenceInfo::UnknownExtended,
00062       Appointment,
00063       Away,
00064       Breakfast,
00065       Busy,
00066       Dinner,
00067       Holiday,
00068       InTransit,
00069       LookingForWork,
00070       Lunch,
00071       Meal,
00072       Meeting,
00073       OnThePhone,
00074       Other,
00075       Performance,
00076       PermanentAbsence,
00077       Playing,
00078       Presentation,
00079       Shopping,
00080       Sleeping,
00081       Spectator,
00082       Steering,
00083       Travel,
00084       TV,
00085       Vacation,
00086       Working,
00087       Worship
00088     };
00089 
00090     static OpalPresEntity * Create(
00091       const PString & url
00092     );
00093 
00094     virtual bool Open(
00095       OpalManager & manager
00096     );
00097 
00098     virtual bool Open(
00099       OpalManager & manager,
00100       const OpalGloballyUniqueID & uid
00101     ) = 0;
00102 
00103     virtual bool IsOpen() const = 0;
00104 
00105     virtual bool Close() = 0;
00106 
00107     virtual bool SetPresence(
00108       State state,
00109       const PString & note = PString::Empty()
00110     ) = 0;
00111 
00112     virtual bool RemovePresence() = 0;
00113   
00114     virtual bool HasAttribute(const PString & key) const
00115     { return m_attributes.Contains(key); }
00116 
00117     virtual PString GetAttribute(const PString & key, const PString & deflt = PString::Empty()) const
00118     { return m_attributes(key, deflt); }
00119 
00120     virtual void SetAttribute(const PString & key, const PString & value)
00121     { m_attributes.SetAt(key, value); }
00122 
00123 
00124   protected:
00125     OpalGloballyUniqueID m_guid;
00126 
00127     PStringToString m_attributes;
00128 };
00129 
00130 #endif  // OPAL_IM_PRES_ENT_H
00131 

Generated on Mon Aug 3 20:50:24 2009 for OPAL by  doxygen 1.5.1