2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMedia_CapabilityImpl.h
20 * @brief This is the header file for the _CapabilityImpl class.
22 * This header file contains the declarations of the _CapabilityImpl class.
25 #ifndef _FMEDIA_INTERNAL_CAPABILITY_IMPL_H_
26 #define _FMEDIA_INTERNAL_CAPABILITY_IMPL_H_
28 #include <unique_ptr.h>
29 #include <libxml/tree.h>
30 #include <FBaseColIList.h>
31 #include <FBaseColHashMap.h>
33 namespace Tizen { namespace Media
35 _OSP_EXPORT_ extern const wchar_t* const AUDIORECORDER_CODEC_TYPE;
36 _OSP_EXPORT_ extern const wchar_t* const AUDIORECORDER_MEDIA_CONTAINER_TYPE;
37 _OSP_EXPORT_ extern const wchar_t* const VIDEORECORDER_AUDIO_CODEC_TYPE;
38 _OSP_EXPORT_ extern const wchar_t* const VIDEORECORDER_VIDEO_CODEC_TYPE;
39 _OSP_EXPORT_ extern const wchar_t* const VIDEORECORDER_MEDIA_CONTAINER_TYPE;
40 _OSP_EXPORT_ extern const wchar_t* const VIDEORECORDER_CODEC;
42 _OSP_EXPORT_ extern const wchar_t* const CAMERA_PRIMARY_ZOOM_LEVEL;
43 _OSP_EXPORT_ extern const wchar_t* const CAMERA_PRIMARY_FOCUS_POINT;
44 _OSP_EXPORT_ extern const wchar_t* const CAMERA_SECONDARY_ZOOM_LEVEL;
45 _OSP_EXPORT_ extern const wchar_t* const CAMERA_SECONDARY_FOCUS_POINT;
47 enum _MediaCapValueType
49 _MEDIA_CAP_VALUE_TYPE_BOOL,
50 _MEDIA_CAP_VALUE_TYPE_INT,
51 _MEDIA_CAP_VALUE_TYPE_LONG_LONG,
52 _MEDIA_CAP_VALUE_TYPE_DOUBLE,
53 _MEDIA_CAP_VALUE_TYPE_STRING,
54 _MEDIA_CAP_VALUE_TYPE_LIST,
57 enum _MediaCapCategoryType
59 _MEDIA_CAP_CATEGORY_NONE,
60 _MEDIA_CAP_CATEGORY_AUDIO,
61 _MEDIA_CAP_CATEGORY_IMAGE,
62 _MEDIA_CAP_CATEGORY_PLAYER,
63 _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA,
64 _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA,
65 _MEDIA_CAP_CATEGORY_VIDEO_RECORDER,
66 _MEDIA_CAP_CATEGORY_AUDIO_RECORDER,
67 _MEDIA_CAP_CATEGORY_CODEC,
71 * @class _CapabilityImpl
72 * @brief This class provides parsing class for MediaCapability class.
75 : public Tizen::Base::Object
78 static _CapabilityImpl* GetInstance(void);
81 * Initializes this instance of _CapabilityImpl.
83 * @return E_SUCCESS in success, an error code in failure
85 * @exception E_SUCCESS The method was successful.
86 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
87 * @exception E_SYSTEM A system error occurred.
89 result Construct(void);
92 * Get capability value in Media.
94 * @return E_SUCCESS in success, an error code in failure
96 * @exception E_SUCCESS The method was successful.
97 * @exception E_OBJ_NOT_FOUND The specified key was not found.
98 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
99 * @exception E_SYSTEM A system error occurred.
101 result GetValue(const Tizen::Base::String& key, bool& value);
104 * Get capability value in Media.
106 * @return E_SUCCESS in success, an error code in failure
108 * @exception E_SUCCESS The method was successful.
109 * @exception E_OBJ_NOT_FOUND The specified key was not found.
110 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
111 * @exception E_SYSTEM A system error occurred.
113 result GetValue(const Tizen::Base::String& key, int& value);
117 * Get capability value in Media.
119 * @return E_SUCCESS in success, an error code in failure
121 * @exception E_SUCCESS The method was successful.
122 * @exception E_OBJ_NOT_FOUND The specified key was not found.
123 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
124 * @exception E_SYSTEM A system error occurred.
126 result GetValue(const Tizen::Base::String& key, long long& value);
129 * Get capability value in Media.
131 * @return E_SUCCESS in success, an error code in failure
133 * @exception E_SUCCESS The method was successful.
134 * @exception E_OBJ_NOT_FOUND The specified key was not found.
135 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
136 * @exception E_SYSTEM A system error occurred.
138 result GetValue(const Tizen::Base::String& key, double& value);
141 * Get capability value in Media.
143 * @return E_SUCCESS in success, an error code in failure
145 * @exception E_SUCCESS The method was successful.
146 * @exception E_OBJ_NOT_FOUND The specified key was not found.
147 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
148 * @exception E_SYSTEM A system error occurred.
150 result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
153 * Get capability value in Media.
155 * @return E_SUCCESS in success, an error code in failure
157 * @exception E_SUCCESS The method was successful.
158 * @exception E_OBJ_NOT_FOUND The specified key was not found.
159 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
160 * @exception E_SYSTEM A system error occurred.
162 result GetValueN(const Tizen::Base::String& key, Tizen::Base::Collection::IList& value);
166 * Convert char to integer
168 * @return Tizen::Base::Object*
170 * @exception E_SUCCESS The method was successful.
171 * @exception E_OBJ_NOT_FOUND The specified key was not found.
172 * @exception E_OUT_OF_MEMORY The memory is insufficient.
173 * @exception E_SYSTEM A system error occurred.
175 static Tizen::Base::Object* ConvertCharToInteger(const char* input, Object* pObj, const void* param);
178 * Convert char to string
180 * @return Tizen::Base::Object*
182 * @exception E_SUCCESS The method was successful.
183 * @exception E_OBJ_NOT_FOUND The specified key was not found.
184 * @exception E_OUT_OF_MEMORY The memory is insufficient.
185 * @exception E_SYSTEM A system error occurred.
187 static Tizen::Base::Object* ConvertCharToString(const char* input, Object* pObj, const void* param);
190 * Convert char to enum
192 * @return Tizen::Base::Object*
194 * @exception E_SUCCESS The method was successful.
195 * @exception E_OBJ_NOT_FOUND The specified key was not found.
196 * @exception E_OUT_OF_MEMORY The memory is insufficient.
197 * @exception E_SYSTEM A system error occurred.
199 static Tizen::Base::Object* ConvertCharToEnum(const char* input, Object* pObj, const void* param);
202 * Convert char to dimesion
204 * @return Tizen::Base::Object*
206 * @exception E_SUCCESS The method was successful.
207 * @exception E_OBJ_NOT_FOUND The specified key was not found.
208 * @exception E_OUT_OF_MEMORY The memory is insufficient.
209 * @exception E_SYSTEM A system error occurred.
211 static Tizen::Base::Object* ConvertCharToDimension(const char* input, Object* pObj, const void* param);
214 * Copy object to list integer type
216 * @return E_SUCCESS in success, an error code in failure
218 * @exception E_SUCCESS The method was successful.
219 * @exception E_OBJ_NOT_FOUND The specified key was not found.
220 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
221 * @exception E_OUT_OF_MEMORY The memory is insufficient.
222 * @exception E_SYSTEM A system error occurred.
224 static result CopyListInteger(int type, Object* pObj, void* value);
227 * Copy object to list string type
229 * @return E_SUCCESS in success, an error code in failure
231 * @exception E_SUCCESS The method was successful.
232 * @exception E_OBJ_NOT_FOUND The specified key was not found.
233 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
234 * @exception E_OUT_OF_MEMORY The memory is insufficient.
235 * @exception E_SYSTEM A system error occurred.
237 static result CopyListString(int type, Object* pObj, void* value);
240 * Copy object to demension type
242 * @return E_SUCCESS in success, an error code in failure
244 * @exception E_SUCCESS The method was successful.
245 * @exception E_OBJ_NOT_FOUND The specified key was not found.
246 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
247 * @exception E_OUT_OF_MEMORY The memory is insufficient.
248 * @exception E_SYSTEM A system error occurred.
250 static result CopyListDimension(int type, Object* pObj, void* value);
253 * Copy object to integer type
255 * @return E_SUCCESS in success, an error code in failure
257 * @exception E_SUCCESS The method was successful.
258 * @exception E_OBJ_NOT_FOUND The specified key was not found.
259 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
260 * @exception E_OUT_OF_MEMORY The memory is insufficient.
261 * @exception E_SYSTEM A system error occurred.
263 static result CopyInteger(int type, Object* pObj, void* value);
266 * Copy object to bool type
268 * @return E_SUCCESS in success, an error code in failure
270 * @exception E_SUCCESS The method was successful.
271 * @exception E_OBJ_NOT_FOUND The specified key was not found.
272 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
273 * @exception E_OUT_OF_MEMORY The memory is insufficient.
274 * @exception E_SYSTEM A system error occurred.
276 static result CopyBool(int type, Object* pObj, void* value);
280 * Get capability value in Media.
282 * @return E_SUCCESS in success, an error code in failure
284 * @param[in] key The key string for capability lookup
285 * @param[in] type value type
286 * @param[out] value returned capability value
288 * @exception E_SUCCESS The method was successful.
289 * @exception E_OBJ_NOT_FOUND The specified key was not found.
290 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
291 * @exception E_SYSTEM A system error occurred.
293 result GetValue(const Tizen::Base::String& key, int type, void* value);
296 * parse the xml file data
297 * @return E_SUCCESS in success, an error code in failure
298 * @param[in] pXmlBuffer xml file content
299 * @param[in] length size of xml buffer
300 * @exception E_SUCCESS The method was successful.
301 * @exception E_OBJ_NOT_FOUND The specified key was not found.
302 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
303 * @exception E_SYSTEM A system error occurred.
305 result ParseCapability(const char* pXmlBuffer, int length);
308 * parse the xml node data
309 * @param[in] pRoot xml start tag node
310 * @param[in] section section name
312 void ParseSection(xmlNode* pRoot, const Tizen::Base::String& section);
316 * This is the default constructor for this class.
318 * @remarks After creating an instance of this class, you must explicitly call one of
319 * the Construct() methods to initialize the instance.
322 _CapabilityImpl(void);
325 * This is the destructor for this class. @n
326 * Resources are deallocated by this method.
327 * This method should be called in the same thread as Construct() method
331 virtual ~_CapabilityImpl(void);
335 * @param[in] src _CapabilityImpl type object
337 _CapabilityImpl(const _CapabilityImpl& src);
340 * assignment operator overloading
341 * @param[in] src _CapabilityImpl type object
343 _CapabilityImpl& operator =(const _CapabilityImpl& src);
346 * parse the capability by the category
347 * @return E_SUCCESS in success, an error code in failure
348 * @param[in] category the category
349 * @exception E_SUCCESS The method was successful.
350 * @exception E_INVALID_ARG The specified category is not valid.
351 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
352 * @exception E_SYSTEM A system error occurred.
354 result ParseCapability(_MediaCapCategoryType category);
356 static void InitCapabilityImpl(void);
358 std::unique_ptr <Tizen::Base::Collection::HashMap> __pMap;
360 bool __primaryCameraDone;
361 bool __secondaryCameraDone;
362 bool __videoRecorderDone;
363 bool __audioRecorderDone;
365 static _CapabilityImpl* __pCapabilityImplInst;