Flush app registry before releasing file lock
[platform/framework/native/appfw.git] / inc / FSysDeviceManager.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        FSysDeviceManager.h
19  * @brief       This is the header file for the %DeviceManager class.
20  *
21  * This header file contains the declarations of the %DeviceManager class.
22  *
23  *
24  */
25
26 #ifndef _FSYS_DEVICE_MANAGER_H_
27 #define _FSYS_DEVICE_MANAGER_H_
28
29 #include <FBaseObject.h>
30
31 namespace Tizen { namespace System
32 {
33
34 class IDeviceEventListener;
35
36 /**
37 * @enum         DeviceType
38 * Defines the type of the supported devices.
39 *
40 * @since        2.0
41 *
42 */
43 enum DeviceType
44 {
45         BluetoothHeadset,       // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_BLUETOOTH_HEADSET.
46         Charger,                // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_CHARGER.
47         UsbClient,              // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_USB_CLIENT.
48         TvOut,                  // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_TV_OUT.
49         WiredHeadset,           // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_WIRED_HEADSET.
50         WiredHeadphone,         // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_WIRED_HEADPHONE.
51         StorageCard,            // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_STORAGE_CARD.
52         Keyboard,               // This enum value is deprecated. Instead of using this enum value, use DEVICE_TYPE_KEYBOARD.
53         DEVICE_TYPE_BLUETOOTH_HEADSET = BluetoothHeadset,       /**< Bluetooth headset */
54         DEVICE_TYPE_CHARGER = Charger,                          /**< Charger*/
55         DEVICE_TYPE_USB_CLIENT = UsbClient,                     /**< USB client */
56         DEVICE_TYPE_TV_OUT = TvOut,                             /**< TV out */
57         DEVICE_TYPE_WIRED_HEADSET = WiredHeadset,               /**< Wired headset */
58         DEVICE_TYPE_WIRED_HEADPHONE = WiredHeadphone,           /**< Wired headphone */
59         DEVICE_TYPE_STORAGE_CARD = StorageCard,                 /**< Storage card */
60         DEVICE_TYPE_KEYBOARD = Keyboard,                        /**< Hardware Built-in keyboard */
61         DEVICE_TYPE_HDMI,                                       /**< HDMI */
62 };
63
64 /**
65  * @class       DeviceManager
66  * @brief       This class provides methods for device management.
67  *
68  * @since       2.0
69  *
70  * @final       This class is not intended for extension.
71  *
72  * The %DeviceManager class provides listeners to handle events for various external device, such as a Bluetooth headset, HDMI, 
73  * and headphone. This class also gets the current state of the device. You cannot create an instance of this class directly.
74  *
75  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/device_management.htm">External Device Management</a>.
76  *
77  * @see IDeviceEventListener
78  *
79  */
80 class _OSP_EXPORT_ DeviceManager
81         : public Tizen::Base::Object
82 {
83
84 public:
85         /**
86          * Gets the specific device state.
87          *
88          * @if OSPCOMPAT
89          * @brief <i> [Compatibility] </i>
90          * @endif
91          * @since                       2.0
92          * @if OSPCOMPAT
93          * @compatibility       This method has compatibility issues with %Tizen API versions @b prior @b to @b 2.0. @n
94          *                                      For more information, see @ref DeviceManagerGetStatePage "here".
95          * @endif
96          *
97          * @param[in]   deviceType      The value from the enumerator DeviceType indicating the device
98          * @param[out]  state           The device <a href="../org.tizen.native.appprogramming/html/guide/system/device_management.htm">state</a> of type Tizen::Base::String
99          *
100          * @return              An error code
101          * @exception   E_SUCCESS                               The method is successful.
102          * @exception   E_SYSTEM                                A system error has occurred.
103          * @exception   E_INVALID_ARG                   The specified @c deviceType is not valid.
104          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
105          */
106         static result GetState(DeviceType deviceType, Tizen::Base::String& state);
107
108         /**
109          * @if OSPCOMPAT
110          * @page DeviceManagerGetStatePage Compatibility for GetState()
111          * @section DeviceManagerGetStatePageIssueSection Issues
112          * Implementation of this method in OSP compatible applications has the following issue: @n
113          * The GetState() method does not return @c E_DEVICE_UNAVAILABLE anymore. The @c E_DEVICE_UNAVAILABLE exception is removed.
114          * @section DeviceManagerGetStatePageIssueSection Resolutions
115          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use @c E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
116          * @endif
117          */
118
119         /**
120          * Adds the device event listener.
121          *
122          * @if OSPCOMPAT
123          * @brief <i> [Compatibility] </i>
124          * @endif
125          * @since               2.0
126          * @if OSPCOMPAT
127          * @compatibility       This method has compatibility issues with %Tizen API versions @b prior @b to @b 2.0. @n
128          *                      For more information, see @ref DeviceManagerAddDeviceEventListenerPage "here".
129          * @endif
130          *
131          * @return              An error code
132          * @param[in]   deviceType                              The device type
133          * @param[in]   listener                                The device event listener
134          * @exception   E_SUCCESS                               The method is successful.
135          * @exception   E_SYSTEM                                A system error has occurred.
136          * @exception   E_INVALID_ARG                   The specified @c deviceType is not valid.
137          * @exception   E_OBJ_ALREADY_EXIST             The specified @c deviceType and @c listener are already registered.
138          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
139          */
140         static result AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
141
142         /**
143          * @if OSPCOMPAT
144          * @page DeviceManagerAddDeviceEventListenerPage Compatibility for AddDeviceEventListener()
145          * @section DeviceManagerAddDeviceEventListenerPageIssueSection Issues
146          * Implementation of this method in OSP compatible applications has the following issue: @n
147          * This AddDeviceEventListener() method does not return @c E_DEVICE_UNAVAILABLE anymore. The @c E_DEVICE_UNAVAILABLE exception is removed.
148          * @section DeviceManagerAddDeviceEventListenerPageIssueSection Resolutions
149          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use @c E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
150          * @endif
151          */
152
153         /**
154          * Removes the device event listener from all types of devices.
155          *
156          * @since               2.0
157          *
158          * @return              An error code
159          * @param[in]   deviceType                              The types of a device
160          * @param[in]   listener                                The device event listener
161          * @exception   E_SUCCESS                               The method is successful.
162          * @exception   E_SYSTEM                                A system error has occurred.
163          * @exception   E_INVALID_ARG                   The specified @c deviceType is not valid.
164          * @exception   E_OBJ_NOT_FOUND                 The specified @c deviceType and @c listener are not registered.
165          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
166          */
167         static result RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
168
169         /**
170          * @if OSPCOMPAT
171          * @page DeviceManagerRemoveDeviceEventListenerPage Compatibility for RemoveDeviceEventListener()
172          * @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Issues
173          * Implementation of this method in OSP compatible applications has the following issue: @n
174          * This RemoveDeviceEventListener() method does not return @c E_DEVICE_UNAVAILABLE anymore. The @c E_DEVICE_UNAVAILABLE exception is removed.
175          * @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Resolutions
176          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use @c E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
177          * @endif
178          */
179
180         /**      
181          * Removes all the device event listeners.
182          *
183          * @since               2.0
184          *
185          * @return              An error code
186          * @exception   E_SUCCESS       The method is successful.
187          * @exception   E_SYSTEM        A system error has occurred.
188          */
189         static result RemoveAllDeviceEventListeners(void);
190
191 private:
192         /**
193          * This is the default constructor for this class. This default constructor is intentionally declared as private so that only the platform can create an instance.
194          */
195         DeviceManager(void);
196
197         /**
198          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object(). @n
199          */
200         virtual ~DeviceManager(void);
201
202         /**
203          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
204          */
205         DeviceManager(const DeviceManager& value);
206
207         /**
208          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
209          */
210         DeviceManager& operator =(const DeviceManager& value);
211
212 private:
213         friend class _DeviceManagerImpl;
214         class _DeviceManagerImpl* __pDeviceManagerImpl;
215
216 }; // DeviceManager
217
218 } } // Tizen::System
219 #endif // _FSYS_DEVICE_MANAGER_H_