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 |
// CallBack Timer and Callback state base
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file nd_callback.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "Nd_CallBack.h"
|
|
23 |
|
|
24 |
CCallBackTimer* CCallBackTimer::NewL(MNdCallBackObserver* aNotifier)
|
|
25 |
/**
|
|
26 |
2 phased constructor, first phase.
|
|
27 |
|
|
28 |
@param aNotifier a pointer to the call back observer.
|
|
29 |
@exception Leaves if ContructL() leaves, or not enough memory is available.
|
|
30 |
@return a new CCallBackTimer object.
|
|
31 |
*/
|
|
32 |
{
|
|
33 |
CCallBackTimer* p=new(ELeave) CCallBackTimer(aNotifier);
|
|
34 |
CleanupStack::PushL(p);
|
|
35 |
p->ConstructL(); // CTimer::ConstructL()
|
|
36 |
CleanupStack::Pop();
|
|
37 |
return p;
|
|
38 |
}
|
|
39 |
|
|
40 |
CCallBackTimer::CCallBackTimer(MNdCallBackObserver* aNotifier)
|
|
41 |
: CTimer(EPriorityStandard), iNotifier(aNotifier)
|
|
42 |
/**
|
|
43 |
Private constructor used in the first phase of construction.
|
|
44 |
|
|
45 |
@param aNotifier a pointer to the call back observer.
|
|
46 |
*/
|
|
47 |
{
|
|
48 |
CActiveScheduler::Add(this);
|
|
49 |
}
|
|
50 |
|
|
51 |
void CCallBackTimer::Start(TTimeIntervalMicroSeconds32 aTimer)
|
|
52 |
/**
|
|
53 |
Start timer.
|
|
54 |
|
|
55 |
@param aTimer a value for the timer.
|
|
56 |
*/
|
|
57 |
{
|
|
58 |
__ASSERT_DEBUG(aTimer>TTimeIntervalMicroSeconds32(0), User::Invariant());
|
|
59 |
After(aTimer);
|
|
60 |
}
|
|
61 |
|
|
62 |
void CCallBackTimer::RunL()
|
|
63 |
/**
|
|
64 |
Notify SM that timer complete.
|
|
65 |
*/
|
|
66 |
{
|
|
67 |
iNotifier->TimerComplete(KErrTimedOut);
|
|
68 |
}
|
|
69 |
|
|
70 |
// NetDial CallBack State base definitions
|
|
71 |
//
|
|
72 |
CNdCallBackStateBase::CNdCallBackStateBase(MAgentStateMachineEnv& aSMObserver)
|
|
73 |
: CAgentStateBase(aSMObserver)
|
|
74 |
/**
|
|
75 |
Constructor.
|
|
76 |
|
|
77 |
@param aSMObserver a reference to the state machine observer.
|
|
78 |
*/
|
|
79 |
{}
|
|
80 |
|
|
81 |
void CNdCallBackStateBase::ConstructL()
|
|
82 |
/**
|
|
83 |
Instantiate Member variable.
|
|
84 |
*/
|
|
85 |
{
|
|
86 |
iCallBackTimer=CCallBackTimer::NewL(this);
|
|
87 |
}
|
|
88 |
|
|
89 |
CNdCallBackStateBase::~CNdCallBackStateBase()
|
|
90 |
/**
|
|
91 |
Destructor.
|
|
92 |
Delete member attributes.
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
delete iCallBackTimer;
|
|
96 |
}
|
|
97 |
|
|
98 |
void CNdCallBackStateBase::TimerComplete(TInt aError)
|
|
99 |
/**
|
|
100 |
Timer completed.
|
|
101 |
|
|
102 |
@param aError a error passed for completition.
|
|
103 |
*/
|
|
104 |
{
|
|
105 |
TRequestStatus* status=&iStatus;
|
|
106 |
User::RequestComplete(status,aError);
|
|
107 |
}
|