simpledatamodeladapter/inc/presencepluginentitywatcher.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  IETF SIMPLE Protocol implementation for XIMP Framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPRESENCEPLUGINENTITYWATCHER_H
       
    20 #define CPRESENCEPLUGINENTITYWATCHER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ximpbase.h>
       
    24 #include <protocolpresencewatching.h>
       
    25 #include <msimplewatcherobserver.h>
       
    26 #include "presenceplugincommon.h"
       
    27 #include "mpresencepluginconnectionobs.h"
       
    28 #include "presencelogger.h"
       
    29 
       
    30 class TXIMPRequestId;
       
    31 class MSimpleDocument;
       
    32 class MSimpleWatcher;
       
    33 class CPresencePluginWatcher;
       
    34 class MSimpleConnection;
       
    35 class CPresencePluginData;
       
    36  
       
    37 /**
       
    38  * CPresencePluginEntityWatcher
       
    39  *
       
    40  * Simple Engine Connection
       
    41  *
       
    42  * @lib presenceplugin.dll
       
    43  * @since S60 v3.2
       
    44  */
       
    45 NONSHARABLE_CLASS( CPresencePluginEntityWatcher ): public CBase,
       
    46     public MSimpleWatcherObserver
       
    47     {
       
    48     private:
       
    49         
       
    50     /**
       
    51     * Current operation
       
    52     */
       
    53 	enum TPluginEntityWatcherOperation
       
    54         {
       
    55         EPluginIdle,
       
    56         EPluginStop,
       
    57         EPluginStart,
       
    58         EPluginModify,
       
    59         EPluginStartNotifyClient
       
    60         };
       
    61             
       
    62     public:
       
    63        
       
    64         /**
       
    65          * Constructor.
       
    66          * @param aObs callback for complete requests
       
    67          * @param aConn Simple Engine connection
       
    68          * @param aHost XIMP connection host 
       
    69          */ 
       
    70         static CPresencePluginEntityWatcher* NewL(
       
    71             MPresencePluginConnectionObs& aObs,
       
    72             MSimpleConnection& aConn,
       
    73        		CPresencePluginWatcher& aWatcher,
       
    74         	CPresencePluginData* aPresenceData );
       
    75         	
       
    76         /**
       
    77          * Standard C++ destructor
       
    78          */
       
    79         virtual ~CPresencePluginEntityWatcher();
       
    80       
       
    81         /**
       
    82          * Access Request id
       
    83          *
       
    84          * @since S60 3.2 
       
    85          * @return XIMP request id
       
    86          */
       
    87         TXIMPRequestId XIMPRequestId();
       
    88         
       
    89         /**
       
    90          * Access Presentity id
       
    91          *
       
    92          * @since S60 3.2 
       
    93          * @return Presentity id
       
    94          */    
       
    95          TPtrC8 PresentityId(); 
       
    96         
       
    97         /**
       
    98          * Start subscribe
       
    99          *
       
   100          * @since S60 3.2 
       
   101          * @param aPresentityId presentity id
       
   102          */
       
   103         void StartSubscribeL( const TDesC8& aPresentityId );  
       
   104         
       
   105         /**
       
   106          * Start subscribe
       
   107          *
       
   108          * @since S60 5.0
       
   109          * @param aPresentityId presentity id
       
   110          * @param aClientRequst client status to complete
       
   111          */        
       
   112         void StartSubscribeL(
       
   113             const TDesC8& aPresentityId, 
       
   114             TRequestStatus& aClientRequst );
       
   115         
       
   116         /**
       
   117          * Stop Subscrib
       
   118          *
       
   119          * @since S60 3.2 
       
   120 		 * @param none
       
   121          * @return none         
       
   122          */
       
   123         void StopSubscribeL();
       
   124         
       
   125         /**
       
   126          * Stop subscribe
       
   127          *
       
   128          * @since S60 5.0
       
   129          * @param aClientRequst client status to complete
       
   130          */                
       
   131         void StopSubscribeL( 
       
   132             TRequestStatus& aClientRequst );
       
   133         
       
   134         /**
       
   135          * Set active status to XIMP
       
   136          *
       
   137          * @since S60 3.2
       
   138          * @param none
       
   139          * @return none
       
   140          */
       
   141         void SetActiveToXIMPL( const TDesC& aIdentity );
       
   142         
       
   143         /**
       
   144          * Set terminated status to XIMP
       
   145          *
       
   146          * @since S60 3.2
       
   147          * @param aIdentity identity
       
   148          * @return none
       
   149          */
       
   150         void SetTerminatedToXIMPL( const TDesC& aIdentity );
       
   151         
       
   152     private:
       
   153     
       
   154         /**
       
   155          * Standard C++ constructor
       
   156          * 
       
   157          * @param aObs, connection observer
       
   158          * @param aConn, SIMPLE connection
       
   159          * @param aWatcher, plugin watcher
       
   160          */ 
       
   161         CPresencePluginEntityWatcher(
       
   162             MPresencePluginConnectionObs& aObs,
       
   163             MSimpleConnection& aConn,
       
   164             CPresencePluginWatcher& aWatcher );
       
   165 
       
   166         /**
       
   167          * Performs the 2nd phase of construction.
       
   168          *
       
   169          * @since S60 3.2 
       
   170          * @param none
       
   171          * @param none
       
   172          */ 
       
   173         void ConstructL( CPresencePluginData* aPresenceData );
       
   174 
       
   175     public: // from base class MSimpleWatcherObserver
       
   176 
       
   177         /**
       
   178          * Defined in a base class
       
   179          */
       
   180         void WatcherReqCompleteL( TInt aOpId, TInt aStatus );
       
   181 
       
   182         /**
       
   183          * Defined in a base class
       
   184          */
       
   185         void WatcherNotificationL( MSimpleDocument& aDocument );
       
   186 
       
   187         /**
       
   188          * Defined in a base class
       
   189          */
       
   190         void WatcherListNotificationL( MSimplePresenceList& aList );
       
   191 
       
   192         /**
       
   193          * Defined in a base class
       
   194          */
       
   195         void WatcherTerminatedL(
       
   196             TInt aOpId, TInt aReason );
       
   197                 
       
   198     private:
       
   199         
       
   200         /**
       
   201          * Set active status to XIMP
       
   202          *
       
   203          * @since S60 3.2
       
   204          * @param none
       
   205          * @return none
       
   206          */
       
   207         void SetActiveToXIMPL( MSimpleDocument& aDocument );
       
   208         
       
   209         /**
       
   210          * Set terminated status to XIMP
       
   211          *
       
   212          * @since S60 3.2
       
   213          * @param none
       
   214          * @return none
       
   215          */
       
   216         void SetTerminatedToXIMPL( );
       
   217         
       
   218         /**
       
   219          * Set pending status to XIMP
       
   220          *
       
   221          * @since S60 3.2
       
   222          * @param none
       
   223          * @return none
       
   224          */
       
   225         void SetPendingToXIMPL( );
       
   226 
       
   227         /**
       
   228          * Completes client request
       
   229          *
       
   230          * @since S60 5.0
       
   231          * @param aStatus, complete code
       
   232          * @return none
       
   233          */
       
   234         void CompleteClientReq( TInt aStatus );
       
   235            
       
   236     private: // Data
       
   237 
       
   238         /**
       
   239          * XIMP Plugin connection observer
       
   240          */
       
   241         MPresencePluginConnectionObs& iConnObs;
       
   242         
       
   243         /**
       
   244          * SIMPLE engine connection
       
   245          * Not Own.
       
   246          */
       
   247         MSimpleConnection& iConnection;
       
   248         
       
   249         /**
       
   250          * SIMPLE engine watcher
       
   251          * Own.
       
   252          */
       
   253         MSimpleWatcher* iWatcher;    
       
   254         
       
   255         /**
       
   256          * PrFW request id
       
   257          * Own.
       
   258          */
       
   259         TXIMPRequestId iXIMPId;
       
   260         
       
   261         /**
       
   262          * Subscribed entity Id.
       
   263          * Own.
       
   264          */
       
   265         HBufC8* iEntityId; 
       
   266              
       
   267         /**
       
   268          * Simple Engine request id
       
   269          * Own.
       
   270          */
       
   271         TInt iSimpleId;
       
   272                           
       
   273         /**
       
   274          * host class
       
   275          * Own.
       
   276          */
       
   277         CPresencePluginWatcher& iPluginWatcher;
       
   278         
       
   279         /**
       
   280          * current pending operation
       
   281          * Own.
       
   282          */
       
   283         TPluginEntityWatcherOperation iOperation;
       
   284         
       
   285         /**
       
   286          * instance to Presence data
       
   287          * Own.
       
   288          */
       
   289         CPresencePluginData* iPresenceData;
       
   290 
       
   291         /**
       
   292          * Client status.
       
   293          * Not own.
       
   294          */
       
   295         TRequestStatus* iClientStatus;                
       
   296 
       
   297         SIMPLE_UNIT_TEST( T_CPresencePluginEntityWatcher )
       
   298         SIMPLE_UNIT_TEST( T_CPresencePluginWatcher )        
       
   299     };
       
   300 
       
   301 #endif // CPRESENCEPLUGINENTITYWATCHER_H