|
1 /* |
|
2 * Copyright (c) 2010 ISB. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * ISB - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: USB driver for test |
|
15 * |
|
16 */ |
|
17 #ifndef __deviceLDD_H__ |
|
18 #define __deviceLDD_H__ |
|
19 |
|
20 #include <kernel.h> |
|
21 #include "webcamera_device.h" |
|
22 |
|
23 #define BUFSIZE (100*1024) |
|
24 /** |
|
25 *Logical channel class |
|
26 * |
|
27 */ |
|
28 class DWebcameraLogicalDevice : public DLogicalDevice |
|
29 { |
|
30 public: |
|
31 DWebcameraLogicalDevice(); |
|
32 ~DWebcameraLogicalDevice(); |
|
33 /** |
|
34 Second stage constructor for DDriver1Factory. |
|
35 This must at least set a name for the driver object. |
|
36 |
|
37 @return KErrNone if successful, otherwise one of the other system wide error codes. |
|
38 */ |
|
39 virtual TInt Install(); |
|
40 /** |
|
41 Return the drivers capabilities. |
|
42 Called in the response to an RDevice::GetCaps() request. |
|
43 |
|
44 @param aDes User-side descriptor to write capabilities information into |
|
45 */ |
|
46 virtual void GetCaps(TDes8& aDes) const; |
|
47 /** |
|
48 Called by the kernel's device driver framework to create a Logical Channel. |
|
49 This is called in the context of the user thread (client) which requested the creation of a Logical Channel |
|
50 (E.g. through a call to RBusLogicalChannel::DoCreate) |
|
51 The thread is in a critical section. |
|
52 |
|
53 @param aChannel Set to point to the created Logical Channel |
|
54 |
|
55 @return KErrNone if successful, otherwise one of the other system wide error codes. |
|
56 */ |
|
57 virtual TInt Create(DLogicalChannelBase*& aChannel); |
|
58 }; |
|
59 |
|
60 /** |
|
61 * |
|
62 * 論理チャネルベースクラス |
|
63 * |
|
64 * 本クラスは、論理チャネル機能を提供する。 |
|
65 * |
|
66 * @ |
|
67 * @ |
|
68 * |
|
69 */ |
|
70 class DWebcameraLogicalChannel : public DWebcameraLogicalChannelBase |
|
71 { |
|
72 public: |
|
73 /** |
|
74 Constructor |
|
75 */ |
|
76 DWebcameraLogicalChannel(); |
|
77 /** |
|
78 Destructor |
|
79 */ |
|
80 ~DWebcameraLogicalChannel(); |
|
81 /** |
|
82 Called when a user thread requests a handle to this channel. |
|
83 */ |
|
84 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType); |
|
85 /** |
|
86 Second stage constructor called by the kernel's device driver framework. |
|
87 This is called in the context of the user thread (client) which requested the creation of a Logical Channel |
|
88 The thread is in a critical section. |
|
89 |
|
90 @param aUnit The unit argument supplied by the client |
|
91 @param aInfo The info argument supplied by the client |
|
92 @param aVer The version argument supplied by the client |
|
93 |
|
94 @return KErrNone if successful, otherwise one of the other system wide error codes. |
|
95 */ |
|
96 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); |
|
97 /** |
|
98 Process a message for this logical channel. |
|
99 This function is called in the context of a DFC thread. |
|
100 |
|
101 @param aMessage The message to process. |
|
102 The iValue member of this distinguishes the message type: |
|
103 iValue==ECloseMsg, channel close message |
|
104 iValue==KMaxTInt, a 'DoCancel' message |
|
105 iValue>=0, a 'DoControl' message with function number equal to iValue |
|
106 iValue<0, a 'DoRequest' message with function number equal to ~iValue |
|
107 */ |
|
108 virtual void HandleMsg(TMessageBase* aMsg); |
|
109 /** |
|
110 Process synchronous 'control' requests |
|
111 */ |
|
112 virtual TInt DoControl(TInt aFunction, TAny* a1, TAny* a2); |
|
113 /** |
|
114 Process asynchronous requests. |
|
115 */ |
|
116 virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); |
|
117 /** |
|
118 Process cancelling of asynchronous requests. |
|
119 */ |
|
120 virtual void DoCancel(TUint aMask); |
|
121 /** |
|
122 Called by PDD from ISR to indicate that a get oneflame operation has completed. |
|
123 */ |
|
124 virtual void GetOneFlameComplete(TInt aResult); |
|
125 /** |
|
126 Called by PDD from ISR to indicate that a get capture image operation has completed. |
|
127 */ |
|
128 virtual void CaptureComplete(TInt aResult); |
|
129 /** |
|
130 DFC Callback which gets triggered after the PDD has signalled that get oneflame completed. |
|
131 This just casts aPtr and calls DoGetOneFlameComplete(). |
|
132 */ |
|
133 static void GetOneFlameDfc(TAny* aPtr); |
|
134 /** |
|
135 DFC Callback which gets triggered after the PDD has signalled that getting Capture image completed. |
|
136 This just casts aPtr and calls DoCaptureComplete(). |
|
137 */ |
|
138 static void CaptureDfc(TAny* aPtr); |
|
139 /** |
|
140 Called from a DFC after the PDD has signalled that getting oneflame completed. |
|
141 */ |
|
142 virtual void DoGetOneFlameComplete(); |
|
143 /** |
|
144 Called from a DFC after the PDD has signalled that getting Capture image completed. |
|
145 */ |
|
146 virtual void DoCaptureComplete(); |
|
147 |
|
148 /** |
|
149 Process a GetConfig control message. This writes the current driver configuration to a |
|
150 RWebcameraDevice::TConfigBuf supplied by the client. |
|
151 */ |
|
152 TInt GetConfig(TDes8* aConfigBuf); |
|
153 /** |
|
154 Process a SetConfig control message. This sets the driver configuration using a |
|
155 RWebcameraDevice::TConfigBuf supplied by the client. |
|
156 */ |
|
157 TInt SetConfig(const TDesC8* aConfigBuf); |
|
158 // void CurrentConfig(RWebcameraDevice::TConfig& aConfig); |
|
159 /** |
|
160 *Get the point to Physical channel. |
|
161 */ |
|
162 DWebcameraDriverBase* Pdd(); |
|
163 |
|
164 private: |
|
165 /** |
|
166 *point to description sent by user-side. |
|
167 */ |
|
168 TDes8* iReceiveDataDescriptor; |
|
169 /** |
|
170 *buffer for one flame. |
|
171 */ |
|
172 HBuf8* iReceiveDataBuffer; |
|
173 /** |
|
174 *the status getting one flame. |
|
175 */ |
|
176 TRequestStatus* iReceiveDataStatus; |
|
177 /** |
|
178 *DFC for getting one flame. |
|
179 */ |
|
180 TDfc iReceiveDataDfc; |
|
181 /** |
|
182 *the result of the get oneflame operation. |
|
183 */ |
|
184 TInt iReceiveDataResult; |
|
185 /** |
|
186 */ |
|
187 TBool iReceiving; |
|
188 /** |
|
189 *point to description sent by user-side. |
|
190 */ |
|
191 TDes8* iCaptureDescriptor; |
|
192 /** |
|
193 *buffer for capture image. |
|
194 */ |
|
195 HBuf8* iCaptureBuffer; |
|
196 /** |
|
197 *the status getting capture image. |
|
198 */ |
|
199 TRequestStatus* iCaptureStatus; |
|
200 /** |
|
201 *DFC of capture. |
|
202 */ |
|
203 TDfc iCaptureDfc; |
|
204 /** |
|
205 *the result of the capture operation. |
|
206 */ |
|
207 TInt iCaptureResult; |
|
208 /** |
|
209 *the status getting capture image. |
|
210 */ |
|
211 TBool iCaptureing; |
|
212 /** |
|
213 *the status of request. |
|
214 */ |
|
215 TBool iRequesting; |
|
216 /** |
|
217 *point to memory used to save one frame or capture image. |
|
218 */ |
|
219 HBuf8* iComm; |
|
220 /** |
|
221 *Physical adress of contiguous memory. |
|
222 */ |
|
223 TUint32 iPhysAddr; |
|
224 /** |
|
225 *the size of buffer used to save one frame or capture image. |
|
226 */ |
|
227 TInt iSize; |
|
228 /** |
|
229 *chunck. |
|
230 */ |
|
231 DPlatChunkHw* iChunk; |
|
232 /** |
|
233 *Linear adress of chunck. |
|
234 */ |
|
235 TUint8* iLAdr; |
|
236 /** |
|
237 *the size of received data. |
|
238 */ |
|
239 TInt iSaveSize; |
|
240 }; |
|
241 |
|
242 #endif |