cmmanager/cmmgr/cmmplugins/cmpluginpacketdata/inc/cmpluginpacketdata.h
changeset 20 9c97ad6591ae
child 27 489cf6208544
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 *       Declaration of packetdata interface implementation
       
    16 *       for "Packetdata" plugin
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef PACKETDATA_PLUGIN_H
       
    21 #define PACKETDATA_PLUGIN_H
       
    22 
       
    23 #include <cmpluginbaseeng.h>
       
    24 #include <cmpluginpacketdatadef.h>
       
    25 
       
    26 /**
       
    27 *  CCmPluginPacketData defines the functionality of packetdata bearer support.
       
    28 *  Most of the API is inherited from CCmPluginBaseEng class.
       
    29 */
       
    30 NONSHARABLE_CLASS( CCmPluginPacketData ) : public CCmPluginBaseEng
       
    31     {
       
    32 
       
    33     public:
       
    34         /**
       
    35          * Two phased constructor.
       
    36          * @return Returns the packetdata plugin object.
       
    37          */
       
    38         static CCmPluginPacketData* NewL( TCmPluginInitParam* aInitParam );
       
    39 
       
    40         /**
       
    41          * Destructor.
       
    42          */
       
    43         virtual ~CCmPluginPacketData();
       
    44 
       
    45     public: // From CCmPluginBaseEng
       
    46         /**
       
    47          * Creates a new instance of packetdata bearer plugin. The instance
       
    48          * created represents a bearer, not a connection method.
       
    49          * @param aInitParam Initialization data.
       
    50          * @return Returns CCmPluginBaseEng type pointer which represents pure
       
    51          * bearer instance for the cmm server.
       
    52          */
       
    53         virtual CCmPluginBaseEng* CreateInstanceL(
       
    54                 TCmPluginInitParam& aInitParam ) const;
       
    55 
       
    56         /**
       
    57          * Following GetBearerInfoXXXL methods return the values of the
       
    58          * requested attributes. These values are packetdata specific
       
    59          * so they don't vary between packetdata Connection Methods.
       
    60          * @param aAttribute An attribute identifier.
       
    61          * @return Returns the value requested. If not found leaves with
       
    62          * KErrNotFound error code.
       
    63          */
       
    64 
       
    65         virtual TUint32 GetBearerInfoIntL( TUint32 aAttribute ) const;
       
    66 
       
    67         virtual TBool GetBearerInfoBoolL( TUint32 aAttribute ) const;
       
    68 
       
    69         virtual HBufC* GetBearerInfoStringL( TUint32 aAttribute ) const;
       
    70 
       
    71         virtual HBufC8* GetBearerInfoString8L( TUint32 aAttribute ) const;
       
    72 
       
    73         /**
       
    74          * Checks if the plug-in can handle the Connection Method identified
       
    75          * with parameter aIapId.
       
    76          * @param aIapId IAPId of the Connection Method to be checked.
       
    77          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    78          */
       
    79         virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
       
    80 
       
    81         /**
       
    82         * Checks if the plug-in can handle the given IAP record.
       
    83         * @param aIapRecord IAP record to be checked
       
    84         * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    85         */
       
    86         virtual TBool CanHandleIapIdL(
       
    87                 CommsDat::CCDIAPRecord *aIapRecord ) const;
       
    88 
       
    89     public: // From CCmPluginBaseEng concerning a Connection Method
       
    90         /**
       
    91          * Before generic side starts to request plugins to load records
       
    92          * it calls this to give a possibility make some preparations
       
    93          * if needed.
       
    94          */
       
    95         virtual void PreparePluginToLoadRecordsL();
       
    96 
       
    97         /**
       
    98          * Before generic side starts to request plugins to update records
       
    99          * it calls this to give a possibility make some preparations
       
   100          * if needed.
       
   101          * @param aGenRecordArray An array of generic records to be updated.
       
   102          * @param aBearerSpecRecordArray An array of bearer specific records
       
   103          * to be updated.
       
   104          */
       
   105         virtual void PreparePluginToUpdateRecordsL(
       
   106                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   107                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   108 
       
   109         /**
       
   110          * Creates the CCDWCDMAPacketServiceRecord type service record.
       
   111          */
       
   112         virtual void CreateServiceRecordL();
       
   113 
       
   114         /**
       
   115          * Loads the service record. Service record pointer is stored to
       
   116          * plugins generic side implementation(CCmPluginBaseEng).
       
   117          */
       
   118         virtual void LoadServiceRecordL();
       
   119 
       
   120         /**
       
   121          * Returns the service record id of this Connection Method.
       
   122          * @return Returns the id of the service record id of this Connection Method.
       
   123          */
       
   124         virtual TUint32 ServiceRecordId() const;
       
   125 
       
   126         /**
       
   127         * Returns the service record name of the Connection Method.
       
   128         * @param aServiceName Name of the service record which CM's iap record
       
   129         * points to.
       
   130         */
       
   131         virtual void ServiceRecordNameLC( HBufC* &aServiceName );
       
   132 
       
   133         /**
       
   134          * Writes the service record data to CommsDat.
       
   135          * @param aGenRecordArray An array containing pointers to service
       
   136          * record of the Connection Method.
       
   137          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   138          * specific records of the Connection Method.
       
   139          */
       
   140         virtual void UpdateServiceRecordL(
       
   141                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   142                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   143 
       
   144         /**
       
   145          * Creates packetdata specific default records.
       
   146          */
       
   147         virtual void CreateBearerRecordsL();
       
   148 
       
   149         /**
       
   150          * Loads packetdata specific records of the Connection Method.
       
   151          */
       
   152         virtual void LoadBearerRecordsL();
       
   153 
       
   154         /**
       
   155          * Returns the bearer record id of the Connection Method.
       
   156          * @param aRecordId Id of the bearer record this CM's iap record
       
   157          * points to.
       
   158          */
       
   159         virtual void BearerRecordIdL( TUint32& aRecordId );
       
   160 
       
   161         /**
       
   162          * Returns the bearer record name of the Connection Method.
       
   163          * @param aBearerName Name of the bearer record this CM's iap record
       
   164          * points to.
       
   165          */
       
   166         virtual void BearerRecordNameLC( HBufC* &aBearerName );
       
   167 
       
   168         /**
       
   169          * Writes packetdata specific record data to CommsDat.
       
   170          * @param aGenRecordArray An array containing pointers to generic records
       
   171          * of the Connection Method.
       
   172          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   173          * specific records to be written.
       
   174          */
       
   175         virtual void UpdateBearerRecordsL(
       
   176                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   177                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   178 
       
   179         /**
       
   180         * Deletes packetdata specific records of the Connection Method.
       
   181         */
       
   182         void DeleteBearerRecordsL();
       
   183 
       
   184         /**
       
   185          * Releases the memory reserved by the packetdata specific records
       
   186          * of the Connection Method.
       
   187          */
       
   188         virtual void ResetBearerRecords();
       
   189 
       
   190         /**
       
   191          * Creates a copy of packetdata specific records and adds them to
       
   192          * aRecordArray.
       
   193          */
       
   194         virtual void GetBearerSpecificRecordsL(
       
   195                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   196 
       
   197         /**
       
   198          * Following GetBearerXXXXAttribute methods get only the
       
   199          * fields in records in pointer arrays(parameters).
       
   200          * @param aAttribute Identifier of the requested value.
       
   201          * @param aGenRecordArray An array containing pointers to generic
       
   202          *      records of the Connection Method.
       
   203          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   204          *      specific records of the Connection Method. aAttribute
       
   205          *      parameter should identify one field(integer, boolean string)
       
   206          *      in one of these records.
       
   207          * @return Returns the requested value. In error case leaves with
       
   208          *      system-wide error code.
       
   209          */
       
   210 
       
   211         virtual TUint32 GetBearerIntAttributeL(
       
   212                 TUint32 aAttribute,
       
   213                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   214                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   215 
       
   216         virtual TBool GetBearerBoolAttributeL(
       
   217                 TUint32 aAttribute,
       
   218                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   219                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   220 
       
   221 
       
   222         virtual HBufC* GetBearerStringAttributeL(
       
   223                 TUint32 aAttribute,
       
   224                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   225                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   226 
       
   227         virtual HBufC8* GetBearerString8AttributeL(
       
   228                 TUint32 aAttribute,
       
   229                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   230                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   231 
       
   232         /**
       
   233          * Following SetBearerXXXXAttribute methods set only the
       
   234          * fields in records in pointer arrays(parameters). They are not
       
   235          * allowed to update the original records in plugins.
       
   236          * @param aAttribute Identifier of the field to set.
       
   237          * @param aValue The value to set.
       
   238          * @param aGenRecordArray An array containing pointers to generic
       
   239          *      records of the Connection Method.
       
   240          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   241          *      specific records of the Connection Method. aAttribute
       
   242          *      parameter should identify one field(integer, boolean string)
       
   243          *      in one of these records.
       
   244          * @return None.
       
   245          */
       
   246 
       
   247         virtual void SetBearerIntAttributeL(
       
   248                 TUint32 aAttribute, TUint32 aValue,
       
   249                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   250                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   251 
       
   252         virtual void SetBearerBoolAttributeL(
       
   253                 TUint32 aAttribute, TBool aValue,
       
   254                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   255                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   256 
       
   257         virtual void SetBearerStringAttributeL(
       
   258                 TUint32 aAttribute, const TDesC16& aValue,
       
   259                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   260                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   261 
       
   262         virtual void SetBearerString8AttributeL(
       
   263                 TUint32 aAttribute, const TDesC8& aValue,
       
   264                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   265                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   266 
       
   267         /**
       
   268          * Bearer is requested by the server if it uses CommsDat tables which
       
   269          * should be observed for possible changes to be able to keep the
       
   270          * data in memory in up to date.
       
   271          * @param aTableIdArray A reference to an array where to add those
       
   272          * table ids.
       
   273          */
       
   274         virtual void GetBearerTableIdsToBeObservedL(
       
   275                 RArray<TUint32>& aTableIdArray ) const;
       
   276 
       
   277     private: // Constructors
       
   278 
       
   279         /**
       
   280         * Constructor
       
   281         */
       
   282         CCmPluginPacketData(
       
   283                 TCmPluginInitParam* aInitParam,
       
   284                 TBool aOutgoing );
       
   285 
       
   286         /**
       
   287         * Second phase constructor
       
   288         */
       
   289         void ConstructL();
       
   290 
       
   291     private:
       
   292         /**
       
   293          * Adds Service record with default values to record array.
       
   294          * @param aRecordArray The array where to add the service record.
       
   295          */
       
   296         void GetDefaultServiceRecordL(
       
   297                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   298 
       
   299         /**
       
   300          * Adds QoS record with default values to record array.
       
   301          * @param aRecordArray The array where to add the QoS record.
       
   302          */
       
   303         void GetDefaultQosRecordL(
       
   304                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   305 
       
   306         /**
       
   307          * Returns a reference to service record of the Connection Method.
       
   308          */
       
   309         CommsDat::CCDWCDMAPacketServiceRecord& ServiceRecord() const;
       
   310 
       
   311         /**
       
   312          * Makes needed preparations before copying records.
       
   313          * @param aCopyInstance Instance of the plugin where to copy.
       
   314          */
       
   315         virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance );
       
   316 
       
   317         /**
       
   318          * Copies the service record.
       
   319          * @return Returns a pointer to service record created.
       
   320          */
       
   321         CommsDat::CCDRecordBase* CopyServiceRecordL();
       
   322 
       
   323         /**
       
   324          * Copies the bearer specific records to copy instance.
       
   325          * @param aCopyInstance Instance of the plugin where to copy.
       
   326          */
       
   327         virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance );
       
   328 
       
   329 
       
   330         /**
       
   331          * Gets an integer value from service record.
       
   332          * @param aAttribute An indentifier to know the field in the record.
       
   333          * @param aGenRecordArray Array of records where the service record
       
   334          * can be found.
       
   335          * @return Returns an integer if the requested attribute
       
   336          * is found. Otherwise leaves with error code KErrNotFound.
       
   337          */
       
   338         TUint32 GetServiceIntAttributeL(
       
   339                 TUint32 aAttribute,
       
   340                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray );
       
   341 
       
   342         /**
       
   343          * Gets a string value from service record. Ownership of the return
       
   344          * value is passed to the caller.
       
   345          * @param aAttribute An indentifier to know the field in the record.
       
   346          * @param aGenRecordArray Array of records where the service record
       
   347          * can be found.
       
   348          * @return Returns a pointer to an buffer if the requested attribute
       
   349          * is found. Otherwise leaves with error code KErrNotFound.
       
   350          */
       
   351         HBufC* GetServiceStringAttributeL(
       
   352                 TUint32 aAttribute,
       
   353                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray );
       
   354 
       
   355         /**
       
   356          * Sets integer value to service record.
       
   357          * @param aAttribute An indentifier to know the field in the record.
       
   358          * @param aValue A value to set.
       
   359          * @param aGenRecordArray Array of records where the service record
       
   360          * can be found.
       
   361          */
       
   362         void SetServiceIntAttributeL(
       
   363                 TUint32 aAttribute,
       
   364                 TUint32 aValue,
       
   365                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray );
       
   366 
       
   367         /**
       
   368          * Gets an integer value from packetdata specific record.
       
   369          * @param aAttribute An indentifier to know the field in the record.
       
   370          * @param aBearerSpecRecordArray Array of records where the service
       
   371          * record can be found.
       
   372          * @return Returns an integer if the requested attribute
       
   373          * is found. Otherwise leaves with error code KErrNotFound.
       
   374          */
       
   375         TUint32 GetQosIntAttributeL(
       
   376                 TUint32 aAttribute,
       
   377                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   378 
       
   379         /**
       
   380          * Sets an integer value to packetdata specific record.
       
   381          * @param aAttribute An indentifier to know the field in the record.
       
   382          * @param aValue The value to be set.
       
   383          * @param aBearerSpecRecordArray Array of records where the service
       
   384          * record can be found.
       
   385          * @return Returns an integer if the requested attribute
       
   386          * is found. Otherwise leaves with error code KErrNotFound.
       
   387          */
       
   388         void SetQosIntAttributeL(
       
   389                 TUint32 aAttribute,
       
   390                 TUint32 aValue,
       
   391                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   392 
       
   393        /**
       
   394         * Sets the PDP-type.
       
   395         * @param aPdpType Pdp type to set.
       
   396         * @param aServiceRecord Pointer to the service record where to save the
       
   397         * pdp type.
       
   398         */
       
   399         void SetPDPTypeL( RPacketContext::TProtocolType aPdpType,
       
   400                           CommsDat::CCDWCDMAPacketServiceRecord* aServiceRecord );
       
   401 
       
   402         /**
       
   403          * Sets the daemon name for the Connection Method.
       
   404          * @param aGenRecordArray An array containing pointers to generic records
       
   405          * of the Connection Method.
       
   406          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   407          * specific records of the Connection Method.
       
   408          */
       
   409         void SetDaemonNameL(
       
   410             RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   411             RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   412 
       
   413     private:
       
   414         /**
       
   415          * Checks if the packetdata network is available.
       
   416          * @return Returns ETrue if the network is available. Otherwise returns
       
   417          * EFalse.
       
   418          */
       
   419         TBool CheckNetworkCoverageL() const;
       
   420 
       
   421     private: // Data
       
   422         /**
       
   423          * Boolean to define if this is outgoing or incoming packetdata cm.
       
   424          */
       
   425         TBool   iOutgoing;
       
   426 
       
   427         /**
       
   428          * Id of the bearer record of the iap.
       
   429          */
       
   430         TUint32 iBearerRecordId;
       
   431 
       
   432         /**
       
   433          * Name of the bearer record of the iap.
       
   434          */
       
   435         HBufC*  iBearerRecordName;
       
   436 
       
   437         /**
       
   438          * pointer to the QoS record of the iap.
       
   439          */
       
   440         CommsDat::CCDUmtsR99QoSAndOnTableRecord* iPacketDataQoSRecord;
       
   441     };
       
   442 
       
   443 #endif // PACKETDATA_PLUGIN_H