|
1 /* |
|
2 * Copyright (c) 2008-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 link disconnection |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_DISCONNECTIONOBSERVER_H |
|
20 #define C_DISCONNECTIONOBSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class CIkeConnectionInterface; |
|
26 |
|
27 /** |
|
28 * Disconnection observer callback interface. |
|
29 * Callback interface which is used by CDisconnectionObserver object to notify |
|
30 * about link disconnection. |
|
31 * |
|
32 * @lib internal (kmdserver.exe) |
|
33 */ |
|
34 class MDisconnectionObserverCallback |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * Notifies about disconnection. |
|
39 * @param aStatus Completion status |
|
40 */ |
|
41 virtual void DisconnectIndication( TInt aStatus ) = 0; |
|
42 }; |
|
43 |
|
44 /** |
|
45 * Disconnection observer. |
|
46 * Active object provides functionality for notifying link disconnection. |
|
47 * |
|
48 * @lib internal (kmdserver.exe) |
|
49 */ |
|
50 class CDisconnectionObserver : public CActive |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aIkeConnectionInterface IKE connection interface |
|
56 * @param aCallback Callback interface |
|
57 */ |
|
58 static CDisconnectionObserver* NewL( CIkeConnectionInterface& aIkeConnectionInterface, |
|
59 MDisconnectionObserverCallback& aCallback ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 ~CDisconnectionObserver(); |
|
65 |
|
66 /** |
|
67 * Starts observing Link disconnection. Link disconnection is notified via |
|
68 * MDisconnectionObserverCallback interface. |
|
69 */ |
|
70 void StartObserving(); |
|
71 |
|
72 private: |
|
73 |
|
74 CDisconnectionObserver( CIkeConnectionInterface& aIkeConnectionInterface, |
|
75 MDisconnectionObserverCallback& aCallback ); |
|
76 |
|
77 // from base class CActive |
|
78 |
|
79 /** |
|
80 * From CActive |
|
81 * Handles completion of asynchronous notification request. |
|
82 */ |
|
83 void RunL(); |
|
84 |
|
85 /** |
|
86 * From CActive |
|
87 * Handles cancellation of asynchronous notification request. |
|
88 */ |
|
89 void DoCancel(); |
|
90 |
|
91 private: // data |
|
92 |
|
93 /** |
|
94 * IKE connection interface. |
|
95 * Not own. |
|
96 */ |
|
97 CIkeConnectionInterface& iIkeConnectionInterface; |
|
98 |
|
99 /** |
|
100 * Callback interface. |
|
101 * Not own. |
|
102 */ |
|
103 MDisconnectionObserverCallback& iCallback; |
|
104 }; |
|
105 |
|
106 |
|
107 #endif // C_DISCONNECTIONOBSERVER_H |