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 FSys_DeviceManagerImpl.cpp
19 * @brief This is the implementation file for _DeviceManagerImpl class.
23 #include <unique_ptr.h>
24 #include <system_info.h>
25 #include <runtime_info.h>
29 #include <FBaseColArrayList.h>
30 #include <FBaseRtEvent.h>
31 #include <FBaseRtIEventArg.h>
32 #include <FBaseStringComparer.h>
33 #include <FBaseSysLog.h>
34 #include <FSysIDeviceEventListener.h>
36 #include <FApp_AppInfo.h>
37 #include <FBase_NativeError.h>
38 #include <FIo_AppServiceIpcMessages.h>
39 #include <FIo_IpcClient.h>
40 #include <FSys_SystemInfoImpl.h>
41 #include <FSys_PowerManagerImpl.h>
43 #include "FSys_CommunicationDispatcherClient.h"
44 #include "FSys_DeviceManagerImpl.h"
46 #define VCONFKEY_APPSERVICE_MMC_STATUS "memory/appservice/mmc"
50 using namespace Tizen::App;
51 using namespace Tizen::Base;
52 using namespace Tizen::Base::Collection;
53 using namespace Tizen::Base::Runtime;
54 using namespace Tizen::Io;
56 namespace Tizen { namespace System
59 static const wchar_t* _DEVICE_MANAGER_SERVICE_ID = L"osp.devicemanager.service";
60 static const wchar_t* _DEVICE_MANAGER_COMMAND_OPEN = L"osp.devicemanager.command.open";
61 static const wchar_t* _DEVICE_MANAGER_COMMAND_CLOSE = L"osp.devicemanager.command.close";
62 static const wchar_t* _DEVICE_MANAGER_COMMAND_STATUS = L"osp.devicemanager.command.status";
63 static const wchar_t* _DEVICE_MANAGER_COMMAND_EVENT = L"osp.devicemanager.command.event";
64 static const wchar_t* _DEVICE_MANAGER_BLUETOOTH = L"osp.devicemanager.bluetooth";
66 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_SERVICE_ID = 0;
67 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_COMMAND_ID = 1;
68 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_DEVICE_ID = 2;
69 const int _OSP_APP_SERVICE_IPC_MESSAGE_DATA = 3;
71 const int _DEVICE_MANAGER_BLUETOOTH_HEADSET = 0x01;
72 const int _DEVICE_MANAGER_CHARGER = 0x02;
73 const int _DEVICE_MANAGER_USB_CLIENT = 0x04;
74 const int _DEVICE_MANAGER_TV_OUT = 0x08;
75 const int _DEVICE_MANAGER_WIRED_HEADSET = 0x10;
76 const int _DEVICE_MANAGER_WIRED_HEADPHONE = 0x20;
77 const int _DEVICE_MANAGER_STORAGECARD = 0x40;
78 const int _DEVICE_MANAGER_KEYBOARD = 0x80;
80 static const wchar_t* _DEVICE_MANAGER_STATE_INSERTED = L"Inserted";
81 static const wchar_t* _DEVICE_MANAGER_STATE_REMOVED = L"Removed";
82 static const wchar_t* _DEVICE_MANAGER_STATE_MOUNTED = L"Mounted";
83 static const wchar_t* _DEVICE_MANAGER_STATE_UNMOUNTED = L"Unmounted";
84 static const wchar_t* _DEVICE_MANAGER_STATE_OPENED = L"Opened";
85 static const wchar_t* _DEVICE_MANAGER_STATE_CLOSED = L"Closed";
87 static const wchar_t* _SYSTEM_INFO_NETWORK_BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
88 static const wchar_t* _SYSTEM_INFO_INPUT_KEYBOARD = L"http://tizen.org/feature/input.keyboard";
89 static const wchar_t* _SYSTEM_INFO_TVOUT_SUPPORTED = L"http://tizen.org/feature/screen.output.rca";
90 static const wchar_t* _SYSTEM_INFO_HDMI = L"http://tizen.org/feature/screen.output.hdmi";
92 _DeviceManagerImpl* _DeviceManagerImpl::__pDeviceManagerImpl = null;
94 class _DeviceManagerEventArg : public IEventArg
97 _DeviceManagerEventArg()
100 DeviceType deviceType;
104 class _DeviceManagerEvent : public Event
107 virtual void FireImpl(IEventListener& listener, const IEventArg& arg)
109 IDeviceEventListener* pListener = dynamic_cast<IDeviceEventListener*> (&listener);
110 const _DeviceManagerEventArg* pArg = dynamic_cast<const _DeviceManagerEventArg*>(&arg);
112 SysTryReturnVoidResult(NID_SYS, pListener != null && pArg != null, E_SYSTEM, "Parameters are not available.");
114 pListener->OnDeviceStateChanged(pArg->deviceType, pArg->state);
120 _DeviceManagerImpl::OnDeviceStateChanged(runtime_info_key_e key, void* pData)
122 if (__pDeviceManagerImpl != null)
124 __pDeviceManagerImpl->SendEvent(key);
129 _DeviceManagerImpl::InitDeviceManagerImpl(void)
131 static _DeviceManagerImpl deviceManagerImpl;
132 __pDeviceManagerImpl = &deviceManagerImpl;
135 _DeviceManagerImpl::GetInstance(void)
137 static pthread_once_t once_block = PTHREAD_ONCE_INIT;
138 if(__pDeviceManagerImpl == null)
140 pthread_once(&once_block, InitDeviceManagerImpl);
142 return __pDeviceManagerImpl;
145 _DeviceManagerImpl::_DeviceManagerImpl()
147 , __headSetType(DEVICE_TYPE_WIRED_HEADPHONE)
148 , __bluetoothReferenceCount(0)
150 result r = E_SUCCESS;
151 int headsetState = 0;
153 static String DEVICE_MANAGER_SERVICE_ID(_DEVICE_MANAGER_SERVICE_ID);
155 _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
156 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
158 r = pCommunicationDispatcherClient->RegisterCommunicationListener(DEVICE_MANAGER_SERVICE_ID, *this);
159 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
161 __pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
163 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED, OnDeviceStateChanged, null);
164 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register USB event");
166 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_CHARGER_CONNECTED, OnDeviceStateChanged, null);
167 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register DEVICE_TYPE_CHARGER event");
169 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, OnDeviceStateChanged, null);
170 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register TV out event");
172 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, OnDeviceStateChanged, null);
173 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register audio jack event");
175 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, OnDeviceStateChanged, null);
176 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register sliding keyboard event");
178 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &headsetState);
179 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to get audio jack status");
181 if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
183 __headSetType = DEVICE_TYPE_WIRED_HEADPHONE;
185 else if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE)
187 __headSetType = DEVICE_TYPE_WIRED_HEADSET;
190 if (!_AppInfo::IsOspCompat())
192 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack, null);
196 ret = vconf_notify_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback, null);
198 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register MMC event callback.");
200 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack, null);
201 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register HDMI event");
203 __deviceEventList.Construct();
209 _DeviceManagerImpl::~_DeviceManagerImpl()
211 result r = E_SUCCESS;
213 _CommunicationDispatcherClient* pCommunicationDispatcherClient = null;
214 String key(_DEVICE_MANAGER_SERVICE_ID);
216 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED);
217 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister USB event");
219 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED);
220 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister TV out event");
222 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS);
223 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister audio jack event");
225 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED);
226 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister sliding keyboard event");
228 if (!_AppInfo::IsOspCompat())
230 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack);
234 ret = vconf_ignore_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback);
236 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister MMC event");
238 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack);
239 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister HDMI event");
242 pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
243 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
245 r = pCommunicationDispatcherClient->UnregisterCommunicationListener(key);
246 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
255 _DeviceManagerImpl::DeviceEventVConfCallBack(keynode_t* node, void* userData)
261 if (strcmp(VCONFKEY_SYSMAN_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
263 SysLog(NID_SYS, "MMC callback is occured");
264 if (__pDeviceManagerImpl != null)
266 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &value);
269 event = _DEVICE_MANAGER_STATE_MOUNTED;
273 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
275 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
278 else if(strcmp(VCONFKEY_SYSMAN_HDMI, vconf_keynode_get_name(node)) == 0)
280 if (__pDeviceManagerImpl != null)
282 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
285 event = _DEVICE_MANAGER_STATE_INSERTED;
289 event = _DEVICE_MANAGER_STATE_REMOVED;
291 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_HDMI, event);
298 _DeviceManagerImpl::MmcEventVconfCallback(keynode_t* node, void* userData)
300 if (strcmp(VCONFKEY_APPSERVICE_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
302 SysLog(NID_SYS, "MMC event callback is called.");
303 if (__pDeviceManagerImpl != NULL)
307 int ret = vconf_get_int(VCONFKEY_APPSERVICE_MMC_STATUS, &value);
308 SysTryReturnVoidResult(NID_SYS, ret == 0, E_SYSTEM, "VCONFKEY_APPSERVICE_MMC_STATUS is error");
312 event = _DEVICE_MANAGER_STATE_MOUNTED;
316 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
318 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
324 _DeviceManagerImpl::SendEvent(DeviceType deviceType, String& state)
326 unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
328 if(__deviceEventList.GetCount() > 0)
330 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
331 SysTryReturnVoidResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
333 while(pEnumerator->MoveNext() == E_SUCCESS)
335 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
336 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
337 SysTryReturnVoidResult(NID_SYS, pDeviceEventListenerContainer != null,E_SYSTEM, "Container is empty");
341 case DEVICE_TYPE_BLUETOOTH_HEADSET:
343 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
349 case DEVICE_TYPE_CHARGER:
351 if(pDeviceEventListenerContainer->__charger == false)
357 case DEVICE_TYPE_USB_CLIENT:
359 if(pDeviceEventListenerContainer->__usbClient == false)
365 case DEVICE_TYPE_TV_OUT:
367 if(pDeviceEventListenerContainer->__tvOut == false)
373 case DEVICE_TYPE_WIRED_HEADSET:
375 if(pDeviceEventListenerContainer->__wiredHeadset == false)
381 case DEVICE_TYPE_WIRED_HEADPHONE:
383 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
389 case DEVICE_TYPE_STORAGE_CARD:
391 if(pDeviceEventListenerContainer->__storageCard == false)
397 case DEVICE_TYPE_KEYBOARD:
399 if(pDeviceEventListenerContainer->__keyboard == false)
405 case DEVICE_TYPE_HDMI:
407 if(pDeviceEventListenerContainer->__hdmi == false)
416 unique_ptr<_DeviceManagerEventArg> pDeviceManagerEventArg(new (std::nothrow) _DeviceManagerEventArg());
417 SysTryReturnVoidResult(NID_SYS, pDeviceManagerEventArg != null, E_OUT_OF_MEMORY, "It is failed to create instance of DeviceManagerEventArg");
419 pDeviceManagerEventArg->deviceType = deviceType;
420 pDeviceManagerEventArg->state = state;
422 if(pDeviceEventListenerContainer->__pEvent != null)
424 pDeviceEventListenerContainer->__pEvent->Fire(*(pDeviceManagerEventArg.release()));
431 _DeviceManagerImpl::RequireBluetoothEvent(void)
433 result r = E_SUCCESS;
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 unique_ptr<IoService_Request> pRequest(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");
467 responseMessages.RemoveAll(true);
473 _DeviceManagerImpl::ReleaseBluetoothEvent(void)
475 result r = E_SUCCESS;
476 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "Ipc Client is not ready");
478 __bluetoothReferenceCount --;
479 SysTryReturnResult(NID_SYS, __bluetoothReferenceCount >= 0, E_SYSTEM, "Fail to manage reference count");
481 if(__bluetoothReferenceCount == 0)
483 ArrayList requestMessages;
484 ArrayList responseMessages;
486 r = requestMessages.Construct();
487 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create request instance");
488 r = responseMessages.Construct();
489 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create response instance");
491 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
492 String commandId = _DEVICE_MANAGER_COMMAND_CLOSE;
493 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
495 r = requestMessages.Add(serviceId);
496 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add service id");
497 r = requestMessages.Add(commandId);
498 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id");
499 r = requestMessages.Add(deviceId);
500 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
502 unique_ptr<IoService_Request> pRequest(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
503 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send bluetooth event subscribe by IPC");
505 r = __pIpcClient->SendRequest(pRequest.get());
506 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
508 responseMessages.RemoveAll(true);
514 _DeviceManagerImpl::AddOnExistedListener(DeviceType deviceType, const IDeviceEventListener* pListener)
516 result r = E_OBJ_NOT_FOUND;
517 unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
519 if(__deviceEventList.GetCount() > 0)
521 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
522 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
524 while(pEnumerator->MoveNext() == E_SUCCESS)
526 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
527 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
528 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
529 if(pDeviceEventListenerContainer->__pListener == pListener)
533 case DEVICE_TYPE_BLUETOOTH_HEADSET:
535 if(pDeviceEventListenerContainer->__bluetoothHeadset == true)
537 r = E_OBJ_ALREADY_EXIST;
541 pDeviceEventListenerContainer->__bluetoothHeadset = true;
542 RequireBluetoothEvent();
547 case DEVICE_TYPE_CHARGER:
549 if(pDeviceEventListenerContainer->__charger == true)
551 r = E_OBJ_ALREADY_EXIST;
555 pDeviceEventListenerContainer->__charger = true;
560 case DEVICE_TYPE_USB_CLIENT:
562 if(pDeviceEventListenerContainer->__usbClient == true)
564 r = E_OBJ_ALREADY_EXIST;
568 pDeviceEventListenerContainer->__usbClient = true;
573 case DEVICE_TYPE_TV_OUT:
576 _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
580 if(!_AppInfo::IsOspCompat())
582 r = E_UNSUPPORTED_OPERATION;
586 r = E_DEVICE_UNAVAILABLE;
591 if(pDeviceEventListenerContainer->__tvOut == true)
593 r = E_OBJ_ALREADY_EXIST;
597 pDeviceEventListenerContainer->__tvOut = true;
602 case DEVICE_TYPE_WIRED_HEADSET:
604 if(pDeviceEventListenerContainer->__wiredHeadset == true)
606 r = E_OBJ_ALREADY_EXIST;
610 pDeviceEventListenerContainer->__wiredHeadset = true;
615 case DEVICE_TYPE_WIRED_HEADPHONE:
617 if(pDeviceEventListenerContainer->__wiredHeadphone == true)
619 r = E_OBJ_ALREADY_EXIST;
623 pDeviceEventListenerContainer->__wiredHeadphone = true;
628 case DEVICE_TYPE_STORAGE_CARD:
630 if(pDeviceEventListenerContainer->__storageCard == true)
632 r = E_OBJ_ALREADY_EXIST;
636 pDeviceEventListenerContainer->__storageCard = true;
641 case DEVICE_TYPE_KEYBOARD:
643 bool keyboard = false;
644 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
646 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
648 if (keyboard == false)
650 if(!_AppInfo::IsOspCompat())
652 return E_UNSUPPORTED_OPERATION;
656 return E_DEVICE_UNAVAILABLE;
660 if(pDeviceEventListenerContainer->__keyboard == true)
662 r = E_OBJ_ALREADY_EXIST;
666 pDeviceEventListenerContainer->__keyboard = true;
671 case DEVICE_TYPE_HDMI:
675 bool supported = false;
676 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_HDMI, supported);
677 SysTryReturnResult(NID_SYS, supported == true, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
679 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
680 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
681 SysTryReturnResult(NID_SYS, value >= 0, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
683 if(pDeviceEventListenerContainer->__hdmi == true)
685 r = E_OBJ_ALREADY_EXIST;
689 pDeviceEventListenerContainer->__hdmi = true;
702 _DeviceManagerImpl::AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
704 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
705 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
706 result r = E_SUCCESS;
708 if(deviceType == DEVICE_TYPE_TV_OUT)
711 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
712 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
716 if(!_AppInfo::IsOspCompat())
718 r = E_UNSUPPORTED_OPERATION;
722 r = E_DEVICE_UNAVAILABLE;
727 else if(deviceType == DEVICE_TYPE_KEYBOARD)
729 bool keyboard = false;
730 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
732 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
734 if (keyboard == false)
736 if(!_AppInfo::IsOspCompat())
738 r = E_UNSUPPORTED_OPERATION;
742 r = E_DEVICE_UNAVAILABLE;
747 else if(deviceType == DEVICE_TYPE_HDMI)
751 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
752 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
755 return E_UNSUPPORTED_OPERATION;
759 r = AddOnExistedListener(deviceType, pListener);
761 if(r == E_OBJ_NOT_FOUND)
763 unique_ptr<_DeviceEventListenerContainer> pDeviceEventContainer(new (std::nothrow) _DeviceEventListenerContainer());
764 SysTryReturnResult(NID_SYS, pDeviceEventContainer != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceEventListenerContainer");
766 unique_ptr<_DeviceManagerEvent> pDeviceManagerEvent(new (std::nothrow) _DeviceManagerEvent());
767 SysTryReturnResult(NID_SYS, pDeviceManagerEvent != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceManagerEvent");
769 pDeviceManagerEvent->AddListener(*pListener);
770 pDeviceEventContainer->__pListener = pListener;
771 pDeviceEventContainer->__pEvent = pDeviceManagerEvent.release();
775 case DEVICE_TYPE_BLUETOOTH_HEADSET:
777 pDeviceEventContainer->__bluetoothHeadset = true;
778 RequireBluetoothEvent();
781 case DEVICE_TYPE_CHARGER:
783 pDeviceEventContainer->__charger = true;
786 case DEVICE_TYPE_USB_CLIENT:
788 pDeviceEventContainer->__usbClient = true;
791 case DEVICE_TYPE_TV_OUT:
794 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
795 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
799 if(!_AppInfo::IsOspCompat())
801 return E_UNSUPPORTED_OPERATION;
805 return E_DEVICE_UNAVAILABLE;
809 pDeviceEventContainer->__tvOut = true;
812 case DEVICE_TYPE_WIRED_HEADSET:
814 pDeviceEventContainer->__wiredHeadset = true;
817 case DEVICE_TYPE_WIRED_HEADPHONE:
819 pDeviceEventContainer->__wiredHeadphone = true;
822 case DEVICE_TYPE_STORAGE_CARD:
824 pDeviceEventContainer->__storageCard = true;
827 case DEVICE_TYPE_KEYBOARD:
829 bool keyboard = false;
830 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
832 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
834 if (keyboard == false)
836 if(!_AppInfo::IsOspCompat())
838 return E_UNSUPPORTED_OPERATION;
842 return E_DEVICE_UNAVAILABLE;
846 pDeviceEventContainer->__keyboard = true;
849 case DEVICE_TYPE_HDMI:
853 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
854 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
857 return E_UNSUPPORTED_OPERATION;
859 pDeviceEventContainer->__hdmi = true;
864 __deviceEventList.Add(pDeviceEventContainer.release());
871 _DeviceManagerImpl::RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
873 result r = E_SUCCESS;
875 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
876 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
877 SysTryReturnResult(NID_SYS, __deviceEventList.GetCount() > 0, E_INVALID_ARG, "There is no registered listener.");
879 unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(__deviceEventList.GetEnumeratorN());
881 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
883 if(deviceType == DEVICE_TYPE_TV_OUT)
886 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
887 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
891 if(!_AppInfo::IsOspCompat())
893 r = E_UNSUPPORTED_OPERATION;
897 r = E_DEVICE_UNAVAILABLE;
902 else if(deviceType == DEVICE_TYPE_KEYBOARD)
904 bool keyboard = false;
905 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
907 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
909 if (keyboard == false)
911 if(!_AppInfo::IsOspCompat())
913 r = E_UNSUPPORTED_OPERATION;
917 r = E_DEVICE_UNAVAILABLE;
921 else if(deviceType == DEVICE_TYPE_HDMI)
925 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
926 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
929 return E_UNSUPPORTED_OPERATION;
933 while(pEnumerator->MoveNext() == E_SUCCESS)
935 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
936 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
937 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
939 if(pDeviceEventListenerContainer->__pListener == pListener)
943 case DEVICE_TYPE_BLUETOOTH_HEADSET:
945 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
947 return E_OBJ_NOT_FOUND;
949 pDeviceEventListenerContainer->__bluetoothHeadset = false;
950 ReleaseBluetoothEvent();
953 case DEVICE_TYPE_CHARGER:
955 if(pDeviceEventListenerContainer->__charger == false)
957 return E_OBJ_NOT_FOUND;
959 pDeviceEventListenerContainer->__charger = false;
962 case DEVICE_TYPE_USB_CLIENT:
964 if(pDeviceEventListenerContainer->__usbClient == false)
966 return E_OBJ_NOT_FOUND;
968 pDeviceEventListenerContainer->__usbClient = false;
971 case DEVICE_TYPE_TV_OUT:
973 if(pDeviceEventListenerContainer->__tvOut == false)
975 return E_OBJ_NOT_FOUND;
977 pDeviceEventListenerContainer->__tvOut = false;
980 case DEVICE_TYPE_WIRED_HEADSET:
982 if(pDeviceEventListenerContainer->__wiredHeadset == false)
984 return E_OBJ_NOT_FOUND;
986 pDeviceEventListenerContainer->__wiredHeadset = false;
989 case DEVICE_TYPE_WIRED_HEADPHONE:
991 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
993 return E_OBJ_NOT_FOUND;
995 pDeviceEventListenerContainer->__wiredHeadphone = false;
998 case DEVICE_TYPE_STORAGE_CARD:
1000 if(pDeviceEventListenerContainer->__storageCard == false)
1002 return E_OBJ_NOT_FOUND;
1004 pDeviceEventListenerContainer->__storageCard = false;
1007 case DEVICE_TYPE_KEYBOARD:
1009 if(pDeviceEventListenerContainer->__keyboard == false)
1011 return E_OBJ_NOT_FOUND;
1013 pDeviceEventListenerContainer->__keyboard = false;
1016 case DEVICE_TYPE_HDMI:
1018 if(pDeviceEventListenerContainer->__hdmi == false)
1020 return E_OBJ_NOT_FOUND;
1022 pDeviceEventListenerContainer->__hdmi = false;
1027 if(pDeviceEventListenerContainer->IsInvalid() == true)
1029 __deviceEventList.Remove(pDeviceEventListenerContainer);
1030 delete pDeviceEventListenerContainer;
1035 return E_OBJ_NOT_FOUND;
1039 _DeviceManagerImpl::RemoveAllDeviceEventListeners(void)
1041 result r = E_SUCCESS;
1043 IEnumeratorT<_DeviceEventListenerContainer*>* pEnumerator = __deviceEventList.GetEnumeratorN();
1044 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
1046 while(pEnumerator->MoveNext() == E_SUCCESS)
1048 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
1049 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
1050 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
1051 __deviceEventList.Remove(pDeviceEventListenerContainer);
1052 delete pDeviceEventListenerContainer;
1056 __bluetoothReferenceCount = 1;
1058 ReleaseBluetoothEvent();
1063 _DeviceManagerImpl::SendEvent(runtime_info_key_e key)
1065 DeviceType type = DEVICE_TYPE_USB_CLIENT;
1072 case RUNTIME_INFO_KEY_USB_CONNECTED:
1074 flag = _DEVICE_MANAGER_USB_CLIENT;
1075 type = DEVICE_TYPE_USB_CLIENT;
1078 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &state);
1079 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get usb state.");
1083 value = _DEVICE_MANAGER_STATE_INSERTED;
1087 value = _DEVICE_MANAGER_STATE_REMOVED;
1091 case RUNTIME_INFO_KEY_CHARGER_CONNECTED:
1093 flag = _DEVICE_MANAGER_CHARGER;
1094 type = DEVICE_TYPE_CHARGER;
1097 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &state);
1098 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get charger state.");
1102 value = _DEVICE_MANAGER_STATE_INSERTED;
1106 value = _DEVICE_MANAGER_STATE_REMOVED;
1110 case RUNTIME_INFO_KEY_TV_OUT_CONNECTED:
1112 flag = _DEVICE_MANAGER_TV_OUT;
1113 type = DEVICE_TYPE_TV_OUT;
1116 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, &state);
1117 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get tv connect state.");
1121 value = _DEVICE_MANAGER_STATE_INSERTED;
1125 value = _DEVICE_MANAGER_STATE_REMOVED;
1129 case RUNTIME_INFO_KEY_AUDIO_JACK_STATUS:
1132 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &state);
1133 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio connect state.");
1135 if (state == RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED)
1137 if (__headSetType == DEVICE_TYPE_WIRED_HEADPHONE)
1139 flag = _DEVICE_MANAGER_WIRED_HEADPHONE;
1140 type = DEVICE_TYPE_WIRED_HEADPHONE;
1144 flag = _DEVICE_MANAGER_WIRED_HEADSET;
1145 type = DEVICE_TYPE_WIRED_HEADSET;
1148 value = _DEVICE_MANAGER_STATE_REMOVED;
1152 if (state == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
1154 __headSetType = DEVICE_TYPE_WIRED_HEADPHONE;
1155 flag = _DEVICE_MANAGER_WIRED_HEADPHONE;
1156 type = DEVICE_TYPE_WIRED_HEADPHONE;
1160 __headSetType = DEVICE_TYPE_WIRED_HEADSET;
1161 flag = _DEVICE_MANAGER_WIRED_HEADSET;
1162 type = DEVICE_TYPE_WIRED_HEADSET;
1164 value = _DEVICE_MANAGER_STATE_INSERTED;
1169 case RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED:
1171 flag = _DEVICE_MANAGER_KEYBOARD;
1172 type = DEVICE_TYPE_KEYBOARD;
1175 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, &state);
1176 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get built-in keyboard state.");
1180 value = _DEVICE_MANAGER_STATE_OPENED;
1184 value = _DEVICE_MANAGER_STATE_CLOSED;
1192 __pDeviceManagerImpl->SendEvent(type, value);
1197 _DeviceManagerImpl::GetState(DeviceType deviceType, String& state)
1199 result r = E_SUCCESS;
1203 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "GetDeviceState Failed");
1208 case DEVICE_TYPE_BLUETOOTH_HEADSET:
1210 bool bluetooth = false;
1211 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_NETWORK_BLUETOOTH, bluetooth);
1212 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option.");
1213 if (bluetooth == false)
1215 if(!_AppInfo::IsOspCompat())
1217 return E_UNSUPPORTED_OPERATION;
1221 return E_DEVICE_UNAVAILABLE;
1225 ArrayList requestMessages;
1226 ArrayList responseMessages;
1228 requestMessages.Construct();
1229 responseMessages.Construct();
1231 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
1232 String commandId = _DEVICE_MANAGER_COMMAND_STATUS;
1233 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
1235 requestMessages.Add(serviceId);
1236 requestMessages.Add(commandId);
1237 requestMessages.Add(deviceId);
1239 unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
1241 r = __pIpcClient->SendRequest(*(pMsg.get()));
1243 String* pMessageData = (String*)responseMessages.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_DATA);
1244 if (pMessageData != null)
1246 state = *pMessageData;
1248 responseMessages.RemoveAll(true);
1252 case DEVICE_TYPE_CHARGER:
1254 bool chargerState = false;
1255 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &chargerState);
1256 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get charger state");
1258 if (chargerState == true)
1260 state = _DEVICE_MANAGER_STATE_INSERTED;
1264 state = _DEVICE_MANAGER_STATE_REMOVED;
1269 case DEVICE_TYPE_USB_CLIENT:
1271 bool cableState = false;
1272 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &cableState);
1273 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get usb state");
1275 if (cableState == true)
1277 state = _DEVICE_MANAGER_STATE_INSERTED;
1281 state = _DEVICE_MANAGER_STATE_REMOVED;
1286 case DEVICE_TYPE_TV_OUT:
1289 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
1290 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
1294 if(!_AppInfo::IsOspCompat())
1296 return E_UNSUPPORTED_OPERATION;
1300 return E_DEVICE_UNAVAILABLE;
1304 bool tvState = false;
1305 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, &tvState);
1306 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get tv state");
1307 if (tvState == true)
1309 state = _DEVICE_MANAGER_STATE_INSERTED;
1313 state = _DEVICE_MANAGER_STATE_REMOVED;
1318 case DEVICE_TYPE_WIRED_HEADSET:
1321 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &audioState);
1322 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio state");
1324 if (audioState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE)
1326 state = _DEVICE_MANAGER_STATE_INSERTED;
1330 state = _DEVICE_MANAGER_STATE_REMOVED;
1335 case DEVICE_TYPE_WIRED_HEADPHONE:
1338 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &audioState);
1339 SysTryReturnResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get audio state");
1341 if (audioState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
1343 state = _DEVICE_MANAGER_STATE_INSERTED;
1347 state = _DEVICE_MANAGER_STATE_REMOVED;
1352 case DEVICE_TYPE_STORAGE_CARD:
1355 if (!_AppInfo::IsOspCompat())
1357 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &value);
1361 ret = vconf_get_int(VCONFKEY_APPSERVICE_MMC_STATUS, &value);
1363 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
1366 state = _DEVICE_MANAGER_STATE_MOUNTED;
1370 state = _DEVICE_MANAGER_STATE_UNMOUNTED;
1375 case DEVICE_TYPE_KEYBOARD:
1377 bool keyboard = false;
1378 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
1379 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get keyboard option.");
1380 if (keyboard == false)
1382 if(!_AppInfo::IsOspCompat())
1384 return E_UNSUPPORTED_OPERATION;
1388 return E_DEVICE_UNAVAILABLE;
1393 case DEVICE_TYPE_HDMI:
1396 bool supported = false;
1397 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_HDMI, supported);
1398 SysTryReturnResult(NID_SYS, supported == true, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
1400 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
1401 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
1404 state = _DEVICE_MANAGER_STATE_INSERTED;
1408 state = _DEVICE_MANAGER_STATE_REMOVED;
1412 return E_UNSUPPORTED_OPERATION;
1419 return E_INVALID_ARG;
1425 _DeviceManagerImpl::OnDataReceived(const ArrayList& data)
1427 StringComparer stringComparer;
1430 String* pServiceId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_SERVICE_ID);
1431 String* pCommandId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_COMMAND_ID);
1432 String* pDeviceId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_HEAD_DEVICE_ID);
1433 String* pEventId = (String*) data.GetAt(_OSP_APP_SERVICE_IPC_MESSAGE_DATA);
1435 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
1436 String commandId = _DEVICE_MANAGER_COMMAND_EVENT;
1437 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
1439 SysTryReturnVoidResult(NID_SYS, pServiceId != null && pCommandId != null && pDeviceId != null && pEventId != null, E_SYSTEM, "There is no device data.");
1441 stringComparer.Compare(*pServiceId, serviceId, cmp);
1444 stringComparer.Compare(*pCommandId, commandId, cmp);
1447 stringComparer.Compare(*pDeviceId, deviceId, cmp);
1450 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_BLUETOOTH_HEADSET, *pEventId);
1456 } } // Tizen::System