cmmanager/cmmgr/cmmplugins/cmpluginwlan/inc/cmpluginwlan.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 WLAN interface implementation
       
    16 *       for WLAN plugin
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef WLAN_PLUGIN_H
       
    22 #define WLAN_PLUGIN_H
       
    23 
       
    24 #include <commsdat_partner.h>
       
    25 #include <cmpluginbaseeng.h>
       
    26 #include <cmpluginwlandef.h>
       
    27 
       
    28 class CCDWlanServiceRecord;
       
    29 
       
    30 
       
    31 /**
       
    32 *  CCmPluginWlan defines the functionality of wlan bearer support.
       
    33 *  Most of the API is inherited from CCmPluginBaseEng class.
       
    34 */
       
    35 NONSHARABLE_CLASS( CCmPluginWlan ) : public CCmPluginBaseEng
       
    36     {
       
    37 
       
    38     public: // Constructors and destructor
       
    39         /**
       
    40          * Two phased constructor.
       
    41          * @return Returns the Wlan plugin object.
       
    42          */
       
    43         static CCmPluginWlan* NewL( TCmPluginInitParam* aInitParam );
       
    44 
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         virtual ~CCmPluginWlan();
       
    49 
       
    50     public: // From CCmPluginBaseEng
       
    51         /**
       
    52          * Creates a new instance of Wlan bearer plugin. The instance
       
    53          * created represents a bearer, not a connection method.
       
    54          * @param aInitParam Initialization data.
       
    55          * @return Returns CCmPluginBaseEng type pointer which represents pure
       
    56          * bearer instance for the cmm server.
       
    57          */
       
    58 
       
    59         virtual CCmPluginBaseEng* CreateInstanceL(
       
    60                 TCmPluginInitParam& aInitParam ) const;
       
    61 
       
    62         /**
       
    63          * Following GetBearerInfoXXXL methods return the values of the
       
    64          * requested attributes. These values are Wlan specific
       
    65          * so they don't vary between Wlan Connection Methods.
       
    66          * @param aAttribute An attribute identifier.
       
    67          * @return Returns the value requested. If not found leaves with
       
    68          * KErrNotFound error code.
       
    69          */
       
    70 
       
    71         virtual TUint32 GetBearerInfoIntL( TUint32 aAttribute ) const;
       
    72 
       
    73         virtual TBool GetBearerInfoBoolL( TUint32 aAttribute ) const;
       
    74 
       
    75         virtual HBufC* GetBearerInfoStringL( TUint32 aAttribute ) const;
       
    76 
       
    77         virtual HBufC8* GetBearerInfoString8L( TUint32 aAttribute ) const;
       
    78 
       
    79         /**
       
    80          * Checks if the plug-in can handle the Connection Method identified
       
    81          * with parameter aIapId.
       
    82          * @param aIapId IAPId of the Connection Method to be checked.
       
    83          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    84          */
       
    85         TBool CanHandleIapIdL( TUint32 aIapId ) const;
       
    86 
       
    87         /**
       
    88         * Checks if the plug-in can handle the given IAP record.
       
    89         * @param aIapRecord IAP record to be checked
       
    90         * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    91         */
       
    92         TBool CanHandleIapIdL( CommsDat::CCDIAPRecord *aIapRecord ) const;
       
    93 
       
    94     public: // From CCmPluginBaseEng concerning a Connection Method
       
    95         /**
       
    96          * Before generic side starts to request plugins to load records
       
    97          * it calls this to give a possibility make some preparations
       
    98          * if needed.
       
    99          */
       
   100         virtual void PreparePluginToLoadRecordsL();
       
   101 
       
   102         /**
       
   103          * Before generic side starts to request plugins to update records
       
   104          * it calls this to give a possibility make some preparations
       
   105          * if needed.
       
   106          * @param aGenRecordArray An array of generic records to be updated.
       
   107          * @param aBearerSpecRecordArray An array of bearer specific records
       
   108          * to be updated.
       
   109          */
       
   110         virtual void PreparePluginToUpdateRecordsL(
       
   111                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   112                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   113 
       
   114         /**
       
   115          * Creates the CCDLANServiceRecord and CCDWlanServiceRecord type service
       
   116          * records.
       
   117          */
       
   118         virtual void CreateServiceRecordL();
       
   119 
       
   120         /**
       
   121          * Loads the service record(which is in wlan case LAN service type).
       
   122          * Service record pointer is stored to plugins generic side
       
   123          * implementation(CCmPluginBaseEng).
       
   124          */
       
   125         void LoadServiceRecordL();
       
   126 
       
   127         /**
       
   128          * Returns the service record id of this Connection Method.
       
   129          * @return Returns the id of the service record id of this Connection Method.
       
   130          */
       
   131         virtual TUint32 ServiceRecordId() const;
       
   132 
       
   133         /**
       
   134         * Returns the service record name of the Connection Method.
       
   135         * @param aServiceName Name of the service record which CM's iap record
       
   136         * points to.
       
   137         */
       
   138         virtual void ServiceRecordNameLC( HBufC* &aServiceName );
       
   139 
       
   140         /**
       
   141          * Writes the service record data to CommsDat.
       
   142          * @param aGenRecordArray An array containing pointers to service
       
   143          * record of the Connection Method.
       
   144          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   145          * specific records of the Connection Method.
       
   146          */
       
   147         virtual void UpdateServiceRecordL(
       
   148                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   149                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   150 
       
   151         /**
       
   152          * Loads Wlan 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 Wlan specific record data to CommsDat.
       
   172          * @param aGenRecordArray An array containing pointer 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 Wlan specific records of the Connection Method.
       
   183         */
       
   184         void DeleteBearerRecordsL();
       
   185 
       
   186         /**
       
   187          * Releases the memory reserved by the Wlan specific records
       
   188          * of the Connection Method.
       
   189          */
       
   190         virtual void ResetBearerRecords();
       
   191 
       
   192         /**
       
   193          * Creates a copy of Wlan specific records and adds them to
       
   194          * aRecordArray.
       
   195          * @param aRecordArray Pointer array where to add bearer specific
       
   196          * records.
       
   197          */
       
   198         virtual void GetBearerSpecificRecordsL(
       
   199                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   200 
       
   201         /**
       
   202          * Following GetBearerXXXXAttribute methods get only the
       
   203          * fields in records in pointer arrays(parameters).
       
   204          * @param aAttribute Identifier of the requested value.
       
   205          * @param aGenRecordArray An array containing pointers to generic
       
   206          *      records of the Connection Method.
       
   207          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   208          *      specific records of the Connection Method. aAttribute
       
   209          *      parameter should identify one field(integer, boolean string)
       
   210          *      in one of these records.
       
   211          * @return Returns the requested value. In error case leaves with
       
   212          *      system-wide error code.
       
   213          */
       
   214 
       
   215         virtual TUint32 GetBearerIntAttributeL(
       
   216                 TUint32 aAttribute,
       
   217                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   218                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   219 
       
   220         virtual TBool GetBearerBoolAttributeL(
       
   221                 TUint32 aAttribute,
       
   222                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   223                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   224 
       
   225         virtual HBufC* GetBearerStringAttributeL(
       
   226                 TUint32 aAttribute,
       
   227                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   228                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   229 
       
   230         virtual HBufC8* GetBearerString8AttributeL(
       
   231                 TUint32 aAttribute,
       
   232                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   233                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   234 
       
   235         /**
       
   236          * Following SetBearerXXXXAttribute methods set only the
       
   237          * fields in records in pointer arrays(parameters). They are not
       
   238          * allowed to update the original records in plugins.
       
   239          * @param aAttribute Identifier of the field to set.
       
   240          * @param aValue The value to set.
       
   241          * @param aGenRecordArray An array containing pointers to generic
       
   242          * records of the Connection Method.
       
   243          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   244          * specific records of the Connection Method. aAttribute
       
   245          * parameter should identify one field(integer, boolean string)
       
   246          * in one of these records.
       
   247          * @return None.
       
   248          */
       
   249 
       
   250         virtual void SetBearerIntAttributeL(
       
   251                 TUint32 aAttribute, TUint32 aValue,
       
   252                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   253                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   254 
       
   255         virtual void SetBearerBoolAttributeL(
       
   256                 TUint32 aAttribute, TBool aValue,
       
   257                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   258                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   259 
       
   260         virtual void SetBearerStringAttributeL(
       
   261                 TUint32 aAttribute, const TDesC16& aValue,
       
   262                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   263                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   264 
       
   265         virtual void SetBearerString8AttributeL(
       
   266                 TUint32 aAttribute, const TDesC8& aValue,
       
   267                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   268                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   269 
       
   270         /**
       
   271          * Bearer is requested by the server if it uses CommsDat tables which
       
   272          * should be observed for possible changes to be able to keep the
       
   273          * data in memory in up to date.
       
   274          * @param aTableIdArray A reference to an array where to add those
       
   275          * table ids.
       
   276          */
       
   277         virtual void GetBearerTableIdsToBeObservedL(
       
   278                 RArray<TUint32>& aTableIdArray ) const;
       
   279 
       
   280     private: // construction
       
   281         /**
       
   282         * Constructor.
       
   283         */
       
   284         CCmPluginWlan( TCmPluginInitParam* aInitParam );
       
   285 
       
   286         /**
       
   287         * Second phase constructor. Leaves on failure.
       
   288         */
       
   289         void ConstructL();
       
   290 
       
   291     private: // from base class
       
   292 
       
   293         /**
       
   294         * From CCmPluginBaseEng
       
   295         * Creates the WLAN service record used by this WLAN
       
   296         */
       
   297         void CreateWlanServiceRecordL();
       
   298 
       
   299     private: // new functions
       
   300 
       
   301         /**
       
   302         * Checks if there are any wlan networks awailable.
       
   303         * @return Returns ETrue if any wlan networks found. Otherwise
       
   304         * returns EFalse.
       
   305         */
       
   306         TBool CheckNetworkCoverageL() const;
       
   307 
       
   308         /**
       
   309          * Sets the daemon name for the Connection Method.
       
   310          * @param aGenRecordArray An array containing pointers to generic
       
   311          * records of the Connection Method.
       
   312          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   313          * specific records of the Connection Method.
       
   314          */
       
   315         void SetDaemonNameL(
       
   316                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   317                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   318 
       
   319         /**
       
   320          * Returns a reference to service record of the Connection Method.
       
   321          * @return Returns a reference to service record of the Connection
       
   322          * Method.
       
   323          */
       
   324         CommsDat::CCDLANServiceRecord& ServiceRecord() const;
       
   325 
       
   326         /**
       
   327          * Makes needed preparations before copying records.
       
   328          * @param aCopyInstance Instance of the plugin where to copy.
       
   329          */
       
   330         virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance );
       
   331 
       
   332         /**
       
   333          * Copies the LAN service record.
       
   334          * @return Returns a pointer to service record created.
       
   335          */
       
   336         CommsDat::CCDRecordBase* CopyServiceRecordL();
       
   337 
       
   338         /**
       
   339          * Copies the Wlan service record.
       
   340          * @param aSourceRecord A record where to copy from.
       
   341          * @param aDestRecord A record where to copy to.
       
   342          */
       
   343         void CopyWlanServiceRecordL(
       
   344                 CCDWlanServiceRecord* aSourceRecord,
       
   345                 CCDWlanServiceRecord* aDestRecord);
       
   346 
       
   347         /**
       
   348          * Copies the bearer specific records to copy instance.
       
   349          * @param aCopyInstance Instance of the plugin where to copy.
       
   350          */
       
   351         virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance );
       
   352 
       
   353         /**
       
   354          * Adds Wlan service record with default values to record array.
       
   355          * @param aRecordArray The array where to add the record.
       
   356          */
       
   357         void GetDefaultWlanServiceRecordL(
       
   358                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   359 
       
   360         /**
       
   361          * Checks if the given attributes are in the correct range.
       
   362          * @param aAttribute Identifies the attribute to be checked.
       
   363          * @param aValue A value to be checked.
       
   364          */
       
   365         void CheckSecurityAttributeValidityL(
       
   366                 const TUint32 aAttribute,
       
   367                 const TUint32 aValue );
       
   368 
       
   369         /**
       
   370          * Convert a 8-bit string in ascii format to hex format. Ownership of
       
   371          * new string is transfered.
       
   372          */
       
   373         HBufC8* ConvertAsciiToHexL( const TDesC8& aSource );
       
   374 
       
   375         /**
       
   376          * Convert a 8-bit string in hex format to ascii format. Ownership of
       
   377          * new string is transfered.
       
   378          */
       
   379         HBufC8* ConvertHexToAsciiL( const TDesC8& aSource );
       
   380 
       
   381         /**
       
   382          * Translates a hex char (0-1, a-f, A-F) to its 10-base numerical
       
   383          * value (0-15).
       
   384          */
       
   385         TUint8 ConvertHexCharToNumberL( const TUint8 aHexChar );
       
   386 
       
   387         /**
       
   388          * Returns the default priority value identified with the parameter.
       
   389          * @param aAttribute Indentifies the default priority value requested.
       
   390          */
       
   391         TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
       
   392 
       
   393     private: // Data
       
   394 
       
   395         /**
       
   396          * WLAN service record.
       
   397          */
       
   398         CCDWlanServiceRecord* iWlanServiceRecord;
       
   399 
       
   400         /**
       
   401          * WLAN table ID.
       
   402          */
       
   403         CommsDat::TMDBElementId iWlanTableId;
       
   404 
       
   405         /**
       
   406          * Bearer priority table ID.
       
   407          */
       
   408         CommsDat::TMDBElementId iBearerPriorityTableId;
       
   409 
       
   410         /**
       
   411          * Boolean to save the WAPI support info.
       
   412          */
       
   413         TBool iWAPISupported;
       
   414     };
       
   415 
       
   416 #endif // WLAN_PLUGIN_H