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