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_RecorderManager.h
20 * @brief This header file contains the declarations of the %_RecorderManager class.
24 #ifndef _FMEDIA_INTERNAL_RECORDER_MANAGER_H_
25 #define _FMEDIA_INTERNAL_RECORDER_MANAGER_H_
28 #include <FBaseColHashMapT.h>
29 #include "FMedia_RecorderTypes.h"
30 #include "FMedia_CameraTypes.h"
31 #include "FMedia_CameraRefHelper.h"
33 namespace Tizen { namespace Media
35 class _RecorderManagerSafeHashMapT;
38 * @class _RecorderManager
39 * @brief This class implements the _RecorderManager class.
41 class _RecorderManager
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 ~_RecorderManager(void);
55 * Get the instance of _RecorderManager.
57 * @return The _RecorderManager instance
58 * @param[in] recorderDevice The recorder 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 _RecorderManager* AddInstance(_RecorderDeviceType recorderDevice);
67 * Release the specific _RecorderManager.
69 * @param[in] recorderDevice The recorder device type.
71 static void Release(_RecorderDeviceType recorderDevice);
74 * Get the instance of _RecorderManager if it exists.
76 * @return The _RecorderManager instance
77 * @param[in] recorderDevice The recorder device id.
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_SYSTEM A system error has occurred.
81 static _RecorderManager* HasInstance(_RecorderDeviceType recorderDevice);
84 * Gets the recorder's handle
86 * @return The handle of camera
88 _RecorderHandle GetHandle(void) const;
91 friend class _RecorderManagerSafeHashMapT;
93 * This is the default constructor for this class.
95 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to
96 * initialize this instance.
99 _RecorderManager(void);
102 * Initializes this instance of _RecorderManager.
104 * @return An error code
105 * @param[in] cameraDevice The camera device id.
106 * @param[in] recorderDevice The recorder device id.
107 * @exception E_SUCCESS The method is successful.
108 * @exception E_SYSTEM A system error has occurred.
109 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
110 * @exception E_DEVICE_UNAVAILABLE The device is unavailable.
112 result Construct(_CameraDeviceType cameraDevice, _RecorderDeviceType recorderDevice);
115 * Converts the error from recorder to Result.
117 * @return An error code
118 * @param[in] err recorder error
120 result ConvertResult(int err) const;
122 _RecorderManager(const _RecorderManager& camera);
123 _RecorderManager& operator =(const _RecorderManager& camera);
125 static void InitSafeHashMapInst(void);
127 _RecorderHandle __handle;
129 static _RecorderManagerSafeHashMapT* __pMap;
133 * @class _RecorderManagerSafeHashMapT
134 * @brief This class is for handling safe HashMap.
137 class _RecorderManagerSafeHashMapT
138 : public Tizen::Base::Collection::HashMapT<_RecorderDeviceType, _RecorderManager*>
139 , public virtual Tizen::Base::Collection::ICollectionT <Tizen::Base::Collection::MapEntryT <_RecorderDeviceType, _RecorderManager*> >
142 _RecorderManagerSafeHashMapT(void);
143 virtual ~_RecorderManagerSafeHashMapT(void);
144 void RemoveItems(void);
147 _RecorderManagerSafeHashMapT(const _RecorderManagerSafeHashMapT& rhs);
148 _RecorderManagerSafeHashMapT& operator =(const _RecorderManagerSafeHashMapT& rhs);