linklayercontrol/networkinterfacemgr/inc/MDbAccess.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 #ifndef __MDBACCESS_H__
       
     2 #define __MDBACCESS_H__
       
     3 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 // All rights reserved.
       
     5 // This component and the accompanying materials are made available
       
     6 // under the terms of "Eclipse Public License v1.0"
       
     7 // which accompanies this distribution, and is available
       
     8 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 //
       
    10 // Initial Contributors:
       
    11 // Nokia Corporation - initial contribution.
       
    12 //
       
    13 // Contributors:
       
    14 //
       
    15 // Description:
       
    16 // Agent Database Access Class Header
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file MDBACCESS.H
       
    22 */
       
    23 
       
    24 #include <etel.h>
       
    25 #include <etelmm.h>
       
    26 #include <comms-infras/connectionsettings.h>
       
    27 #include <commsdattypesv1_1.h>
       
    28 #include <comms-infras/dbaccess.h>
       
    29 
       
    30 class CCommDbOverrideSettings;
       
    31 class TConnectionSettings;
       
    32 class MServiceChangeObserver;
       
    33 
       
    34 class MCommsDbAccess
       
    35 /**
       
    36 MCommsDbAccess
       
    37 Abstract interface to CCommsDbAccess implementation
       
    38 
       
    39 Note that the interface class provides certain sensible 'default'
       
    40 implementations of some of the interface functions, to reduce the
       
    41 burden on implementations
       
    42 
       
    43 @internalTechnology
       
    44 */
       
    45 	{
       
    46 public:
       
    47 	IMPORT_C virtual ~MCommsDbAccess();
       
    48 
       
    49 	/** Close database access */
       
    50 	virtual void Close() = 0;
       
    51 
       
    52 	/**
       
    53 	Sets overrides on the database
       
    54 
       
    55 	@param aOverrides pointer to the override settings to store.  Note that ownership of these overrides is retained by the caller.
       
    56 	@exception leaves if database access fails
       
    57 	*/
       
    58 	virtual void SetOverridesL(CCommDbOverrideSettings* aOverrides) = 0;
       
    59 
       
    60 	// Get functions
       
    61 	virtual TBool IsShowingHiddenRecords() = 0;
       
    62 
       
    63 	/** Default setting */
       
    64 	/**
       
    65 	Retrieves the current connection preferences from CommDb
       
    66 
       
    67 	@param aSettings on return contatins the connection preferences for the specified direction and rank
       
    68 	@param aDirection the connection direction (either incoming or outgoing)
       
    69 	@param aRank the current connection attempt
       
    70 	@exception leaves if database access fails
       
    71 	*/
       
    72 	virtual void GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank) = 0;
       
    73 	/**
       
    74 	Stores the current connection preferences in CommDb
       
    75 
       
    76 	@param aSettings contatins the connection preferences for the specified direction and rank (stored inside aSettings)
       
    77 	@exception leaves if database access fails
       
    78 	*/
       
    79 	virtual void SetCurrentSettingsL(const TConnectionSettings& aSettings) = 0;
       
    80 	/**
       
    81 	Retrieves the IapId for the connection type of ranking aRank
       
    82 
       
    83 	@param IapId the id of the IAP to look for in the IAP table.
       
    84 	@param aDirection the connection direction (either incoming or outgoing)
       
    85 	@param aRank the current connection attempt
       
    86 	@exception leaves if database access fails
       
    87 	*/
       
    88 	virtual void GetPreferedIapL(TUint32& aIapId, TCommDbConnectionDirection aDirection, TUint32 aRank) = 0;
       
    89 	/**
       
    90 	Stores the prefered IapId for the connection type of ranking aRank
       
    91 
       
    92 	@param IapId the id of the IAP to look for in the IAP table
       
    93 	@param aDirection the connection direction (either incoming or outgoing).
       
    94 	@param aRank the current connection attempt
       
    95 	@exception leaves if database access fails
       
    96 	*/
       
    97 	virtual void SetPreferedIapL(TUint32& aIapId, TCommDbConnectionDirection aDirection, TUint32 aRank) = 0;
       
    98 	/**
       
    99 	Checks in the database for the precence of an Iap
       
   100 
       
   101 	@param aIapId, the id of the IAP to look for in the IAP table
       
   102 	@returns ETrue if the Iap exists
       
   103 	*/
       
   104 	virtual TBool DoesIapExistL(TUint32 aIapId) = 0;
       
   105 	virtual void GetFirstValidIapL(TUint32& aIapId) = 0;
       
   106 
       
   107 	/**
       
   108 	For a specified IAP, retrieves the CommDb ID of the service table and the type of the service table (e.g. DIAL_OUT_ISP, INCOMING_GPRS etc)
       
   109 
       
   110 	@param aSettings (both input and output) specifies the IAP ID and returns the service ID and type
       
   111 	@exception leaves if database access fails
       
   112 	*/
       
   113 	virtual void GetServiceSettingsL(TConnectionSettings& aSettings) = 0;
       
   114 	/**
       
   115 	Determines whether this is an NTRAS connection.
       
   116 	This is used to decide whether or not to check for bearer availability before selecting an IAP.
       
   117 	The function looks at phone number stored in the service record.
       
   118 
       
   119 	@param aSettings specifies the ID of the service record to look at.
       
   120 	@returns ETrue if the phone number in zero, otherwise EFalse
       
   121 	@exception leaves if database access fails
       
   122 	*/
       
   123 	virtual TBool IsTelNumLengthZeroForRasConnectionL(TConnectionSettings& aSettings) = 0;
       
   124 	/**
       
   125 	  Fetch the maximum number of connection attempts from the database
       
   126 	*/
       
   127 	virtual TInt GetConnectionAttempts() = 0;
       
   128 
       
   129 	/** Modem related */
       
   130 	virtual void GetBearerAvailabilityTsyNameL(TDes& aTsyName) = 0;
       
   131 	/**
       
   132 	Retrieve the TSY name from the database
       
   133 
       
   134 	@param aName the name of the TSY
       
   135 	@exception leaves if database could not be accessed
       
   136 	*/
       
   137 	virtual void GetTsyNameL(TDes& aTsyName) = 0;
       
   138 	virtual void SetCommPortL(const RCall::TCommPort& aCommPort) = 0;
       
   139 
       
   140 	/** Service Related */
       
   141 	virtual void GetServiceTypeL(TDes& aServiceType) = 0;
       
   142 	virtual void GetAuthParamsL(TBool& aPromptForAuth,TDes& aUsername,TDes& aPassword) = 0;
       
   143 
       
   144 	/** Agent Related */
       
   145 	virtual void GetAgentExtL(const TDesC& aServiceType, TDes& aAgentExt) = 0;
       
   146 
       
   147 	/** MobileIP Related */
       
   148 	/**
       
   149 	Set the phone network mode in the database
       
   150 
       
   151 	@param aMode the current network mode
       
   152 	*/
       
   153   	virtual void SetNetworkMode(RMobilePhone::TMobilePhoneNetworkMode aNetworkMode) = 0;
       
   154 	/**
       
   155 	Fetch the phone network mode from the database
       
   156 
       
   157 	@returns the current network mode
       
   158 	*/
       
   159 	virtual RMobilePhone::TMobilePhoneNetworkMode NetworkMode() const = 0;
       
   160 
       
   161 	/** Call to database server for use by NifMan */
       
   162 	virtual TInt ReadInt(const TDesC& aField, TUint32& aValue) = 0;
       
   163 	virtual TInt ReadBool(const TDesC& aField, TBool& aValue) = 0;
       
   164 	virtual TInt ReadDes(const TDesC& aField, TDes8& aValue) = 0;
       
   165 	virtual TInt ReadDes(const TDesC& aField, TDes16& aValue) = 0;
       
   166 	virtual HBufC* ReadLongDesLC(const TDesC& aField) = 0;
       
   167 	virtual TInt WriteInt(const TDesC& aField, TUint32 aValue) = 0;
       
   168 	virtual TInt WriteBool(const TDesC& aField, TBool aValuge) = 0;
       
   169 	virtual TInt WriteDes(const TDesC& aField, const TDesC8& aValue) = 0;
       
   170 	virtual TInt WriteDes(const TDesC& aField, const TDesC16& aValue) = 0;
       
   171 
       
   172 	/** Service change noification */
       
   173 	/**
       
   174 	Request a notification if the database is changed
       
   175 
       
   176 	@param aObserver Pointer to call back on with notification
       
   177 	@exception leaves if unable to monitor
       
   178 	*/
       
   179 	virtual void RequestNotificationOfServiceChangeL(MServiceChangeObserver* aObserver) = 0;
       
   180 	/**
       
   181 	Cancel the request for notification if the database is changed
       
   182 
       
   183 	@param aObserver Pointer to call back on with notification
       
   184 	@exception leaves if unable to remove the subscription
       
   185 	*/
       
   186 	virtual void CancelRequestNotificationOfServiceChange(MServiceChangeObserver* aObserver) = 0;
       
   187 
       
   188 	/** Reads from the agent extensions: read from the overrides, or
       
   189 		if they don't exist straight from the database */
       
   190 	/**
       
   191 	Retrieve a TUint32 value from the database
       
   192 
       
   193 	@param aTable the table to access
       
   194 	@param aField the name of the field to retrieve
       
   195 	@param aValue on return contains the value of the specified field
       
   196 	@exception leaves if database access fails
       
   197 	*/
       
   198 	virtual void GetIntL(const TDesC& aTable, const TDesC& aField, TUint32& aValue) = 0;
       
   199 	virtual void GetBoolL(const TDesC& aTable, const TDesC& aField, TBool& aValue) = 0;
       
   200 	/**
       
   201 	Retrieve a TDesC value from the database
       
   202 
       
   203 	@param aTable the table to access
       
   204 	@param aField the name of the field to retrieve
       
   205 	@param aValue on return contains the value of the specified field
       
   206 	@exception leaves if database access fails
       
   207 	*/
       
   208 	virtual void GetDesL(const TDesC& aTable, const TDesC& aField, TDes8& aValue) = 0;
       
   209 	/**
       
   210 	Retrieve a TDesC value from the database
       
   211 
       
   212 	@param aTable the table to access
       
   213 	@param aField the name of the field to retrieve
       
   214 	@param aValue on return contains the value of the specified field
       
   215 	@exception leaves if database access fails
       
   216 	*/
       
   217 	virtual void GetDesL(const TDesC& aTable, const TDesC& aField, TDes16& aValue) = 0;
       
   218 	virtual HBufC* GetLongDesLC(const TDesC& aTable, const TDesC& aField) = 0;
       
   219 	virtual TInt GetLengthOfLongDesL(const TDesC& aTable, const TDesC& aField) = 0;
       
   220 	virtual void GetGlobalL(const TDesC& aName,TUint32& aVal) = 0;
       
   221 
       
   222 	/** Some specific function for agent exts */
       
   223 	virtual CCommsDbAccess::CCommsDbAccessModemTable* ModemTable() = 0;
       
   224 	
       
   225 	virtual TUint32 LocationId() const = 0;
       
   226 	virtual TCommDbConnectionDirection GetConnectionDirection() const = 0;
       
   227 
       
   228 	/** Data capability checking */
       
   229 	IMPORT_C TInt CheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage );
       
   230 	IMPORT_C TInt CheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage );
       
   231 protected:
       
   232 	/** Data capability checking */
       
   233 	virtual TInt DoCheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage ) = 0;
       
   234 	virtual TInt DoCheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage ) = 0;
       
   235 	};
       
   236 
       
   237 
       
   238 #endif /* #ifndef __MDBACCESS_H__ */
       
   239