2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSysDeviceManager.h
20 * @brief This is the header file for the %DeviceManager class.
22 * This header file contains the declarations of the %DeviceManager class.
27 #ifndef _FSYS_DEVICE_MANAGER_H_
28 #define _FSYS_DEVICE_MANAGER_H_
30 #include <FBaseObject.h>
32 namespace Tizen { namespace System
35 class IDeviceEventListener;
39 * Defines the type of the supported devices.
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 */
66 * @class DeviceManager
67 * @brief This class provides methods for device management.
71 * @final This class is not intended for extension.
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.
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>.
79 * @see IDeviceEventListener
82 class _OSP_EXPORT_ DeviceManager
83 : public Tizen::Base::Object
88 * Gets the specific device state.
91 * @brief <i> [Compatibility] </i>
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".
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
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.
108 static result GetState(DeviceType deviceType, Tizen::Base::String& state);
112 * @page DeviceManagerGetStatePage Compatibility for GetState()
113 * @section DeviceManagerGetStatePageIssueSection Issues
114 * Implementation of this method in OSP compatible applications 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 Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
122 * Adds a device event listener.
125 * @brief <i> [Compatibility] </i>
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".
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.
142 static result AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
146 * @page DeviceManagerAddDeviceEventListenerPage Compatibility for AddDeviceEventListener()
147 * @section DeviceManagerAddDeviceEventListenerPageIssueSection Issues
148 * Implementation of this method in OSP compatible applications 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 Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE exception.
156 * Removes a device event listener from all types of devices.
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.
169 static result RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
173 * @page DeviceManagerRemoveDeviceEventListenerPage Compatibility for RemoveDeviceEventListener()
174 * @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Issues
175 * Implementation of this method in OSP compatible applications 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 Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE exception.
183 * Removes all device event listeners.
187 * @return An error code
188 * @exception E_SUCCESS The method is successful.
189 * @exception E_SYSTEM A system error has occurred.
191 static result RemoveAllDeviceEventListeners(void);
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.
200 * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object(). @n
202 virtual ~DeviceManager(void);
205 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
207 DeviceManager(const DeviceManager& value);
210 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
212 DeviceManager& operator =(const DeviceManager& value);
215 friend class _DeviceManagerImpl;
216 class _DeviceManagerImpl* __pDeviceManagerImpl;
221 #endif // _FSYS_DEVICE_MANAGER_H_