2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FIoMmcStorageManager.h
19 * @brief This is the header file for the %MmcStorageManager class.
21 * This header file contains the declarations of the %MmcStorageManager class.
24 #ifndef _FIO_MMC_STORAGE_MANAGER_H_
25 #define _FIO_MMC_STORAGE_MANAGER_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FIoIMmcStorageMountListener.h>
30 #include <FIoIMmcStorageFormatListener.h>
32 namespace Tizen { namespace Io
36 * @class MmcStorageManager
37 * @brief This class provides methods to mount, unmount, and format external MMC.
41 * @final This class is not intended for extension.
43 * The %MmcStorageManager class provides methods to mount, unmount, and format external MMC.
45 * @see IMmcStorageMountListener
46 * @see IMmcStorageFormatListener
53 * using namespace Tizen::Base;
54 * using namespace Tizen::Io;
56 * class MyMmcStorageMountListener
57 * : public Tizen::Io::IMmcStorageMountListener
60 * void OnMmcStorageMounted (result r)
64 * AppLog(“External MMC is mounted”);
68 * void OnMmcStorageUnmounted (result r)
72 * AppLog(“External MMC is unmounted”);
78 * MyClass::Execute(void)
80 * MyMmcStorageMountListener* pMyMmcStorageMountListener = new MyMmcStorageMountListener();
82 * MmcStorageManager* pMmcStorageMgr = new MmcStorageManager();
84 * pMmcStorageMgr->AddMmcStorageMountListener(*pMyMmcStorageMountListener);
86 * pMmcStorageMgr->Mount();
88 * pMmcStorageMgr->Unmount();
93 class _OSP_EXPORT_ MmcStorageManager
94 : public Tizen::Base::Object
99 * Gets the MMC storage manager instance.
103 * @return A pointer to %MmcStorageManager instance if this method is successful, @n
105 * @exception E_SUCCESS The method is successful.
106 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
107 * @remarks The specific error code can be accessed using the GetLastResult() method.
109 static MmcStorageManager* GetInstance(void);
112 * Mounts file system of external MMC.
115 * @privlevel platform
116 * @privilege %http://tizen.org/privilege/settingmanager.write @n
117 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
119 * @return An error code
120 * @exception E_SUCCESS Mount operation is successfully started.
121 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
122 * @exception E_INVALID_OPERATION The external MMC has already been mounted.
123 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
124 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
125 * @remarks The directory path of the mounted external MMC can be obtained by calling
126 * Environment::GetExternalStoragePath().
131 * Unmounts file system of external MMC.
134 * @privlevel platform
135 * @privilege %http://tizen.org/privilege/settingmanager.write @n
136 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
138 * @return An error code
139 * @exception E_SUCCESS Unmount operation is successfully started.
140 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
141 * @exception E_INVALID_OPERATION The external MMC has already been unmounted.
142 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
143 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
145 result Unmount(void);
148 * Formats file system of external MMC.
151 * @privlevel platform
152 * @privilege %http://tizen.org/privilege/settingmanager.write @n
153 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
155 * @return An error code
156 * @exception E_SUCCESS Format operation is successfully started.
157 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
158 * @exception E_INVALID_OPERATION The external MMC should be unmounted for format operation.
159 * @exception E_SERVICE_BUSY One of mount, unmount and format operations is ongoing.
160 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
165 * Adds the listener for receiving the result of external MMC mount or unmount operations.
169 * @return An error code
170 * @param[in] listener The listener to add
171 * @exception E_SUCCESS The method is successful.
172 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
174 result AddMmcStorageMountListener(IMmcStorageMountListener& listener);
177 * Removes the listener for receiving the result of external MMC mount or unmount operations.
181 * @return An error code
182 * @param[in] listener The listener to add
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
186 result RemoveMmcStorageMountListener(IMmcStorageMountListener& listener);
189 * Adds the listener for receiving the result of external MMC format operation.
193 * @return An error code
194 * @param[in] listener The listener to add
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
198 result AddMmcStorageFormatListener(IMmcStorageFormatListener& listener);
201 * Removes the listener for receiving the result of external MMC format operation.
205 * @return An error code
206 * @param[in] listener The listener to add
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
210 result RemoveMmcStorageFormatListener(IMmcStorageFormatListener& listener);
214 * This default constructor is intentionally declared as private to implement the Singleton semantic.
216 MmcStorageManager(void);
219 * This destructor is intentionally declared as private to implement the Singleton semantic.
221 virtual ~MmcStorageManager(void);
224 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
226 MmcStorageManager(const MmcStorageManager& rhs);
229 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
231 MmcStorageManager& operator =(const MmcStorageManager& rhs);
233 static void InitSingleton(void);
235 static void DestroySingleton(void);
238 static MmcStorageManager* __pMmcStorageManagerInstance;
239 friend class _MmcStorageManagerImpl;
240 class _MmcStorageManagerImpl* __pMmcStorageManagerImpl;
242 }; // MmcStorageManager
246 #endif // _FIO_MMC_STORAGE_MANAGER_H_