cmmanager/cmmgr/cmmplugins/cmpluginlan/inc/cmpluginlan.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 *      Declaration of Lan interface implementation
       
    16 *      for "LAN" plugin
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef LAN_PLUGIN_H
       
    23 #define LAN_PLUGIN_H
       
    24 
       
    25 #include <cmpluginbaseeng.h>
       
    26 #include <cmpluginlandef.h>
       
    27 
       
    28 
       
    29 /**
       
    30 *  CCmPluginLan defines the functionality of lan bearer support.
       
    31 *  Most of the API is inherited from CCmPluginBaseEng class.
       
    32 */
       
    33 NONSHARABLE_CLASS( CCmPluginLan ) : public CCmPluginBaseEng
       
    34     {
       
    35     public: // Constructors and destructor
       
    36         /**
       
    37          * Two phased constructor.
       
    38          * @return Returns the LAN plugin object.
       
    39          */
       
    40         static CCmPluginLan* NewL( TCmPluginInitParam* aInitParam );
       
    41 
       
    42         /**
       
    43          * Destructor.
       
    44          */
       
    45         virtual ~CCmPluginLan();
       
    46 
       
    47     public: // From CCmPluginBaseEng
       
    48         /**
       
    49          * Creates a new instance of LAN bearer plugin. The instance
       
    50          * created represents a bearer, not a connection method.
       
    51          * @param aInitParam Initialization data.
       
    52          * @return Returns CCmPluginBaseEng type pointer which represents pure
       
    53          * bearer instance for the cmm server.
       
    54          */
       
    55         virtual CCmPluginBaseEng* CreateInstanceL(
       
    56                 TCmPluginInitParam& aInitParam ) const;
       
    57 
       
    58         /**
       
    59          * Following GetBearerInfoXXXL methods return the values of the
       
    60          * requested attributes. These values are LAN specific
       
    61          * so they don't vary between LAN Conneciton Methods.
       
    62          * @param aAttribute An attribute identifier.
       
    63          * @return Returns the value requested. If not found leaves with
       
    64          * KErrNotFound error code.
       
    65          */
       
    66 
       
    67         virtual TUint32 GetBearerInfoIntL( TUint32 aAttribute ) const;
       
    68 
       
    69         virtual TBool GetBearerInfoBoolL( TUint32 aAttribute ) const;
       
    70 
       
    71         virtual HBufC* GetBearerInfoStringL( TUint32 aAttribute ) const;
       
    72 
       
    73         virtual HBufC8* GetBearerInfoString8L( TUint32 aAttribute ) const;
       
    74 
       
    75         /**
       
    76          * Checks if the plug-in can handle the Connection Method identified
       
    77          * with parameter aIapId.
       
    78          * @param aIapId IAPId of the Connection Method to be checked.
       
    79          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    80          */
       
    81         virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
       
    82 
       
    83         /**
       
    84         * Checks if the plug-in can handle the given IAP record.
       
    85         * @param aIapRecord IAP record to be checked
       
    86         * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    87         */
       
    88         virtual TBool CanHandleIapIdL(
       
    89                 CommsDat::CCDIAPRecord* aIapRecord ) const;
       
    90 
       
    91     public: // From CCmPluginBaseEng concerning a Connection Method
       
    92         /**
       
    93          * Before generic side starts to request plugins to load records
       
    94          * it calls this to give a possibility make some preparations
       
    95          * if needed.
       
    96          */
       
    97         virtual void PreparePluginToLoadRecordsL();
       
    98 
       
    99         /**
       
   100          * Before generic side starts to request plugins to update records
       
   101          * it calls this to give a possibility make some preparations
       
   102          * if needed.
       
   103          * @param aGenRecordArray An array of generic records to be updated.
       
   104          * @param aBearerSpecRecordArray An array of bearer specific records
       
   105          * to be updated.
       
   106          */
       
   107         virtual void PreparePluginToUpdateRecordsL(
       
   108                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   109                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   110 
       
   111         /**
       
   112          * Creates the CCDLANServiceRecord type service record.
       
   113          */
       
   114         virtual void CreateServiceRecordL();
       
   115 
       
   116         /**
       
   117          * Loads the service record. Service record pointer is stored to
       
   118          * plugins generic side implementation(CCmPluginBaseEng).
       
   119          */
       
   120         void LoadServiceRecordL();
       
   121 
       
   122         /**
       
   123          * Returns the service record id of this Connection Method.
       
   124          * @return Returns the id of the service record id of this Connection Method.
       
   125          */
       
   126         virtual TUint32 ServiceRecordId() const;
       
   127 
       
   128         /**
       
   129         * Returns the service record name of the Connection Method.
       
   130         * @param aServiceName Name of the service record which CM's iap record
       
   131         * points to.
       
   132         */
       
   133         virtual void ServiceRecordNameLC( HBufC* &aServiceName );
       
   134 
       
   135         /**
       
   136          * Writes the service record data to CommsDat.
       
   137          * @param aGenRecordArray An array containing pointers to service
       
   138          * record of the Connection Method.
       
   139          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   140          * specific records of the Connection Method.
       
   141          */
       
   142         virtual void UpdateServiceRecordL(
       
   143                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   144                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   145 
       
   146         /**
       
   147          * Creates LAN specific default records.
       
   148          */
       
   149         virtual void CreateBearerRecordsL();
       
   150 
       
   151         /**
       
   152          * Loads LAN specific records of the Connection Method.
       
   153          */
       
   154         virtual void LoadBearerRecordsL();
       
   155 
       
   156         /**
       
   157          * Returns the bearer record id of the Connection Method.
       
   158          * @param aRecordId Id of the bearer record this CM's iap record
       
   159          * points to.
       
   160          */
       
   161         virtual void BearerRecordIdL( TUint32& aRecordId );
       
   162 
       
   163         /**
       
   164          * Returns the bearer record name of the Connection Method.
       
   165          * @param aBearerName Name of the bearer record this CM's iap record
       
   166          * points to.
       
   167          */
       
   168         virtual void BearerRecordNameLC( HBufC*& aBearerName );
       
   169 
       
   170         /**
       
   171          * Writes LAN specific record data to CommsDat.
       
   172          * @param aGenRecordArray An array containing pointers to service
       
   173          * record of the Connection Method.
       
   174          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   175          * specific records to be written.
       
   176          */
       
   177         virtual void UpdateBearerRecordsL(
       
   178                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   179                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   180 
       
   181         /**
       
   182         * Deletes LAN specific records of the Connection Method.
       
   183         */
       
   184         void DeleteBearerRecordsL();
       
   185 
       
   186         /**
       
   187          * Releases the memory reserved by the LAN specific records
       
   188          * of the Connection Method.
       
   189          */
       
   190         virtual void ResetBearerRecords();
       
   191 
       
   192         /**
       
   193          * Creates a copy of LAN specific records and adds them to
       
   194          * aRecordArray.
       
   195          */
       
   196         virtual void GetBearerSpecificRecordsL(
       
   197                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   198 
       
   199         /**
       
   200          * Following GetBearerXXXXAttribute methods get only the
       
   201          * fields in records in pointer arrays(parameters).
       
   202          * @param aAttribute Identifier of the requested value.
       
   203          * @param aGenRecordArray An array containing pointers to generic
       
   204          * records of the Connection Method.
       
   205          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   206          * specific records of the Connection Method. aAttribute
       
   207          * parameter should identify one field(integer, boolean string)
       
   208          * in one of these records.
       
   209          * @return Returns the requested value. In error case leaves with
       
   210          * system-wide error code.
       
   211          */
       
   212 
       
   213         virtual TUint32 GetBearerIntAttributeL(
       
   214                 TUint32 aAttribute,
       
   215                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   216                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   217 
       
   218         virtual TBool GetBearerBoolAttributeL(
       
   219                 TUint32 aAttribute,
       
   220                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   221                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   222 
       
   223         virtual HBufC* GetBearerStringAttributeL(
       
   224                 TUint32 aAttribute,
       
   225                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   226                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   227 
       
   228         virtual HBufC8* GetBearerString8AttributeL(
       
   229                 TUint32 aAttribute,
       
   230                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   231                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   232 
       
   233         /**
       
   234          * Following SetBearerXXXXAttribute methods set only the
       
   235          * fields in records in pointer arrays(parameters). They are not
       
   236          * allowed to update the original records in plugins.
       
   237          * @param aAttribute Identifier of the field to set.
       
   238          * @param aValue The value to set.
       
   239          * @param aGenRecordArray An array containing pointers to generic
       
   240          * records of the Connection Method.
       
   241          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   242          * specific records of the Connection Method. aAttribute
       
   243          * parameter should identify one field(integer, boolean string)
       
   244          * in one of these records.
       
   245          * @return None.
       
   246          */
       
   247 
       
   248         virtual void SetBearerIntAttributeL(
       
   249                 TUint32 aAttribute, TUint32 aValue,
       
   250                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   251                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   252 
       
   253         virtual void SetBearerBoolAttributeL(
       
   254                 TUint32 aAttribute, TBool aValue,
       
   255                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   256                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   257 
       
   258         virtual void SetBearerStringAttributeL(
       
   259                 TUint32 aAttribute, const TDesC16& aValue,
       
   260                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   261                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   262 
       
   263         virtual void SetBearerString8AttributeL(
       
   264                 TUint32 aAttribute, const TDesC8& aValue,
       
   265                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   266                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   267 
       
   268         /**
       
   269          * Bearer is requested by the server if it uses CommsDat tables which
       
   270          * should be observed for possible changes to be able to keep the
       
   271          * data in memory in up to date.
       
   272          * @param aTableIdArray A reference to an array where to add those
       
   273          * table ids.
       
   274          */
       
   275         virtual void GetBearerTableIdsToBeObservedL(
       
   276                 RArray<TUint32>& aTableIdArray ) const;
       
   277 
       
   278     private: // Constructors
       
   279         /**
       
   280         * Constructor.
       
   281         */
       
   282         CCmPluginLan( TCmPluginInitParam* aInitParam );
       
   283 
       
   284         /**
       
   285         * Second phase constructor. Leaves on failure.
       
   286         */
       
   287         void ConstructL();
       
   288 
       
   289     private:
       
   290         /**
       
   291          * Sets the daemon name for the Connection Method.
       
   292          */
       
   293         void SetDaemonNameL(
       
   294                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   295                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   296 
       
   297         /**
       
   298          * Returns a reference to service record of the Connection Method.
       
   299          */
       
   300         CommsDat::CCDLANServiceRecord& ServiceRecord() const;
       
   301 
       
   302         /**
       
   303          * Makes needed preparations before copying records.
       
   304          * @param aCopyInstance Instance of the plugin where to copy.
       
   305          */
       
   306         virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance );
       
   307 
       
   308         /**
       
   309          * Copies the service record.
       
   310          * @return Returns a pointer to service record created.
       
   311          */
       
   312         CommsDat::CCDRecordBase* CopyServiceRecordL();
       
   313 
       
   314         /**
       
   315          * Copies the bearer specific records to copy instance.
       
   316          * @param aCopyInstance Instance of the plugin where to copy.
       
   317          */
       
   318         virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance );
       
   319 
       
   320         /**
       
   321          * Adds LAN bearer record with default values to record array.
       
   322          * @param aRecordArray The array where to add the bearer record.
       
   323          */
       
   324         void GetDefaultLanBearerRecordL(
       
   325                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   326 
       
   327         /**
       
   328          * Returns the default priority value identified with the parameter.
       
   329          * @param aAttribute Indentifies the default priority value requested.
       
   330          */
       
   331         TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
       
   332 
       
   333     private: // Data
       
   334 
       
   335         /**
       
   336          * Pointer to LAN bearer record.
       
   337          */
       
   338         CommsDat::CCDLANBearerRecord* iBearerRecord;
       
   339 
       
   340         /**
       
   341          * Bearer priority table ID.
       
   342          */
       
   343         CommsDat::TMDBElementId iBearerPriorityTableId;
       
   344     };
       
   345 
       
   346 #endif // LAN_PLUGIN_H