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 FSys_DeviceManagerImpl.cpp
20 * @brief This is the implementation file for _DeviceManagerImpl class.
24 #include <unique_ptr.h>
25 #include <system_info.h>
26 #include <runtime_info.h>
30 #include <FBaseColArrayList.h>
31 #include <FBaseRtEvent.h>
32 #include <FBaseRtIEventArg.h>
33 #include <FBaseStringComparer.h>
34 #include <FBaseSysLog.h>
35 #include <FSysIDeviceEventListener.h>
37 #include <FApp_AppInfo.h>
38 #include <FBase_NativeError.h>
39 #include <FIo_AppServiceIpcMessages.h>
40 #include <FIo_IpcClient.h>
41 #include <FSys_SystemInfoImpl.h>
42 #include <FSys_PowerManagerImpl.h>
44 #include "FSys_CommunicationDispatcherClient.h"
45 #include "FSys_DeviceManagerImpl.h"
47 #define VCONFKEY_APPSERVICE_MMC_STATUS "memory/appservice/mmc"
49 using namespace Tizen::App;
50 using namespace Tizen::Base;
51 using namespace Tizen::Base::Collection;
52 using namespace Tizen::Base::Runtime;
53 using namespace Tizen::Io;
55 namespace Tizen { namespace System
58 static const wchar_t* _DEVICE_MANAGER_SERVICE_ID = L"osp.devicemanager.service";
59 static const wchar_t* _DEVICE_MANAGER_COMMAND_OPEN = L"osp.devicemanager.command.open";
60 static const wchar_t* _DEVICE_MANAGER_COMMAND_CLOSE = L"osp.devicemanager.command.close";
61 static const wchar_t* _DEVICE_MANAGER_COMMAND_STATUS = L"osp.devicemanager.command.status";
62 static const wchar_t* _DEVICE_MANAGER_COMMAND_EVENT = L"osp.devicemanager.command.event";
63 static const wchar_t* _DEVICE_MANAGER_BLUETOOTH = L"osp.devicemanager.bluetooth";
65 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_SERVICE_ID = 0;
66 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_COMMAND_ID = 1;
67 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_DEVICE_ID = 2;
68 const int _OSP_APP_SERVICE_IPC_MESSAGE_DATA = 3;
70 const int _DEVICE_MANAGER_BLUETOOTH_HEADSET = 0x01;
71 const int _DEVICE_MANAGER_CHARGER = 0x02;
72 const int _DEVICE_MANAGER_USB_CLIENT = 0x04;
73 const int _DEVICE_MANAGER_TV_OUT = 0x08;
74 const int _DEVICE_MANAGER_WIRED_HEADSET = 0x10;
75 const int _DEVICE_MANAGER_WIRED_HEADPHONE = 0x20;
76 const int _DEVICE_MANAGER_STORAGECARD = 0x40;
77 const int _DEVICE_MANAGER_KEYBOARD = 0x80;
79 static const wchar_t* _DEVICE_MANAGER_STATE_INSERTED = L"Inserted";
80 static const wchar_t* _DEVICE_MANAGER_STATE_REMOVED = L"Removed";
81 static const wchar_t* _DEVICE_MANAGER_STATE_MOUNTED = L"Mounted";
82 static const wchar_t* _DEVICE_MANAGER_STATE_UNMOUNTED = L"Unmounted";
83 static const wchar_t* _DEVICE_MANAGER_STATE_OPENED = L"Opened";
84 static const wchar_t* _DEVICE_MANAGER_STATE_CLOSED = L"Closed";
86 static const wchar_t* _SYSTEM_INFO_NETWORK_BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
87 static const wchar_t* _SYSTEM_INFO_INPUT_KEYBOARD = L"http://tizen.org/feature/input.keyboard";
88 static const wchar_t* _SYSTEM_INFO_TVOUT_SUPPORTED = L"http://tizen.org/feature/screen.output.rca";
89 static const wchar_t* _SYSTEM_INFO_HDMI = L"http://tizen.org/feature/screen.output.hdmi";
91 _DeviceManagerImpl* _DeviceManagerImpl::__pDeviceManagerImpl = null;
93 class _DeviceManagerEventArg : public IEventArg
96 _DeviceManagerEventArg()
99 DeviceType deviceType;
103 class _DeviceManagerEvent : public Event
106 virtual void FireImpl(IEventListener& listener, const IEventArg& arg)
108 IDeviceEventListener* pListener = dynamic_cast<IDeviceEventListener*> (&listener);
109 const _DeviceManagerEventArg* pArg = dynamic_cast<const _DeviceManagerEventArg*>(&arg);
111 SysTryReturnVoidResult(NID_SYS, pListener != null && pArg != null, E_SYSTEM, "Parameters are not available.");
113 pListener->OnDeviceStateChanged(pArg->deviceType, pArg->state);
119 _DeviceManagerImpl::OnDeviceStateChanged(runtime_info_key_e key, void* pData)
121 if (__pDeviceManagerImpl != null)
123 __pDeviceManagerImpl->SendEvent(key);
128 _DeviceManagerImpl::InitDeviceManagerImpl(void)
130 static _DeviceManagerImpl deviceManagerImpl;
131 __pDeviceManagerImpl = &deviceManagerImpl;
134 _DeviceManagerImpl::GetInstance(void)
136 static pthread_once_t once_block = PTHREAD_ONCE_INIT;
137 if(__pDeviceManagerImpl == null)
139 pthread_once(&once_block, InitDeviceManagerImpl);
141 return __pDeviceManagerImpl;
144 _DeviceManagerImpl::_DeviceManagerImpl()
146 , __headSetType(DEVICE_TYPE_WIRED_HEADPHONE)
147 , __bluetoothReferenceCount(0)
149 result r = E_SUCCESS;
150 int headsetState = 0;
152 static String DEVICE_MANAGER_SERVICE_ID(_DEVICE_MANAGER_SERVICE_ID);
154 _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
155 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
157 r = pCommunicationDispatcherClient->RegisterCommunicationListener(DEVICE_MANAGER_SERVICE_ID, *this);
158 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
160 __pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
162 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED, OnDeviceStateChanged, null);
163 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register USB event");
165 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_CHARGER_CONNECTED, OnDeviceStateChanged, null);
166 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register DEVICE_TYPE_CHARGER event");
168 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, OnDeviceStateChanged, null);
169 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register TV out event");
171 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, OnDeviceStateChanged, null);
172 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register audio jack event");
174 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, OnDeviceStateChanged, null);
175 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register sliding keyboard event");
177 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &headsetState);
178 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to get audio jack status");
180 if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
182 __headSetType = DEVICE_TYPE_WIRED_HEADPHONE;
184 else if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE)
186 __headSetType = DEVICE_TYPE_WIRED_HEADSET;
189 if (!_AppInfo::IsOspCompat())
191 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack, null);
195 ret = vconf_notify_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback, null);
197 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register MMC event callback.");
199 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack, null);
200 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register HDMI event");
202 __deviceEventList.Construct();
208 _DeviceManagerImpl::~_DeviceManagerImpl()
210 result r = E_SUCCESS;
212 _CommunicationDispatcherClient* pCommunicationDispatcherClient = null;
213 String key(_DEVICE_MANAGER_SERVICE_ID);
215 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED);
216 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister USB event");
218 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED);
219 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister TV out event");
221 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS);
222 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister audio jack event");
224 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED);
225 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister sliding keyboard event");
227 if (!_AppInfo::IsOspCompat())
229 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack);
233 ret = vconf_ignore_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback);
235 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister MMC event");
237 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack);
238 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister HDMI event");
241 pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
242 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
244 r = pCommunicationDispatcherClient->UnregisterCommunicationListener(key);
245 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
254 _DeviceManagerImpl::DeviceEventVConfCallBack(keynode_t* node, void* userData)
260 if (strcmp(VCONFKEY_SYSMAN_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
262 SysLog(NID_SYS, "MMC callback is occured");
263 if (__pDeviceManagerImpl != null)
265 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &value);
268 event = _DEVICE_MANAGER_STATE_MOUNTED;
272 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
274 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
277 else if(strcmp(VCONFKEY_SYSMAN_HDMI, vconf_keynode_get_name(node)) == 0)
279 if (__pDeviceManagerImpl != null)
281 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
284 event = _DEVICE_MANAGER_STATE_INSERTED;
288 event = _DEVICE_MANAGER_STATE_REMOVED;
290 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_HDMI, event);
297 _DeviceManagerImpl::MmcEventVconfCallback(keynode_t* node, void* userData)
299 if (strcmp(VCONFKEY_APPSERVICE_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
301 SysLog(NID_SYS, "MMC event callback is called.");
302 if (__pDeviceManagerImpl != NULL)
306 int ret = vconf_get_int(VCONFKEY_APPSERVICE_MMC_STATUS, &value);
307 SysTryReturnVoidResult(NID_SYS, ret == 0, E_SYSTEM, "VCONFKEY_APPSERVICE_MMC_STATUS is error");
311 event = _DEVICE_MANAGER_STATE_MOUNTED;
315 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
317 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
323 _DeviceManagerImpl::SendEvent(DeviceType deviceType, String& state)
325 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
327 if(__deviceEventList.GetCount() > 0)
329 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
330 SysTryReturnVoidResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
332 while(pEnumerator->MoveNext() == E_SUCCESS)
334 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
335 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
336 SysTryReturnVoidResult(NID_SYS, pDeviceEventListenerContainer != null,E_SYSTEM, "Container is empty");
340 case DEVICE_TYPE_BLUETOOTH_HEADSET:
342 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
348 case DEVICE_TYPE_CHARGER:
350 if(pDeviceEventListenerContainer->__charger == false)
356 case DEVICE_TYPE_USB_CLIENT:
358 if(pDeviceEventListenerContainer->__usbClient == false)
364 case DEVICE_TYPE_TV_OUT:
366 if(pDeviceEventListenerContainer->__tvOut == false)
372 case DEVICE_TYPE_WIRED_HEADSET:
374 if(pDeviceEventListenerContainer->__wiredHeadset == false)
380 case DEVICE_TYPE_WIRED_HEADPHONE:
382 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
388 case DEVICE_TYPE_STORAGE_CARD:
390 if(pDeviceEventListenerContainer->__storageCard == false)
396 case DEVICE_TYPE_KEYBOARD:
398 if(pDeviceEventListenerContainer->__keyboard == false)
404 case DEVICE_TYPE_HDMI:
406 if(pDeviceEventListenerContainer->__hdmi == false)
415 std::unique_ptr<_DeviceManagerEventArg> pDeviceManagerEventArg(new (std::nothrow) _DeviceManagerEventArg());
416 SysTryReturnVoidResult(NID_SYS, pDeviceManagerEventArg != null, E_OUT_OF_MEMORY, "It is failed to create instance of DeviceManagerEventArg");
418 pDeviceManagerEventArg->deviceType = deviceType;
419 pDeviceManagerEventArg->state = state;
421 if(pDeviceEventListenerContainer->__pEvent != null)
423 pDeviceEventListenerContainer->__pEvent->Fire(*(pDeviceManagerEventArg.release()));
430 _DeviceManagerImpl::RequireBluetoothEvent(void)
432 result r = E_SUCCESS;
433 std::unique_ptr<IoService_Request> pRequest(null);
435 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "Ipc Client is not ready");
437 __bluetoothReferenceCount ++;
439 if(__bluetoothReferenceCount == 1)
441 ArrayList requestMessages;
442 ArrayList responseMessages;
444 r = requestMessages.Construct();
445 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create request instance");
446 r = responseMessages.Construct();
447 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create response instance");
449 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
450 String commandId = _DEVICE_MANAGER_COMMAND_OPEN;
451 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
453 r = requestMessages.Add(serviceId);
454 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add service id");
455 r = requestMessages.Add(commandId);
456 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id");
457 r = requestMessages.Add(deviceId);
459 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add device id (bluetooth)");
461 pRequest.reset(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
462 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send bluetooth event subscribe by IPC");
464 r = __pIpcClient->SendRequest(pRequest.get());
465 SysTryReturnResult(NID_SYS, r == E_SUCCESS,E_SYSTEM, "It is failed to add bluetooth id");
471 _DeviceManagerImpl::ReleaseBluetoothEvent(void)
473 result r = E_SUCCESS;
474 std::unique_ptr<IoService_Request> pRequest(null);
475 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "Ipc Client is not ready");
477 __bluetoothReferenceCount --;
478 SysTryReturnResult(NID_SYS, __bluetoothReferenceCount >= 0, E_SYSTEM, "Fail to manage reference count");
480 if(__bluetoothReferenceCount == 0)
482 ArrayList requestMessages;
483 ArrayList responseMessages;
485 r = requestMessages.Construct();
486 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create request instance");
487 r = responseMessages.Construct();
488 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create response instance");
490 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
491 String commandId = _DEVICE_MANAGER_COMMAND_CLOSE;
492 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
494 r = requestMessages.Add(serviceId);
495 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add service id");
496 r = requestMessages.Add(commandId);
497 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id");
498 r = requestMessages.Add(deviceId);
499 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
501 pRequest.reset(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
502 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send bluetooth event subscribe by IPC");
504 r = __pIpcClient->SendRequest(pRequest.get());
505 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
511 _DeviceManagerImpl::AddOnExistedListener(DeviceType deviceType, const IDeviceEventListener* pListener)
513 result r = E_OBJ_NOT_FOUND;
514 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
516 if(__deviceEventList.GetCount() > 0)
518 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
519 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
521 while(pEnumerator->MoveNext() == E_SUCCESS)
523 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
524 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
525 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
526 if(pDeviceEventListenerContainer->__pListener == pListener)
530 case DEVICE_TYPE_BLUETOOTH_HEADSET:
532 if(pDeviceEventListenerContainer->__bluetoothHeadset == true)
534 r = E_OBJ_ALREADY_EXIST;
538 pDeviceEventListenerContainer->__bluetoothHeadset = true;
539 RequireBluetoothEvent();
544 case DEVICE_TYPE_CHARGER:
546 if(pDeviceEventListenerContainer->__charger == true)
548 r = E_OBJ_ALREADY_EXIST;
552 pDeviceEventListenerContainer->__charger = true;
557 case DEVICE_TYPE_USB_CLIENT:
559 if(pDeviceEventListenerContainer->__usbClient == true)
561 r = E_OBJ_ALREADY_EXIST;
565 pDeviceEventListenerContainer->__usbClient = true;
570 case DEVICE_TYPE_TV_OUT:
573 _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
577 if(!_AppInfo::IsOspCompat())
579 r = E_UNSUPPORTED_OPERATION;
583 r = E_DEVICE_UNAVAILABLE;
588 if(pDeviceEventListenerContainer->__tvOut == true)
590 r = E_OBJ_ALREADY_EXIST;
594 pDeviceEventListenerContainer->__tvOut = true;
599 case DEVICE_TYPE_WIRED_HEADSET:
601 if(pDeviceEventListenerContainer->__wiredHeadset == true)
603 r = E_OBJ_ALREADY_EXIST;
607 pDeviceEventListenerContainer->__wiredHeadset = true;
612 case DEVICE_TYPE_WIRED_HEADPHONE:
614 if(pDeviceEventListenerContainer->__wiredHeadphone == true)
616 r = E_OBJ_ALREADY_EXIST;
620 pDeviceEventListenerContainer->__wiredHeadphone = true;
625 case DEVICE_TYPE_STORAGE_CARD:
627 if(pDeviceEventListenerContainer->__storageCard == true)
629 r = E_OBJ_ALREADY_EXIST;
633 pDeviceEventListenerContainer->__storageCard = true;
638 case DEVICE_TYPE_KEYBOARD:
640 bool keyboard = false;
641 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
643 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
645 if (keyboard == false)
647 if(!_AppInfo::IsOspCompat())
649 return E_UNSUPPORTED_OPERATION;
653 return E_DEVICE_UNAVAILABLE;
657 if(pDeviceEventListenerContainer->__keyboard == true)
659 r = E_OBJ_ALREADY_EXIST;
663 pDeviceEventListenerContainer->__keyboard = true;
668 case DEVICE_TYPE_HDMI:
672 bool supported = false;
673 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_HDMI, supported);
674 SysTryReturnResult(NID_SYS, supported == true, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
676 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
677 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
678 SysTryReturnResult(NID_SYS, value >= 0, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
680 if(pDeviceEventListenerContainer->__hdmi == true)
682 r = E_OBJ_ALREADY_EXIST;
686 pDeviceEventListenerContainer->__hdmi = true;
699 _DeviceManagerImpl::AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
701 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
702 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
703 result r = E_SUCCESS;
705 if(deviceType == DEVICE_TYPE_TV_OUT)
708 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
709 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
713 if(!_AppInfo::IsOspCompat())
715 r = E_UNSUPPORTED_OPERATION;
719 r = E_DEVICE_UNAVAILABLE;
724 else if(deviceType == DEVICE_TYPE_KEYBOARD)
726 bool keyboard = false;
727 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
729 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
731 if (keyboard == false)
733 if(!_AppInfo::IsOspCompat())
735 r = E_UNSUPPORTED_OPERATION;
739 r = E_DEVICE_UNAVAILABLE;
744 else if(deviceType == DEVICE_TYPE_HDMI)
748 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
749 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
752 return E_UNSUPPORTED_OPERATION;
756 r = AddOnExistedListener(deviceType, pListener);
758 if(r == E_OBJ_NOT_FOUND)
760 std::unique_ptr<_DeviceEventListenerContainer> pDeviceEventContainer(new (std::nothrow) _DeviceEventListenerContainer());
761 SysTryReturnResult(NID_SYS, pDeviceEventContainer != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceEventListenerContainer");
763 std::unique_ptr<_DeviceManagerEvent> pDeviceManagerEvent(new (std::nothrow) _DeviceManagerEvent());
764 SysTryReturnResult(NID_SYS, pDeviceManagerEvent != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceManagerEvent");
766 pDeviceManagerEvent->AddListener(*pListener);
767 pDeviceEventContainer->__pListener = pListener;
768 pDeviceEventContainer->__pEvent = pDeviceManagerEvent.release();
772 case DEVICE_TYPE_BLUETOOTH_HEADSET:
774 pDeviceEventContainer->__bluetoothHeadset = true;
775 RequireBluetoothEvent();
778 case DEVICE_TYPE_CHARGER:
780 pDeviceEventContainer->__charger = true;
783 case DEVICE_TYPE_USB_CLIENT:
785 pDeviceEventContainer->__usbClient = true;
788 case DEVICE_TYPE_TV_OUT:
791 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
792 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
796 if(!_AppInfo::IsOspCompat())
798 return E_UNSUPPORTED_OPERATION;
802 return E_DEVICE_UNAVAILABLE;
806 pDeviceEventContainer->__tvOut = true;
809 case DEVICE_TYPE_WIRED_HEADSET:
811 pDeviceEventContainer->__wiredHeadset = true;
814 case DEVICE_TYPE_WIRED_HEADPHONE:
816 pDeviceEventContainer->__wiredHeadphone = true;
819 case DEVICE_TYPE_STORAGE_CARD:
821 pDeviceEventContainer->__storageCard = true;
824 case DEVICE_TYPE_KEYBOARD:
826 bool keyboard = false;
827 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
829 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
831 if (keyboard == false)
833 if(!_AppInfo::IsOspCompat())
835 return E_UNSUPPORTED_OPERATION;
839 return E_DEVICE_UNAVAILABLE;
843 pDeviceEventContainer->__keyboard = true;
846 case DEVICE_TYPE_HDMI:
850 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
851 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
854 return E_UNSUPPORTED_OPERATION;
856 pDeviceEventContainer->__hdmi = true;
861 __deviceEventList.Add(pDeviceEventContainer.release());
868 _DeviceManagerImpl::RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
870 result r = E_SUCCESS;
872 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
873 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
874 SysTryReturnResult(NID_SYS, __deviceEventList.GetCount() > 0, E_INVALID_ARG, "There is no registered listener.");
876 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(__deviceEventList.GetEnumeratorN());
878 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
880 if(deviceType == DEVICE_TYPE_TV_OUT)
883 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
884 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
888 if(!_AppInfo::IsOspCompat())
890 r = E_UNSUPPORTED_OPERATION;
894 r = E_DEVICE_UNAVAILABLE;
899 else if(deviceType == DEVICE_TYPE_KEYBOARD)
901 bool keyboard = false;
902 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
904 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
906 if (keyboard == false)
908 if(!_AppInfo::IsOspCompat())
910 r = E_UNSUPPORTED_OPERATION;
914 r = E_DEVICE_UNAVAILABLE;
918 else if(deviceType == DEVICE_TYPE_HDMI)
922 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
923 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
926 return E_UNSUPPORTED_OPERATION;
930 while(pEnumerator->MoveNext() == E_SUCCESS)
932 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
933 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
934 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
936 if(pDeviceEventListenerContainer->__pListener == pListener)
940 case DEVICE_TYPE_BLUETOOTH_HEADSET:
942 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
944 return E_OBJ_NOT_FOUND;
946 pDeviceEventListenerContainer->__bluetoothHeadset = false;
947 ReleaseBluetoothEvent();
950 case DEVICE_TYPE_CHARGER:
952 if(pDeviceEventListenerContainer->__charger == false)
954 return E_OBJ_NOT_FOUND;
956 pDeviceEventListenerContainer->__charger = false;
959 case DEVICE_TYPE_USB_CLIENT:
961 if(pDeviceEventListenerContainer->__usbClient == false)
963 return E_OBJ_NOT_FOUND;
965 pDeviceEventListenerContainer->__usbClient = false;
968 case DEVICE_TYPE_TV_OUT:
970 if(pDeviceEventListenerContainer->__tvOut == false)
972 return E_OBJ_NOT_FOUND;
974 pDeviceEventListenerContainer->__tvOut = false;
977 case DEVICE_TYPE_WIRED_HEADSET:
979 if(pDeviceEventListenerContainer->__wiredHeadset == false)
981 return E_OBJ_NOT_FOUND;
983 pDeviceEventListenerContainer->__wiredHeadset = false;
986 case DEVICE_TYPE_WIRED_HEADPHONE:
988 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
990 return E_OBJ_NOT_FOUND;
992 pDeviceEventListenerContainer->__wiredHeadphone = false;
995 case DEVICE_TYPE_STORAGE_CARD:
997 if(pDeviceEventListenerContainer->__storageCard == false)
999 return E_OBJ_NOT_FOUND;
1001 pDeviceEventListenerContainer->__storageCard = false;
1004 case DEVICE_TYPE_KEYBOARD:
1006 if(pDeviceEventListenerContainer->__keyboard == false)
1008 return E_OBJ_NOT_FOUND;
1010 pDeviceEventListenerContainer->__keyboard = false;
1013 case DEVICE_TYPE_HDMI:
1015 if(pDeviceEventListenerContainer->__hdmi == false)
1017 return E_OBJ_NOT_FOUND;
1019 pDeviceEventListenerContainer->__hdmi = false;
1024 if(pDeviceEventListenerContainer->IsInvalid() == true)
1026 __deviceEventList.Remove(pDeviceEventListenerContainer);
1027 delete pDeviceEventListenerContainer;
1032 return E_OBJ_NOT_FOUND;
1036 _DeviceManagerImpl::RemoveAllDeviceEventListeners(void)
1038 result r = E_SUCCESS;
1040 IEnumeratorT<_DeviceEventListenerContainer*>* pEnumerator = __deviceEventList.GetEnumeratorN();
1041 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
1043 while(pEnumerator->MoveNext() == E_SUCCESS)
1045 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
1046 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
1047 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
1048 __deviceEventList.Remove(pDeviceEventListenerContainer);
1049 delete pDeviceEventListenerContainer;
1053 __bluetoothReferenceCount = 1;
1055 ReleaseBluetoothEvent();
1060 _DeviceManagerImpl::SendEvent(runtime_info_key_e key)
1062 DeviceType type = DEVICE_TYPE_USB_CLIENT;
1069 case RUNTIME_INFO_KEY_USB_CONNECTED:
1071 flag = _DEVICE_MANAGER_USB_CLIENT;
1072 type = DEVICE_TYPE_USB_CLIENT;
1075 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &state);
1076 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get usb state.");
1080 value = _DEVICE_MANAGER_STATE_INSERTED;
1084 value = _DEVICE_MANAGER_STATE_REMOVED;
1088 case RUNTIME_INFO_KEY_CHARGER_CONNECTED:
1090 flag = _DEVICE_MANAGER_CHARGER;
1091 type = DEVICE_TYPE_CHARGER;
1094 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get charger state.");
1098 value = _DEVICE_MANAGER_STATE_INSERTED;
1102 value = _DEVICE_MANAGER_STATE_REMOVED;
1106 case RUNTIME_INFO_KEY_TV_OUT_CONNECTED:
1108 flag = _DEVICE_MANAGER_TV_OUT;
1109 type = DEVICE_TYPE_TV_OUT;
1112 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, &state);
1113 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get tv connect state.");
1117 value = _DEVICE_MANAGER_STATE_INSERTED;
1121 value = _DEVICE_MANAGER_STATE_REMOVED;
1125 case RUNTIME_INFO_KEY_AUDIO_JACK_STATUS:
1128 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &state);
1129 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio connect state.");
1131 if (state == RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED)
1133 if (__headSetType == DEVICE_TYPE_WIRED_HEADPHONE)
1135 flag = _DEVICE_MANAGER_WIRED_HEADPHONE;
1136 type = DEVICE_TYPE_WIRED_HEADPHONE;
1140 flag = _DEVICE_MANAGER_WIRED_HEADSET;
1141 type = DEVICE_TYPE_WIRED_HEADSET;
1144 value = _DEVICE_MANAGER_STATE_REMOVED;
1148 if (state == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
1150 __headSetType = DEVICE_TYPE_WIRED_HEADPHONE;
1151 flag = _DEVICE_MANAGER_WIRED_HEADPHONE;
1152 type = DEVICE_TYPE_WIRED_HEADPHONE;
1156 __headSetType = DEVICE_TYPE_WIRED_HEADSET;
1157 flag = _DEVICE_MANAGER_WIRED_HEADSET;
1158 type = DEVICE_TYPE_WIRED_HEADSET;
1160 value = _DEVICE_MANAGER_STATE_INSERTED;
1165 case RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED:
1167 flag = _DEVICE_MANAGER_KEYBOARD;
1168 type = DEVICE_TYPE_KEYBOARD;
1171 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, &state);
1172 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get built-in keyboard state.");
1176 value = _DEVICE_MANAGER_STATE_OPENED;
1180 value = _DEVICE_MANAGER_STATE_CLOSED;
1188 __pDeviceManagerImpl->SendEvent(type, value);
1193 _DeviceManagerImpl::GetState(DeviceType deviceType, String& state)
1195 result r = E_SUCCESS;
1199 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "GetDeviceState Failed");
1204 case DEVICE_TYPE_BLUETOOTH_HEADSET:
1206 bool bluetooth = false;
1207 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_NETWORK_BLUETOOTH, bluetooth);
1208 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option.");
1209 if (bluetooth == false)
1211 if(!_AppInfo::IsOspCompat())
1213 return E_UNSUPPORTED_OPERATION;
1217 return E_DEVICE_UNAVAILABLE;
1221 ArrayList requestMessages;
1222 ArrayList responseMessages;
1224 requestMessages.Construct();
1225 responseMessages.Construct();
1227 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
1228 String commandId = _DEVICE_MANAGER_COMMAND_STATUS;
1229 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
1231 requestMessages.Add(serviceId);
1232 requestMessages.Add(commandId);
1233 requestMessages.Add(deviceId);
1235 IoService_Request* pMsg = new (std::nothrow) IoService_Request(requestMessages, &responseMessages);
1237 r = __pIpcClient->SendRequest(*pMsg);
1239 String* pMessageData = (String*)responseMessages.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_DATA);
1240 if (pMessageData != null)
1242 state = *pMessageData;
1248 case DEVICE_TYPE_CHARGER:
1250 bool chargerState = false;
1251 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &chargerState);
1252 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get charger state");
1254 if (chargerState == true)
1256 state = _DEVICE_MANAGER_STATE_INSERTED;
1260 state = _DEVICE_MANAGER_STATE_REMOVED;
1265 case DEVICE_TYPE_USB_CLIENT:
1267 bool cableState = false;
1268 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &cableState);
1269 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get usb state");
1271 if (cableState == true)
1273 state = _DEVICE_MANAGER_STATE_INSERTED;
1277 state = _DEVICE_MANAGER_STATE_REMOVED;
1282 case DEVICE_TYPE_TV_OUT:
1285 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
1286 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
1290 if(!_AppInfo::IsOspCompat())
1292 return E_UNSUPPORTED_OPERATION;
1296 return E_DEVICE_UNAVAILABLE;
1300 bool tvState = false;
1301 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, &tvState);
1302 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get tv state");
1303 if (tvState == true)
1305 state = _DEVICE_MANAGER_STATE_INSERTED;
1309 state = _DEVICE_MANAGER_STATE_REMOVED;
1314 case DEVICE_TYPE_WIRED_HEADSET:
1317 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &audioState);
1318 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio state");
1320 if (audioState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE)
1322 state = _DEVICE_MANAGER_STATE_INSERTED;
1326 state = _DEVICE_MANAGER_STATE_REMOVED;
1331 case DEVICE_TYPE_WIRED_HEADPHONE:
1334 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &audioState);
1335 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio state");
1337 if (audioState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
1339 state = _DEVICE_MANAGER_STATE_INSERTED;
1343 state = _DEVICE_MANAGER_STATE_REMOVED;
1348 case DEVICE_TYPE_STORAGE_CARD:
1351 if (!_AppInfo::IsOspCompat())
1353 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &value);
1357 ret = vconf_get_int(VCONFKEY_APPSERVICE_MMC_STATUS, &value);
1359 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
1362 state = _DEVICE_MANAGER_STATE_MOUNTED;
1366 state = _DEVICE_MANAGER_STATE_UNMOUNTED;
1371 case DEVICE_TYPE_KEYBOARD:
1373 bool keyboard = false;
1374 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
1375 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get keyboard option.");
1376 if (keyboard == false)
1378 if(!_AppInfo::IsOspCompat())
1380 return E_UNSUPPORTED_OPERATION;
1384 return E_DEVICE_UNAVAILABLE;
1389 case DEVICE_TYPE_HDMI:
1392 bool supported = false;
1393 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_HDMI, supported);
1394 SysTryReturnResult(NID_SYS, supported == false, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
1396 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
1397 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
1400 state = _DEVICE_MANAGER_STATE_INSERTED;
1404 state = _DEVICE_MANAGER_STATE_REMOVED;
1408 return E_UNSUPPORTED_OPERATION;
1415 return E_INVALID_ARG;
1421 _DeviceManagerImpl::OnDataReceived(const ArrayList& data)
1423 StringComparer stringComparer;
1426 String* pServiceId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_SERVICE_ID);
1427 String* pCommandId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_COMMAND_ID);
1428 String* pDeviceId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_DEVICE_ID);
1429 String* pEventId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_DATA);
1431 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
1432 String commandId = _DEVICE_MANAGER_COMMAND_EVENT;
1433 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
1435 SysTryReturnVoidResult(NID_SYS, pServiceId != null && pCommandId != null && pDeviceId != null && pEventId != null, E_SYSTEM, "There is no device data.");
1437 stringComparer.Compare(*pServiceId, serviceId, cmp);
1440 stringComparer.Compare(*pCommandId, commandId, cmp);
1443 stringComparer.Compare(*pDeviceId, deviceId, cmp);
1446 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_BLUETOOTH_HEADSET, *pEventId);
1452 } } // Tizen::System