2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSysDeviceManager.h
19 * @brief This is the header file for the %DeviceManager class.
21 * This header file contains the declarations of the %DeviceManager class.
26 #ifndef _FSYS_DEVICE_MANAGER_H_
27 #define _FSYS_DEVICE_MANAGER_H_
29 #include <FBaseObject.h>
31 namespace Tizen { namespace System
34 class IDeviceEventListener;
38 * Defines the type of the supported devices.
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 */
65 * @class DeviceManager
66 * @brief This class provides methods for device management.
70 * @final This class is not intended for extension.
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.
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>.
77 * @see IDeviceEventListener
80 class _OSP_EXPORT_ DeviceManager
81 : public Tizen::Base::Object
86 * Gets the specific device state.
89 * @brief <i> [Compatibility] </i>
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".
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
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.
106 static result GetState(DeviceType deviceType, Tizen::Base::String& state);
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.
120 * Adds the device event listener.
123 * @brief <i> [Compatibility] </i>
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".
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.
140 static result AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
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.
154 * Removes the device event listener from all types of devices.
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.
167 static result RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener& listener);
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.
181 * Removes all the device event listeners.
185 * @return An error code
186 * @exception E_SUCCESS The method is successful.
187 * @exception E_SYSTEM A system error has occurred.
189 static result RemoveAllDeviceEventListeners(void);
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.
198 * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object(). @n
200 virtual ~DeviceManager(void);
203 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
205 DeviceManager(const DeviceManager& value);
208 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
210 DeviceManager& operator =(const DeviceManager& value);
213 friend class _DeviceManagerImpl;
214 class _DeviceManagerImpl* __pDeviceManagerImpl;
219 #endif // _FSYS_DEVICE_MANAGER_H_