17 |
17 |
18 #ifndef __deviceIFI_H |
18 #ifndef __deviceIFI_H |
19 #define __deviceIFI_H |
19 #define __deviceIFI_H |
20 |
20 |
21 /** |
21 /** |
22 Returns the driver's name |
22 Returns the driver's name |
23 */ |
23 */ |
24 inline const TDesC& RWebcameraDevice::Name() |
24 inline const TDesC& RWebcameraDevice::Name() |
25 { |
25 { |
26 _LIT(KDriverName,"WebcameraDevice"); |
26 _LIT(KDriverName,"WebcameraDevice"); |
27 return KDriverName; |
27 return KDriverName; |
28 } |
28 } |
29 |
29 |
30 /** |
30 /** |
31 Returns the version number of the driver |
31 Returns the version number of the driver |
32 */ |
32 */ |
33 inline TVersion RWebcameraDevice::VersionRequired() |
33 inline TVersion RWebcameraDevice::VersionRequired() |
34 { |
34 { |
35 const TInt KMajorVersionNumber=1; |
35 const TInt KMajorVersionNumber = 1; |
36 const TInt KMinorVersionNumber=1; |
36 const TInt KMinorVersionNumber = 1; |
37 const TInt KBuildVersionNumber=0; |
37 const TInt KBuildVersionNumber = 0; |
38 return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); |
38 return TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber); |
39 } |
39 } |
40 |
40 |
41 /* |
41 /* |
42 NOTE: The following member functions would normally be exported from a seperate client DLL |
42 NOTE: The following member functions would normally be exported from a seperate client DLL |
43 but are included inline in this header file for convenience. |
43 but are included inline in this header file for convenience. |
44 */ |
44 */ |
45 |
45 |
46 #ifndef __KERNEL_MODE__ |
46 #ifndef __KERNEL_MODE__ |
47 |
47 |
48 /** |
48 /** |
49 Opens a logical channel to the driver |
49 Opens a logical channel to the driver |
50 |
50 |
51 @return One of the system wide error codes. |
51 @return One of the system wide error codes. |
52 */ |
52 */ |
53 inline TInt RWebcameraDevice::Open() |
53 inline TInt RWebcameraDevice::Open() |
54 { |
54 { |
55 return DoCreate(Name(),VersionRequired(),KNullUnit,NULL,NULL,EOwnerThread); |
55 return DoCreate(Name(), VersionRequired(), KNullUnit, NULL, NULL, EOwnerThread); |
56 } |
56 } |
57 |
57 |
58 |
58 |
59 /** |
59 /** |
60 Gets the current configuration settings. |
60 Gets the current configuration settings. |
61 |
61 |
62 @param aConfig A structure which will be filled with the configuration settings. |
62 @param aConfig A structure which will be filled with the configuration settings. |
63 |
63 @return KErrNone |
64 @return KErrNone |
|
65 */ |
64 */ |
66 inline TInt RWebcameraDevice::GetConfig(TConfigBuf& aConfig) |
65 inline TInt RWebcameraDevice::GetConfig(TConfigBuf& aConfig) |
67 { |
66 { |
68 return DoControl(EGetConfig,(TAny*)&aConfig); |
67 return DoControl(EGetConfig, (TAny*)&aConfig); |
69 } |
68 } |
70 |
69 |
71 |
70 |
72 /** |
71 /** |
73 Sets the current configuration settings. |
72 Sets the current configuration settings. |
74 |
73 |
75 @param aConfig The new configuration settings to be used. |
74 @param aConfig The new configuration settings to be used. |
76 |
75 @return KErrInUse if there are outstanding data transfer requests. |
77 @return KErrInUse if there are outstanding data transfer requests. |
76 KErrArgument if any configuration values are invalid. |
78 KErrArgument if any configuration values are invalid. |
77 KErrNone otherwise |
79 KErrNone otherwise |
|
80 */ |
78 */ |
81 inline TInt RWebcameraDevice::SetConfig(const TConfigBuf& aConfig) |
79 inline TInt RWebcameraDevice::SetConfig(const TConfigBuf& aConfig) |
82 { |
80 { |
83 return DoControl(ESetConfig,(TAny*)&aConfig); |
81 return DoControl(ESetConfig, (TAny*)&aConfig); |
84 } |
82 } |
85 |
83 |
86 /** |
84 /** |
87 Receives image from the device. |
85 Open shared chunks |
88 Only one receive request may be pending at any time. |
86 */ |
|
87 inline TInt RWebcameraDevice::OpenSharedChunks(RChunk& aChunk, TChunkInfo& aChunkInfo) |
|
88 { |
|
89 TInt r = DoControl(EOpenSharedChunck, (TAny*)&aChunkInfo); |
|
90 aChunk.SetHandle(aChunkInfo.iChunkHandle); |
|
91 return r; |
|
92 } |
89 |
93 |
90 @param aStatus The request to be signalled when the data has been received. |
94 /** |
91 The result value will be set to KErrNone on success; |
95 Close shared chunks |
92 or set to one of the system wide error codes when an error occurs. |
|
93 @param aData A descriptor to which the received data will be written. |
|
94 */ |
96 */ |
95 inline void RWebcameraDevice::StartViewFinder(TRequestStatus& aStatus,TDes8& aBuffer) |
97 inline TInt RWebcameraDevice::CloseSharedChunks(TRequestStatus& aStatus, RChunk& aChunk) |
96 { |
98 { |
97 TInt length=BUFSIZE; |
99 DoRequest(ECloseSharedChunck,aStatus, (TAny*)&aChunk); |
98 DoRequest(EStart,aStatus,(TAny*)&aBuffer,(TAny*)&length); |
100 } |
99 } |
101 |
|
102 /** |
|
103 Power on Camera Device. |
|
104 @param aStatus The request to be signalled when the data has been received. |
|
105 The result value will be set to KErrNone on success; |
|
106 or set to one of the system wide error codes when an error occurs. |
|
107 */ |
|
108 inline void RWebcameraDevice::PowerOn(TRequestStatus& aStatus) |
|
109 { |
|
110 DoRequest(EPowerOn, aStatus); |
|
111 } |
|
112 |
|
113 /** |
|
114 Power off Camera Device. |
|
115 @param aStatus The request to be signalled when the data has been received. |
|
116 The result value will be set to KErrNone on success; |
|
117 or set to one of the system wide error codes when an error occurs. |
|
118 */ |
|
119 inline void RWebcameraDevice::PowerOff(TRequestStatus& aStatus) |
|
120 { |
|
121 DoRequest(EPowerOff, aStatus); |
|
122 } |
|
123 |
|
124 /** |
|
125 Init ViewFinder. |
|
126 */ |
|
127 inline TInt RWebcameraDevice::InitViewFinder() |
|
128 { |
|
129 return DoControl(EInitViewFinder, NULL); |
|
130 } |
|
131 |
|
132 /** |
|
133 Receives image from the device. |
|
134 Only one receive request may be pending at any time. |
|
135 |
|
136 @param aStatus The request to be signalled when the data has been received. |
|
137 The result value will be set to KErrNone on success; |
|
138 or set to one of the system wide error codes when an error occurs. |
|
139 @param aData A descriptor to which the received data will be written. |
|
140 */ |
|
141 inline void RWebcameraDevice::StartViewFinder(TRequestStatus& aStatus,TInt& aChunkLen) |
|
142 { |
|
143 DoRequest(EStart,aStatus, (TAny*)&aChunkLen); |
|
144 } |
100 |
145 |
101 |
146 |
102 /** |
147 /** |
103 Cancels a previous StartViewFinder request. |
148 Cancels a previous StartViewFinder request. |
104 */ |
149 */ |
105 inline void RWebcameraDevice::StartViewFinderCancel() |
150 inline void RWebcameraDevice::StartViewFinderCancel() |
106 { |
151 { |
107 DoCancel(1<<EStart); |
152 DoCancel(1 << EStart); |
108 } |
153 } |
109 |
154 |
110 inline void RWebcameraDevice::StopViewFinder() |
155 inline void RWebcameraDevice::StopViewFinder() |
111 { |
156 { |
112 DoCancel(1<<EStart); |
157 DoCancel(1 << EStart); |
113 } |
158 } |
114 |
159 |
115 /** |
160 /** |
116 Capture data from the device. |
161 Capture data from the device. |
117 Only one Capture request may be pending at any time. |
162 Only one Capture request may be pending at any time. |
118 |
163 |
119 @param aStatus The request to be signalled when the data has been captureed. |
164 @param aStatus The request to be signalled when the data has been captureed. |
120 The result value will be set to KErrNone on success; |
165 The result value will be set to KErrNone on success; |
121 or set to one of the system wide error codes when an error occurs. |
166 or set to one of the system wide error codes when an error occurs. |
122 @param aData A descriptor to which the captured data will be written. |
167 @param aData A descriptor to which the captured data will be written. |
123 */ |
168 */ |
124 inline void RWebcameraDevice::Capture(TRequestStatus& aStatus,TDes8& aBuffer) |
169 inline void RWebcameraDevice::Capture(TRequestStatus& aStatus,TInt& aChunkLen) |
125 { |
170 { |
126 TInt length=BUFSIZE; |
171 DoRequest(ECapture,aStatus, (TAny*)&aChunkLen); |
127 DoRequest(ECapture,aStatus,(TAny*)&aBuffer,(TAny*)&length); |
172 } |
128 } |
|
129 |
173 |
130 /** |
174 /** |
131 Cancels a previous capture request. |
175 Cancels a previous capture request. |
132 */ |
176 */ |
133 inline void RWebcameraDevice::CaptureCancel() |
177 inline void RWebcameraDevice::CaptureCancel() |
134 { |
178 { |
135 DoCancel(1<<ECapture); |
179 DoCancel(1 << ECapture); |
136 } |
180 } |
137 #endif // !__KERNEL_MODE__ |
181 #endif // !__KERNEL_MODE__ |
138 |
182 |
139 #endif |
183 #endif |