presencecache/inc/presencecachewriter2.h
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 /*
       
     2 * Copyright (c) 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 MPRESENCECACHEWRITER2_H
       
    19 #define MPRESENCECACHEWRITER2_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <badesca.h>
       
    23 #include <presencecacheids.hrh>
       
    24 
       
    25 class MPresenceBuddyInfo2;
       
    26 class MPresenceCacheWriteHandler2;
       
    27 
       
    28 /**
       
    29  * Interface for presence cache writer API. This interface is implemented 
       
    30  * by the Presence Cache client. Notice that an xsp id is
       
    31  * in the form ovi:xyz@example.com
       
    32  *
       
    33  * @since S60 v3.2
       
    34  */
       
    35 class MPresenceCacheWriter2
       
    36     {
       
    37 public:
       
    38 
       
    39     /**
       
    40      * Factory method to instantiate MPresenceCacheWriter2.
       
    41      *
       
    42      * @return The new MPresenceCacheWriter object. Object
       
    43      *         ownership is returned to caller.
       
    44      */
       
    45     
       
    46     IMPORT_C static MPresenceCacheWriter2* CreateWriterL( );  
       
    47     
       
    48     /**
       
    49      * Public destructor.
       
    50      * Objects can be deleted through this interface.
       
    51      */    
       
    52     virtual ~MPresenceCacheWriter2() {};    
       
    53     
       
    54 
       
    55 public: //Sub interfaces for presence cache writer, Synchronous methods
       
    56 
       
    57     /**
       
    58      * Writes presence info to cache for a given buddy. Leaves only in system
       
    59      * errors.
       
    60      *
       
    61      * @param aPresenceBuddyInfo contains xsp identity and presence
       
    62      * @return Error code
       
    63      */
       
    64     virtual TInt WritePresenceL(const MPresenceBuddyInfo2* aPresenceBuddyInfo) = 0;
       
    65             
       
    66     /**
       
    67      * Instantiates new buddy presence info object.
       
    68      *
       
    69      * @return New buddy presence info instance. Object ownership
       
    70      *         is returned to caller.
       
    71      * @leave KErrNoMemory if failed to allocate memory.
       
    72      */
       
    73     virtual MPresenceBuddyInfo2* NewBuddyPresenceInfoLC() = 0;
       
    74 
       
    75         
       
    76     /**
       
    77      * Delete all buddies presence associated with given service.
       
    78      *
       
    79      * @param aServiceName service name as in sp table
       
    80      * @return error code
       
    81      */
       
    82     virtual TInt DeleteService(const TDesC& aServiceName) = 0;
       
    83     
       
    84     /**
       
    85      * Deletes all presence related to given xsp identity.
       
    86      * Leaves only in system errors.
       
    87      *
       
    88      * @param aIdentity identity for buddy to be removed, in xsp format
       
    89      * @return error code
       
    90      */
       
    91     virtual TInt DeletePresenceL(const TDesC& aIdentity) = 0;
       
    92     
       
    93     /**
       
    94      * Cancels any async. write operation going on. After calling this
       
    95      * method no callback will be received from asycn write method.
       
    96      *
       
    97      * @return error code, KErrNone if successfully cancelled.
       
    98      */
       
    99     virtual TInt CancelWrite() = 0;
       
   100     
       
   101 
       
   102 public: //Sub interfaces for presence cache writer, Asynchronous methods
       
   103 
       
   104     /**
       
   105      * Writes buddy presence info objects to cache. Returns in 
       
   106      * MPresenceCacheWriteHandler2's HandlePresenceWriteL. Provide a null pointer
       
   107      * to receive no call back. Leaves only in system errors.
       
   108      *
       
   109      * @param aBuddyPresenceInfos presence infos for all buddies. 
       
   110      *         Ownership remains to caller.
       
   111      * @param MPresenceCacheWriterHandler2 to handle async calls. A 'NULL' pointer
       
   112      *         can be provided to receive no call back.
       
   113      * @return TInt error code.
       
   114      */    
       
   115     virtual TInt WriteMultiplePresenceL(
       
   116         const RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfos,
       
   117         MPresenceCacheWriteHandler2* aHandler) = 0;  
       
   118     
       
   119     };
       
   120 
       
   121 #endif // MPRESENCECACHEWRITER_H