PECengine/AttributeLibrary2/SrcTransactions/CPEngPresenceNotificationHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Presence notification handler.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGPRESENCENOTIFICATIONHANDLER_H__
       
    19 #define CPENGPRESENCENOTIFICATIONHANDLER_H__
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include "MPEngIncomingTransactionHandler.h"
       
    24 #include "PEngWVCspVersion.h"
       
    25 #include <E32Base.h>
       
    26 #include <BaDescA.h>
       
    27 
       
    28 
       
    29 //FORWARD DECLARATION
       
    30 class MPEngPresenceAttrManager;
       
    31 class MPEngPresenceAttrTransactionEnv;
       
    32 class MPEngXMLParser;
       
    33 class MPEngPresenceAttrModel2;
       
    34 
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * Presence notification handler.
       
    41  *
       
    42  * @lib PEngAttrLib
       
    43  * @since 3.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CPEngPresenceNotificationHandler ) : public CBase,
       
    46         public MPEngIncomingTransactionHandler
       
    47     {
       
    48 public:  // Constructors and destructor
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CPEngPresenceNotificationHandler* NewL( const TDesC& aDomain,
       
    54     TPEngWVCspVersion aCspVersion,
       
    55     MPEngPresenceAttrManager& aAttrManager,
       
    56     MPEngPresenceAttrTransactionEnv& aTransEnv );
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     virtual ~CPEngPresenceNotificationHandler();
       
    62 
       
    63 
       
    64 
       
    65 private:
       
    66 
       
    67     /**
       
    68      * C++ default constructor.
       
    69      */
       
    70     CPEngPresenceNotificationHandler( MPEngPresenceAttrManager& aAttrManager,
       
    71                                       MPEngPresenceAttrTransactionEnv& aTransEnv,
       
    72                                       TPEngWVCspVersion aCspVersion );
       
    73 
       
    74     /**
       
    75      * By default Symbian 2nd phase constructor is private.
       
    76      */
       
    77     void ConstructL( const TDesC& aDomain );
       
    78 
       
    79 
       
    80 
       
    81 public: // Methods from MPEngIncomingTransactionHandler
       
    82 
       
    83     /**
       
    84      * From MPEngIncomingTransactionHandler
       
    85      *
       
    86      * @since 3.0
       
    87      */
       
    88     void ProcessRequestL( const TDesC8& aRequest,
       
    89                           TRequestStatus& aStatus );
       
    90 
       
    91     void CancelProcessing();
       
    92 
       
    93 
       
    94 public: // New methods
       
    95 
       
    96 
       
    97     /**
       
    98      * Checks is the incoming request
       
    99      * a presence update notification.
       
   100      *
       
   101      * @since 3.0
       
   102      * @param aIncomingRequest The incoming request to check.
       
   103      * @return ETrue if the request is presence update
       
   104      * request. Else EFalse.
       
   105      */
       
   106     static TBool CanHandleL( const TDesC8& aIncomingRequest );
       
   107 
       
   108 
       
   109 
       
   110     /**
       
   111      * Processes one presence notification block.
       
   112      *
       
   113      * @since 3.0
       
   114      * @param aPresenceBlock The presence block to process.
       
   115      * @param aDomain The domain for presence notification.
       
   116      * @param aSubscribedPresences Subscribed presences IDs.
       
   117      *        Used for matching presence notifications to
       
   118      *        subscribed presence IDs.
       
   119      * @param aAttributeManager The attribute manager to instantiate attribute models.
       
   120      * @param aParser XML parser for processing the notification.
       
   121      * @param aModels Model array to append generated attribute models.
       
   122      * @return EFalse if couldn't match the notification presence ID to any subscriped ID.
       
   123      *         Else ETrue.
       
   124      */
       
   125     static TBool ProcessNotifyBlockL( const TDesC8& aPresenceBlock,
       
   126                                       const TDesC& aDomain,
       
   127                                       const MDesCArray& aSubscribedPresences,
       
   128                                       MPEngPresenceAttrManager& aAttributeManager,
       
   129                                       MPEngXMLParser& aParser,
       
   130                                       RPointerArray< MPEngPresenceAttrModel2 >& aModels );
       
   131 
       
   132 
       
   133 private:    // Data
       
   134 
       
   135     //REF: The attribute manger
       
   136     MPEngPresenceAttrManager&   iAttributeManager;
       
   137 
       
   138     //REF: The attribute transaction environment
       
   139     MPEngPresenceAttrTransactionEnv&  iTransEnv;
       
   140 
       
   141     //OWN: WV CSP version
       
   142     TPEngWVCspVersion   iCspVersion;
       
   143 
       
   144     //OWN: The XML parser
       
   145     MPEngXMLParser* iXmlParser;
       
   146 
       
   147     //OWN: Presence data blocks
       
   148     CDesC8ArraySeg  iPresenceDataBlocks;
       
   149 
       
   150     //OWN: Parsed attribute models
       
   151     RPointerArray< MPEngPresenceAttrModel2 > iModels;
       
   152 
       
   153     //OWN: Transaction domain.
       
   154     HBufC16* iDomain;
       
   155 
       
   156     };
       
   157 
       
   158 #endif      //  CPENGPRESENCENOTIFICATIONHANDLER_H__
       
   159 
       
   160 //  End of File
       
   161 
       
   162 
       
   163 
       
   164