|
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: Copies signals changes between network and local media |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CDUNSIGNALCOPY_H |
|
20 #define C_CDUNSIGNALCOPY_H |
|
21 |
|
22 #include "DunTransporter.h" |
|
23 #include "DunTransUtils.h" |
|
24 #include "DunAtCmdHandler.h" |
|
25 |
|
26 /** |
|
27 * Class for copying signal changes between to endpoints |
|
28 * |
|
29 * @lib dunutils.lib |
|
30 * @since S60 v3.2 |
|
31 */ |
|
32 NONSHARABLE_CLASS( CDunSignalCopy ) : public CActive |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 * @return Instance of self |
|
40 */ |
|
41 static CDunSignalCopy* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CDunSignalCopy(); |
|
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 RunL error is detected |
|
59 * |
|
60 * @since S60 3.2 |
|
61 * @param aCallback Callback to call when line status changes |
|
62 * @return Symbian error code on error, KErrNone otherwise |
|
63 */ |
|
64 TInt AddCallback( MDunConnMon* aCallback ); |
|
65 |
|
66 /** |
|
67 * Sets media to use for this endpoint monitor |
|
68 * |
|
69 * @since S60 3.2 |
|
70 * @param aComm RComm pointer to local media side |
|
71 * @param aNetwork RComm pointer to network side |
|
72 * @param aStreamType Stream type for this endpoint |
|
73 * @return Symbian error code on error, KErrNone otherwise |
|
74 */ |
|
75 TInt SetMedia( RComm* aComm, |
|
76 RComm* aNetwork, |
|
77 TDunStreamType aStreamType ); |
|
78 |
|
79 /** |
|
80 * Issues request to start monitoring the endpoint for line status change |
|
81 * |
|
82 * @since S60 3.2 |
|
83 * @return Symbian error code on error, KErrNone otherwise |
|
84 */ |
|
85 TInt IssueRequest(); |
|
86 |
|
87 /** |
|
88 * Stops monitoring the endpoint for line status change |
|
89 * |
|
90 * @since S60 3.2 |
|
91 * @return Symbian error code on error, KErrNone otherwise |
|
92 */ |
|
93 TInt Stop(); |
|
94 |
|
95 private: |
|
96 |
|
97 CDunSignalCopy(); |
|
98 |
|
99 void ConstructL(); |
|
100 |
|
101 /** |
|
102 * Initializes this class |
|
103 * |
|
104 * @since S60 3.2 |
|
105 * @return None |
|
106 */ |
|
107 void Initialize(); |
|
108 |
|
109 /** |
|
110 * Manages upstream signal changes |
|
111 * |
|
112 * @since S60 3.2 |
|
113 * @return None |
|
114 */ |
|
115 void ManageSignalChange(); |
|
116 |
|
117 /** |
|
118 * Manages signal changes |
|
119 * |
|
120 * @since S60 3.2 |
|
121 * @return None |
|
122 */ |
|
123 void ManageSignalChangeUpstream(); |
|
124 |
|
125 /** |
|
126 * Manages downstream signal changes |
|
127 * |
|
128 * @since S60 3.2 |
|
129 * @return None |
|
130 */ |
|
131 void ManageSignalChangeDownstream(); |
|
132 |
|
133 /** |
|
134 * Changes upstream signal |
|
135 * |
|
136 * @since S60 5.0 |
|
137 * @param aSetMask Set the handshaking lines in the mask |
|
138 * @param aClearMask Clear the handshaking lines in the mask |
|
139 * @return None |
|
140 */ |
|
141 void ChangeUpstreamSignal( TUint aSetMask, TUint aClearMask ); |
|
142 |
|
143 /** |
|
144 * Changes downstream signal |
|
145 * |
|
146 * @since S60 3.2 |
|
147 * @param aSetMask Set the handshaking lines in the mask |
|
148 * @param aClearMask Clear the handshaking lines in the mask |
|
149 * @return None |
|
150 */ |
|
151 void ChangeDownstreamSignal( TUint aSetMask, TUint aClearMask ); |
|
152 |
|
153 // from base class CActive |
|
154 |
|
155 /* |
|
156 * From CActive. |
|
157 * Gets called when line status changes |
|
158 * |
|
159 * @since S60 3.2 |
|
160 * @return None |
|
161 */ |
|
162 void RunL(); |
|
163 |
|
164 /** |
|
165 * From CActive. |
|
166 * Gets called on cancel |
|
167 * |
|
168 * @since S60 3.2 |
|
169 * @return None |
|
170 */ |
|
171 void DoCancel(); |
|
172 |
|
173 private: // data |
|
174 |
|
175 /** |
|
176 * Callback(s) to call when notification(s) via MDunConnMon to be made |
|
177 * Normally contains only one callback |
|
178 */ |
|
179 RPointerArray<MDunConnMon> iCallbacks; |
|
180 |
|
181 /** |
|
182 * Callback(s) to call when command mode starts or ends |
|
183 * Usually two needed: one for upstream and second for downstream |
|
184 */ |
|
185 RPointerArray<MDunCmdModeMonitor> iCmdCallbacks; |
|
186 |
|
187 /** |
|
188 * Used media context: network or local |
|
189 */ |
|
190 TDunMediaContext iContextInUse; |
|
191 |
|
192 /** |
|
193 * Used stream type: upstream or downstream |
|
194 */ |
|
195 TDunStreamType iStreamType; |
|
196 |
|
197 /** |
|
198 * Current state of connection monitoring: active or inactive |
|
199 */ |
|
200 TDunState iSignalCopyState; |
|
201 |
|
202 /** |
|
203 * Signal to listen with RComm::NotifySignalChange() |
|
204 */ |
|
205 TUint iListenSignals; |
|
206 |
|
207 /** |
|
208 * Signals set when RComm::NotifySignalChange() request completes |
|
209 */ |
|
210 TUint iSignals; |
|
211 |
|
212 /** |
|
213 * RComm object of network side |
|
214 * Not own. |
|
215 */ |
|
216 RComm* iNetwork; |
|
217 |
|
218 /** |
|
219 * RComm object of local media side |
|
220 * Not own. |
|
221 */ |
|
222 RComm* iComm; |
|
223 |
|
224 }; |
|
225 |
|
226 #endif // C_CDUNSIGNALCOPY_H |