cmmanager/cmmgr/cmmserver/inc/cmmconnmethodinstance.h
changeset 20 9c97ad6591ae
child 23 7ec726f93df1
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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:
       
    15 * Session side object representing a connection method.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CMMCONNMETHODINSTANCE_H_
       
    21 #define CMMCONNMETHODINSTANCE_H_
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "cmmserverdefs.h"
       
    26 
       
    27 class CCmmSession;
       
    28 class CCmmCache;
       
    29 class CCmPluginBaseEng;
       
    30 class CCmClientPluginInstance;
       
    31 class CCmmConnMethodStruct;
       
    32 class TCmmIdStruct;
       
    33 
       
    34 
       
    35 /**
       
    36  * TODO, see DestInstance
       
    37  */
       
    38 NONSHARABLE_CLASS( CCmmConnMethodInstance ) : public CObject
       
    39     {
       
    40 public:
       
    41     /**
       
    42      * NewL.
       
    43      */
       
    44     static CCmmConnMethodInstance* NewL( CCmmSession* aCmmSession, CCmmCache* aCache );
       
    45 
       
    46     /**
       
    47      * NewLC.
       
    48      */
       
    49     static CCmmConnMethodInstance* NewLC( CCmmSession* aCmmSession, CCmmCache* aCache );
       
    50 
       
    51     /**
       
    52      * Destructor.
       
    53      */
       
    54     ~CCmmConnMethodInstance();
       
    55 
       
    56 private:
       
    57     /**
       
    58      * Constructor.
       
    59      *
       
    60      * @param aCache database cache.
       
    61      */
       
    62     CCmmConnMethodInstance( CCmmSession* aCmmSession, CCmmCache* aCache );
       
    63 
       
    64     /**
       
    65      * Second phase constructor.
       
    66      */
       
    67     void ConstructL();
       
    68 
       
    69 public:
       
    70     /**
       
    71      * Set the plugin base pointer.
       
    72      */
       
    73     void SetPlugin( CCmPluginBaseEng* aPlugin );
       
    74 
       
    75     /**
       
    76      * Get the plugin base pointer.
       
    77      */
       
    78     CCmPluginBaseEng* GetPlugin() const;
       
    79 
       
    80     /**
       
    81      * Get connection method ID.
       
    82      */
       
    83     TUint32 GetId() const;
       
    84 
       
    85     /**
       
    86      * Set connection method ID.
       
    87      */
       
    88     void SetId( const TUint32& aConnMethodId );
       
    89 
       
    90     /**
       
    91      * Return bearer type.
       
    92      */
       
    93     TUint32 GetBearerType() const;
       
    94 
       
    95     /**
       
    96      * Set bearer type.
       
    97      */
       
    98     void SetBearerType( const TUint32& aBearerType );
       
    99 
       
   100     /**
       
   101      * Get handle ID.
       
   102      */
       
   103     TInt GetHandle() const;
       
   104 
       
   105     /**
       
   106      * Set handle ID.
       
   107      */
       
   108     void SetHandle( const TInt& aHandle );
       
   109 
       
   110     /**
       
   111      * Get pointer to the plugin data container.
       
   112      */
       
   113     CCmClientPluginInstance* GetPluginDataInstance() const;
       
   114 
       
   115     /**
       
   116      * Return ETrue, if this connection method represents an embedded destination.
       
   117      */
       
   118     TBool IsEmbeddedDestination() const;
       
   119 
       
   120     /**
       
   121      * Save the contents of this connection method into database. The attribute
       
   122      * aTemporaryHandle must be true if this connection instance was
       
   123      * temporarily created for the duration of this update operation only. 
       
   124      */
       
   125     void UpdateL( TBool aTemporaryHandle = EFalse );
       
   126 
       
   127     /**
       
   128      * Copy the relevant connection method information from cache side object.
       
   129      */
       
   130     void CopyDataL( CCmmConnMethodStruct* aConnMethodStruct );
       
   131 
       
   132     /**
       
   133      * Returns integer value identified by aAttribute. Some special cases
       
   134      * are handled in this module and the rest in plugin.
       
   135      * @param aAttribute Parameter which specifies the requested attribute.
       
   136      * @return Returns the value of the requested attribute if succees. Otherwise
       
   137      * leaves with KErrArgument
       
   138      */
       
   139     TUint32 GetIntAttributeL( const TUint32& aAttribute );
       
   140 
       
   141     /**
       
   142      * Returns integer value identified by aAttribute. Some special cases
       
   143      * are handled in this module and the rest in plugin.
       
   144      * @param aAttribute Parameter which specifies the requested attribute.
       
   145      * @return Returns the value of the requested attribute if succees. Otherwise
       
   146      * leaves with KErrArgument
       
   147      */
       
   148     TBool GetBoolAttributeL( const TUint32& aAttribute );
       
   149 
       
   150     /**
       
   151      * Returns 16 bit string value identified by aAttribute.
       
   152      * @param aAttribute Parameter which specifies the requested attribute.
       
   153      * @return Returns the value of the requested attribute if succees. Otherwise
       
   154      * leaves with KErrArgument
       
   155      */
       
   156     HBufC* GetStringAttributeL( const TUint32& aAttribute );
       
   157 
       
   158     /**
       
   159      * Returns 8 bit string value identified by aAttribute.
       
   160      * @param aAttribute Parameter which specifies the requested attribute.
       
   161      * @return Returns the value of the requested attribute if succees. Otherwise
       
   162      * leaves with KErrArgument
       
   163      */
       
   164     HBufC8* GetString8AttributeL( const TUint32& aAttribute );
       
   165 
       
   166     /**
       
   167      * Sets the integer value identified by aAttribute.
       
   168      * @param aAttribute Identifies the attribute to be set.
       
   169      * @param aValue The value to be set.
       
   170      * @return None
       
   171      */
       
   172     void SetIntAttributeL(
       
   173         const TUint32& aAttribute,
       
   174         const TUint32& aValue );
       
   175 
       
   176     /**
       
   177      * Sets the integer value identified by aAttribute.
       
   178      * @param aAttribute Identifies the attribute to be set.
       
   179      * @param aValue The value to be set.
       
   180      * @return None
       
   181      */
       
   182     void SetBoolAttributeL(
       
   183         const TUint32& aAttribute,
       
   184         const TBool& aValue );
       
   185 
       
   186     /**
       
   187      * Sets the 16 bit string value identified by aAttribute.
       
   188      * @param aAttribute Identifies the attribute to be set.
       
   189      * @param aValue The value to be set.
       
   190      * @return None
       
   191      */
       
   192     void SetStringAttributeL(
       
   193         const TUint32& aAttribute,
       
   194         const TDesC16& aValue );
       
   195 
       
   196     /**
       
   197      * Sets the 8 bit string value identified by aAttribute.
       
   198      * @param aAttribute Identifies the attribute to be set.
       
   199      * @param aValue The value to be set.
       
   200      * @return None
       
   201      */
       
   202     void SetString8AttributeL(
       
   203         const TUint32& aAttribute,
       
   204         const TDesC8& aValue );
       
   205 
       
   206     /**
       
   207      * Gets the current status of this connection method instance.
       
   208      */
       
   209     TCmmConnMethodStatus GetStatus() const;
       
   210 
       
   211     /**
       
   212      * Sets a new status value.
       
   213      */
       
   214     void SetStatus( const TCmmConnMethodStatus& aStatus );
       
   215 
       
   216     /*
       
   217      * Called after this connection method has been updated and database
       
   218      * transaction has completed successfully. Sets the internal state of this
       
   219      * connection method instance to reflect the new valid state.
       
   220      */
       
   221     void UpdateSuccessful();
       
   222 
       
   223     /**
       
   224      * Called after this connection method has been deleted and database
       
   225      * transaction has completed successfully. Sets the internal state of this
       
   226      * connection method structure to reflect the new deleted state.
       
   227      */
       
   228     void DeleteSuccessful( const TUint32& aNewSecondaryId );
       
   229 
       
   230     /**
       
   231      * After update/delete to database, refresh temporary ID to real ID if
       
   232      * necessary and refresh status information for any related handles for
       
   233      * all client sessions.
       
   234      */
       
   235     void RefreshHandlesForAllSessions( const TCmmIdStruct& aIdStruct );
       
   236 
       
   237     /**
       
   238      * Removes a connection method from any open destination handle in the same
       
   239      * session.
       
   240      */
       
   241     void RemoveConnMethodFromSessionDestinationHandles( const TUint32& aConnMethodId );
       
   242 
       
   243 private:
       
   244     // Session that owns this instance.
       
   245     CCmmSession* iCmmSession; // Not owned.
       
   246 
       
   247     // Database cache.
       
   248     CCmmCache* iCache; // Not owned.
       
   249 
       
   250     // Pointer to original bearer plugin owned by cache.
       
   251     CCmPluginBaseEng* iPlugin; // Not owned.
       
   252 
       
   253     // Object to contain the data of this connection method instance.
       
   254     CCmClientPluginInstance* iPluginDataInstance; // Owned.
       
   255 
       
   256     // Connection method ID.
       
   257     TUint32 iConnMethodId;
       
   258 
       
   259     // Connection method bearer type.
       
   260     TUint32 iBearerType;
       
   261 
       
   262     // Connection method handle status.
       
   263     TCmmConnMethodStatus iStatus;
       
   264 
       
   265     // Subsession handle ID.
       
   266     TInt iHandle;
       
   267     };
       
   268 
       
   269 #endif // CMMCONNMETHODINSTANCE_H_
       
   270 
       
   271 // End of file