35
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: Header file for class CUsbActivePersonalityHandler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CUSBACTIVEPERSONALITYHANDLER_H
|
|
20 |
#define CUSBACTIVEPERSONALITYHANDLER_H
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include <etelmm.h> // for fetching the IMEI code for serial number
|
|
24 |
#include <mmtsy_names.h> // for RTelServer names
|
|
25 |
#include "cusbwatcher.h"
|
|
26 |
|
|
27 |
const TUid KUidPersonalityPlugIns = {0x10274793};
|
|
28 |
|
|
29 |
// FORWARD CLASS DECLARATIONS
|
|
30 |
class CUsbPersonality;
|
|
31 |
class TUsbPersonalityParams;
|
|
32 |
class CUsbPersonalityNotifier;
|
|
33 |
|
|
34 |
// CLASS DECLARATION
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Class to handle USB personality issues.
|
|
38 |
*
|
|
39 |
* @lib euser.lib usbman.lib c32.lib centralrepository.lib
|
|
40 |
* @since Series 60 3.0
|
|
41 |
*/
|
|
42 |
NONSHARABLE_CLASS( CUsbActivePersonalityHandler ) : public CActive
|
|
43 |
|
|
44 |
{
|
|
45 |
public: // Constructors and destructor
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Two-phased constructor.
|
|
49 |
*
|
|
50 |
* @param aUsbMan Reference to RUsb.
|
|
51 |
* @param aOwner Reference to CUsbWatcher.
|
|
52 |
* @return pointer to created object
|
|
53 |
*/
|
|
54 |
static CUsbActivePersonalityHandler* NewL( RUsb& aUsbMan,
|
|
55 |
CUsbWatcher& aOwner );
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Destructor.
|
|
59 |
*/
|
|
60 |
virtual ~CUsbActivePersonalityHandler();
|
|
61 |
|
|
62 |
public: // New functions
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Confirm personality load. If current personality can be unloaded
|
|
66 |
* and new personality can be loaded then this method will complete
|
|
67 |
* aStatus with KErrNone.
|
|
68 |
*
|
|
69 |
* @since Series 60 3.2
|
|
70 |
* @param aStatus Used to complete outstanding request.
|
|
71 |
*/
|
|
72 |
void ConfirmPersonalityUnload( TRequestStatus& aStatus );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Start personality.
|
|
76 |
*
|
|
77 |
* @since Series 60 3.2
|
|
78 |
* @param aPersonalityId Identification of the personality to be loaded.
|
|
79 |
* @param aAskOnConnectionSetting When this parameter is ETrue, "ask on connection" query is shown.
|
|
80 |
* @param aStatus Used to complete outstanding request.
|
|
81 |
*/
|
|
82 |
void StartPersonality( TInt& aPersonalityId,
|
|
83 |
TInt aAskOnConnectionSetting, TRequestStatus& aStatus );
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Stop current personality.
|
|
87 |
*
|
|
88 |
* @since Series 60 3.2
|
|
89 |
* @param aStatus Used to complete outstanding request.
|
|
90 |
*/
|
|
91 |
void StopPersonality( TRequestStatus& aStatus );
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Called by the owner class when device state is changed.
|
|
95 |
*
|
|
96 |
* @since Series 60 3.0
|
|
97 |
* @param aState state of the device
|
|
98 |
*/
|
|
99 |
void StateChangeNotify( TUsbDeviceState aStateOld,
|
|
100 |
TUsbDeviceState aStateNew );
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Called by the owner class when device state is changed.
|
|
104 |
*
|
|
105 |
* @since Series 60 3.2
|
|
106 |
*/
|
|
107 |
void PersonalitySelected();
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Cancel Cable connected notifier
|
|
111 |
*
|
|
112 |
* @since Series 60 5.0
|
|
113 |
*/
|
|
114 |
void CancelCableConnectedNotifier();
|
|
115 |
|
|
116 |
public: // from base class CActive
|
|
117 |
|
|
118 |
/**
|
|
119 |
* From CActive.
|
|
120 |
* This method is called when outstanding request is completed.
|
|
121 |
*
|
|
122 |
* @since Series 60 3.0
|
|
123 |
*/
|
|
124 |
void RunL();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* From CActive.
|
|
128 |
* This method is called when RunL() leaves.
|
|
129 |
*
|
|
130 |
* @since Series 60 3.0
|
|
131 |
* @param aError the error returned
|
|
132 |
* @return error
|
|
133 |
*/
|
|
134 |
TInt RunError( TInt /*aError*/ );
|
|
135 |
|
|
136 |
/**
|
|
137 |
* From CActive
|
|
138 |
* This method is called when Cancel() is called and there is outstanding
|
|
139 |
* request pending.
|
|
140 |
*
|
|
141 |
* @since Series 60 3.0
|
|
142 |
*/
|
|
143 |
void DoCancel();
|
|
144 |
|
|
145 |
private:
|
|
146 |
|
|
147 |
/** Personality handler states */
|
|
148 |
enum TUsbActivePersonalityState
|
|
149 |
{
|
|
150 |
EUsbPersonalityIdle = 0,
|
|
151 |
EUsbPersonalityPrepareStart,
|
|
152 |
EUsbPersonalityStartUsb,
|
|
153 |
EUsbPersonalityFinishStart,
|
|
154 |
EUsbPersonalityStarted,
|
|
155 |
EUsbPersonalityPrepareStop,
|
|
156 |
EUsbPersonalityStopUsb,
|
|
157 |
EUsbPersonalityFinishStop
|
|
158 |
};
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Construct USB serial number.
|
|
162 |
* @since Series 60 3.0
|
|
163 |
*/
|
|
164 |
void ConstructUsbSerialNumberL();
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Publish serial number to P&S for USB Manager.
|
|
168 |
* @since Series 60 3.0
|
|
169 |
* @return In case of success KErrNone is returned.
|
|
170 |
*/
|
|
171 |
TInt PublishSerialNumber();
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Creates and returns a class handler object for the given personality.
|
|
175 |
* @since Series 60 3.0
|
|
176 |
* @param aPersonality Personality ID where return value is written.
|
|
177 |
* @return Pointer to created object
|
|
178 |
*/
|
|
179 |
CUsbPersonality* NewPersonalityHandlerL( TInt aPersonality );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Constructor is prohibited.
|
|
183 |
* @param aUsbMan Reference to usb manager.
|
|
184 |
* @param aParent Reference to UsbWatcher.
|
|
185 |
*/
|
|
186 |
CUsbActivePersonalityHandler( RUsb& aUsbMan, CUsbWatcher& aOwner );
|
|
187 |
|
|
188 |
/**
|
|
189 |
* C++ default constructor (no implementation provided).
|
|
190 |
*/
|
|
191 |
CUsbActivePersonalityHandler();
|
|
192 |
|
|
193 |
/**
|
|
194 |
* By default Symbian 2nd phase constructor is private.
|
|
195 |
*/
|
|
196 |
void ConstructL();
|
|
197 |
|
|
198 |
private: // Data
|
|
199 |
/**
|
|
200 |
* Handle to Usb Manager
|
|
201 |
*/
|
|
202 |
RUsb iUsbMan;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Currently loaded personality
|
|
206 |
*/
|
|
207 |
CUsbPersonality* iCurrentPersonalityHandler;
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Dummy descriptor used by ask on connection.
|
|
211 |
*/
|
|
212 |
TPtrC8 iDummy;
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Dummy descriptor buf
|
|
216 |
*/
|
|
217 |
TBuf8<1> iDummyBuf;
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Buffer where selected personality is stored by the ask
|
|
221 |
* on connection.
|
|
222 |
*/
|
|
223 |
TPckgBuf<TInt> iPersonalityPckgBuf;
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Owner of this class.
|
|
227 |
*/
|
|
228 |
CUsbWatcher& iOwner;
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Personality id of currently loaded personality.
|
|
232 |
*/
|
|
233 |
TInt *iPersonalityId;
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Ask on connection is either on (1) or off (0).
|
|
237 |
*/
|
|
238 |
TInt iAskOnConnectionSetting;
|
|
239 |
|
|
240 |
/**
|
|
241 |
* When value is ETrue then serial number is written to P&S.
|
|
242 |
*/
|
|
243 |
TBool iSerialNumberWritten;
|
|
244 |
|
|
245 |
/**
|
|
246 |
* When value is ETrue then personality uses serial number.
|
|
247 |
*/
|
|
248 |
TBool iUseSerialNumber;
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Access to mobile phone functionality.
|
|
252 |
*/
|
|
253 |
RMobilePhone::TMobilePhoneIdentityV1 iPhoneInfo;
|
|
254 |
|
|
255 |
/**
|
|
256 |
* State of the class.
|
|
257 |
*/
|
|
258 |
TUsbActivePersonalityState iState;
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Cleanup process or normal process in various states
|
|
262 |
*/
|
|
263 |
TBool isFailureCleanup;
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Request to be completed.
|
|
267 |
*/
|
|
268 |
TRequestStatus *iRequestStatus;
|
|
269 |
|
|
270 |
/**
|
|
271 |
* Container class for personalities.
|
|
272 |
*/
|
|
273 |
TUsbPersonalityParams* iPersonalityParams;
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Handle to notifier class, which is used to show notes/queries.
|
|
277 |
*/
|
|
278 |
CUsbPersonalityNotifier* iPersonalityNotifier;
|
|
279 |
|
|
280 |
/**
|
|
281 |
* The device state.
|
|
282 |
*/
|
|
283 |
TUsbDeviceState iDeviceState;
|
|
284 |
|
|
285 |
/**
|
|
286 |
* Packages for queries
|
|
287 |
*/
|
|
288 |
TUSBQueriesNotifierParamsPckg iQueryParams;
|
|
289 |
};
|
|
290 |
|
|
291 |
#endif // CUSBACTIVEPERSONALITYHANDLER_H
|
|
292 |
|
|
293 |
// End of File
|