|
1 /* |
|
2 * Copyright (c) 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: Defines the ECom plugin for HTI camera service. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HTICAMERASERVICEPLUGIN_H |
|
21 #define HTICAMERASERVICEPLUGIN_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <HtiServicePluginInterface.h> |
|
25 #include "EngineVideoRecording.h" |
|
26 // CONSTANTS |
|
27 |
|
28 // MACROS |
|
29 |
|
30 // DATA TYPES |
|
31 |
|
32 // FUNCTION PROTOTYPES |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CEngineVideoRecording; |
|
36 class MEngineVideoRecordingObserver; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * The ECom plugin for HTI camera service. |
|
42 * |
|
43 */ |
|
44 class CHtiCameraServicePlugin : public CHTIServicePluginInterface, |
|
45 public MEngineVideoRecordingObserver |
|
46 { |
|
47 |
|
48 protected: |
|
49 // commands |
|
50 enum TCommands |
|
51 { |
|
52 ECmdInitialize = 0x01, |
|
53 ECmdPrepareVideoRecording = 0x02, |
|
54 ECmdStartVideoRecording = 0x05, |
|
55 ECmdPausingVideoRecording = 0x06, |
|
56 ECmdResumeVideoRecording = 0x07, |
|
57 ECmdStopVideoRecording = 0x08, |
|
58 ECmdCloseVideoRecording = 0x09, |
|
59 ECmdGetZoom = 0x0a, |
|
60 ECmdSetZoom = 0x0b, |
|
61 |
|
62 ECmdUninitialize = 0x51, |
|
63 EResultOk = 0xFF // only for response message |
|
64 }; |
|
65 |
|
66 |
|
67 public: // Constructors and destructor |
|
68 |
|
69 /** |
|
70 * Two-phased constructor. |
|
71 */ |
|
72 static CHtiCameraServicePlugin* NewL(); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 public: |
|
77 // Functions from base classes |
|
78 |
|
79 /** |
|
80 * From CHTIServicePluginInterface |
|
81 * Called by the HTI Framework when sending message to this service. |
|
82 * @param aMessage message body destinated to a servive |
|
83 * @param aPriority message priority |
|
84 */ |
|
85 void ProcessMessageL(const TDesC8& aMessage, |
|
86 THtiMessagePriority aPriority); |
|
87 |
|
88 /** |
|
89 * From CHTIServicePluginInterface |
|
90 * Indicates to HTI Framework whether the plugin is ready to process |
|
91 * a new message or if it's busy processing previous message. |
|
92 */ |
|
93 TBool IsBusy(); |
|
94 |
|
95 |
|
96 protected: // New functions |
|
97 |
|
98 /** |
|
99 * C++ default constructor. |
|
100 */ |
|
101 CHtiCameraServicePlugin(); |
|
102 |
|
103 /** |
|
104 * 2nd phase constructor. |
|
105 */ |
|
106 void ConstructL(); |
|
107 |
|
108 /** |
|
109 * Destructor. |
|
110 */ |
|
111 virtual ~CHtiCameraServicePlugin(); |
|
112 |
|
113 protected: |
|
114 // Functions from base classes |
|
115 |
|
116 /** |
|
117 * From MEngineVideoRecordingObserver |
|
118 * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(), |
|
119 * or CEngineVideoRecording::Reserve() completes. |
|
120 * Indicates if Video Recording Engine is ready for operation, |
|
121 * the camera is reserved and its power is switched on. |
|
122 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code. |
|
123 * @return void |
|
124 */ |
|
125 virtual void MevroInitComplete( TInt aError ); |
|
126 |
|
127 /** |
|
128 * From MEngineVideoRecordingObserver |
|
129 * Called asynchronously when preparing of video recording completes |
|
130 * after PrepareVideoRecordingL() has been called. |
|
131 * May be called second time with an error code after a successful preparation |
|
132 * if video recording loses its prepared state for some reason (e.g. audio HW |
|
133 * is reserved for some other application). |
|
134 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code. |
|
135 * @return void |
|
136 */ |
|
137 virtual void MevroVideoPrepareComplete(TInt aError); |
|
138 |
|
139 /** |
|
140 * From MEngineVideoRecordingObserver |
|
141 * Called (possibly asynchronously) when video recording is running |
|
142 * after CEngineVideoRecording::StartVideoRecording() or |
|
143 * CEngineVideoRecording::ResumeVideoRecording() has been called. |
|
144 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code. |
|
145 * @return void |
|
146 */ |
|
147 virtual void MevroVideoRecordingOn(TInt aError); |
|
148 |
|
149 /** |
|
150 * From MEngineVideoRecordingObserver |
|
151 * Called (possibly asynchronously) when video recording is paused after |
|
152 * CEngineVideoRecording::PauseVideoRecording() has been called. |
|
153 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code. |
|
154 * @return void |
|
155 */ |
|
156 virtual void MevroVideoRecordingPaused(TInt aError); |
|
157 |
|
158 /** |
|
159 * From MEngineVideoRecordingObserver |
|
160 * Called (possibly asynchronously) when video recording is completed |
|
161 * after CEngineVideoRecording::StopVideoRecording() has been called or |
|
162 * recording has been completed for some other reason. |
|
163 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code. |
|
164 * if aError == KErrDiskFull, then disk storage is full. |
|
165 * if aError == KErrCompletion, then clip max size was reached. |
|
166 * @return void |
|
167 */ |
|
168 virtual void MevroVideoRecordingComplete(TInt aError); |
|
169 |
|
170 private: |
|
171 void HandleInitializeCmdL(const TDesC8& aData); |
|
172 void HandleUninitializeCmdL(const TDesC8& aData); |
|
173 void HandlePrepareVideoRecordingCmdL(const TDesC8& aData); |
|
174 void HandleStartVideoRecordingCmdL( const TDesC8& aData ); |
|
175 void HandlePausingVideoRecordingCmdL( const TDesC8& aData ); |
|
176 void HandleResumeVideoRecordingCmdL( const TDesC8& aData ); |
|
177 void HandleStopVideoRecordingCmdL( const TDesC8& aData ); |
|
178 void HandleCloseVideoRecordingCmdL( const TDesC8& aData ); |
|
179 void HandleGetZoomCmdL( const TDesC8& aData ); |
|
180 void HandleSetZoomCmdL( const TDesC8& aData ); |
|
181 |
|
182 void SendOkMsgL( const TDesC8& aData ); |
|
183 void SendErrorMessageL( TInt aError, const TDesC8& aDescription ); |
|
184 |
|
185 TInt ParseString( const TDesC8& aRequest, |
|
186 TInt aOffset, TDes& aResult ); |
|
187 |
|
188 public: // Data |
|
189 |
|
190 protected: // Data |
|
191 |
|
192 private: // Data |
|
193 // Flag telling if the service is busy processing a message |
|
194 TBool iIsBusy; |
|
195 |
|
196 TInt iError; |
|
197 CEngineVideoRecording* iVideoRecordingEngine; |
|
198 CActiveSchedulerWait* iWaiter; |
|
199 |
|
200 }; |
|
201 |
|
202 #endif // HTICAMERASERVICEPLUGIN_H |
|
203 |
|
204 // End of File |