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 FIoMmcStorageManager.h
20 * @brief This is the header file for the %MmcStorageManager class.
22 * This header file contains the declarations of the %MmcStorageManager class.
25 #ifndef _FIO_MMC_STORAGE_MANAGER_H_
26 #define _FIO_MMC_STORAGE_MANAGER_H_
28 #include <FBaseObject.h>
29 #include <FBaseResult.h>
30 #include <FIoIMmcStorageMountListener.h>
31 #include <FIoIMmcStorageFormatListener.h>
33 namespace Tizen { namespace Io
37 * @class MmcStorageManager
38 * @brief This class provides methods to mount, unmount, and format external MMC.
42 * @final This class is not intended for extension.
44 * The %MmcStorageManager class provides methods to mount, unmount, and format external MMC.
46 * @see IMmcStorageMountListener
47 * @see IMmcStorageFormatListener
54 * using namespace Tizen::Base;
55 * using namespace Tizen::Io;
57 * class MyMmcStorageMountListener
58 * : public Tizen::Io::IMmcStorageMountListener
61 * void OnMmcStorageMounted (result r)
65 * AppLog(“External MMC is mounted”);
69 * void OnMmcStorageUnmounted (result r)
73 * AppLog(“External MMC is unmounted”);
79 * MyClass::Execute(void)
81 * MyMmcStorageMountListener* pMyMmcStorageMountListener = new MyMmcStorageMountListener();
83 * MmcStorageManager* pMmcStorageMgr = new MmcStorageManager();
85 * pMmcStorageMgr->AddMmcStorageMountListener(*pMyMmcStorageMountListener);
87 * pMmcStorageMgr->Mount();
89 * pMmcStorageMgr->Unmount();
94 class _OSP_EXPORT_ MmcStorageManager
95 : public Tizen::Base::Object
100 * Gets the MMC storage manager instance.
104 * @return A pointer to %MmcStorageManager instance if this method is successful, @n
106 * @exception E_SUCCESS The method is successful.
107 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
108 * @remarks The specific error code can be accessed using the GetLastResult() method.
110 static MmcStorageManager* GetInstance(void);
113 * Mounts file system of external MMC.
116 * @privlevel platform
117 * @privilege %http://tizen.org/privilege/settingmanager.write @n
118 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
120 * @return An error code
121 * @exception E_SUCCESS Mount operation is successfully started.
122 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
123 * @exception E_INVALID_OPERATION The external MMC has already been mounted.
124 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
125 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
126 * @remarks The directory path of the mounted external MMC can be obtained by calling
127 * Environment::GetExternalStoragePath().
132 * Unmounts file system of external MMC.
135 * @privlevel platform
136 * @privilege %http://tizen.org/privilege/settingmanager.write @n
137 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
139 * @return An error code
140 * @exception E_SUCCESS Unmount operation is successfully started.
141 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
142 * @exception E_INVALID_OPERATION The external MMC has already been unmounted.
143 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
144 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
146 result Unmount(void);
149 * Formats file system of external MMC.
152 * @privlevel platform
153 * @privilege %http://tizen.org/privilege/settingmanager.write @n
154 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
156 * @return An error code
157 * @exception E_SUCCESS Format operation is successfully started.
158 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
159 * @exception E_INVALID_OPERATION The external MMC should be unmounted for format operation.
160 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
161 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
166 * Adds the listener for receiving the result of external MMC mount or unmount operations.
170 * @return An error code
171 * @param[in] listener The listener to add
172 * @exception E_SUCCESS The method is successful.
173 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
175 result AddMmcStorageMountListener(IMmcStorageMountListener& listener);
178 * Removes the listener for receiving the result of external MMC mount or unmount operations.
182 * @return An error code
183 * @param[in] listener The listener to add
184 * @exception E_SUCCESS The method is successful.
185 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
187 result RemoveMmcStorageMountListener(IMmcStorageMountListener& listener);
190 * Adds the listener for receiving the result of external MMC format operation.
194 * @return An error code
195 * @param[in] listener The listener to add
196 * @exception E_SUCCESS The method is successful.
197 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
199 result AddMmcStorageFormatListener(IMmcStorageFormatListener& listener);
202 * Removes the listener for receiving the result of external MMC format operation.
206 * @return An error code
207 * @param[in] listener The listener to add
208 * @exception E_SUCCESS The method is successful.
209 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
211 result RemoveMmcStorageFormatListener(IMmcStorageFormatListener& listener);
215 * This default constructor is intentionally declared as private to implement the Singleton semantic.
217 MmcStorageManager(void);
220 * This destructor is intentionally declared as private to implement the Singleton semantic.
222 virtual ~MmcStorageManager(void);
225 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
227 MmcStorageManager(const MmcStorageManager& rhs);
230 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
232 MmcStorageManager& operator =(const MmcStorageManager& rhs);
234 static void InitSingleton(void);
236 static void DestroySingleton(void);
239 static MmcStorageManager* __pMmcStorageManagerInstance;
240 friend class _MmcStorageManagerImpl;
241 class _MmcStorageManagerImpl* __pMmcStorageManagerImpl;
243 }; // MmcStorageManager
247 #endif // _FIO_MMC_STORAGE_MANAGER_H_