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