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_CameraManager.h
20 * @brief This header file contains the declarations of the %_CameraManager class.
24 #ifndef _FMEDIA_INTERNAL_CAMERA_MANAGER_H_
25 #define _FMEDIA_INTERNAL_CAMERA_MANAGER_H_
27 #include <FBaseColHashMapT.h>
28 #include "FMedia_CameraTypes.h"
29 #include "FMedia_CameraRefHelper.h"
31 namespace Tizen { namespace Media
34 class _CameraManagerSafeHashMapT;
37 * @class _CameraManager
38 * @brief This class implements the _CameraManager class.
42 : public _CameraRefHelper
46 * This is the destructor for this class. @n
47 * All allocated resources are deallocated by this method. This method should be called in the same thread
48 * where the Construct() method is called.
52 virtual ~_CameraManager(void);
55 * Get the instance of _CameraManager.
57 * @return The _CameraManager instance
58 * @param[in] cameraDevice The camera device id.
59 * @exception E_SUCCESS The method is successful.
60 * @exception E_SYSTEM A system error has occurred.
61 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
62 * @exception E_DEVICE_UNAVAILABLE The device is unavailable.
64 static _CameraManager* AddInstance(_CameraDeviceType cameraDevice);
67 * Release the specific _CameraManager.
69 * @param[in] cameraDevice The camera device type
71 static void Release(_CameraDeviceType cameraDevice);
74 * Gets the camera's handle
76 * @return The handle of camera
78 _CameraHandle GetHandle(void) const;
81 friend class _CameraManagerSafeHashMapT;
83 * This is the default constructor for this class.
85 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to
86 * initialize this instance.
92 * Initializes this instance of _CameraManager.
94 * @return An error code
95 * @param[in] cameraDevice The camera device id.
96 * @exception E_SUCCESS The method is successful.
97 * @exception E_SYSTEM A system error has occurred.
98 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
99 * @exception E_DEVICE_UNAVAILABLE The device is unavailable.
101 result Construct(_CameraDeviceType cameraDevice);
104 * Converts the error from camera to Result.
106 * @return An error code
107 * @param[in] err camera error
109 result ConvertResult(int err) const;
111 _CameraManager(const _CameraManager& rhs);
112 _CameraManager& operator =(const _CameraManager& rhs);
114 static void InitSingleton(void);
115 static void DestroySingleton(void);
117 _CameraHandle __handle;
119 static _CameraManagerSafeHashMapT* __pMap;
123 * @class _CameraManagerSafeHashMapT
124 * @brief This class is for handling safe HashMap.
127 class _CameraManagerSafeHashMapT
128 : public Tizen::Base::Collection::HashMapT<_CameraDeviceType, _CameraManager*>
129 , public virtual Tizen::Base::Collection::ICollectionT <Tizen::Base::Collection::MapEntryT <_CameraDeviceType, _CameraManager*> >
132 _CameraManagerSafeHashMapT(void);
133 virtual ~_CameraManagerSafeHashMapT(void);
134 void RemoveItems(void);
137 _CameraManagerSafeHashMapT(const _CameraManagerSafeHashMapT& rhs);
138 _CameraManagerSafeHashMapT& operator =(const _CameraManagerSafeHashMapT& rhs);