|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: active object, that monitors IKE plugin session error |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ikedebug.h" |
|
20 #include "ikepluginsessionif.h" |
|
21 #include "ikepluginsessionhandler.h" |
|
22 |
|
23 // CLASS HEADER |
|
24 #include "errorobserver.h" |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // Two-phased constructor. |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CErrorObserver* CErrorObserver::NewL( MIkePluginSessionIf& aIkePluginSession, |
|
33 MIkePluginSessionHandlerCallback& aCallback, |
|
34 MIkeDebug& aDebug ) |
|
35 { |
|
36 CErrorObserver* self = new (ELeave) CErrorObserver( aIkePluginSession, |
|
37 aCallback, |
|
38 aDebug ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Destructor. |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CErrorObserver::~CErrorObserver() |
|
50 { |
|
51 Cancel(); |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Constructor. |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CErrorObserver::CErrorObserver( MIkePluginSessionIf& aIkePluginSession, |
|
59 MIkePluginSessionHandlerCallback& aCallback, |
|
60 MIkeDebug& aDebug ) |
|
61 : CActive( EPriorityStandard ), |
|
62 iIkePluginSession( aIkePluginSession ), |
|
63 iCallback( aCallback ), |
|
64 iDebug( aDebug ) |
|
65 { |
|
66 CActiveScheduler::Add( this ); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Constructor. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CErrorObserver::ConstructL() |
|
74 { |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // Requests asynchronous error notification. |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CErrorObserver::StartObserving() |
|
82 { |
|
83 iIkePluginSession.NotifyError( iStatus ); |
|
84 SetActive(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // From class CActive |
|
89 // Handles completion of asynchronous notification request. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CErrorObserver::RunL() |
|
93 { |
|
94 DEBUG_LOG1(_L("IKE plugin session error=%d"), iStatus.Int()); |
|
95 iCallback.IkePluginSessionError( iStatus.Int() ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // From class CActive |
|
100 // Handles cancellation of asynchronous notification request. |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void CErrorObserver::DoCancel() |
|
104 { |
|
105 iIkePluginSession.CancelNotifyError(); |
|
106 } |
|
107 |