|
1 #ifndef __DBACCESSIMPLv2_H__ |
|
2 #define __DBACCESSIMPLv2_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 Implementation Class Header |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file DBACCESSIMPL.H |
|
22 */ |
|
23 |
|
24 #include "MDbAccess.h" |
|
25 #include <commsdattypesv1_1.h> |
|
26 using namespace CommsDat; |
|
27 |
|
28 NONSHARABLE_CLASS(CCommsDatAccessImpl) : public CBase, public MCommsDbAccess |
|
29 /** |
|
30 CCommsDatAccessImpl |
|
31 One of these per CAgentController object. Has a CCommsDatabase object and CCommsDbTableView's for |
|
32 accessing data in CommDb. Also uses a CCommDbOverrideSettings for accessing overridden |
|
33 fields. Also has a CDbChangeNotification for checking when the database is changed. |
|
34 Exported methods in CCommsDatAccessImpl object are also used by the CScriptBase class. |
|
35 @internalTechnology |
|
36 */ |
|
37 { |
|
38 public: |
|
39 static CCommsDatAccessImpl* NewL(); |
|
40 static CCommsDatAccessImpl* NewL(TBool aShowHidden); |
|
41 virtual ~CCommsDatAccessImpl(); |
|
42 |
|
43 /** Close database access */ |
|
44 virtual void Close(); |
|
45 |
|
46 /** Set function */ |
|
47 virtual void SetOverridesL(CCommDbOverrideSettings* aOverrides); |
|
48 |
|
49 // Get functions |
|
50 virtual TBool IsShowingHiddenRecords(); |
|
51 |
|
52 /** Default setting */ |
|
53 virtual void GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank); |
|
54 virtual void SetCurrentSettingsL(const TConnectionSettings& aSettings); |
|
55 virtual void GetPreferedIapL(TUint32& aIapId, TCommDbConnectionDirection aDirection, TUint32 aRank); |
|
56 virtual void SetPreferedIapL(TUint32& aIapId, TCommDbConnectionDirection aDirection, TUint32 aRank); |
|
57 virtual TBool DoesIapExistL(TUint32 aIapId); |
|
58 virtual void GetFirstValidIapL(TUint32& aIapId); |
|
59 virtual void GetServiceSettingsL(TConnectionSettings& aSettings); |
|
60 virtual TBool IsTelNumLengthZeroForRasConnectionL(TConnectionSettings& aSettings); |
|
61 |
|
62 /** |
|
63 Fetch the maximum number of connection attempts from the database |
|
64 */ |
|
65 virtual TInt GetConnectionAttempts(); |
|
66 |
|
67 /** Modem related */ |
|
68 virtual void GetBearerAvailabilityTsyNameL(TDes& aTsyName); |
|
69 virtual void GetTsyNameL(TDes& aTsyName); |
|
70 virtual void SetCommPortL(const RCall::TCommPort& aCommPort); |
|
71 |
|
72 /** Service Related */ |
|
73 virtual void GetServiceTypeL(TDes& aServiceType); |
|
74 virtual void GetAuthParamsL(TBool& aPromptForAuth,TDes& aUsername,TDes& aPassword); |
|
75 |
|
76 /** Agent Related */ |
|
77 virtual void GetAgentExtL(const TDesC& aServiceType, TDes& aAgentExt); |
|
78 |
|
79 /** MobileIP Related */ |
|
80 virtual void SetNetworkMode(RMobilePhone::TMobilePhoneNetworkMode aNetworkMode); |
|
81 virtual RMobilePhone::TMobilePhoneNetworkMode NetworkMode() const; |
|
82 |
|
83 /** Call to database server for use by NifMan */ |
|
84 virtual TInt ReadInt(const TDesC& aField, TUint32& aValue); |
|
85 virtual TInt ReadBool(const TDesC& aField, TBool& aValue); |
|
86 virtual TInt ReadDes(const TDesC& aField, TDes8& aValue); |
|
87 virtual TInt ReadDes(const TDesC& aField, TDes16& aValue); |
|
88 virtual HBufC* ReadLongDesLC(const TDesC& aField); |
|
89 virtual TInt WriteInt(const TDesC& aField, TUint32 aValue); |
|
90 virtual TInt WriteBool(const TDesC& aField, TBool aValuge); |
|
91 virtual TInt WriteDes(const TDesC& aField, const TDesC8& aValue); |
|
92 virtual TInt WriteDes(const TDesC& aField, const TDesC16& aValue); |
|
93 |
|
94 /** Service change noification */ |
|
95 virtual void RequestNotificationOfServiceChangeL(MServiceChangeObserver* aObserver); |
|
96 virtual void CancelRequestNotificationOfServiceChange(MServiceChangeObserver* aObserver); |
|
97 |
|
98 /** Reads from the agent extensions: read from the overrides, or |
|
99 if they don't exist straight from the database */ |
|
100 virtual void GetIntL(const TDesC& aTable, const TDesC& aField, TUint32& aValue); |
|
101 virtual void GetBoolL(const TDesC& aTable, const TDesC& aField, TBool& aValue); |
|
102 virtual void GetDesL(const TDesC& aTable, const TDesC& aField, TDes8& aValue); |
|
103 virtual void GetDesL(const TDesC& aTable, const TDesC& aField, TDes16& aValue); |
|
104 virtual HBufC* GetLongDesLC(const TDesC& aTable, const TDesC& aField); |
|
105 virtual TInt GetLengthOfLongDesL(const TDesC& aTable, const TDesC& aField); |
|
106 virtual void GetGlobalL(const TDesC& aName,TUint32& aVal); |
|
107 |
|
108 /** Some specific function for agent exts */ |
|
109 virtual CCommsDbAccess::CCommsDbAccessModemTable* ModemTable(); |
|
110 virtual TUint32 LocationId() const; |
|
111 virtual TCommDbConnectionDirection GetConnectionDirection() const; |
|
112 |
|
113 protected: |
|
114 /** Data capability checking */ |
|
115 virtual TInt DoCheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage ); |
|
116 virtual TInt DoCheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage ); |
|
117 |
|
118 private: |
|
119 CCommsDatAccessImpl(); |
|
120 void ConstructL(TBool& aShowHidden); |
|
121 |
|
122 /** Getting and setting connection preferences */ |
|
123 void GetIapConnectionPreferenceL(TConnectionSettings& aSettings); |
|
124 void SetIapConnectionPreferenceL(const TConnectionSettings& aSettings); |
|
125 TBool LocationRequiredL(); |
|
126 |
|
127 /** Convert name from NifMan */ |
|
128 CCDRecordBase* ConvertFieldNameL(TDes& aName); |
|
129 CCDRecordBase* ConvertTableNameToRecordAccessL(const TDesC& aTable); |
|
130 |
|
131 /** Service change notification */ |
|
132 void CheckForServiceChange(TBool aChanged); |
|
133 |
|
134 /** Reads from overrides and then if not there read from database */ |
|
135 void GetIntL(CCDRecordBase* aRecord, const TDesC& aField, TUint32& aValue); |
|
136 void GetBoolL(CCDRecordBase* aRecord, const TDesC& aField, TBool& aValue); |
|
137 void GetDesL(CCDRecordBase* aRecord, const TDesC& aField, TDes8& aValue); |
|
138 void GetDesL(CCDRecordBase* aRecord, const TDesC& aField, TDes16& aValue); |
|
139 HBufC* GetLongDesLC(CCDRecordBase* aRecord, const TDesC& aField); |
|
140 TInt GetLengthOfLongDesL(CCDRecordBase* aRecord, const TDesC& aField); |
|
141 |
|
142 void CreateCacheL(); |
|
143 |
|
144 private: |
|
145 CMDBSession* iDb; |
|
146 TCommDbConnectionDirection iDirection; |
|
147 CCDIAPRecord* iIAPSetting; |
|
148 //CCDServiceRecordBase* iServiceSetting; |
|
149 CCDChargecardRecord* iChargecardSetting; |
|
150 CCDBearerRecordBase* iBearerSetting; |
|
151 CCDLocationRecord* iLocationSetting; |
|
152 CCDRecordBase* iLanServiceExtensionTable; // used for the LAN service extension tables, such as BT PAN and WLAN |
|
153 // needs to appear as part of the LAN service table to clients, as they cannot cope with the extra level of indirection in the database |
|
154 // (they have no way of specifying a record id in a table, and therefore cannot access the correct records in the PAN and WLAN extension tables) |
|
155 TBool iGotSettings; |
|
156 CCommDbOverrideSettings* iOverrides; |
|
157 RCall::TCommPort iCommPort; |
|
158 MServiceChangeObserver* iServiceChangeObserver; |
|
159 |
|
160 /** MobileIP network mode */ |
|
161 RMobilePhone::TMobilePhoneNetworkMode iNetworkMode; |
|
162 TBool iShowHidden; |
|
163 |
|
164 //NEw new |
|
165 TBool iIAPOverridden; |
|
166 |
|
167 }; |
|
168 |
|
169 |
|
170 #endif /* #ifndef __DBACCESSIMPL_H__ */ |
|
171 |