Merge "Update PackageAppFilter API" into tizen_2.1
[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 class _OSP_EXPORT_ MmcStorageManager
50            : public Tizen::Base::Object
51 {
52
53 public:
54         /**
55         * Gets the MMC storage manager instance.
56         *
57         * @since                2.0
58         *
59         * @return               A pointer to %MmcStorageManager instance if this method is successful, @n
60         *                               else @c null
61         * @exception    E_SUCCESS                       The method is successful.
62         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
63         * @remarks              The specific error code can be accessed using the GetLastResult() method.
64         */
65         static MmcStorageManager* GetInstance(void);
66
67         /**
68         * Mounts file system of external MMC.
69         *
70         * @since                2.0
71         * @privlevel    platform
72         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
73         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
74         *
75         * @return               An error code
76         * @exception    E_SUCCESS                       Mount operation is successfully started.
77         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
78         * @exception    E_INVALID_OPERATION     The external MMC has already been mounted.
79         * @exception    E_SERVICE_BUSY          One of mount, unmount and format operations is ongoing.
80         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
81         * @remarks              The directory path of the mounted external MMC can be obtained by calling
82         *                               Environment::GetExternalStoragePath().
83         */
84         result Mount(void);
85
86         /**
87         * Unmounts file system of external MMC.
88         *
89         * @since                2.0
90         * @privlevel    platform
91         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
92         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
93         *
94         * @return               An error code
95         * @exception    E_SUCCESS                       Unmount operation is successfully started.
96         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
97         * @exception    E_INVALID_OPERATION     The external MMC has already been unmounted.
98         * @exception    E_SERVICE_BUSY          One of mount, unmount and format operations is ongoing.
99         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
100         */
101         result Unmount(void);
102
103         /**
104         * Formats file system of external MMC.
105         *
106         * @since                2.0
107         * @privlevel    platform
108         * @privilege    %http://tizen.org/privilege/settingmanager.write @n
109         *                               (%http://tizen.org/privilege/systemsetting.read is deprecated.)
110         *
111         * @return               An error code
112         * @exception    E_SUCCESS                       Format operation is successfully started.
113         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
114         * @exception    E_INVALID_OPERATION     The external MMC should be unmounted for format operation.
115         * @exception    E_SERVICE_BUSY          One of mount, unmount and format operations is ongoing.
116         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
117         */
118         result Format(void);
119
120         /**
121         * Adds the listener for receiving the result of external MMC mount or unmount operations.
122         *
123         * @since                2.0
124         *
125         * @return               An error code
126         * @param[in]    listener                        The listener to add
127         * @exception    E_SUCCESS                       The method is successful.
128         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
129         */
130         result AddMmcStorageMountListener(IMmcStorageMountListener& listener);
131
132         /**
133         * Removes the listener for receiving the result of external MMC mount or unmount operations.
134         *
135         * @since                2.0
136         *
137         * @return               An error code
138         * @param[in]    listener                        The listener to add
139         * @exception    E_SUCCESS                       The method is successful.
140         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
141         */
142         result RemoveMmcStorageMountListener(IMmcStorageMountListener& listener);
143
144         /**
145         * Adds the listener for receiving the result of external MMC format operation.
146         *
147         * @since                2.0
148         *
149         * @return               An error code
150         * @param[in]    listener                        The listener to add
151         * @exception    E_SUCCESS                       The method is successful.
152         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
153         */
154         result AddMmcStorageFormatListener(IMmcStorageFormatListener& listener);
155
156         /**
157         * Removes the listener for receiving the result of external MMC format operation.
158         *
159         * @since                2.0
160         *
161         * @return               An error code
162         * @param[in]    listener                        The listener to add
163         * @exception    E_SUCCESS                       The method is successful.
164         * @exception    E_SYSTEM                        The method cannot proceed due to a severe system error.
165         */
166         result RemoveMmcStorageFormatListener(IMmcStorageFormatListener& listener);
167
168 private:
169         /**
170         * This default constructor is intentionally declared as private to implement the Singleton semantic.
171         */
172         MmcStorageManager(void);
173
174         /**
175         * This destructor is intentionally declared as private to implement the Singleton semantic.
176         */
177         virtual ~MmcStorageManager(void);
178
179         /**
180         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
181         */
182         MmcStorageManager(const MmcStorageManager& rhs);
183
184         /**
185         * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
186         */
187         MmcStorageManager& operator =(const MmcStorageManager& rhs);
188
189         static void InitSingleton(void);
190
191         static void DestroySingleton(void);
192
193 private:
194         static MmcStorageManager* __pMmcStorageManagerInstance;
195         friend class _MmcStorageManagerImpl;
196         class _MmcStorageManagerImpl* __pMmcStorageManagerImpl;
197
198 }; // MmcStorageManager
199
200 }} // Tizen::Io
201
202 #endif // _FIO_MMC_STORAGE_MANAGER_H_