|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSHENGCAMERAHANDLER_H |
|
20 #define MUSHENGCAMERAHANDLER_H |
|
21 |
|
22 // USER |
|
23 #include "musunittesting.h" |
|
24 #include "mussettings.h" |
|
25 |
|
26 // SYSTEM |
|
27 #include <ecam.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CMceCameraSource; |
|
31 class CMceSession; |
|
32 |
|
33 // CLASS |
|
34 |
|
35 class TMusEngCameraHandler |
|
36 { |
|
37 MUS_UNITTEST( UT_CMusEngOutSession ) |
|
38 MUS_UNITTEST( UT_CMusEngLiveSession ) |
|
39 MUS_UNITTEST( UT_CMusEngTwoWaySession ) |
|
40 MUS_UNITTEST( UT_CMusEngTwoWayRecvSession ) |
|
41 MUS_UNITTEST( UT_TMusEngCameraHandler ) |
|
42 |
|
43 public: |
|
44 /* |
|
45 * Defines current camera to be used |
|
46 */ |
|
47 enum TCurrentCamera |
|
48 { |
|
49 ENextCamera = -1, |
|
50 EBackCamera = 0, |
|
51 EFrontCamera = 1 |
|
52 }; |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Determines the number of cameras on the device. |
|
58 * |
|
59 * @param aCurrentCamera returns current camera.. |
|
60 * |
|
61 * @return Count of cameras present on the device. |
|
62 */ |
|
63 IMPORT_C TInt CamerasAvailableL( TCurrentCamera& aCurrentCamera ); |
|
64 |
|
65 /** |
|
66 * Change current camera to front to back |
|
67 * |
|
68 * @param aCurrentCamera Change camera to be used. |
|
69 */ |
|
70 IMPORT_C void ChangeCameraL( TCurrentCamera aCurrentCamera ); |
|
71 |
|
72 /** |
|
73 * Gets current zoom factor |
|
74 * |
|
75 * @pre Session is established |
|
76 * @leave KErrNotReady if precondition not fullfilled |
|
77 */ |
|
78 IMPORT_C TInt CurrentZoomL() const; |
|
79 |
|
80 /** |
|
81 * Sets new zoom factor |
|
82 * |
|
83 * @pre Session is established |
|
84 * @pre MinZoomL <= aNewZoomFactor <= MaxZoomL |
|
85 * @leave KErrNotReady if session is not established |
|
86 */ |
|
87 IMPORT_C void SetZoomL( TInt aNewZoomFactor ); |
|
88 |
|
89 /** |
|
90 * Gets minimum zoom factor |
|
91 * |
|
92 * @pre Session is established |
|
93 * @leave KErrNotReady if precondition not fullfilled |
|
94 */ |
|
95 IMPORT_C TInt MinZoomL() const; |
|
96 |
|
97 /** |
|
98 * Gets maximum zoom factor |
|
99 * |
|
100 * @pre Session is established |
|
101 * @leave KErrNotReady if precondition not fullfilled |
|
102 */ |
|
103 IMPORT_C TInt MaxZoomL() const; |
|
104 |
|
105 /** |
|
106 * Increases zoom factor by one. |
|
107 * |
|
108 * @pre Session is established |
|
109 * @leave KErrNotReady if precondition not fullfilled |
|
110 */ |
|
111 IMPORT_C void ZoomInL(); |
|
112 |
|
113 /** |
|
114 * Decreases zoom factor by one. |
|
115 * |
|
116 * @pre Session is established |
|
117 * @leave KErrNotReady if precondition not fullfilled |
|
118 */ |
|
119 IMPORT_C void ZoomOutL(); |
|
120 |
|
121 /** |
|
122 * Sets zoom factor to default. |
|
123 * |
|
124 * @pre Session is established |
|
125 * @leave KErrNotReady if precondition not fullfilled |
|
126 */ |
|
127 IMPORT_C void ZoomDefaultL(); |
|
128 |
|
129 /** |
|
130 * Sets current brightness |
|
131 * |
|
132 * @pre Session is established |
|
133 * @leave KErrNotReady if precondition not fullfilled |
|
134 */ |
|
135 IMPORT_C void SetBrightnessL( TInt aBrightness ) const; |
|
136 |
|
137 |
|
138 /** |
|
139 * Gets current brightness |
|
140 * |
|
141 * @pre Session is established |
|
142 * @leave KErrNotReady if precondition not fullfilled |
|
143 */ |
|
144 IMPORT_C TInt CurrentBrightnessL() const; |
|
145 |
|
146 /** |
|
147 * Gets maximum brightness |
|
148 * |
|
149 * @pre Session is established |
|
150 * @leave KErrNotReady if precondition not fullfilled |
|
151 */ |
|
152 IMPORT_C TInt MaxBrightnessL() const; |
|
153 |
|
154 /** |
|
155 * Gets minimum brightness |
|
156 * |
|
157 * @pre Session is established |
|
158 * @leave KErrNotReady if precondition not fullfilled |
|
159 */ |
|
160 IMPORT_C TInt MinBrightnessL() const; |
|
161 |
|
162 /** |
|
163 * Increases brightness by one. |
|
164 * |
|
165 * @pre Session is established |
|
166 * @leave KErrNotReady if precondition not fullfilled |
|
167 */ |
|
168 IMPORT_C void IncreaseBrightnessL(); |
|
169 |
|
170 /** |
|
171 * Decreases brightness by one. |
|
172 * |
|
173 * @pre Session is established |
|
174 * @leave KErrNotReady if precondition not fullfilled |
|
175 */ |
|
176 IMPORT_C void DecreaseBrightnessL(); |
|
177 |
|
178 /** |
|
179 * Sets brightness factor to default. |
|
180 * |
|
181 * @pre Session is established |
|
182 * @leave KErrNotReady if precondition not fullfilled |
|
183 */ |
|
184 IMPORT_C void BrightnessDefaultL(); |
|
185 |
|
186 /** |
|
187 * Sets brightness to automatic. |
|
188 * |
|
189 * @pre Session is established |
|
190 * @leave KErrNotReady if precondition not fullfilled |
|
191 */ |
|
192 IMPORT_C void BrightnessAutoL(); |
|
193 |
|
194 /** |
|
195 * Resumes previously paused session. |
|
196 * Continues using viewfinder and enables streaming video. |
|
197 * |
|
198 */ |
|
199 IMPORT_C void PlayL(); |
|
200 |
|
201 /** |
|
202 * Pauses session. |
|
203 * Holds display and disables streaming video to network. |
|
204 * |
|
205 */ |
|
206 IMPORT_C void PauseL(); |
|
207 |
|
208 /** |
|
209 * Tells whether session is paused or not |
|
210 */ |
|
211 IMPORT_C TBool IsPlayingL(); |
|
212 |
|
213 |
|
214 public: |
|
215 |
|
216 TMusEngCameraHandler(); |
|
217 |
|
218 void SetSession( CMceSession* aSession ); |
|
219 |
|
220 void InitializeL( CMceCameraSource& aCamera ); |
|
221 |
|
222 void InitializeZoomStepSize(); |
|
223 |
|
224 void ReadCameraUsageKeyL(); |
|
225 |
|
226 TInt ZoomStepSize( TInt64& aTime ); |
|
227 |
|
228 void ChangeActiveCameraL( TCurrentCamera aNewCamera ); |
|
229 |
|
230 private: |
|
231 |
|
232 CMceSession* iSession; // Not owned |
|
233 |
|
234 TCameraInfo iCameraInfo; |
|
235 |
|
236 TInt iDefaultZoomFactor; |
|
237 |
|
238 TInt iDefaultBrightness; |
|
239 |
|
240 TInt64 iZoomInTime; |
|
241 |
|
242 TInt64 iZoomOutTime; |
|
243 |
|
244 TInt iSmallZoomStep; |
|
245 |
|
246 TInt iBigZoomStep; |
|
247 |
|
248 TCurrentCamera iCurrentCamera; |
|
249 |
|
250 MusSettingsKeys::TUseCamera iCameraUsage; |
|
251 |
|
252 }; |
|
253 |
|
254 #endif |
|
255 |