|
1 // Copyright (c) 2004-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 // |
|
15 |
|
16 #include "panagtutils.h" |
|
17 using namespace PanAgent; |
|
18 |
|
19 void PanAgent::PanAgentPanic(TPanAgentPanic aPanicCode) |
|
20 /** |
|
21 PAN agent panic |
|
22 @param aPanicCode A code identifying the specific panic |
|
23 */ |
|
24 { |
|
25 User::Panic(KPanAgentName, aPanicCode); |
|
26 } |
|
27 |
|
28 void PanAgent::PanAgentPanic(TPanAgentPanic aPanicCode, TInt aState) |
|
29 /** |
|
30 PAN agent panic |
|
31 @param aPanicCode A code identifying the specific panic |
|
32 @param aState The state in which the panic occurred. |
|
33 */ |
|
34 { |
|
35 User::Panic(KPanAgentName, (aPanicCode*KStatePanicMultiplier) + KStatePanicDelimiter + aState); |
|
36 } |
|
37 |
|
38 |
|
39 // |
|
40 // Timer helper class |
|
41 // |
|
42 |
|
43 CPanAgtTimerHelper* CPanAgtTimerHelper::NewL(MPanAgtTimerCallback& aCallback) |
|
44 /** |
|
45 |
|
46 */ |
|
47 { |
|
48 CPanAgtTimerHelper* self = new(ELeave) CPanAgtTimerHelper(aCallback); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 CPanAgtTimerHelper::CPanAgtTimerHelper(MPanAgtTimerCallback& aCallback) : |
|
56 CActive(EPriorityStandard), iCallback(aCallback) |
|
57 /** |
|
58 |
|
59 */ |
|
60 { |
|
61 CActiveScheduler::Add(this); |
|
62 } |
|
63 |
|
64 void CPanAgtTimerHelper::ConstructL() |
|
65 /** |
|
66 |
|
67 */ |
|
68 { |
|
69 // create and set timer |
|
70 User::LeaveIfError(iTimer.CreateLocal()); |
|
71 } |
|
72 |
|
73 void CPanAgtTimerHelper::SetTimer(TTimeIntervalMicroSeconds32 aInterval) |
|
74 /** |
|
75 Set the timer for the specified interval |
|
76 */ |
|
77 { |
|
78 // set a timer for the maximum amount of time we will wait for the role switch to complete |
|
79 iTimer.After(iStatus, aInterval); |
|
80 SetActive(); |
|
81 } |
|
82 |
|
83 void CPanAgtTimerHelper::RunL() |
|
84 /** |
|
85 Timer has completed |
|
86 */ |
|
87 { |
|
88 if(iStatus==KErrNone) |
|
89 { |
|
90 iCallback.TimerComplete(); |
|
91 } |
|
92 else |
|
93 { |
|
94 iCallback.TimerError(iStatus.Int()); |
|
95 } |
|
96 } |
|
97 |
|
98 void CPanAgtTimerHelper::DoCancel() |
|
99 /** |
|
100 Cancel the timer |
|
101 */ |
|
102 { |
|
103 iTimer.Cancel(); |
|
104 } |