Enable build with iniparser v 3.1
[platform/framework/native/appfw.git] / inc / FIoMmcStorageManager.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18 * @file         FIoMmcStorageManager.h
19 * @brief        This is the header file for the %MmcStorageManager class.
20 *
21 * This header file contains the declarations of the %MmcStorageManager class.
22 */
23
24 #ifndef _FIO_MMC_STORAGE_MANAGER_H_
25 #define _FIO_MMC_STORAGE_MANAGER_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FIoIMmcStorageMountListener.h>
30 #include <FIoIMmcStorageFormatListener.h>
31
32 namespace Tizen { namespace Io
33 {
34
35 /**
36  * @class       MmcStorageManager
37  * @brief       This class provides methods to mount, unmount, and format external MMC.
38  *
39  * @since       2.0
40  *
41  * @final       This class is not intended for extension.
42  *
43  * The %MmcStorageManager class provides methods to mount, unmount, and format external MMC.
44  *
45  * @see IMmcStorageMountListener
46  * @see IMmcStorageFormatListener
47  *
48  * @code
49  *
50  * #include <FBase.h>
51  * #include <FIo.h>
52  *
53  * using namespace Tizen::Base;
54  * using namespace Tizen::Io;
55  *
56  * class MyMmcStorageMountListener
57  * : public Tizen::Io::IMmcStorageMountListener
58  * {
59  * public:
60  *      void OnMmcStorageMounted (result r)
61  *      {
62  *              if (!IsFailed(r))
63  *              {
64  *                      AppLog(“External MMC is mounted”);
65  *              }
66  *      }
67  *
68  *      void OnMmcStorageUnmounted (result r)
69  *      {
70  *              if (!IsFailed(r))
71  *              {
72  *                  AppLog(“External MMC is unmounted”);
73  *              }
74  *      }
75  * };
76  *
77  * void
78  * MyClass::Execute(void)
79  * {
80  *              MyMmcStorageMountListener* pMyMmcStorageMountListener = new MyMmcStorageMountListener();
81  *
82  *              MmcStorageManager* pMmcStorageMgr = new MmcStorageManager();
83  *
84  *              pMmcStorageMgr->AddMmcStorageMountListener(*pMyMmcStorageMountListener);
85  *
86  *              pMmcStorageMgr->Mount();
87  *
88  *              pMmcStorageMgr->Unmount();
89  * }
90  *
91  * @endcode
92  */
93 class _OSP_EXPORT_ MmcStorageManager
94            : public Tizen::Base::Object
95 {
96
97 public:
98         /**
99         * Gets the pointer to the %MmcStorageManager instance.
100         *
101         * @since                2.0
102         *
103         * @return               The pointer to %MmcStorageManager instance if this method is successful, @n
104         *                               else @c null
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.
108         */
109         static MmcStorageManager* GetInstance(void);
110
111         /**
112         * Mounts the file system of the external MMC.
113         *
114         * @since                2.0
115         * @privlevel    platform
116         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
117         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
118         *
119         * @return               An error code
120         * @exception    E_SUCCESS                       The 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().
127         */
128         result Mount(void);
129
130         /**
131         * Unmounts the file system of the external MMC.
132         *
133         * @since                2.0
134         * @privlevel    platform
135         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
136         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
137         *
138         * @return               An error code
139         * @exception    E_SUCCESS                       The 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.
144         */
145         result Unmount(void);
146
147         /**
148         * Formats the file system of the external MMC.
149         *
150         * @since                2.0
151         * @privlevel    platform
152         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
153         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
154         *
155         * @return               An error code
156         * @exception    E_SUCCESS                       The 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.
161         */
162         result Format(void);
163
164         /**
165         * Adds the listener for receiving the result of external MMC mount or unmount operations.
166         *
167         * @since                2.0
168         *
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.
173         */
174         result AddMmcStorageMountListener(IMmcStorageMountListener& listener);
175
176         /**
177         * Removes the listener for receiving the result of external MMC mount or unmount operations.
178         *
179         * @since                2.0
180         *
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.
185         */
186         result RemoveMmcStorageMountListener(IMmcStorageMountListener& listener);
187
188         /**
189         * Adds the listener for receiving the result of external MMC format operation.
190         *
191         * @since                2.0
192         *
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.
197         */
198         result AddMmcStorageFormatListener(IMmcStorageFormatListener& listener);
199
200         /**
201         * Removes the listener for receiving the result of external MMC format operation.
202         *
203         * @since                2.0
204         *
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.
209         */
210         result RemoveMmcStorageFormatListener(IMmcStorageFormatListener& listener);
211
212 private:
213         /**
214         * This default constructor is intentionally declared as private to implement the Singleton semantic.
215         */
216         MmcStorageManager(void);
217
218         /**
219         * This destructor is intentionally declared as private to implement the Singleton semantic.
220         */
221         virtual ~MmcStorageManager(void);
222
223         /**
224         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
225         */
226         MmcStorageManager(const MmcStorageManager& rhs);
227
228         /**
229         * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
230         */
231         MmcStorageManager& operator =(const MmcStorageManager& rhs);
232
233         static void InitSingleton(void);
234
235         static void DestroySingleton(void);
236
237 private:
238         static MmcStorageManager* __pMmcStorageManagerInstance;
239         friend class _MmcStorageManagerImpl;
240         class _MmcStorageManagerImpl* __pMmcStorageManagerImpl;
241
242 }; // MmcStorageManager
243
244 }} // Tizen::Io
245
246 #endif // _FIO_MMC_STORAGE_MANAGER_H_