1 /* |
|
2 * Copyright (c) 2006-2010 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: Monitors signal changes on network side and reports changes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CDUNSIGNALNOTIFY_H |
|
20 #define C_CDUNSIGNALNOTIFY_H |
|
21 |
|
22 #include "DunTransUtils.h" |
|
23 #include "DunAtCmdHandler.h" |
|
24 |
|
25 /** |
|
26 * Class for monitoring line status and reporting changes |
|
27 * |
|
28 * @lib dunutils.lib |
|
29 * @since S60 v3.2 |
|
30 */ |
|
31 NONSHARABLE_CLASS( CDunSignalNotify ) : public CActive |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 * @param aUtility Pointer to common utility class |
|
39 * @return Instance of self |
|
40 */ |
|
41 static CDunSignalNotify* NewL( MDunTransporterUtilityAux* aUtility ); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CDunSignalNotify(); |
|
47 |
|
48 /** |
|
49 * Resets data to initial values |
|
50 * |
|
51 * @since S60 3.2 |
|
52 * @return None |
|
53 */ |
|
54 void ResetData(); |
|
55 |
|
56 /** |
|
57 * Adds callback for line status change controlling |
|
58 * The callback will be called when line status change is detected in |
|
59 * endpoint |
|
60 * |
|
61 * @since S60 3.2 |
|
62 * @param aCallback Callback to call when line status changes |
|
63 * @return Symbian error code on error, KErrNone otherwise |
|
64 */ |
|
65 TInt AddCallback( MDunConnMon* aCallback ); |
|
66 |
|
67 /** |
|
68 * Sets media to use for this endpoint monitor (network side) |
|
69 * |
|
70 * @since S60 3.2 |
|
71 * @param aComm RComm pointer to use as the endpoint |
|
72 * @return Symbian error code on error, KErrNone otherwise |
|
73 */ |
|
74 TInt SetMedia( RComm* aComm ); |
|
75 |
|
76 /** |
|
77 * Issues request to start monitoring the endpoint for line status change |
|
78 * |
|
79 * @since S60 3.2 |
|
80 * @return Symbian error code on error, KErrNone otherwise |
|
81 */ |
|
82 TInt IssueRequest(); |
|
83 |
|
84 /** |
|
85 * Stops monitoring the endpoint for line status change |
|
86 * |
|
87 * @since S60 3.2 |
|
88 * @return Symbian error code on error, KErrNone otherwise |
|
89 */ |
|
90 TInt Stop(); |
|
91 |
|
92 private: |
|
93 |
|
94 CDunSignalNotify( MDunTransporterUtilityAux* aUtility ); |
|
95 |
|
96 void ConstructL(); |
|
97 |
|
98 /** |
|
99 * Initializes this class |
|
100 * |
|
101 * @since S60 3.2 |
|
102 * @return None |
|
103 */ |
|
104 void Initialize(); |
|
105 |
|
106 /** |
|
107 * Manages signal changes |
|
108 * |
|
109 * @since S60 3.2 |
|
110 * @return None |
|
111 */ |
|
112 void ManageSignalChange(); |
|
113 |
|
114 /** |
|
115 * Reports signal change |
|
116 * |
|
117 * @since S60 3.2 |
|
118 * @param aSetMask Set the handshaking lines in the mask |
|
119 * @param aClearMask Clear the handshaking lines in the mask. |
|
120 * @return None |
|
121 */ |
|
122 void ReportSignalChange( TUint aSetMask, TUint aClearMask ); |
|
123 |
|
124 // from base class CActive |
|
125 |
|
126 /* |
|
127 * From CActive. |
|
128 * Gets called when line status changes |
|
129 * |
|
130 * @since S60 3.2 |
|
131 * @return None |
|
132 */ |
|
133 void RunL(); |
|
134 |
|
135 /** |
|
136 * From CActive. |
|
137 * Gets called on cancel |
|
138 * |
|
139 * @since S60 3.2 |
|
140 * @return None |
|
141 */ |
|
142 void DoCancel(); |
|
143 |
|
144 private: // data |
|
145 |
|
146 /** |
|
147 * Callback(s) to call when notification(s) via MDunConnMon to be made |
|
148 * Normally contains only one callback |
|
149 */ |
|
150 RPointerArray<MDunConnMon> iCallbacks; |
|
151 |
|
152 /** |
|
153 * Pointer to common utility class |
|
154 * Not own. |
|
155 */ |
|
156 MDunTransporterUtilityAux* iUtility; |
|
157 |
|
158 /** |
|
159 * Current state of signal monitoring: active or inactive |
|
160 */ |
|
161 TDunState iSignalNotifyState; |
|
162 |
|
163 /** |
|
164 * Signals to listen with RComm::NotifySignalChange() |
|
165 */ |
|
166 TUint iListenSignals; |
|
167 |
|
168 /** |
|
169 * Signals set when RComm::NotifySignalChange() request completes |
|
170 */ |
|
171 TUint iSignals; |
|
172 |
|
173 /** |
|
174 * RComm object of network side |
|
175 * Not own. |
|
176 */ |
|
177 RComm* iNetwork; |
|
178 |
|
179 }; |
|
180 |
|
181 #endif // C_CDUNSIGNALNOTIFY_H |
|