24
|
1 |
// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// CCommsDbNetDialAccess definitions
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file nd_dbacc.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <nifvar.h>
|
|
23 |
#include <commsdattypesv1_1.h>
|
|
24 |
#include <commsdatutils.h>
|
|
25 |
using namespace CommsDat;
|
|
26 |
#include "ND_DBACC.H"
|
|
27 |
#include "SLOGGER.H"
|
|
28 |
#include "ND_STD.H"
|
|
29 |
|
|
30 |
/**
|
|
31 |
@internalComponent
|
|
32 |
*/
|
|
33 |
const TUint32 KZeroFieldValue=0uL;
|
|
34 |
|
|
35 |
CCommsDbNetDialAccess* CCommsDbNetDialAccess::NewL(CCommsDbAccess* aDbAccess)
|
|
36 |
/**
|
|
37 |
2 phased constructor, first phase.
|
|
38 |
|
|
39 |
@param aDbAccess a pointer to the database accessor.
|
|
40 |
@exception Leaves if CCommsDbNetDialAccess() constructor leaves, or not enough memory is available.
|
|
41 |
@return a new CCommsDbNetDialAccess object.
|
|
42 |
*/
|
|
43 |
{
|
|
44 |
return new(ELeave) CCommsDbNetDialAccess(aDbAccess);
|
|
45 |
}
|
|
46 |
|
|
47 |
CCommsDbNetDialAccess::CCommsDbNetDialAccess(CCommsDbAccess* aDbAccess)
|
|
48 |
: iDbAccess(aDbAccess)
|
|
49 |
/**
|
|
50 |
Private constructor used in the first phase of construction.
|
|
51 |
|
|
52 |
@param aDbAccess a pointer to the database accessor.
|
|
53 |
*/
|
|
54 |
{}
|
|
55 |
|
|
56 |
CCommsDbNetDialAccess::~CCommsDbNetDialAccess()
|
|
57 |
/**
|
|
58 |
Destructor.
|
|
59 |
*/
|
|
60 |
{}
|
|
61 |
|
|
62 |
void CCommsDbNetDialAccess::Close()
|
|
63 |
/**
|
|
64 |
Closes database accessor.
|
|
65 |
*/
|
|
66 |
{
|
|
67 |
iDbAccess->Close();
|
|
68 |
}
|
|
69 |
|
|
70 |
void CCommsDbNetDialAccess::GetTsyNameL(TDes& aTsyName)
|
|
71 |
/**
|
|
72 |
Gets TSY name from database.
|
|
73 |
|
|
74 |
@param aTsyName a reference to the TSY name that is read from database.
|
|
75 |
@exception Leaves if GetTsyNameL() leaves.
|
|
76 |
*/
|
|
77 |
{
|
|
78 |
iDbAccess->GetTsyNameL(aTsyName);
|
|
79 |
}
|
|
80 |
|
|
81 |
void CCommsDbNetDialAccess::SetCommPortL(const RCall::TCommPort& aCommPort)
|
|
82 |
/**
|
|
83 |
Sets COMM-port into database.
|
|
84 |
|
|
85 |
@param aCommPort a reference to the COMM-port written into database.
|
|
86 |
@exception Leaves if SetCommPortL() leaves.
|
|
87 |
*/
|
|
88 |
{
|
|
89 |
iDbAccess->SetCommPortL(aCommPort);
|
|
90 |
}
|
|
91 |
|
|
92 |
void CCommsDbNetDialAccess::GetCommPortForDirectConnectL(RCall::TCommPort& aCommPort)
|
|
93 |
/**
|
|
94 |
Get comm port details for direct connection.
|
|
95 |
|
|
96 |
@param aCommPort a reference to the COMM-port read from database.
|
|
97 |
@exception Leaves if ReadTextL() leaves.
|
|
98 |
*/
|
|
99 |
{
|
|
100 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
101 |
CleanupStack::PushL(modemTable);
|
|
102 |
if (modemTable == 0)
|
|
103 |
{
|
|
104 |
User::Leave(KErrNoMemory); // most likely?
|
|
105 |
}
|
|
106 |
|
|
107 |
aCommPort.iCsy = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iCsyName;
|
|
108 |
aCommPort.iPort = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iPortName;
|
|
109 |
|
|
110 |
CleanupStack::PopAndDestroy(modemTable);
|
|
111 |
}
|
|
112 |
|
|
113 |
void CCommsDbNetDialAccess::GetBcaStackL(TDes& aBcaStack)
|
|
114 |
/**
|
|
115 |
Gets the Bca Stack
|
|
116 |
|
|
117 |
@param aBcaStack the BcaStack
|
|
118 |
@exception Leaves if ReadTextL() leaves.
|
|
119 |
*/
|
|
120 |
{
|
|
121 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
122 |
CleanupStack::PushL(modemTable);
|
|
123 |
if (modemTable == 0)
|
|
124 |
{
|
|
125 |
User::Leave(KErrNoMemory); // most likely?
|
|
126 |
}
|
|
127 |
|
|
128 |
aBcaStack = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iBcaStack;
|
|
129 |
|
|
130 |
CleanupStack::PopAndDestroy(modemTable);
|
|
131 |
}
|
|
132 |
|
|
133 |
TInt CCommsDbNetDialAccess::GetIapId()
|
|
134 |
{
|
|
135 |
_LIT(KIAPId, "IAP\\Id");
|
|
136 |
|
|
137 |
TUint32 iap;
|
|
138 |
TInt err = iDbAccess->ReadInt(KIAPId(), iap);
|
|
139 |
return (err == KErrNone) ? iap : err;
|
|
140 |
}
|
|
141 |
|
|
142 |
void CCommsDbNetDialAccess::GetCommConfigForDirectConnectL(TCommConfig& aCommConfig)
|
|
143 |
/**
|
|
144 |
Get settings from modem config settings for data bits, stop bits and parity
|
|
145 |
and get appropriate handshaking for direct connection.
|
|
146 |
|
|
147 |
@param aCommConfig a reference to the configuration read for connection.
|
|
148 |
@exception Leaves if PopulateModemCommSettingsL() leaves.
|
|
149 |
*/
|
|
150 |
{
|
|
151 |
TCommConfigV01& cfg=aCommConfig();
|
|
152 |
PopulateModemCommSettingsL(cfg);
|
|
153 |
// DSRFail not asserted for battery powered modems that switch on with DTR High
|
|
154 |
cfg.iHandshake&=(~(KDCDHandshakeMask | KDSRFailHandshakeMask | KCTSHandshakeMask));
|
|
155 |
// Should be 0 for correct script operation
|
|
156 |
cfg.iTerminatorCount=0;
|
|
157 |
}
|
|
158 |
|
|
159 |
void CCommsDbNetDialAccess::GetCommPortRoleL(TCommRole& aRole)
|
|
160 |
/**
|
|
161 |
Get comm port role (DCE or DTE)
|
|
162 |
|
|
163 |
@param aRole a reference to the role read from the database
|
|
164 |
@exception Leaves if ReadUintL() leaves.
|
|
165 |
*/
|
|
166 |
{
|
|
167 |
TUint32 dummy = KZeroFieldValue;
|
|
168 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
169 |
CleanupStack::PushL(modemTable);
|
|
170 |
if (modemTable == 0)
|
|
171 |
{
|
|
172 |
User::Leave(KErrNoMemory); // most likely?
|
|
173 |
}
|
|
174 |
|
|
175 |
dummy = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iCommRole;
|
|
176 |
if (dummy & KModemCommRoleDCE)
|
|
177 |
{
|
|
178 |
aRole = ECommRoleDCE;
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
aRole = ECommRoleDTE;
|
|
183 |
}
|
|
184 |
|
|
185 |
CleanupStack::PopAndDestroy(modemTable);
|
|
186 |
|
|
187 |
}
|
|
188 |
|
|
189 |
void CCommsDbNetDialAccess::GetCallParamsL(RCall::TCallParams& aParams)
|
|
190 |
/**
|
|
191 |
Parse info about speaker settings and pause time from modem prefs and location table
|
|
192 |
into TCallParams struct. Assume we require a location as we are dialling a number.
|
|
193 |
|
|
194 |
@param aParams a reference to the Core API call parameters read from database.
|
|
195 |
@exception Leaves if ReadUintL(), GetIntL() or GetBoolL() leaves.
|
|
196 |
*/
|
|
197 |
{
|
|
198 |
TUint32 value=KZeroFieldValue;
|
|
199 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
200 |
CleanupStack::PushL(modemTable);
|
|
201 |
if (modemTable == 0)
|
|
202 |
{
|
|
203 |
User::Leave(KErrNoMemory); // most likely?
|
|
204 |
}
|
|
205 |
|
|
206 |
value = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iSpeakerPref;
|
|
207 |
|
|
208 |
switch (value)
|
|
209 |
{
|
|
210 |
case EModemSpeakerSettingNever:
|
|
211 |
aParams.iSpeakerControl=RCall::EMonitorSpeakerControlAlwaysOff;
|
|
212 |
break;
|
|
213 |
case EModemSpeakerSettingUntilCallAnswered:
|
|
214 |
aParams.iSpeakerControl=RCall::EMonitorSpeakerControlOnUntilCarrier;
|
|
215 |
break;
|
|
216 |
case EModemSpeakerSettingAlways:
|
|
217 |
aParams.iSpeakerControl=RCall::EMonitorSpeakerControlAlwaysOn;
|
|
218 |
break;
|
|
219 |
case EModemSpeakerSettingAfterDialUntilAnswer:
|
|
220 |
aParams.iSpeakerControl=RCall::EMonitorSpeakerControlOnExceptDuringDialling;
|
|
221 |
break;
|
|
222 |
default:
|
|
223 |
aParams.iSpeakerControl=RCall::EMonitorSpeakerControlUnknown;
|
|
224 |
break;
|
|
225 |
}
|
|
226 |
|
|
227 |
value = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iSpeakerVolPref;
|
|
228 |
|
|
229 |
CleanupStack::PopAndDestroy(modemTable);
|
|
230 |
switch (value)
|
|
231 |
{
|
|
232 |
case EModemSpeakerVolumeQuiet:
|
|
233 |
aParams.iSpeakerVolume=RCall::EMonitorSpeakerVolumeLow;
|
|
234 |
break;
|
|
235 |
case EModemSpeakerVolumeMedium:
|
|
236 |
aParams.iSpeakerVolume=RCall::EMonitorSpeakerVolumeMedium;
|
|
237 |
break;
|
|
238 |
case EModemSpeakerVolumeLoud:
|
|
239 |
aParams.iSpeakerVolume=RCall::EMonitorSpeakerVolumeHigh;
|
|
240 |
break;
|
|
241 |
default:
|
|
242 |
aParams.iSpeakerVolume=RCall::EMonitorSpeakerVolumeUnknown;
|
|
243 |
break;
|
|
244 |
}
|
|
245 |
|
|
246 |
TPtrC loc(LOCATION);
|
|
247 |
iDbAccess->GetIntL(loc,TPtrC(LOCATION_PAUSE_AFTER_DIAL_OUT),value);
|
|
248 |
aParams.iInterval=(TUint)value;
|
|
249 |
|
|
250 |
TBool bValue;
|
|
251 |
iDbAccess->GetBoolL(loc,TPtrC(LOCATION_WAIT_FOR_DIAL_TONE),bValue);
|
|
252 |
if (bValue)
|
|
253 |
{
|
|
254 |
aParams.iWaitForDialTone=RCall::EDialToneWait;
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
aParams.iWaitForDialTone=RCall::EDialToneNoWait;
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
TInt CCommsDbNetDialAccess::GetRedialAttempts(TUint32& aAttempts)
|
|
263 |
/**
|
|
264 |
Reads amount of redial attempts from database.
|
|
265 |
|
|
266 |
@param aAttempts a reference to redial attempts read from database.
|
|
267 |
@return an error code trapped if GetGlobalL() leaves.
|
|
268 |
*/
|
|
269 |
{
|
|
270 |
TRAPD(ret,iDbAccess->GetGlobalL(TPtrC(REDIAL_ATTEMPTS),aAttempts));
|
|
271 |
return ret;
|
|
272 |
}
|
|
273 |
|
|
274 |
void CCommsDbNetDialAccess::GetRemoteParty(TDes& aRemoteParty)
|
|
275 |
/**
|
|
276 |
Read ISP name from database and return as remote party.
|
|
277 |
|
|
278 |
@param aRemoteParty a reference to ISP name read from database.
|
|
279 |
@exception Leaves if GetDesL() leaves.
|
|
280 |
*/
|
|
281 |
{
|
|
282 |
TInt ret(KErrNone);
|
|
283 |
TPtrC name(COMMDB_NAME);
|
|
284 |
|
|
285 |
ret = AssertDialOutTable();
|
|
286 |
if (ret != KErrNone)
|
|
287 |
{
|
|
288 |
//if AssertDialOutTable encounters serios errors (OOM)
|
|
289 |
//it must set aRemoteParty appropriatelly
|
|
290 |
_LIT(unknownParty,"???");
|
|
291 |
aRemoteParty=unknownParty;
|
|
292 |
return;
|
|
293 |
}
|
|
294 |
|
|
295 |
TRAP(ret,iDbAccess->GetDesL(TPtrC(IAP),name,aRemoteParty));
|
|
296 |
|
|
297 |
if(ret!=KErrNone)
|
|
298 |
{
|
|
299 |
_LIT(unknownParty,"???");
|
|
300 |
aRemoteParty=unknownParty;
|
|
301 |
}
|
|
302 |
}
|
|
303 |
|
|
304 |
void CCommsDbNetDialAccess::IsDefaultTelNumL(TBool& aIsTelNum)
|
|
305 |
/**
|
|
306 |
Check length of default tel no - if 0 set boolean to false, else true.
|
|
307 |
Only for dial out
|
|
308 |
|
|
309 |
@param aIsTelNum a reference to the default tel num read from database.
|
|
310 |
@exception Leaves if GetDesL() leaves.
|
|
311 |
|
|
312 |
*/
|
|
313 |
{
|
|
314 |
User::LeaveIfError(AssertDialOutTable());
|
|
315 |
|
|
316 |
TDialString telNum;
|
|
317 |
iDbAccess->GetDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_DEFAULT_TEL_NUM),telNum);
|
|
318 |
if (telNum.Length()==0)
|
|
319 |
aIsTelNum=EFalse;
|
|
320 |
else
|
|
321 |
aIsTelNum=ETrue;
|
|
322 |
}
|
|
323 |
|
|
324 |
void CCommsDbNetDialAccess::GetUsePctL(TBool& aUsePct)
|
|
325 |
/**
|
|
326 |
Read the DisplayPct boolean from the ISP database
|
|
327 |
Only for dial out
|
|
328 |
|
|
329 |
@param aUsePct a reference to the DisplayPct boolean read from database.
|
|
330 |
@exception Leaves if GetBoolL() leaves.
|
|
331 |
*/
|
|
332 |
{
|
|
333 |
User::LeaveIfError(AssertDialOutTable());
|
|
334 |
iDbAccess->GetBoolL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_DISPLAY_PCT),aUsePct);
|
|
335 |
}
|
|
336 |
|
|
337 |
void CCommsDbNetDialAccess::GetScriptDetailsL(TBool& aUseScript, TInt& aLength)
|
|
338 |
/**
|
|
339 |
Get the length of the script into aLength.
|
|
340 |
Dial in or dial out.
|
|
341 |
|
|
342 |
@param aUseScript a reference to the script boolean read from database.
|
|
343 |
@param aLength a reference to the lenght of script read from database.
|
|
344 |
@exception Leaves if GetBoolL() or GetLengthOfLongDesL() leaves.
|
|
345 |
*/
|
|
346 |
{
|
|
347 |
User::LeaveIfError(AssertDialOutTable());
|
|
348 |
iDbAccess->GetBoolL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_USE_LOGIN_SCRIPT),aUseScript);
|
|
349 |
aLength=iDbAccess->GetLengthOfLongDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_LOGIN_SCRIPT));
|
|
350 |
}
|
|
351 |
|
|
352 |
HBufC* CCommsDbNetDialAccess::GetScriptLC()
|
|
353 |
/**
|
|
354 |
Return the script.
|
|
355 |
Dial in or dial out.
|
|
356 |
|
|
357 |
@exception Leaves if GetBoolL() or GetLengthOfLongDesL() leaves.
|
|
358 |
@return as HBufC* the login script read from database.
|
|
359 |
*/
|
|
360 |
{
|
|
361 |
User::LeaveIfError(AssertDialOutTable());
|
|
362 |
return iDbAccess->GetLongDesLC(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_LOGIN_SCRIPT));
|
|
363 |
}
|
|
364 |
|
|
365 |
void CCommsDbNetDialAccess::GetLoginParamsL(TBool& aPromptForLogin,TDes& aLoginName,TDes& aLoginPass,TDes& aIPAddress)
|
|
366 |
/**
|
|
367 |
Get boolean PromptForLogin and login name, login password and IP address
|
|
368 |
Dial out only.
|
|
369 |
|
|
370 |
@param aPromptForLogin a reference to the prompt boolean read from database.
|
|
371 |
@param aLoginName a reference to the login name read from database.
|
|
372 |
@param aLoginPass a reference to the login password read from database.
|
|
373 |
@param aIPAddress a reference to the ISP IP address read from database.
|
|
374 |
@exception Leaves if GetBoolL() or GetDesL() leaves.
|
|
375 |
*/
|
|
376 |
{
|
|
377 |
User::LeaveIfError(AssertDialOutTable());
|
|
378 |
|
|
379 |
iDbAccess->GetBoolL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_PROMPT_FOR_LOGIN),aPromptForLogin);
|
|
380 |
iDbAccess->GetDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_LOGIN_NAME),aLoginName);
|
|
381 |
iDbAccess->GetDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_LOGIN_PASS),aLoginPass);
|
|
382 |
iDbAccess->GetDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_IP_ADDR),aIPAddress);
|
|
383 |
}
|
|
384 |
|
|
385 |
TInt CCommsDbNetDialAccess::GetCallbackTimeout(TUint32& aTimeout)
|
|
386 |
/**
|
|
387 |
Get call back timeout.
|
|
388 |
|
|
389 |
@param aTimeout a reference to the dial out time read from database.
|
|
390 |
@return an error code trapped if GetIntL() leaves.
|
|
391 |
*/
|
|
392 |
{
|
|
393 |
TInt ret = AssertDialOutTable();
|
|
394 |
if (ret != KErrNone)
|
|
395 |
return ret;
|
|
396 |
|
|
397 |
TRAP(ret,iDbAccess->GetIntL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_CALLBACK_TIMEOUT),aTimeout));
|
|
398 |
return ret;
|
|
399 |
}
|
|
400 |
|
|
401 |
TBool CCommsDbNetDialAccess::HscsdSettingsAvailableL()
|
|
402 |
/**
|
|
403 |
Check if HSCSD settings are available in database.
|
|
404 |
|
|
405 |
@return ETrue if bearer type in database is EBearerTypeHSCSD. Else return EFalse.
|
|
406 |
*/
|
|
407 |
{
|
|
408 |
User::LeaveIfError(AssertDialOutTable());
|
|
409 |
|
|
410 |
TUint32 temp=0uL;
|
|
411 |
TRAPD(ret,iDbAccess->GetIntL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_BEARER_TYPE),temp));
|
|
412 |
if (ret==KErrUnknown)
|
|
413 |
return EFalse;
|
|
414 |
User::LeaveIfError(ret); // any other error
|
|
415 |
if ((TCommsDbBearerType)temp==EBearerTypeHSCSD)
|
|
416 |
return ETrue;
|
|
417 |
return EFalse;
|
|
418 |
}
|
|
419 |
|
|
420 |
void CCommsDbNetDialAccess::GetMmHscsdParametersL(RMobileCall::TMobileHscsdCallParamsV1& aMmHscsdParams)
|
|
421 |
/**
|
|
422 |
Get Multimode HSCSD call parameters..
|
|
423 |
|
|
424 |
@param aMmHscsdParams a reference to the multimode HSCSD call parameters read from database.
|
|
425 |
@exception Leaves if GetIntL or GetBoolL() leaves.
|
|
426 |
*/
|
|
427 |
{
|
|
428 |
User::LeaveIfError(AssertDialOutTable());
|
|
429 |
|
|
430 |
TUint32 temp=0uL;
|
|
431 |
TPtrC serviceTableName(DIAL_OUT_ISP);
|
|
432 |
iDbAccess->GetIntL(serviceTableName,TPtrC(ISP_AIUR),temp);
|
|
433 |
aMmHscsdParams.iWantedAiur=(RMobileCall::TMobileCallAiur)temp;
|
|
434 |
iDbAccess->GetIntL(serviceTableName,TPtrC(ISP_REQUESTED_TIME_SLOTS),temp);
|
|
435 |
aMmHscsdParams.iWantedRxTimeSlots=(TInt)temp;
|
|
436 |
iDbAccess->GetIntL(serviceTableName,TPtrC(ISP_MAXIMUM_TIME_SLOTS),temp);
|
|
437 |
aMmHscsdParams.iMaxTimeSlots=(TInt)temp;
|
|
438 |
iDbAccess->GetIntL(serviceTableName,TPtrC(ISP_CHANNEL_CODING),temp);
|
|
439 |
aMmHscsdParams.iCodings=(TUint32)temp;
|
|
440 |
iDbAccess->GetIntL(serviceTableName,TPtrC(ISP_ASYMMETRY),temp);
|
|
441 |
aMmHscsdParams.iAsymmetry=(RMobileCall::TMobileCallAsymmetry)temp;
|
|
442 |
TBool b;
|
|
443 |
iDbAccess->GetBoolL(serviceTableName,TPtrC(ISP_USER_INIT_UPGRADE),b);
|
|
444 |
aMmHscsdParams.iUserInitUpgrade=b;
|
|
445 |
}
|
|
446 |
|
|
447 |
TBool CCommsDbNetDialAccess::GetMmCallParams(RMobileCall::TMobileDataCallParamsV1& aMmParams)
|
|
448 |
/**
|
|
449 |
Get Multimode data call parameters. If the parameters can be read from database,
|
|
450 |
return ETrue, else return EFalse.
|
|
451 |
|
|
452 |
@param aMmParams a reference to the multimode data call parameters read from database.
|
|
453 |
@return ETrue if multimode data call parameters are read successfully. Else return EFalse.
|
|
454 |
*/
|
|
455 |
{
|
|
456 |
TInt ret = AssertDialOutTable();
|
|
457 |
if (ret!=KErrNone)
|
|
458 |
return EFalse;
|
|
459 |
|
|
460 |
TUint32 temp=0uL;
|
|
461 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_BEARER_SERVICE),temp));
|
|
462 |
if (ret!=KErrNone)
|
|
463 |
return EFalse;
|
|
464 |
aMmParams.iService=(RMobileCall::TMobileCallDataService)temp;
|
|
465 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_BEARER_SPEED),temp));
|
|
466 |
if (ret!=KErrNone)
|
|
467 |
return EFalse;
|
|
468 |
aMmParams.iSpeed=(RMobileCall::TMobileCallDataSpeed)temp;
|
|
469 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_BEARER_PROTOCOL),temp));
|
|
470 |
if (ret!=KErrNone)
|
|
471 |
return EFalse;
|
|
472 |
aMmParams.iProtocol=(RMobileCall::TMobileCallDataProtocol)temp;
|
|
473 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_BEARER_CE),temp));
|
|
474 |
if (ret!=KErrNone)
|
|
475 |
return EFalse;
|
|
476 |
aMmParams.iQoS=(RMobileCall::TMobileCallDataQoS)temp;
|
|
477 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_RLP_VERSION),temp));
|
|
478 |
if (ret!=KErrNone)
|
|
479 |
return EFalse;
|
|
480 |
aMmParams.iRLPVersion=(RMobileCall::TMobileCallDataRLPVersion)temp;
|
|
481 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_IWF_TO_MS),temp));
|
|
482 |
if (ret!=KErrNone)
|
|
483 |
return EFalse;
|
|
484 |
aMmParams.iModemToMSWindowSize=(TInt)temp;
|
|
485 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_MS_TO_IWF),temp));
|
|
486 |
if (ret!=KErrNone)
|
|
487 |
return EFalse;
|
|
488 |
aMmParams.iMSToModemWindowSize=(TInt)temp;
|
|
489 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_ACK_TIMER),temp));
|
|
490 |
if (ret!=KErrNone)
|
|
491 |
return EFalse;
|
|
492 |
aMmParams.iAckTimer=(TInt)temp;
|
|
493 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_RETRANSMISSION_ATTEMPTS),temp));
|
|
494 |
if (ret!=KErrNone)
|
|
495 |
return EFalse;
|
|
496 |
aMmParams.iRetransmissionAttempts=(TInt)temp;
|
|
497 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_RESEQUENCE_PERIOD),temp));
|
|
498 |
if (ret!=KErrNone)
|
|
499 |
return EFalse;
|
|
500 |
aMmParams.iResequencingPeriod=(TInt)temp;
|
|
501 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_V42_COMPRESSION),temp));
|
|
502 |
if (ret!=KErrNone)
|
|
503 |
return EFalse;
|
|
504 |
aMmParams.iV42bisReq=(RMobileCall::TMobileCallDataV42bis)temp;
|
|
505 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_V42_CODEWORDS),temp));
|
|
506 |
if (ret!=KErrNone)
|
|
507 |
return EFalse;
|
|
508 |
aMmParams.iV42bisCodewordsNum=(TInt)temp;
|
|
509 |
TRAP(ret,iDbAccess->GetIntL(KGeneralServiceTable,TPtrC(ISP_V42_MAX_LENGTH),temp));
|
|
510 |
if (ret!=KErrNone)
|
|
511 |
return EFalse;
|
|
512 |
aMmParams.iV42bisMaxStringLength=(TInt)temp;
|
|
513 |
TBool useEdge;
|
|
514 |
TRAP(ret,iDbAccess->GetBoolL(KGeneralServiceTable,TPtrC(ISP_USE_EDGE),useEdge));
|
|
515 |
if (ret!=KErrNone)
|
|
516 |
return EFalse;
|
|
517 |
aMmParams.iUseEdge=useEdge;
|
|
518 |
return ETrue;
|
|
519 |
}
|
|
520 |
|
|
521 |
void CCommsDbNetDialAccess::CopyIspInitStringToModemL()
|
|
522 |
/**
|
|
523 |
Copy over ISP init string from ISP to modem table.
|
|
524 |
|
|
525 |
@exception Leaves if GetDesL(), UpdateRecord() or PutRecordChanges() leaves.
|
|
526 |
*/
|
|
527 |
{
|
|
528 |
TBuf8<KCommsDbSvrMaxFieldLength> initStringIsp;
|
|
529 |
iDbAccess->GetDesL (KGeneralServiceTable, TPtrC (ISP_INIT_STRING), initStringIsp);
|
|
530 |
TBuf8<KCommsDbSvrMaxFieldLength> initStringModem;
|
|
531 |
|
|
532 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
533 |
CleanupStack::PushL(modemTable);
|
|
534 |
if (modemTable == 0)
|
|
535 |
{
|
|
536 |
User::Leave(KErrNoMemory); // most likely?
|
|
537 |
}
|
|
538 |
|
|
539 |
initStringModem = static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iModemInitString;
|
|
540 |
|
|
541 |
if (initStringIsp.CompareF (initStringModem) != 0)
|
|
542 |
{
|
|
543 |
modemTable->iRecord->RefreshL(*(modemTable->iSession));
|
|
544 |
static_cast<CCDModemBearerRecord*>(modemTable->iRecord)->iModemInitString = initStringIsp;
|
|
545 |
modemTable->iRecord->ModifyL(*(modemTable->iSession));
|
|
546 |
}
|
|
547 |
|
|
548 |
CleanupStack::PopAndDestroy(modemTable);
|
|
549 |
}
|
|
550 |
|
|
551 |
void CCommsDbNetDialAccess::DoDiallingResolutionL(TDialString& aTelNum, TParseMode aMode)
|
|
552 |
/**
|
|
553 |
Decide which phone number to use by checking alternative locations and do correct dialling
|
|
554 |
resolution. Write correct dial string back to aTelNum.
|
|
555 |
Only for dial out.
|
|
556 |
|
|
557 |
@param aTelNum a reference to the telephone number resolved in database.
|
|
558 |
@param aMode a parse mode passed for parsing.
|
|
559 |
@exception Leaves if GetDesL(), GetBoolL(), SetUnresolvedDialStringL(), GetIntL() or ResolvePhoneNumberL() leaves.
|
|
560 |
*/
|
|
561 |
{
|
|
562 |
User::LeaveIfError(AssertDialOutTable());
|
|
563 |
TDialString fullNum;
|
|
564 |
iDbAccess->GetDesL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_DEFAULT_TEL_NUM),fullNum);
|
|
565 |
TBool doDiallingResolution;
|
|
566 |
iDbAccess->GetBoolL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_DIAL_RESOLUTION),doDiallingResolution);
|
|
567 |
|
|
568 |
if(!doDiallingResolution || fullNum.Length()==0)
|
|
569 |
{
|
|
570 |
SetUnresolvedDialStringL(aTelNum,fullNum,aMode);
|
|
571 |
}
|
|
572 |
else
|
|
573 |
{
|
|
574 |
TUint32 chargecardId=KZeroFieldValue;
|
|
575 |
TInt ret=KErrNone;
|
|
576 |
|
|
577 |
TRAP(ret,iDbAccess->GetIntL(TPtrC(DIAL_OUT_ISP),TPtrC(ISP_CHARGECARD),chargecardId));
|
|
578 |
|
|
579 |
if (ret==KErrUnknown) // don't care if there isn't one
|
|
580 |
{
|
|
581 |
ret=KErrNone;
|
|
582 |
}
|
|
583 |
|
|
584 |
User::LeaveIfError(ret);
|
|
585 |
CommsDatUtils::CCommsDatUtils::ResolvePhoneNumberL(fullNum,aTelNum,aMode,iDbAccess->LocationId(),chargecardId);
|
|
586 |
}
|
|
587 |
}
|
|
588 |
|
|
589 |
// Private functions
|
|
590 |
|
|
591 |
TInt CCommsDbNetDialAccess::AssertDialOutTable() const
|
|
592 |
/**
|
|
593 |
Reads service type from database.
|
|
594 |
|
|
595 |
@exception Panics if GetServiceTypeL() leaves or service type read from database is not DIAL_OUT_ISP.
|
|
596 |
*/
|
|
597 |
{
|
|
598 |
TBuf<KCommsDbSvrMaxFieldLength> serviceType;
|
|
599 |
TRAPD(ret, iDbAccess->GetServiceTypeL(serviceType));
|
|
600 |
if (ret == KErrNone && serviceType!=TPtrC(DIAL_OUT_ISP))
|
|
601 |
{
|
|
602 |
NetDialPanic(EIllegalDbRequestForService);
|
|
603 |
}
|
|
604 |
|
|
605 |
return ret;
|
|
606 |
}
|
|
607 |
|
|
608 |
void CCommsDbNetDialAccess::SetUnresolvedDialStringL(TDialString& aTelNum,const TDialString& aFullNum, TParseMode aMode)
|
|
609 |
/**
|
|
610 |
Resolves which letters 'T' or 'P' should prefix number when NOT doing dial resolution.
|
|
611 |
Returns number with prefix in aFullNum.
|
|
612 |
|
|
613 |
@param aTelNum a reference to the telephone number to be resolved.
|
|
614 |
@param aFullNum a reference to the full resolved telephone number, filled here.
|
|
615 |
@param aMode a parse mode passed for parsing.
|
|
616 |
@exception Leaves if GetBoolL() leaves.
|
|
617 |
*/
|
|
618 |
{
|
|
619 |
aTelNum.Zero(); // restart the dial string
|
|
620 |
TBool mobile;
|
|
621 |
TPtrC loc(LOCATION);
|
|
622 |
iDbAccess->GetBoolL(loc,TPtrC(LOCATION_MOBILE),mobile);
|
|
623 |
if (!mobile && aMode==EForDialing)
|
|
624 |
{
|
|
625 |
TBool pulseDial;
|
|
626 |
iDbAccess->GetBoolL(loc,TPtrC(LOCATION_USE_PULSE_DIAL),pulseDial);
|
|
627 |
if (pulseDial)
|
|
628 |
aTelNum.Append(KCharP);
|
|
629 |
else
|
|
630 |
aTelNum.Append(KCharT);
|
|
631 |
}
|
|
632 |
aTelNum.Append(aFullNum);
|
|
633 |
}
|
|
634 |
|
|
635 |
void CCommsDbNetDialAccess::PopulateModemCommSettingsL(TCommConfigV01& aCfg)
|
|
636 |
/**
|
|
637 |
Read configuration for COMM-port from database and sets it into aCfg
|
|
638 |
|
|
639 |
@param aCfg a reference to COMM-port confiquration, read values are passed back in the parameter.
|
|
640 |
@exception Leaves if ReadUintL() leaves.
|
|
641 |
*/
|
|
642 |
{
|
|
643 |
TUint32 dummy;
|
|
644 |
CCommsDbAccess::CCommsDbAccessModemTable* modemTable = iDbAccess->ModemTable();
|
|
645 |
CleanupStack::PushL(modemTable);
|
|
646 |
if (modemTable == 0)
|
|
647 |
{
|
|
648 |
User::Leave(KErrNoMemory); // most likely?
|
|
649 |
}
|
|
650 |
CCDModemBearerRecord* table = static_cast<CCDModemBearerRecord*>(modemTable->iRecord);
|
|
651 |
CleanupStack::PopAndDestroy(modemTable);
|
|
652 |
|
|
653 |
dummy = table->iRate;
|
|
654 |
aCfg.iRate=TBps(dummy);
|
|
655 |
dummy = table->iDataBits;
|
|
656 |
aCfg.iDataBits=TDataBits(dummy);
|
|
657 |
dummy = table->iStopBits;
|
|
658 |
aCfg.iStopBits=TStopBits(dummy);
|
|
659 |
dummy = table->iParity;
|
|
660 |
aCfg.iParity=TParity(dummy);
|
|
661 |
aCfg.iHandshake=TUint(table->iHandshaking);
|
|
662 |
|
|
663 |
aCfg.iParityError=KConfigParityErrorIgnore;
|
|
664 |
aCfg.iFifo=EFifoEnable;
|
|
665 |
|
|
666 |
aCfg.iSpecialRate=TInt(table->iSpecialRate);
|
|
667 |
|
|
668 |
aCfg.iTerminatorCount=2;
|
|
669 |
aCfg.iTerminator[0]=0x0a;
|
|
670 |
aCfg.iTerminator[1]=0x0d;
|
|
671 |
|
|
672 |
aCfg.iXonChar=TText8(table->iXonChar);
|
|
673 |
aCfg.iXoffChar=TText8(table->iXoffChar);
|
|
674 |
|
|
675 |
aCfg.iParityErrorChar=0;
|
|
676 |
aCfg.iSIREnable=ESIRDisable;
|
|
677 |
aCfg.iSIRSettings=0;
|
|
678 |
|
|
679 |
aCfg.iSIRSettings=TUint(table->iSirSettings);
|
|
680 |
}
|
|
681 |
|