85ce0559ffc657e05d4e8a40a6abb5523eec70df
[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 listener to handle events for various external device,
73  * such as a Bluetooth headset, HDMI, and headphone.
74  * This class also gets the current state of the device. You cannot create an instance of this class directly.
75  *
76  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/device_management.htm">External Device Management</a>.
77  *
78  * @see IDeviceEventListener
79  *
80  */
81 class _OSP_EXPORT_ DeviceManager
82         : public Tizen::Base::Object
83 {
84
85 public:
86         /**
87          * Gets the specific device state.
88          *
89          * @if OSPCOMPAT
90          * @brief <i> [Compatibility] </i>
91          * @endif
92          * @since       2.0
93          * @if OSPCOMPAT
94          * @compatibility       This method has compatibility issues with %Tizen API versions @b prior @b to @b 2.0. @n
95          *                      For more information, see @ref DeviceManagerGetStatePage "here".
96          * @endif
97          *
98          * @param[in]   deviceType      The value from the enumerator DeviceType indicating the device
99          * @param[out]  state           The device <a href="../org.tizen.native.appprogramming/html/guide/system/device_management.htm">state</a> of type Tizen::Base::String
100          *
101          * @return      An error code
102          * @exception   E_SUCCESS               The method is successful.
103          * @exception   E_SYSTEM                A system error has occurred.
104          * @exception   E_INVALID_ARG           The specified @c deviceType is not valid.
105          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
106          */
107         static result GetState(DeviceType deviceType, Tizen::Base::String& state);
108
109         /**
110          * @if OSPCOMPAT
111          * @page DeviceManagerGetStatePage Compatibility for GetState()
112          * @section DeviceManagerGetStatePageIssueSection Issues
113          * Implementation of this method in OSP compatible applications has the following issue: @n
114          * The GetState() method does not return E_DEVICE_UNAVAILABLE anymore. The E_DEVICE_UNAVAILABLE exception is removed.
115          * @section DeviceManagerGetStatePageIssueSection Resolutions
116          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
117          * @endif
118          */
119
120         /**
121          * Adds a device event listener.
122          *
123          * @if OSPCOMPAT
124          * @brief <i> [Compatibility] </i>
125          * @endif
126          * @since       2.0
127          * @if OSPCOMPAT
128          * @compatibility       This method has compatibility issues with %Tizen API versions @b prior @b to @b 2.0. @n
129          *                      For more information, see @ref DeviceManagerAddDeviceEventListenerPage "here".
130          * @endif
131          *
132          * @return      An error code
133          * @param[in]   deviceType              The types of a device
134          * @param[in]   listener                The device event listener
135          * @exception   E_SUCCESS               The method is successful.
136          * @exception   E_SYSTEM                A system error has occurred.
137          * @exception   E_INVALID_ARG           The specified @c deviceType is not valid.
138          * @exception   E_OBJ_ALREADY_EXIST     The specified @c deviceType and @c listener are already registered.
139          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
140          */
141         static result AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
142
143         /**
144          * @if OSPCOMPAT
145          * @page DeviceManagerAddDeviceEventListenerPage Compatibility for AddDeviceEventListener()
146          * @section DeviceManagerAddDeviceEventListenerPageIssueSection Issues
147          * Implementation of this method in OSP compatible applications has the following issue: @n
148          * This AddDeviceEventListener() method does not return E_DEVICE_UNAVAILABLE anymore. The E_DEVICE_UNAVAILABLE exception is removed.
149          * @section DeviceManagerAddDeviceEventListenerPageIssueSection Resolutions
150          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
151          * @endif
152          */
153
154         /**
155          * Removes a device event listener from all types of devices.
156          *
157          * @since       2.0
158          *
159          * @return      An error code
160          * @param[in]   deviceType              The types of a device
161          * @param[in]   listener                The device event listener
162          * @exception   E_SUCCESS               The method is successful.
163          * @exception   E_SYSTEM                A system error has occurred.
164          * @exception   E_INVALID_ARG           The specified @c deviceType is not valid.
165          * @exception   E_OBJ_NOT_FOUND         The specified @c deviceType and @c listener are not registered.
166          * @exception   E_UNSUPPORTED_OPERATION The specified @c deviceType is not supported on this model.
167          */
168         static result RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
169
170         /**
171          * @if OSPCOMPAT
172          * @page DeviceManagerRemoveDeviceEventListenerPage Compatibility for RemoveDeviceEventListener()
173          * @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Issues
174          * Implementation of this method in OSP compatible applications has the following issue: @n
175          * This RemoveDeviceEventListener() method does not return E_DEVICE_UNAVAILABLE anymore. The E_DEVICE_UNAVAILABLE exception is removed.
176          * @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Resolutions
177          * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
178          * @endif
179          */
180
181         /**      
182          * Removes all device event listeners.
183          *
184          * @since       2.0
185          *
186          * @return      An error code
187          * @exception   E_SUCCESS       The method is successful.
188          * @exception   E_SYSTEM        A system error has occurred.
189          */
190         static result RemoveAllDeviceEventListeners(void);
191
192 private:
193         /**
194          * 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.
195          */
196         DeviceManager(void);
197
198         /**
199          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object(). @n
200          */
201         virtual ~DeviceManager(void);
202
203         /**
204          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
205          */
206         DeviceManager(const DeviceManager& value);
207
208         /**
209          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
210          */
211         DeviceManager& operator =(const DeviceManager& value);
212
213 private:
214         friend class _DeviceManagerImpl;
215         class _DeviceManagerImpl* __pDeviceManagerImpl;
216
217 }; // DeviceManager
218
219 } } // Tizen::System
220 #endif // _FSYS_DEVICE_MANAGER_H_