cmmanager/cmmgr/cmmserver/inc/cmmconnmethodstruct.h
branchRCL_3
changeset 58 83ca720e2b9a
parent 57 05bc53fe583b
child 62 bb1f80fb7db2
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
     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 * Cache side object representing a connection method.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CMMCONNMETHODSTRUCT_H_
       
    21 #define CMMCONNMETHODSTRUCT_H_
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "cmmserverdefs.h"
       
    26 
       
    27 class CCmmConnMethodInstance;
       
    28 class CCmPluginBaseEng;
       
    29 
       
    30 
       
    31 /**
       
    32  * Cache side object representing a connection method. Reflects the current
       
    33  * state in database.
       
    34  */
       
    35 NONSHARABLE_CLASS( CCmmConnMethodStruct ) : public CBase
       
    36     {
       
    37 public:
       
    38     static CCmmConnMethodStruct* NewL( const TUint32 aConnMethodId );
       
    39     static CCmmConnMethodStruct* NewLC( const TUint32 aConnMethodId );
       
    40     ~CCmmConnMethodStruct();
       
    41 
       
    42 private:
       
    43     CCmmConnMethodStruct( TUint32 aConnMethodId );
       
    44     void ConstructL();
       
    45 
       
    46 public:
       
    47     /**
       
    48      * Return the reference count.
       
    49      */
       
    50     TInt GetReferenceCounter();
       
    51 
       
    52     /**
       
    53      * Increase the reference counter by one.
       
    54      */
       
    55     void IncrementReferenceCounter();
       
    56 
       
    57     /**
       
    58      * Return the connection method ID.
       
    59      */
       
    60     TUint32 GetId() const;
       
    61 
       
    62     /**
       
    63      * Set the connection method ID.
       
    64      */
       
    65     void SetId( const TUint32 aConnMethodId );
       
    66 
       
    67     /**
       
    68      * Return bearer type.
       
    69      */
       
    70     TUint32 GetBearerType() const;
       
    71 
       
    72     /**
       
    73      * Gets the current status of this connection method struct.
       
    74      */
       
    75     TCmmConnMethodStatus GetStatus() const;
       
    76 
       
    77     /**
       
    78      * Gets the current record status of this connection method struct.
       
    79      */
       
    80     TCmmRecordStatus GetRecordStatus() const;
       
    81 
       
    82     /**
       
    83      * Sets a new status value.
       
    84      */
       
    85     void SetStatus( const TCmmConnMethodStatus& aStatus );
       
    86 
       
    87     /**
       
    88      * Reload the connection method data in this cache side object to be in
       
    89      * synch with the database(only if needed).
       
    90      */
       
    91     void ReloadPluginDataIfNeededL();
       
    92 
       
    93     /**
       
    94      * Decrease the reference counter by one. Return the remaining number of
       
    95      * references.
       
    96      */
       
    97     TInt ConnMethodInstanceClosed();
       
    98 
       
    99     /**
       
   100      * Set the connection method plugin pointer, bearer type and status.
       
   101      */
       
   102     void SetPlugin(
       
   103             CCmPluginBaseEng* aPlugin,
       
   104             TUint32 aBearerType,
       
   105             TCmmConnMethodStatus aStatus );
       
   106 
       
   107     /**
       
   108      * Returns the connection method plugin.
       
   109      */
       
   110     CCmPluginBaseEng* GetPlugin();
       
   111 
       
   112     /**
       
   113      * Called after this connection method has been updated and database
       
   114      * transaction has completed successfully. Sets the internal state of this
       
   115      * connection method structure to reflect the new valid state.
       
   116      */
       
   117     void UpdateSuccessful();
       
   118 
       
   119     /**
       
   120      * Called after this connection method has been deleted and database
       
   121      * transaction has completed successfully. Sets the internal state of this
       
   122      * connection method structure to reflect the new deleted state.
       
   123      */
       
   124     void DeleteSuccessful( const TUint32 aNewSecondaryId );
       
   125 
       
   126     /**
       
   127      * Notify about a possible change in database on specified record table.
       
   128      */
       
   129     void NotifyRecordChange( const TUint32 aRecordType );
       
   130 
       
   131 private:
       
   132     /**
       
   133      * Set the record status.
       
   134      */
       
   135     void SetRecordStatus( const TCmmRecordStatus aStatus );
       
   136 
       
   137 private:
       
   138     // The connection method plugin.
       
   139     CCmPluginBaseEng* iConnMethodPlugin; // Owned.
       
   140 
       
   141     // Total number of handles that the clients have to this connection method.
       
   142     TInt iReferenceCounter;
       
   143 
       
   144     // Connection method ID.
       
   145     // For new connection methods, while no valid database ID is available,
       
   146     // will be assigned a temporary ID that will have a value above
       
   147     // above KTemporaryIdCounterStart.
       
   148     TUint32 iConnMethodId;
       
   149 
       
   150     // Connection method bearer type.
       
   151     TUint32 iBearerType;
       
   152 
       
   153     // Current status of this connection method.
       
   154     TCmmConnMethodStatus iStatus;
       
   155 
       
   156     // Current status of the loaded commsdat records of this connection method.
       
   157     TCmmRecordStatus iRecordStatus;
       
   158     };
       
   159 
       
   160 #endif // CMMCONNMETHODSTRUCT_H_
       
   161 
       
   162 // End of file