|
1 /* |
|
2 * Copyright (c) 2007-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 CUsbDevConStarter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CUSBDEVCONSTARTER_H |
|
20 #define CUSBDEVCONSTARTER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * class for starting usbdevcon process |
|
26 * This class will start usbdevcon process. It also supervises its |
|
27 * termination. |
|
28 * @since S60 v5.0 |
|
29 */ |
|
30 NONSHARABLE_CLASS( CUsbDevConStarter ) : public CActive |
|
31 { |
|
32 |
|
33 public: |
|
34 |
|
35 //states for starting usbdevcon |
|
36 enum TUsbDevConStarterState |
|
37 { |
|
38 EIdle, |
|
39 EWaitingRendezvous, |
|
40 ERunning |
|
41 }; |
|
42 |
|
43 static CUsbDevConStarter* NewL(); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CUsbDevConStarter(); |
|
49 |
|
50 /** |
|
51 * Start usbdevcon process |
|
52 * The usbdevcon process is started, unless it is already running. |
|
53 * |
|
54 * @since S60 5.0 |
|
55 */ |
|
56 void Start(); |
|
57 |
|
58 /** |
|
59 * Logon for usbdevcon process termination |
|
60 * |
|
61 * @since S60 5.0 |
|
62 */ |
|
63 void Logon(); |
|
64 |
|
65 /** |
|
66 * StopRestarting prevents usbdevcon restart |
|
67 * If usbdevcon terminates, it is not restarted, if StopRestarting has |
|
68 * been called. |
|
69 * |
|
70 * @since S60 5.0 |
|
71 */ |
|
72 void StopRestarting(); |
|
73 |
|
74 private: // From base class |
|
75 |
|
76 /** |
|
77 * From CActive. |
|
78 * Handles the process termination |
|
79 * |
|
80 * @since Series 60 5.0 |
|
81 */ |
|
82 void RunL(); |
|
83 |
|
84 /** |
|
85 * From CActive. |
|
86 * Never called in this implementation |
|
87 * |
|
88 * @since Series 60 5.0 |
|
89 * @param aError The error returned |
|
90 * @return error |
|
91 */ |
|
92 TInt RunError( TInt aError ); |
|
93 |
|
94 /** |
|
95 * From CActive |
|
96 * Cancels outstanding request. |
|
97 * Note that process may be running after Cancel. If Start is called |
|
98 * after Cancel, another process will be started. |
|
99 * |
|
100 * @since Series 60 5.0 |
|
101 */ |
|
102 void DoCancel(); |
|
103 |
|
104 private: |
|
105 |
|
106 CUsbDevConStarter(); |
|
107 |
|
108 void ConstructL(); |
|
109 |
|
110 private: // data |
|
111 |
|
112 /** |
|
113 * Handle to UsbDevCon process |
|
114 */ |
|
115 RProcess iProcess; |
|
116 |
|
117 /** |
|
118 * Is set to run. |
|
119 */ |
|
120 TBool iStarted; |
|
121 |
|
122 /** |
|
123 * State of starting usbdevcon |
|
124 */ |
|
125 TUsbDevConStarterState iState; |
|
126 }; |
|
127 |
|
128 #endif // CUSBDEVCONSTARTER_H |
|
129 |
|
130 // End of file |