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