imsrv_plat/ximp_presence_cache_api/inc/presencecachewriter.h
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2007, 2008 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:  Interface for presence cache writer.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPRESENCECACHEWRITER_H
       
    19 #define MPRESENCECACHEWRITER_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <ximpbase.h>
       
    23 #include <presencemanagementifids.hrh>
       
    24 
       
    25 
       
    26 class MPresenceInfo;
       
    27 class MPersonPresenceInfo;
       
    28 class MPresenceInfoField;
       
    29 class MPresenceBuddyInfo;
       
    30 class MPersonPresenceInfo;
       
    31 class MPresCacheWriteHandler;
       
    32 class MPresenceBuddyInfoList;
       
    33 class MXIMPIdentity;
       
    34 class MPresenceObjectFactory;
       
    35 
       
    36 
       
    37 /**
       
    38  * Interface for presence cache writer API. This interface is implemented 
       
    39  * by the XIMP Framework Presence Cache client. Clients must call 
       
    40  * REComSession::FinalClose() from their destructors. Notice that an xsp id is
       
    41  * in the form ovi:xyz@example.com
       
    42  *
       
    43  * @ingroup ximpprescacheapi
       
    44  * @since S60 v3.2
       
    45  */
       
    46 class MPresenceCacheWriter //: public MXIMPBase
       
    47     {
       
    48 public:
       
    49 
       
    50     /** Interface ID for the MPresenceCacheWriter. */
       
    51     enum { KInterfaceId = XIMP_ECOM_IF_UID_PRESENCE_CACHE_WRITER };
       
    52 
       
    53 
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Factory method to instantiate MPresenceCacheWriter through 
       
    58      * the ECom.
       
    59      *
       
    60      * @return The new MPresenceCacheWriter object. Object
       
    61      *         ownership is returned to caller.
       
    62      */
       
    63     static inline MPresenceCacheWriter* NewL();
       
    64 
       
    65     /**
       
    66      * Public destructor.
       
    67      * Objects can be deleted through this interface.
       
    68      */
       
    69     virtual inline ~MPresenceCacheWriter();
       
    70     
       
    71 protected:
       
    72 
       
    73     /**
       
    74      * Default constructor to zero initialize
       
    75      * the iEcomDtorID member.
       
    76      */
       
    77     inline MPresenceCacheWriter();
       
    78 
       
    79 
       
    80 public: //Sub interfaces for presence cache writer, Synchonous methods
       
    81 
       
    82     /**
       
    83      * Writes presence info to cache for a given buddy. Leaves only in system
       
    84      * errors.
       
    85      *
       
    86      * @param aPresenceBuddyInfo contains xsp identity and presence
       
    87      * @return Error code
       
    88      */
       
    89     virtual TInt WritePresenceL(const MPresenceBuddyInfo* aPresenceBuddyInfo) = 0;
       
    90     
       
    91     
       
    92     /**
       
    93      * Instantiates new Presence object Factory object. With this factory presence
       
    94      * related ximp structures can be created.
       
    95      *
       
    96      * @return reference to MPresenceObjectFactory. No ownership to caller.
       
    97      */
       
    98     virtual MPresenceObjectFactory& PresenceObjectFactory() const = 0;
       
    99     
       
   100     
       
   101     /**
       
   102      * Instantiates new identity object.
       
   103      *
       
   104      * @return New Identity instance. Object ownership is returned to caller.
       
   105      * @leave KErrNoMemory if failed to allocate memory.
       
   106      */
       
   107     virtual MXIMPIdentity* NewIdentityLC() = 0;
       
   108 
       
   109 
       
   110     /**
       
   111      * Instantiates new presence info object.
       
   112      *
       
   113      * @return New presence info instance. Object ownership
       
   114      *         is returned to caller.
       
   115      * @leave KErrNoMemory if failed to allocate memory.
       
   116      */
       
   117     virtual MPresenceInfo* NewPresenceInfoLC() = 0;
       
   118     
       
   119     
       
   120     /**
       
   121      * Instantiates new buddy presence info object.
       
   122      *
       
   123      * @return New buddy presence info instance. Object ownership
       
   124      *         is returned to caller.
       
   125      * @leave KErrNoMemory if failed to allocate memory.
       
   126      */
       
   127     virtual MPresenceBuddyInfo* NewBuddyPresenceInfoLC() = 0;
       
   128     
       
   129     /**
       
   130      * Instantiates new buddy presence info list object.
       
   131      *
       
   132      * @param aServiceName service name for this list, if set to KNullDesC
       
   133      *        the list can be appended with identities from different services
       
   134      * @return New buddy presence info list instance. Object ownership
       
   135      *         is returned to caller.
       
   136      * @leave KErrNoMemory if failed to allocate memory.
       
   137      */
       
   138     virtual MPresenceBuddyInfoList* NewPresenceBuddyInfoListLC(const TDesC& aServiceName) = 0;
       
   139     
       
   140     
       
   141     /**
       
   142      * Delete all buddies presence associated with given service.
       
   143      *
       
   144      * @param aServiceName service name as in sp table
       
   145      * @return error code
       
   146      */
       
   147     virtual TInt DeleteService(const TDesC& aServiceName) = 0;
       
   148     
       
   149     /**
       
   150      * Deletes all presence related to given xsp identity.
       
   151      * Leaves only in system errors.
       
   152      *
       
   153      * @param MXIMPIdentity identity for buddy to be removed, in xsp format
       
   154      * @return error code
       
   155      */
       
   156     virtual TInt DeletePresenceL(const MXIMPIdentity& aIdentity) = 0;
       
   157     
       
   158     /**
       
   159      * Cancels any async. write operation going on. After calling this
       
   160      * method no callback will be received from asycn write method.
       
   161      *
       
   162      * @return error code, KErrNone if successfully cancelled.
       
   163      */
       
   164     virtual TInt CancelWrite() = 0;
       
   165     
       
   166 
       
   167 public: //Sub interfaces for presence cache writer, Asynchronous methods
       
   168 
       
   169     /**
       
   170      * Writes buddy presence info objects to cache. Returns in 
       
   171      * MPresCacheWriteHandler's HandlePresenceWriteL. Provide a null pointer
       
   172      * to receive no call back. Leaves only in system errors.
       
   173      *
       
   174      * @param aBuddyPresenceInfos presence infos for all buddies. 
       
   175      *         Ownership remains to caller.
       
   176      * @param MPresCacheWriterHandler to handle async calls. A 'NULL' pointer
       
   177      *         can be provided to receive no call back.
       
   178      * @return TInt error code.
       
   179      */    
       
   180     virtual TInt WritePresenceL(const MPresenceBuddyInfoList* aBuddyPresenceInfos,
       
   181                                     MPresCacheWriteHandler* aHandler) = 0;
       
   182 
       
   183    
       
   184 private: // Data
       
   185 
       
   186     //OWN: ECom destructor ID
       
   187     TUid iEcomDtorID;
       
   188     };
       
   189 
       
   190 #include <presencecachewriter.inl>
       
   191 
       
   192 
       
   193 #endif // MPRESENCECACHEWRITER_H