|
1 /* |
|
2 * Copyright (c) 2007 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: State, while waiting for requests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CEP0WRITER_H |
|
20 #define CEP0WRITER_H |
|
21 |
|
22 #include "cusbdevcon.h" |
|
23 |
|
24 class CStateMachine; // gets notifications on events happened on EP0 |
|
25 |
|
26 /** |
|
27 * EP0 Writer |
|
28 * |
|
29 * @lib usbdevcon.lib |
|
30 * @since S60 v.5.0 |
|
31 */ |
|
32 |
|
33 class CEP0Writer : public CActive |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 * |
|
41 * @since S60 v.5.0 |
|
42 * @param aObserver Gets notification when Read request is completed |
|
43 * @param aLdd Link to services for reading EP0 |
|
44 * @return Constructed instance |
|
45 */ |
|
46 static CEP0Writer* NewL(CStateMachine& aObserver, RDevUsbcClient& aLdd); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 * |
|
51 * @since S60 v.5.0 |
|
52 */ |
|
53 virtual ~CEP0Writer(); |
|
54 |
|
55 /** |
|
56 * Set request to write EP0 data |
|
57 * |
|
58 * @since S60 v.5.0 |
|
59 * @param aBuffer Data to write |
|
60 * @param aDataLength Max length of data to write |
|
61 */ |
|
62 void Write(const RBuf8& aBuffer, TUint aDataLength); |
|
63 |
|
64 private: |
|
65 |
|
66 /** |
|
67 * Default construction |
|
68 * |
|
69 * @since S60 v.5.0 |
|
70 * @param aObserver Gets notification when Read request is completed |
|
71 * @param aLdd Link to services for writing EP0 |
|
72 */ |
|
73 CEP0Writer(CStateMachine& aObserver, RDevUsbcClient& aLdd); |
|
74 |
|
75 /** |
|
76 * Two-phased construction. |
|
77 * |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 // from CActive |
|
82 |
|
83 /** |
|
84 * From CActive. |
|
85 * |
|
86 */ |
|
87 void RunL(); |
|
88 |
|
89 /** |
|
90 * From CActive. |
|
91 * |
|
92 */ |
|
93 void DoCancel(); |
|
94 |
|
95 /** |
|
96 * From CActive. |
|
97 * |
|
98 */ |
|
99 TInt RunError( TInt /*aError*/ ); |
|
100 |
|
101 private: // data |
|
102 |
|
103 /** |
|
104 * Gets notifications |
|
105 * Not own. |
|
106 */ |
|
107 CStateMachine& iObserver; |
|
108 |
|
109 /** |
|
110 * LDD |
|
111 * Not own. |
|
112 */ |
|
113 RDevUsbcClient& iLdd; |
|
114 |
|
115 /** |
|
116 * Write data |
|
117 * |
|
118 */ |
|
119 RBuf8 iBuffer; |
|
120 }; |
|
121 |
|
122 #endif // CEP0WRITER_H |