presencefwsimpleadpt/inc/simpleplugingroups.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:    Simple Protocol implementation for Presence Framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CSIMPLEPLUGINGROUPS_H
       
    22 #define CSIMPLEPLUGINGROUPS_H
       
    23 
       
    24 #include <e32std.h>
       
    25 
       
    26 #include <ximpbase.h>
       
    27 #include <protocolpresentitygroups.h>
       
    28 
       
    29 #include <mrlspresxdmasynchandler.h>
       
    30 
       
    31 #include "simpleplugincommon.h"
       
    32 #include "msimplepluginconnectionobs.h"
       
    33 
       
    34 
       
    35 class TXIMPRequestId;
       
    36 class MXIMPIdentity;
       
    37 class MPresenceInfoFilter;
       
    38 class MProtocolPresentityGroupsDataHost;
       
    39 class MXIMPObjectCollection;
       
    40 
       
    41 class MSimpleWinfo;
       
    42 class CPresenceXDM;
       
    43 class CRLSXDM;
       
    44 class CXdmEngine;
       
    45 class CXdmDocument;
       
    46 
       
    47 
       
    48 /**
       
    49  * CSimplePluginGroups
       
    50  *
       
    51  * Simple Engine Connection
       
    52  *
       
    53  * @lib ?library
       
    54  * @since s60 v5.0
       
    55  */
       
    56 NONSHARABLE_CLASS( CSimplePluginGroups ) : public CActive,
       
    57     public MProtocolPresentityGroups
       
    58     {
       
    59 private:
       
    60 
       
    61 
       
    62     /**
       
    63      * Current operation
       
    64      */
       
    65     enum TPluginGroupsOperation
       
    66         {
       
    67         ENoOperation,
       
    68         ECreatePresentityGroup,
       
    69         EDeletePresentityGroup,
       
    70         EAddPresentityGroupMember,
       
    71         ERemovePresentityGroupMember,
       
    72         EGetListOfLists,
       
    73         EGetListContent
       
    74         };
       
    75 
       
    76     /**
       
    77      * Current actibe object state
       
    78      */
       
    79     enum TPluginGroupsState
       
    80         {
       
    81         EPluginIdle,
       
    82         EPluginInitXdm,
       
    83         EPluginFetchRls,
       
    84         EPluginAddGroupMember,
       
    85         EPluginRemoveGroupMember,
       
    86         EPluginCommitRls,
       
    87         EPluginCommitXdm,
       
    88         ERemoveGroupFromGranted        
       
    89         };
       
    90 
       
    91 public:
       
    92     /**
       
    93      * Constructor.
       
    94      * @param aObs callback for complete requests
       
    95      */
       
    96     static CSimplePluginGroups* NewL(
       
    97         MSimplePluginConnectionObs& aObs );
       
    98 
       
    99     virtual ~CSimplePluginGroups();
       
   100 
       
   101 
       
   102 
       
   103 private:
       
   104 
       
   105     CSimplePluginGroups(
       
   106         MSimplePluginConnectionObs& aObs );
       
   107 
       
   108     void ConstructL( );
       
   109 
       
   110 
       
   111 // from base class MXIMPBase
       
   112 public:
       
   113 
       
   114     /**
       
   115      * Defined in a base class
       
   116      */
       
   117     TAny* GetInterface(
       
   118         TInt32 aInterfaceId,
       
   119         TIfGetOps aOps );
       
   120 
       
   121     /**
       
   122      * Defined in a base class
       
   123      */
       
   124     const TAny* GetInterface(
       
   125         TInt32 aInterfaceId,
       
   126         TIfGetOps aOps ) const;
       
   127 
       
   128     /**
       
   129      * Defined in a base class
       
   130      */
       
   131     TInt32 GetInterfaceId() const;
       
   132 
       
   133 
       
   134 // from base class MProtocolPresentityGroups
       
   135 
       
   136     /**
       
   137      * Defined in a base class
       
   138      */
       
   139     void DoSubscribePresentityGroupListL(
       
   140                     TXIMPRequestId aReqId );
       
   141 
       
   142     /**
       
   143      * Defined in a base class
       
   144      */
       
   145     void DoUnsubscribePresentityGroupListL(
       
   146                     TXIMPRequestId aReqId );
       
   147 
       
   148     /**
       
   149      * Defined in a base class
       
   150      */
       
   151     void DoCreatePresentityGroupL(
       
   152                     const MXIMPIdentity& aGroupId,
       
   153                     const TDesC16& aDisplayName,
       
   154                     TXIMPRequestId aReqId );
       
   155 
       
   156     /**
       
   157      * Defined in a base class
       
   158      */
       
   159     void DoDeletePresentityGroupL(
       
   160                     const MXIMPIdentity& aGroupId,
       
   161                     TXIMPRequestId aReqId );
       
   162 
       
   163     /**
       
   164      * Defined in a base class
       
   165      */
       
   166     void DoUpdatePresentityGroupDisplayNameL(
       
   167                     const MXIMPIdentity& aGroupId,
       
   168                     const TDesC16& aDisplayName,
       
   169                     TXIMPRequestId aReqId );
       
   170 
       
   171     /**
       
   172      * Defined in a base class
       
   173      */
       
   174     void DoSubscribePresentityGroupContentL(
       
   175                     const MXIMPIdentity& aGroupId,
       
   176                     TXIMPRequestId aReqId );
       
   177 
       
   178     /**
       
   179      * Defined in a base class
       
   180      */
       
   181     void DoUnsubscribePresentityGroupContentL(
       
   182                     const MXIMPIdentity& aGroupId,
       
   183                     TXIMPRequestId aReqId );
       
   184 
       
   185     /**
       
   186      * Defined in a base class
       
   187      */
       
   188     void DoAddPresentityGroupMemberL(
       
   189                     const MXIMPIdentity& aGroupId,
       
   190                     const MXIMPIdentity& aMemberId,
       
   191                     const TDesC16& aMemberDisplayName,
       
   192                     TXIMPRequestId aReqId );
       
   193 
       
   194     /**
       
   195      * Defined in a base class
       
   196      */
       
   197     void DoRemovePresentityGroupMemberL(
       
   198                     const MXIMPIdentity& aGroupId,
       
   199                     const MXIMPIdentity& aMemberId,
       
   200                     TXIMPRequestId aReqId );
       
   201 
       
   202     /**
       
   203      * Defined in a base class
       
   204      */
       
   205     void DoUpdatePresentityGroupMemberDisplayNameL(
       
   206                     const MXIMPIdentity& aGroupId,
       
   207                     const MXIMPIdentity& aMemberId,
       
   208                     const TDesC16& aMemberDisplayName,
       
   209                     TXIMPRequestId aReqId );
       
   210 
       
   211 protected:
       
   212 
       
   213 // from base class CActive
       
   214 
       
   215     /**
       
   216      * Defined in a base class
       
   217      */
       
   218     void RunL();
       
   219 
       
   220     /**
       
   221      * Defined in a base class
       
   222      */
       
   223     TInt RunError( TInt aError );
       
   224 
       
   225     /**
       
   226      * Defined in a base class
       
   227      */
       
   228     void DoCancel();
       
   229 
       
   230 private:
       
   231 
       
   232     /**
       
   233      * Save presentity id
       
   234      * @param aPresentityId presentity id
       
   235      */
       
   236     void SetPresIdentityL(
       
   237         const MXIMPIdentity& aPresentityId );
       
   238 
       
   239     /**
       
   240      * Save presentity id
       
   241      * @param aPresentityId presentity id
       
   242      */
       
   243     void SetPresIdentity2L(
       
   244         const MXIMPIdentity& aPresentityId );
       
   245 
       
   246     /**
       
   247      * Calls MXIMPProtocolConnectionHost callback
       
   248      * @param aStatus error status
       
   249      */
       
   250     void CompletePrFwReq( TInt aStatus );
       
   251 
       
   252     /**
       
   253      * Start XDM operation
       
   254      */
       
   255     void StartXdmOperationL(
       
   256         TXIMPRequestId aReqId,
       
   257         TPluginGroupsOperation aOperation );
       
   258 
       
   259     /**
       
   260      * Start XDM operation
       
   261      */
       
   262     void StartXdmOperationL(
       
   263         const MXIMPIdentity& aId,
       
   264         TXIMPRequestId aReqId,
       
   265         TPluginGroupsOperation aOperation );
       
   266 
       
   267     /**
       
   268      * Start XDM operation
       
   269      */
       
   270     void StartXdmOperationL(
       
   271         const MXIMPIdentity& aId,
       
   272         const TDesC16& aDisplayName,
       
   273         TXIMPRequestId aReqId,
       
   274         TPluginGroupsOperation aOperation );
       
   275 
       
   276     /**
       
   277      * Start XDM operation
       
   278      */
       
   279     void StartXdmOperationL(
       
   280         const MXIMPIdentity& aId,
       
   281         const MXIMPIdentity& aMemberId,
       
   282         TXIMPRequestId aReqId,
       
   283         TPluginGroupsOperation aOperation );
       
   284 
       
   285     /**
       
   286      * Start XDM operation
       
   287      */
       
   288     void StartXdmOperationL(
       
   289         const MXIMPIdentity& aId,
       
   290         const MXIMPIdentity& aMemberId,
       
   291         const TDesC16& aDisplayName,
       
   292         TXIMPRequestId aReqId,
       
   293         TPluginGroupsOperation aOperation );              
       
   294 
       
   295     /**
       
   296      * Start XDM operation
       
   297      */
       
   298     void StartXdmOperationL();
       
   299     
       
   300     /**
       
   301      * Start XDM operation, StartXdmOperationL calls this.
       
   302      */
       
   303     void DoStartXdmOperationL( );      
       
   304 
       
   305     /**
       
   306      * Call CSimpleXdmUtils operation
       
   307      */
       
   308     void CallActualXdmOperationL();
       
   309 
       
   310     /**
       
   311      * Get list of the entity lists
       
   312      */
       
   313     void GetListOfListsL();
       
   314 
       
   315     /**
       
   316      * Get content of the entity list
       
   317      */
       
   318     void GetListContentL();
       
   319 
       
   320     /**
       
   321      * Yields to active scheduler and runs next RunL loop
       
   322      * @param aStatus error status
       
   323      */
       
   324     void CompleteMe( TInt aStatus );
       
   325     
       
   326     /**
       
   327      * Copy data from aLists and from aNames into aCollection
       
   328      * @param aNames group names [IN]
       
   329      * @param aNames group display names [IN]
       
   330      * @param aCollection collection of MPresentityGroupInfo [OUT]
       
   331      */         
       
   332     void CopyGroupArraysToCollectionL( 
       
   333         CDesCArrayFlat& aLists, CDesCArrayFlat& aNames, MXIMPObjectCollection& aCollection );  
       
   334         
       
   335     /**
       
   336      * Copy data from aIds and from aNames into aCollection
       
   337      * @param aNames group member names [IN]
       
   338      * @param aNames group member display names [IN]
       
   339      * @param aCollection collection of MPresentityGroupMemberInfo [OUT]
       
   340      */        
       
   341     void CopyGroupMembersToCollectionL( 
       
   342         CPtrCArray& aIds, CPtrCArray& aNames, MXIMPObjectCollection& aCollection);
       
   343         
       
   344         
       
   345     /**
       
   346      * Add presentity group
       
   347      * @param aGroupId group id
       
   348      * @param adispName display name
       
   349      */        
       
   350     void HandleCreatePresentityGroupL( 
       
   351         const TDesC& aGroupId, const TDesC& aDispName );
       
   352             
       
   353     /**
       
   354      * Delete presentity group
       
   355      * @param aGroupId group id
       
   356      */    
       
   357     void HandleDeletePresentityGroupL( const TDesC& aGroupId );
       
   358     
       
   359     /**
       
   360      * Add presentity group member
       
   361      */    
       
   362     void HandleAddPresentityGroupMemberL();
       
   363     
       
   364     /**
       
   365      * Remove group member
       
   366      */
       
   367     void HandleRemovePresentityGroupMemberL();
       
   368 
       
   369 
       
   370 
       
   371 private: // Data
       
   372 
       
   373     /**
       
   374      * PrFw Plugin connection observer
       
   375      */
       
   376     MSimplePluginConnectionObs& iConnObs;
       
   377 
       
   378     /**
       
   379      * XDM Settings id
       
   380      */
       
   381     TInt iSettingsId;
       
   382 
       
   383     /**
       
   384      * PrFW request id
       
   385      */
       
   386     TXIMPRequestId iPrFwId;
       
   387 
       
   388     /**
       
   389      * PrFW request id for own requests
       
   390      */
       
   391     TXIMPRequestId iPrFwIdOwn;
       
   392 
       
   393     /**
       
   394      * Simple Engine request id
       
   395      */
       
   396     TInt iSimpleId;
       
   397 
       
   398     /**
       
   399      * Subscribed items. Bitmask.
       
   400      */
       
   401     TUint iSubscribed;
       
   402 
       
   403     /**
       
   404      * Current operation
       
   405      */
       
   406     TPluginGroupsOperation iOperation;
       
   407 
       
   408     /**
       
   409      * Current presentity in progress
       
   410      * Own.
       
   411      */
       
   412     HBufC16* iPresIdentity;
       
   413 
       
   414     /**
       
   415      * Current presentity in progress
       
   416      * Own.
       
   417      */
       
   418     HBufC16* iPresIdentity2;
       
   419 
       
   420     /**
       
   421      * XDM Utils
       
   422      * Not own.
       
   423      */
       
   424     CSimplePluginXdmUtils* iXdmUtils;
       
   425 
       
   426     /**
       
   427      * Display name
       
   428      * Own
       
   429      */
       
   430     HBufC* iDisplayName;
       
   431 
       
   432     /**
       
   433      * Active object state
       
   434      */
       
   435     TPluginGroupsState iState;
       
   436 
       
   437     TBool iCompleted;
       
   438 
       
   439     };
       
   440 
       
   441 #endif // CSimplePluginGroups_H