|
1 /* |
|
2 * Copyright (c) 2008 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: Modem's mode listener and notifier |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CDUNATMODELISTEN_H |
|
20 #define C_CDUNATMODELISTEN_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <atextcommon.h> |
|
24 #include "DunTransporter.h" |
|
25 |
|
26 /** |
|
27 * Notification interface class for modem's mode listener |
|
28 * |
|
29 * @lib dunatext.lib |
|
30 * @since TB9.2 |
|
31 */ |
|
32 NONSHARABLE_CLASS( MDunAtModeListen ) |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Notifies about mode status change |
|
39 * |
|
40 * @since TB9.2 |
|
41 * @param aMode Current modem modes |
|
42 * @return Symbian error code on error, KErrNone otherwise |
|
43 */ |
|
44 virtual TInt NotifyModeStatusChange( TUint aMode ) = 0; |
|
45 |
|
46 }; |
|
47 |
|
48 /** |
|
49 * Class for modem's mode listener and notifier |
|
50 * |
|
51 * @lib dunatext.lib |
|
52 * @since TB9.2 |
|
53 */ |
|
54 NONSHARABLE_CLASS( CDunAtModeListen ) : public CActive |
|
55 { |
|
56 |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * aAtCmdExtCommand AT command extension to common functionality |
|
62 * aCallback Callback to mode status change |
|
63 * @return Instance of self |
|
64 */ |
|
65 static CDunAtModeListen* NewL( RATExtCommon* aAtCmdExtCommon, |
|
66 MDunAtModeListen* aCallback ); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * aAtCmdExtCommand AT command extension to common functionality |
|
71 * aCallback Callback to mode status change |
|
72 * @return Instance of self |
|
73 */ |
|
74 static CDunAtModeListen* NewLC( RATExtCommon* aAtCmdExtCommon, |
|
75 MDunAtModeListen* aCallback ); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CDunAtModeListen(); |
|
81 |
|
82 /** |
|
83 * Resets data to initial values |
|
84 * |
|
85 * @since TB9.2 |
|
86 * @return None |
|
87 */ |
|
88 void ResetData(); |
|
89 |
|
90 /** |
|
91 * Issues request to start monitoring for mode status changes |
|
92 * |
|
93 * @since TB9.2 |
|
94 * @return Symbian error code on error, KErrNone otherwise |
|
95 */ |
|
96 TInt IssueRequest(); |
|
97 |
|
98 /** |
|
99 * Stops monitoring for mode status changes |
|
100 * |
|
101 * @since TB9.2 |
|
102 * @return Symbian error code on error, KErrNone otherwise |
|
103 */ |
|
104 TInt Stop(); |
|
105 |
|
106 private: |
|
107 |
|
108 CDunAtModeListen( RATExtCommon* iAtCmdExtCommon, |
|
109 MDunAtModeListen* aCallback ); |
|
110 |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Initializes this class |
|
115 * |
|
116 * @since TB9.2 |
|
117 * @return None |
|
118 */ |
|
119 void Initialize(); |
|
120 |
|
121 // from base class CActive |
|
122 |
|
123 /** |
|
124 * From CActive. |
|
125 * Gets called when mode changes |
|
126 * |
|
127 * @since TB9.2 |
|
128 * @return None |
|
129 */ |
|
130 void RunL(); |
|
131 |
|
132 /** |
|
133 * From CActive. |
|
134 * Gets called on cancel |
|
135 * |
|
136 * @since TB9.2 |
|
137 * @return None |
|
138 */ |
|
139 void DoCancel(); |
|
140 |
|
141 private: // data |
|
142 |
|
143 /** |
|
144 * AT command extension to common functionality |
|
145 * Not own. |
|
146 */ |
|
147 RATExtCommon* iAtCmdExtCommon; |
|
148 |
|
149 /** |
|
150 * Callback to call when mode status changes |
|
151 * Not own. |
|
152 */ |
|
153 MDunAtModeListen* iCallback; |
|
154 |
|
155 /** |
|
156 * Current state of mode listening: active or inactive |
|
157 */ |
|
158 TDunState iModeListenState; |
|
159 |
|
160 /** |
|
161 * Stored mode status change |
|
162 */ |
|
163 TUint iMode; |
|
164 |
|
165 /** |
|
166 * Package for mode status changes |
|
167 */ |
|
168 TPckg<TUint> iModePckg; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // C_CDUNATMODELISTEN_H |