webservices/wsoviplugin/inc/wsovisessioncontext.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     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: Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23  
       
    24 
       
    25 #ifndef WSOvi_HANDLER_SESSION_CONTEXT_H
       
    26 #define WSOvi_HANDLER_SESSION_CONTEXT_H
       
    27 
       
    28 // INCLUDES
       
    29 #include <e32std.h>
       
    30 #include <flogger.h>
       
    31 #include "msensessioncontext.h"
       
    32 #include "MSenServiceDescription.h"
       
    33 #include "msenmessagecontext.h"
       
    34 #include "msenremoteserviceconsumer.h"
       
    35 #include "wsovicons.h"
       
    36 #include "wsovimessagecontext.h"
       
    37 
       
    38 
       
    39 // DATA TYPES
       
    40 typedef RSenPointerMap<TDesC8, CSenWSDescription> RContextMapDescription;
       
    41 
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class MSenRemoteServiceSession;
       
    45 class CSenWSDescription;
       
    46 class CWSOviServiceSession;
       
    47 
       
    48 /**
       
    49  * Implement Session Context.       
       
    50  */
       
    51 class CWSOviSessionContext : public CBase, public MSenSessionContext
       
    52     {
       
    53 
       
    54     public:
       
    55         static CWSOviSessionContext* NewL();
       
    56         static CWSOviSessionContext* NewLC();
       
    57         ~CWSOviSessionContext();
       
    58 
       
    59         //from SessionContext    
       
    60         virtual const CSenWSDescription* GetSession();
       
    61         virtual const CSenWSDescription* GetInitializer();
       
    62         
       
    63         virtual TInt                             Add(const TDesC8& aKey, CSenWSDescription* aValue);
       
    64         virtual TInt                             Update(const TDesC8& aKey, CSenWSDescription* aValue);
       
    65         virtual const CSenWSDescription* GetSenWSDescriptionL(const TDesC8& aKey);
       
    66 
       
    67         //in fact, now relation between session and sessionCtx is 1 to 1, so no need for map & keys    
       
    68         virtual TInt                            Add(const TDesC8& aKey, MSenRemoteServiceSession& aValue); // protected context    
       
    69         virtual TInt                            Update(const TDesC8& aKey, MSenRemoteServiceSession& aValue);
       
    70         virtual const MSenRemoteServiceSession* GetSenRemoteServiceSessionL(const TDesC8& aKey);    
       
    71         
       
    72         //from MContext    
       
    73         virtual SenContext::TContextType Type() const;        
       
    74         virtual SenContext::TContextDirection Direction() const;
       
    75         //desc - ownership transfered
       
    76         virtual TInt Add(const TDesC8& aKey, const TDesC8& aValue);
       
    77         virtual TInt Update(const TDesC8& aKey, const TDesC8& aValue);
       
    78         virtual const TDesC8* GetDesC8L(const TDesC8& aKey);
       
    79         virtual TInt Remove(const TDesC8& aKey);
       
    80 
       
    81         //Int handling methods doesnt take ownership. but create new object from passed value
       
    82         virtual TInt Add(const TDesC8& aKey, TInt aValue);
       
    83         virtual TInt Update(const TDesC8& aKey, TInt aValue);
       
    84         virtual const TInt* GetIntL(const TDesC8& aKey);
       
    85         virtual TInt Add(const TDesC8& aKey, CSenElement* aValue);
       
    86         virtual TInt Update(const TDesC8& aKey, CSenElement* aValue);
       
    87         virtual const CSenElement* GetSenElementL(const TDesC8& aKey) ;
       
    88         virtual TInt Add(const TDesC8& aKey, TAny* aValue);
       
    89         virtual TInt Update(const TDesC8& aKey, TAny* aValue) ;
       
    90         virtual TAny* GetAnyL(const TDesC8& aKey);
       
    91         virtual const CSenXmlReader* GetParser();
       
    92         virtual TInt Count() const;
       
    93         virtual TPtrC8 KeyAtL(TInt aIndex);
       
    94         virtual void Reset() ;
       
    95         
       
    96         inline virtual TInt SetDirection( SenContext::TContextDirection /* aDirection */ ) { return KErrNotSupported; } // not implemented
       
    97 
       
    98         // New methods
       
    99         TInt SetTokenKeysL(const TDesC8& aToken);
       
   100         /**
       
   101          * Update session context after incoming message
       
   102          *
       
   103          * @since S60 5.0
       
   104          */
       
   105         void UpdateFromMessageInContextL(CWSOviMessageContext& aMessageContext);
       
   106         
       
   107         /**
       
   108          * Update session context after outgoing message has been prepared, 
       
   109          *  to check which elements has been consumed.
       
   110          *
       
   111          * @since S60 5.0
       
   112          */
       
   113         void UpdateFromMessageOutContextL(CWSOviMessageContext& aMessageContext);
       
   114         
       
   115         TInt ShareTokenWithL(CWSOviSessionContext* aWSOviSessionCtxDst);        
       
   116     private:
       
   117         void UpdateDesC8L(CWSOviMessageContext& aMessageContext, const TDesC8& aKey);
       
   118         
       
   119         
       
   120     protected:
       
   121         /**
       
   122          * Function:   CWSOviSessionContext
       
   123          *
       
   124          * Discussion: Perform the first phase of two phase construction
       
   125          */
       
   126         CWSOviSessionContext();
       
   127 
       
   128         /**
       
   129          * Function:   ConstructL
       
   130          *
       
   131          * Discussion: Perform the second phase construction of a
       
   132          *             CImplementationClassPlus object.
       
   133          */
       
   134         void ConstructL();
       
   135         
       
   136     private:
       
   137         MSenRemoteServiceConsumer* iRemoteServiceConsumer;
       
   138         MSenRemoteServiceSession* iSession;//nbot owned, session keeped by DAO
       
   139         RContextMapDescription iDescriptions;
       
   140         RMapInt                iInts;
       
   141         RMapDescriptors         iDescs;
       
   142         TAny*                       ipConsumer; // not owned
       
   143         TAny*                       iTP; // not owned
       
   144     };
       
   145 
       
   146 #endif // WSOvi_HANDLER_SESSION_CONTEXT_H
       
   147     
       
   148 // END OF FILE
       
   149