24
|
1 |
// Copyright (c) 2003-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 |
// Dial In States
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file Nd_dlinstates.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "ND_DLIN.H"
|
|
23 |
#include "Nd_dlinStates.h"
|
|
24 |
#include "SLOGGER.H"
|
|
25 |
#include <comms-infras/eventlogger.h>
|
|
26 |
#include <csdprog.h>
|
|
27 |
#include "ND_DBACC.H"
|
|
28 |
#include "Nd_CallBack.h"
|
|
29 |
|
|
30 |
const TInt KDefaultCallBackTimeMicroSec=90000000; //< 1.5 minutes
|
|
31 |
|
|
32 |
CDlInInit* CDlInInit::NewL(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
33 |
/**
|
|
34 |
Initial State Definition
|
|
35 |
|
|
36 |
2 phased constructor for CDlInInit, first phase.
|
|
37 |
|
|
38 |
@param aSMObserver a reference to state machine observer.
|
|
39 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
40 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
41 |
@return a new CDlInInit object.
|
|
42 |
*/
|
|
43 |
{
|
|
44 |
CDlInInit* r=new(ELeave) CDlInInit(aSMObserver, aNdEnv);
|
|
45 |
CleanupStack::PushL(r);
|
|
46 |
r->ConstructL();
|
|
47 |
CleanupStack::Pop();
|
|
48 |
return r;
|
|
49 |
}
|
|
50 |
|
|
51 |
CDlInInit::~CDlInInit()
|
|
52 |
/**
|
|
53 |
Destructor.
|
|
54 |
Cancel active request.
|
|
55 |
*/
|
|
56 |
{
|
|
57 |
Cancel();
|
|
58 |
}
|
|
59 |
|
|
60 |
CDlInInit::CDlInInit(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
61 |
: CAgentStateBase(aSMObserver),iNdEnv(&aNdEnv)
|
|
62 |
/**
|
|
63 |
Private constructor for CDlInInit, used in the first phase of construction.
|
|
64 |
|
|
65 |
@param aSMObserver a reference to the database accessor.
|
|
66 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
67 |
*/
|
|
68 |
{}
|
|
69 |
|
|
70 |
void CDlInInit::ConstructL()
|
|
71 |
/**
|
|
72 |
Instantiate Member variable.
|
|
73 |
*/
|
|
74 |
{}
|
|
75 |
|
|
76 |
void CDlInInit::StartState()
|
|
77 |
/**
|
|
78 |
Starts dial in init state.
|
|
79 |
Call JumpToRunl() with KErrNone.
|
|
80 |
*/
|
|
81 |
{
|
|
82 |
JumpToRunl(KErrNone);
|
|
83 |
}
|
|
84 |
|
|
85 |
CAgentStateBase* CDlInInit::NextStateL(TBool aContinue)
|
|
86 |
/**
|
|
87 |
Changes to from init state to next state.
|
|
88 |
If connection is not continued and iStatus is not KErrNone, create disconnect state.
|
|
89 |
Else create answering state.
|
|
90 |
|
|
91 |
@exception Leaves if NewL() leaves.
|
|
92 |
@return a new CDlInDisconnect or CDlInAnswering object.
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
if(!aContinue||(iStatus!=KErrNone))
|
|
96 |
{
|
|
97 |
return CDlInDisconnect::NewL(*iSMObserver, *iNdEnv);
|
|
98 |
}
|
|
99 |
else
|
|
100 |
{
|
|
101 |
return CDlInAnswering::NewL(*iSMObserver, *iNdEnv);
|
|
102 |
}
|
|
103 |
}
|
|
104 |
|
|
105 |
void CDlInInit::DoCancel()
|
|
106 |
/**
|
|
107 |
Cancels active requests.
|
|
108 |
*/
|
|
109 |
{
|
|
110 |
}
|
|
111 |
|
|
112 |
void CDlInInit::RunL()
|
|
113 |
/**
|
|
114 |
Dial in init completed.
|
|
115 |
Call CompleteState() with iStatus.Int().
|
|
116 |
*/
|
|
117 |
{
|
|
118 |
__ASSERT_DEBUG(iStatus==KErrNone, User::Invariant());
|
|
119 |
(iNdEnv->BaseEnv())->CompleteState(iStatus.Int());
|
|
120 |
}
|
|
121 |
|
|
122 |
CDlInAnswering* CDlInAnswering::NewL(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
123 |
/**
|
|
124 |
Answering State Definition
|
|
125 |
|
|
126 |
2 phased constructor for CDlInAnswering, first phase.
|
|
127 |
|
|
128 |
@param aSMObserver a reference to state machine observer.
|
|
129 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
130 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
131 |
@return a new CDlInAnswering object.
|
|
132 |
*/
|
|
133 |
{
|
|
134 |
CDlInAnswering* r=new(ELeave) CDlInAnswering(aSMObserver, aNdEnv);
|
|
135 |
CleanupStack::PushL(r);
|
|
136 |
r->ConstructL();
|
|
137 |
CleanupStack::Pop();
|
|
138 |
return r;
|
|
139 |
}
|
|
140 |
|
|
141 |
CDlInAnswering::~CDlInAnswering()
|
|
142 |
/**
|
|
143 |
Destructor.
|
|
144 |
Cancel active request.
|
|
145 |
*/
|
|
146 |
{
|
|
147 |
Cancel();
|
|
148 |
}
|
|
149 |
|
|
150 |
CDlInAnswering::CDlInAnswering(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
151 |
: CNdCallBackStateBase(aSMObserver),iNdEnv(&aNdEnv)
|
|
152 |
/**
|
|
153 |
Private constructor for CDlInAnswering, used in the first phase of construction.
|
|
154 |
|
|
155 |
@param aSMObserver a reference to the database accessor.
|
|
156 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
157 |
*/
|
|
158 |
{}
|
|
159 |
|
|
160 |
void CDlInAnswering::ConstructL()
|
|
161 |
/**
|
|
162 |
Instantiate Member variable.
|
|
163 |
Call CNdCallBackStateBase::ConstructL().
|
|
164 |
*/
|
|
165 |
{
|
|
166 |
CNdCallBackStateBase::ConstructL();
|
|
167 |
}
|
|
168 |
|
|
169 |
void CDlInAnswering::StartState()
|
|
170 |
/**
|
|
171 |
Starts dial in answering state.
|
|
172 |
Call UpdateProgress() with ECsdStartingAnswer and KErrNone.
|
|
173 |
If call back is used, get call back timeout and start call back timer.
|
|
174 |
Call WaitForIncomingCallL() from ETel server processor.
|
|
175 |
If WaitForIncomingCallL() leaves, trap it and call JumpToRunl() with the leave error.
|
|
176 |
Else set state active.
|
|
177 |
*/
|
|
178 |
{
|
|
179 |
iSMObserver->UpdateProgress(ECsdStartingAnswer,KErrNone);
|
|
180 |
|
|
181 |
if ((iNdEnv->BaseEnv())->CallBack())
|
|
182 |
{
|
|
183 |
TUint32 temp;
|
|
184 |
TInt ret=(iNdEnv->NetDialDb())->GetCallbackTimeout(temp);
|
|
185 |
TTimeIntervalMicroSeconds32 timer;
|
|
186 |
if (ret!=KErrNone)
|
|
187 |
timer=KDefaultCallBackTimeMicroSec;
|
|
188 |
else
|
|
189 |
timer=temp;
|
|
190 |
iCallBackTimer->Start(timer);
|
|
191 |
}
|
|
192 |
|
|
193 |
TRAPD(err,(iNdEnv->TelServPrc())->WaitForIncomingCallL(*this));
|
|
194 |
if(err!=KErrNone)
|
|
195 |
{
|
|
196 |
JumpToRunl(err);
|
|
197 |
return;
|
|
198 |
}
|
|
199 |
else
|
|
200 |
{
|
|
201 |
iStatus=KRequestPending;
|
|
202 |
SetActive();
|
|
203 |
}
|
|
204 |
}
|
|
205 |
|
|
206 |
CAgentStateBase* CDlInAnswering::NextStateL(TBool aContinue)
|
|
207 |
/**
|
|
208 |
Changes to from answering state to next state.
|
|
209 |
If connection is not continued and iStatus is not KErrNone, create hangup state.
|
|
210 |
Else if connection is not accepted, create answering state.
|
|
211 |
Else create log call start state.
|
|
212 |
|
|
213 |
@exception Leaves if NewL() leaves.
|
|
214 |
@return a new CDlInHangUp, CDlInAnswering or CDlInLogCallStart object.
|
|
215 |
*/
|
|
216 |
{
|
|
217 |
if(!aContinue||(iStatus!=KErrNone))
|
|
218 |
{
|
|
219 |
return CDlInHangUp::NewL(*iSMObserver, *iNdEnv);
|
|
220 |
}
|
|
221 |
else if (!iConnectionAccepted)
|
|
222 |
{
|
|
223 |
return CDlInAnswering::NewL(*iSMObserver, *iNdEnv);
|
|
224 |
}
|
|
225 |
else //succesful run of state
|
|
226 |
{
|
|
227 |
TBuf<KCommsDbSvrMaxFieldLength> remoteParty;
|
|
228 |
iNdEnv->NetDialDb()->GetRemoteParty(remoteParty);
|
|
229 |
iNdEnv->Logger()->LogDataAddEvent(R_LOG_CON_CONNECTED, remoteParty,R_LOG_DIR_IN,KNullDesC, KLogDataEventTypeUid);
|
|
230 |
return CDlInOpen::NewL(*iSMObserver, *iNdEnv);
|
|
231 |
}
|
|
232 |
}
|
|
233 |
|
|
234 |
void CDlInAnswering::TelFunctionComplete(TInt aError)
|
|
235 |
/**
|
|
236 |
Dial in answer TelFunctionComplete.
|
|
237 |
Complete state with aError.
|
|
238 |
|
|
239 |
@param aError identifies the error code for completition.
|
|
240 |
*/
|
|
241 |
{
|
|
242 |
TRequestStatus* status=&iStatus;
|
|
243 |
User::RequestComplete(status,aError);
|
|
244 |
}
|
|
245 |
|
|
246 |
void CDlInAnswering::RunL()
|
|
247 |
/**
|
|
248 |
Dial in answer completed (should not complete if connection cancelled).
|
|
249 |
If there is an error then signal it, otherwise advance phase.
|
|
250 |
Answer is always asynchronous, so should never complete when cancelled
|
|
251 |
*/
|
|
252 |
{
|
|
253 |
if ((NULL != iNdEnv->TelServPrc()) && (iStatus==KErrTimedOut)) // timer went off before call received
|
|
254 |
(iNdEnv->TelServPrc())->Cancel();
|
|
255 |
if (iCallBackTimer!=NULL)
|
|
256 |
iCallBackTimer->Cancel();
|
|
257 |
|
|
258 |
if(iStatus!=KErrNone)
|
|
259 |
{
|
|
260 |
__FLOG_STMT(_LIT(logString3,"Answering");)
|
|
261 |
__FLOG_STATIC2(KNetDialLogFolder(),KNetDialLogFile(),TRefByValue<const TDesC>(KCompletedPhaseLogString()), &logString3(), iStatus.Int());
|
|
262 |
}
|
|
263 |
else
|
|
264 |
{
|
|
265 |
TInt err=KErrNone;
|
|
266 |
iConnectionAccepted=ETrue;
|
|
267 |
if (!(iNdEnv->BaseEnv())->CallBack())
|
|
268 |
err=iSMObserver->IncomingConnectionReceived();
|
|
269 |
if (err==KErrNone)
|
|
270 |
{
|
|
271 |
iSMObserver->UpdateProgress(ECsdAnswered,KErrNone);
|
|
272 |
iSMObserver->ServiceStarted();
|
|
273 |
}
|
|
274 |
else
|
|
275 |
{
|
|
276 |
iConnectionAccepted=EFalse;
|
|
277 |
}
|
|
278 |
}
|
|
279 |
(iNdEnv->BaseEnv())->CompleteState(iStatus.Int());
|
|
280 |
}
|
|
281 |
|
|
282 |
void CDlInAnswering::DoCancel()
|
|
283 |
/**
|
|
284 |
Cancels active requests.
|
|
285 |
*/
|
|
286 |
{
|
|
287 |
|
|
288 |
if ((iNdEnv->TelServPrc())!=NULL)
|
|
289 |
(iNdEnv->TelServPrc())->Cancel();
|
|
290 |
iCallBackTimer->Cancel();
|
|
291 |
if(iStatus==KRequestPending)
|
|
292 |
{
|
|
293 |
TelFunctionComplete(KErrCancel);
|
|
294 |
}
|
|
295 |
}
|
|
296 |
|
|
297 |
CDlInOpen* CDlInOpen::NewL(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
298 |
/**
|
|
299 |
Open State Definition
|
|
300 |
|
|
301 |
2 phased constructor for CDlInOpen, first phase.
|
|
302 |
|
|
303 |
@param aSMObserver a reference to state machine observer.
|
|
304 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
305 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
306 |
@return a new CDlInOpen object.
|
|
307 |
*/
|
|
308 |
{
|
|
309 |
CDlInOpen* r=new(ELeave) CDlInOpen(aSMObserver, aNdEnv);
|
|
310 |
CleanupStack::PushL(r);
|
|
311 |
r->ConstructL();
|
|
312 |
CleanupStack::Pop();
|
|
313 |
return r;
|
|
314 |
}
|
|
315 |
|
|
316 |
CDlInOpen::CDlInOpen(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
317 |
: CAgentStateBase(aSMObserver),iNdEnv(&aNdEnv)
|
|
318 |
/**
|
|
319 |
Private constructor for CDlInOpen, used in the first phase of construction.
|
|
320 |
|
|
321 |
@param aSMObserver a reference to the database accessor.
|
|
322 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
323 |
*/
|
|
324 |
{}
|
|
325 |
|
|
326 |
CDlInOpen::~CDlInOpen()
|
|
327 |
/**
|
|
328 |
Destructor.
|
|
329 |
Cancel active request.
|
|
330 |
*/
|
|
331 |
{
|
|
332 |
Cancel();
|
|
333 |
}
|
|
334 |
|
|
335 |
void CDlInOpen::ConstructL()
|
|
336 |
/**
|
|
337 |
Instantiate Member variable.
|
|
338 |
*/
|
|
339 |
{}
|
|
340 |
|
|
341 |
void CDlInOpen::StartState()
|
|
342 |
/**
|
|
343 |
Starts dial in open state.
|
|
344 |
Request COMM-port from ETEL, trap possible leave.
|
|
345 |
Call JumpToRunl with error code from requesting COMM-port.
|
|
346 |
*/
|
|
347 |
{
|
|
348 |
RCall::TCommPort commPort;
|
|
349 |
TRAPD(err,(iNdEnv->TelServPrc())->GetCommPortL(commPort));
|
|
350 |
JumpToRunl(err);
|
|
351 |
}
|
|
352 |
|
|
353 |
CAgentStateBase* CDlInOpen::NextStateL(TBool aContinue)
|
|
354 |
/**
|
|
355 |
Changes to from log call start state to next state.
|
|
356 |
HangUp will be the next state whether or not a client has requested a connection cancel
|
|
357 |
unless connection is lost on a callback connection. In which case a reconnection
|
|
358 |
must be attempted, therefore return to dial up SM and redial.
|
|
359 |
If connection is continued, create dialup init state.
|
|
360 |
Else create hangup state.
|
|
361 |
|
|
362 |
@exception Leaves if NewL() leaves.
|
|
363 |
@return a new CDlUpInit or CDlInHangUp object.
|
|
364 |
*/
|
|
365 |
{
|
|
366 |
if(aContinue)
|
|
367 |
{
|
|
368 |
// Redial the server to get it to do callback again
|
|
369 |
return CDlUpInit::NewL(*iSMObserver,*iNdEnv);
|
|
370 |
}
|
|
371 |
else
|
|
372 |
{
|
|
373 |
// HangUp will be the next state whether or not a client has requested a connection cancel
|
|
374 |
return CDlInHangUp::NewL(*iSMObserver, *iNdEnv);
|
|
375 |
}
|
|
376 |
}
|
|
377 |
|
|
378 |
void CDlInOpen::DoCancel()
|
|
379 |
/**
|
|
380 |
Cancels active requests.
|
|
381 |
*/
|
|
382 |
{
|
|
383 |
}
|
|
384 |
|
|
385 |
void CDlInOpen::RunL()
|
|
386 |
/**
|
|
387 |
Dial in open start completed.
|
|
388 |
Call ConnectionComplete() with EConnectionOpen and iStatus.Int().
|
|
389 |
*/
|
|
390 |
{
|
|
391 |
__FLOG_STMT(_LIT8(logString,"NetDial:\tConnection Open");)
|
|
392 |
__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString());
|
|
393 |
iSMObserver->ConnectionComplete(ECsdConnectionOpen,iStatus.Int());
|
|
394 |
}
|
|
395 |
|
|
396 |
CDlInDisconnect* CDlInDisconnect::NewL(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
397 |
/**
|
|
398 |
Disconnect State Definition
|
|
399 |
|
|
400 |
2 phased constructor for CDlInDisconnect, first phase.
|
|
401 |
|
|
402 |
@param aSMObserver a reference to state machine observer.
|
|
403 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
404 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
405 |
@return a new CDlInDisconnect object.
|
|
406 |
*/
|
|
407 |
{
|
|
408 |
CDlInDisconnect* r=new(ELeave) CDlInDisconnect(aSMObserver, aNdEnv);
|
|
409 |
CleanupStack::PushL(r);
|
|
410 |
r->ConstructL();
|
|
411 |
CleanupStack::Pop();
|
|
412 |
return r;
|
|
413 |
}
|
|
414 |
|
|
415 |
CDlInDisconnect::CDlInDisconnect(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
416 |
: CAgentStateBase(aSMObserver),iNdEnv(&aNdEnv)
|
|
417 |
/**
|
|
418 |
Private constructor for CDlInDisconnect, used in the first phase of construction.
|
|
419 |
|
|
420 |
@param aSMObserver a reference to the database accessor.
|
|
421 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
422 |
*/
|
|
423 |
{}
|
|
424 |
|
|
425 |
void CDlInDisconnect::ConstructL()
|
|
426 |
/**
|
|
427 |
Instantiate Member variable.
|
|
428 |
*/
|
|
429 |
{}
|
|
430 |
|
|
431 |
CDlInDisconnect::~CDlInDisconnect()
|
|
432 |
/**
|
|
433 |
Destructor.
|
|
434 |
Cancel active request.
|
|
435 |
*/
|
|
436 |
{
|
|
437 |
Cancel();
|
|
438 |
}
|
|
439 |
|
|
440 |
void CDlInDisconnect::StartState()
|
|
441 |
/**
|
|
442 |
Starts dial in disconnect state.
|
|
443 |
If ETel server processor is used, close it and possible opened objects.
|
|
444 |
Call JumpToRunl with KErrNone.
|
|
445 |
*/
|
|
446 |
{
|
|
447 |
if ((iNdEnv->TelServPrc())!=NULL)
|
|
448 |
(iNdEnv->TelServPrc())->CloseCall();
|
|
449 |
|
|
450 |
// We need to make sure that logging is finished before closing everything.
|
|
451 |
// forward iStatus to the logger, which will be responsible to complete iStatus when it is finished.
|
|
452 |
iStatus = KRequestPending;
|
|
453 |
iNdEnv->Logger()->LogDataNotifyLastEventUpdate(&iStatus);
|
|
454 |
SetActive();
|
|
455 |
}
|
|
456 |
|
|
457 |
CAgentStateBase* CDlInDisconnect::NextStateL(TBool /*aContinue*/)
|
|
458 |
/**
|
|
459 |
Returns the same disconnect state.
|
|
460 |
|
|
461 |
@exception Leaves if NewL() leaves.
|
|
462 |
@return a new CDlInDisconnect object.
|
|
463 |
*/
|
|
464 |
{
|
|
465 |
return CDlInDisconnect::NewL(*iSMObserver, *iNdEnv);
|
|
466 |
}
|
|
467 |
|
|
468 |
void CDlInDisconnect::DoCancel()
|
|
469 |
/**
|
|
470 |
Cancels active requests.
|
|
471 |
*/
|
|
472 |
{
|
|
473 |
}
|
|
474 |
|
|
475 |
void CDlInDisconnect::RunL()
|
|
476 |
/**
|
|
477 |
Dial in disconnect completed.
|
|
478 |
Call DisconnectComplete().
|
|
479 |
*/
|
|
480 |
{
|
|
481 |
__FLOG_STMT(_LIT8(logString,"NetDial:\tDisconnect Complete");)
|
|
482 |
__FLOG_STATIC(KNetDialLogFolder(),KNetDialLogFile(),logString());
|
|
483 |
|
|
484 |
iSMObserver->DisconnectComplete();
|
|
485 |
}
|
|
486 |
|
|
487 |
CDlInHangUp* CDlInHangUp::NewL(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
488 |
/**
|
|
489 |
Hangup State Definition
|
|
490 |
|
|
491 |
2 phased constructor for CDlInHangUp, first phase.
|
|
492 |
|
|
493 |
@param aSMObserver a reference to state machine observer.
|
|
494 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
495 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
496 |
@return a new CDlInHangUp object.
|
|
497 |
*/
|
|
498 |
{
|
|
499 |
CDlInHangUp* r=new(ELeave) CDlInHangUp(aSMObserver, aNdEnv);
|
|
500 |
CleanupStack::PushL(r);
|
|
501 |
r->ConstructL();
|
|
502 |
CleanupStack::Pop();
|
|
503 |
return r;
|
|
504 |
}
|
|
505 |
|
|
506 |
CDlInHangUp::CDlInHangUp(MAgentStateMachineEnv& aSMObserver, MNetdialEnv& aNdEnv)
|
|
507 |
: CAgentStateBase(aSMObserver),iNdEnv(&aNdEnv)
|
|
508 |
/**
|
|
509 |
Private constructor for CDlInHangUp, used in the first phase of construction.
|
|
510 |
|
|
511 |
@param aSMObserver a reference to the database accessor.
|
|
512 |
@param aNdEnv a reference to the Netdial which defines a set of utility functions.
|
|
513 |
*/
|
|
514 |
{}
|
|
515 |
|
|
516 |
void CDlInHangUp::ConstructL()
|
|
517 |
/**
|
|
518 |
Instantiate Member variable.
|
|
519 |
*/
|
|
520 |
{}
|
|
521 |
|
|
522 |
CDlInHangUp::~CDlInHangUp()
|
|
523 |
/**
|
|
524 |
Destructor.
|
|
525 |
Cancel active request.
|
|
526 |
*/
|
|
527 |
{
|
|
528 |
Cancel();
|
|
529 |
}
|
|
530 |
|
|
531 |
void CDlInHangUp::StartState()
|
|
532 |
/**
|
|
533 |
Starts dial in hangup state.
|
|
534 |
Call UpdateProgress with ECsdStartingHangUp and KErrNone.
|
|
535 |
If COMM-port is loaned, return port to ETEL.
|
|
536 |
If returning of COMM-port leaves, trap error and call JumpToRunl with error.
|
|
537 |
If call is active, start hangup and set state active.
|
|
538 |
Else call JumpToRunl() with KErrNone.
|
|
539 |
*/
|
|
540 |
{
|
|
541 |
iSMObserver->UpdateProgress(ECsdStartingHangUp,KErrNone);
|
|
542 |
|
|
543 |
if (iNdEnv->TelServPrc()->CommPortLoaned())
|
|
544 |
{
|
|
545 |
// returns ownership of the comm port to ETEL
|
|
546 |
TRAPD(err,(iNdEnv->TelServPrc())->ReturnCommPortL());
|
|
547 |
if(err!=KErrNone)
|
|
548 |
{
|
|
549 |
JumpToRunl(err);
|
|
550 |
return;
|
|
551 |
}
|
|
552 |
}
|
|
553 |
|
|
554 |
if (iNdEnv->TelServPrc()->CallActive())
|
|
555 |
{
|
|
556 |
(iNdEnv->TelServPrc())->StartHangUpAfterDialIn(*this);
|
|
557 |
iStatus=KRequestPending;
|
|
558 |
SetActive();
|
|
559 |
}
|
|
560 |
else
|
|
561 |
JumpToRunl(KErrNone);
|
|
562 |
}
|
|
563 |
|
|
564 |
CAgentStateBase* CDlInHangUp::NextStateL(TBool /*aContinue*/)
|
|
565 |
/**
|
|
566 |
Changes to from init state to next state.
|
|
567 |
Disconnect will be the next state whether or not a client has requested a connection cancel.
|
|
568 |
Create disconnect state.
|
|
569 |
|
|
570 |
@exception Leaves if NewL() leaves.
|
|
571 |
@return a new CDlInDisconnect object.
|
|
572 |
*/
|
|
573 |
{
|
|
574 |
return CDlInDisconnect::NewL(*iSMObserver, *iNdEnv);
|
|
575 |
}
|
|
576 |
|
|
577 |
void CDlInHangUp::TelFunctionComplete(TInt aError)
|
|
578 |
/**
|
|
579 |
Dial in hangup TelFunctionComplete.
|
|
580 |
Complete state with aError.
|
|
581 |
|
|
582 |
@param aError identifies the error code for completition.
|
|
583 |
*/
|
|
584 |
{
|
|
585 |
TRequestStatus* status=&iStatus;
|
|
586 |
User::RequestComplete(status,aError);
|
|
587 |
}
|
|
588 |
|
|
589 |
void CDlInHangUp::DoCancel()
|
|
590 |
/**
|
|
591 |
Cancels active requests.
|
|
592 |
*/
|
|
593 |
{
|
|
594 |
if((iNdEnv->TelServPrc())!=NULL)
|
|
595 |
(iNdEnv->TelServPrc())->Cancel();
|
|
596 |
if(iStatus==KRequestPending)
|
|
597 |
{
|
|
598 |
TelFunctionComplete(KErrCancel);
|
|
599 |
}
|
|
600 |
}
|
|
601 |
|
|
602 |
void CDlInHangUp::RunL()
|
|
603 |
/**
|
|
604 |
Dial in hangup completed.
|
|
605 |
If there is an error then signal it, otherwise advance phase
|
|
606 |
Hangup is always asynchronous, so it should never complete when cancelled.
|
|
607 |
*/
|
|
608 |
{
|
|
609 |
//update the log object
|
|
610 |
iNdEnv->Logger()->LogDataUpdateEvent(R_LOG_CON_DISCONNECTED, KLogDataEventTypeUid);
|
|
611 |
if(iStatus!=KErrNone)
|
|
612 |
{
|
|
613 |
__FLOG_STMT(_LIT(logString3,"Hanging Up");)
|
|
614 |
__FLOG_STATIC2(KNetDialLogFolder(),KNetDialLogFile(),TRefByValue<const TDesC>(KCompletedPhaseLogString()), &logString3(), iStatus.Int());
|
|
615 |
}
|
|
616 |
iSMObserver->UpdateProgress(ECsdFinishedHangUp,KErrNone);
|
|
617 |
(iNdEnv->BaseEnv())->CompleteState(iStatus.Int());
|
|
618 |
}
|