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"
48 using namespace Tizen::App;
49 using namespace Tizen::Base;
50 using namespace Tizen::Base::Collection;
51 using namespace Tizen::Base::Runtime;
52 using namespace Tizen::Io;
54 namespace Tizen { namespace System
57 static const wchar_t* _DEVICE_MANAGER_SERVICE_ID = L"osp.devicemanager.service";
58 static const wchar_t* _DEVICE_MANAGER_COMMAND_OPEN = L"osp.devicemanager.command.open";
59 static const wchar_t* _DEVICE_MANAGER_COMMAND_CLOSE = L"osp.devicemanager.command.close";
60 static const wchar_t* _DEVICE_MANAGER_COMMAND_STATUS = L"osp.devicemanager.command.status";
61 static const wchar_t* _DEVICE_MANAGER_COMMAND_EVENT = L"osp.devicemanager.command.event";
62 static const wchar_t* _DEVICE_MANAGER_BLUETOOTH = L"osp.devicemanager.bluetooth";
64 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_SERVICE_ID = 0;
65 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_COMMAND_ID = 1;
66 const int _OSP_APP_SERVICE_IPC_MESSAGE_HEAD_DEVICE_ID = 2;
67 const int _OSP_APP_SERVICE_IPC_MESSAGE_DATA = 3;
69 const int _DEVICE_MANAGER_BLUETOOTH_HEADSET = 0x01;
70 const int _DEVICE_MANAGER_CHARGER = 0x02;
71 const int _DEVICE_MANAGER_USB_CLIENT = 0x04;
72 const int _DEVICE_MANAGER_TV_OUT = 0x08;
73 const int _DEVICE_MANAGER_WIRED_HEADSET = 0x10;
74 const int _DEVICE_MANAGER_WIRED_HEADPHONE = 0x20;
75 const int _DEVICE_MANAGER_STORAGECARD = 0x40;
76 const int _DEVICE_MANAGER_KEYBOARD = 0x80;
78 static const wchar_t* _DEVICE_MANAGER_STATE_INSERTED = L"Inserted";
79 static const wchar_t* _DEVICE_MANAGER_STATE_REMOVED = L"Removed";
80 static const wchar_t* _DEVICE_MANAGER_STATE_MOUNTED = L"Mounted";
81 static const wchar_t* _DEVICE_MANAGER_STATE_UNMOUNTED = L"Unmounted";
82 static const wchar_t* _DEVICE_MANAGER_STATE_OPENED = L"Opened";
83 static const wchar_t* _DEVICE_MANAGER_STATE_CLOSED = L"Closed";
85 static const wchar_t* _SYSTEM_INFO_NETWORK_BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
86 static const wchar_t* _SYSTEM_INFO_INPUT_KEYBOARD = L"http://tizen.org/feature/input.keyboard";
87 static const wchar_t* _SYSTEM_INFO_TVOUT_SUPPORTED = L"http://tizen.org/feature/screen.output.rca";
88 static const wchar_t* _SYSTEM_INFO_HDMI = L"http://tizen.org/feature/screen.output.hdmi";
90 _DeviceManagerImpl* _DeviceManagerImpl::__pDeviceManagerImpl = null;
92 class _DeviceManagerEventArg : public IEventArg
95 _DeviceManagerEventArg()
98 DeviceType deviceType;
102 class _DeviceManagerEvent : public Event
105 virtual void FireImpl(IEventListener& listener, const IEventArg& arg)
107 IDeviceEventListener* pListener = dynamic_cast<IDeviceEventListener*> (&listener);
108 const _DeviceManagerEventArg* pArg = dynamic_cast<const _DeviceManagerEventArg*>(&arg);
110 SysTryReturnVoidResult(NID_SYS, pListener != null && pArg != null, E_SYSTEM, "Parameters are not available.");
112 pListener->OnDeviceStateChanged(pArg->deviceType, pArg->state);
118 _DeviceManagerImpl::OnDeviceStateChanged(runtime_info_key_e key, void* pData)
120 if (__pDeviceManagerImpl != null)
122 __pDeviceManagerImpl->SendEvent(key);
127 _DeviceManagerImpl::InitDeviceManagerImpl(void)
129 static _DeviceManagerImpl deviceManagerImpl;
130 __pDeviceManagerImpl = &deviceManagerImpl;
133 _DeviceManagerImpl::GetInstance(void)
135 static pthread_once_t once_block = PTHREAD_ONCE_INIT;
136 if(__pDeviceManagerImpl == null)
138 pthread_once(&once_block, InitDeviceManagerImpl);
140 return __pDeviceManagerImpl;
143 _DeviceManagerImpl::_DeviceManagerImpl()
145 , __headSetType(DEVICE_TYPE_WIRED_HEADPHONE)
146 , __bluetoothReferenceCount(0)
148 result r = E_SUCCESS;
149 int headsetState = 0;
151 static String DEVICE_MANAGER_SERVICE_ID(_DEVICE_MANAGER_SERVICE_ID);
153 _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
154 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
156 r = pCommunicationDispatcherClient->RegisterCommunicationListener(DEVICE_MANAGER_SERVICE_ID, *this);
157 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
159 __pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
161 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED, OnDeviceStateChanged, null);
162 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register USB event");
164 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_CHARGER_CONNECTED, OnDeviceStateChanged, null);
165 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register DEVICE_TYPE_CHARGER event");
167 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, OnDeviceStateChanged, null);
168 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register TV out event");
170 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, OnDeviceStateChanged, null);
171 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register audio jack event");
173 ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, OnDeviceStateChanged, null);
174 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to register sliding keyboard event");
176 ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &headsetState);
177 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to get audio jack status");
179 if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE)
181 __headSetType = DEVICE_TYPE_WIRED_HEADPHONE;
183 else if (headsetState == RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE)
185 __headSetType = DEVICE_TYPE_WIRED_HEADSET;
188 if (!_AppInfo::IsOspCompat())
190 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack, null);
194 ret = vconf_notify_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback, null);
196 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register MMC event callback.");
198 ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack, null);
199 SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to register HDMI event");
201 __deviceEventList.Construct();
207 _DeviceManagerImpl::~_DeviceManagerImpl()
209 result r = E_SUCCESS;
211 _CommunicationDispatcherClient* pCommunicationDispatcherClient = null;
212 String key(_DEVICE_MANAGER_SERVICE_ID);
214 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_USB_CONNECTED);
215 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister USB event");
217 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED);
218 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister TV out event");
220 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS);
221 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister audio jack event");
223 ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED);
224 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister sliding keyboard event");
226 if (!_AppInfo::IsOspCompat())
228 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, DeviceEventVConfCallBack);
232 ret = vconf_ignore_key_changed(VCONFKEY_APPSERVICE_MMC_STATUS, MmcEventVconfCallback);
234 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister MMC event");
236 ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_HDMI, DeviceEventVConfCallBack);
237 SysTryCatch(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, r = E_SYSTEM, r, "It is failed to unregister HDMI event");
240 pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
241 SysTryCatch(NID_SYS, pCommunicationDispatcherClient != null, r = E_SYSTEM, r, "It is failed to get CommunicationDispatcherClient.");
243 r = pCommunicationDispatcherClient->UnregisterCommunicationListener(key);
244 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to register on CommunicationDispatcherClient.");
253 _DeviceManagerImpl::DeviceEventVConfCallBack(keynode_t* node, void* userData)
259 if (strcmp(VCONFKEY_SYSMAN_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
261 SysLog(NID_SYS, "MMC callback is occured");
262 if (__pDeviceManagerImpl != null)
264 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &value);
267 event = _DEVICE_MANAGER_STATE_MOUNTED;
271 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
273 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
276 else if(strcmp(VCONFKEY_SYSMAN_HDMI, vconf_keynode_get_name(node)) == 0)
278 if (__pDeviceManagerImpl != null)
280 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
283 event = _DEVICE_MANAGER_STATE_INSERTED;
287 event = _DEVICE_MANAGER_STATE_REMOVED;
289 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_HDMI, event);
296 _DeviceManagerImpl::MmcEventVconfCallback(keynode_t* node, void* userData)
298 if (strcmp(VCONFKEY_APPSERVICE_MMC_STATUS, vconf_keynode_get_name(node)) == 0)
300 SysLog(NID_SYS, "MMC event callback is called.");
301 if (__pDeviceManagerImpl != NULL)
305 int ret = vconf_get_int(VCONFKEY_APPSERVICE_MMC_STATUS, &value);
306 SysTryReturnVoidResult(NID_SYS, ret == 0, E_SYSTEM, "VCONFKEY_APPSERVICE_MMC_STATUS is error");
310 event = _DEVICE_MANAGER_STATE_MOUNTED;
314 event = _DEVICE_MANAGER_STATE_UNMOUNTED;
316 __pDeviceManagerImpl->SendEvent(DEVICE_TYPE_STORAGE_CARD, event);
322 _DeviceManagerImpl::SendEvent(DeviceType deviceType, String& state)
324 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
326 if(__deviceEventList.GetCount() > 0)
328 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
329 SysTryReturnVoidResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
331 while(pEnumerator->MoveNext() == E_SUCCESS)
333 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
334 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
335 SysTryReturnVoidResult(NID_SYS, pDeviceEventListenerContainer != null,E_SYSTEM, "Container is empty");
339 case DEVICE_TYPE_BLUETOOTH_HEADSET:
341 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
347 case DEVICE_TYPE_CHARGER:
349 if(pDeviceEventListenerContainer->__charger == false)
355 case DEVICE_TYPE_USB_CLIENT:
357 if(pDeviceEventListenerContainer->__usbClient == false)
363 case DEVICE_TYPE_TV_OUT:
365 if(pDeviceEventListenerContainer->__tvOut == false)
371 case DEVICE_TYPE_WIRED_HEADSET:
373 if(pDeviceEventListenerContainer->__wiredHeadset == false)
379 case DEVICE_TYPE_WIRED_HEADPHONE:
381 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
387 case DEVICE_TYPE_STORAGE_CARD:
389 if(pDeviceEventListenerContainer->__storageCard == false)
395 case DEVICE_TYPE_KEYBOARD:
397 if(pDeviceEventListenerContainer->__keyboard == false)
403 case DEVICE_TYPE_HDMI:
405 if(pDeviceEventListenerContainer->__hdmi == false)
414 std::unique_ptr<_DeviceManagerEventArg> pDeviceManagerEventArg(new (std::nothrow) _DeviceManagerEventArg());
415 SysTryReturnVoidResult(NID_SYS, pDeviceManagerEventArg != null, E_OUT_OF_MEMORY, "It is failed to create instance of DeviceManagerEventArg");
417 pDeviceManagerEventArg->deviceType = deviceType;
418 pDeviceManagerEventArg->state = state;
420 if(pDeviceEventListenerContainer->__pEvent != null)
422 pDeviceEventListenerContainer->__pEvent->Fire(*(pDeviceManagerEventArg.release()));
429 _DeviceManagerImpl::RequireBluetoothEvent(void)
431 result r = E_SUCCESS;
432 std::unique_ptr<IoService_Request> pRequest(null);
434 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "Ipc Client is not ready");
436 __bluetoothReferenceCount ++;
438 if(__bluetoothReferenceCount == 1)
440 ArrayList requestMessages;
441 ArrayList responseMessages;
443 r = requestMessages.Construct();
444 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create request instance");
445 r = responseMessages.Construct();
446 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create response instance");
448 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
449 String commandId = _DEVICE_MANAGER_COMMAND_OPEN;
450 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
452 r = requestMessages.Add(serviceId);
453 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add service id");
454 r = requestMessages.Add(commandId);
455 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id");
456 r = requestMessages.Add(deviceId);
458 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add device id (bluetooth)");
460 pRequest.reset(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
461 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send bluetooth event subscribe by IPC");
463 r = __pIpcClient->SendRequest(pRequest.get());
464 SysTryReturnResult(NID_SYS, r == E_SUCCESS,E_SYSTEM, "It is failed to add bluetooth id");
470 _DeviceManagerImpl::ReleaseBluetoothEvent(void)
472 result r = E_SUCCESS;
473 std::unique_ptr<IoService_Request> pRequest(null);
474 SysTryReturnResult(NID_SYS, __pIpcClient != null, E_SYSTEM, "Ipc Client is not ready");
476 __bluetoothReferenceCount --;
477 SysTryReturnResult(NID_SYS, __bluetoothReferenceCount >= 0, E_SYSTEM, "Fail to manage reference count");
479 if(__bluetoothReferenceCount == 0)
481 ArrayList requestMessages;
482 ArrayList responseMessages;
484 r = requestMessages.Construct();
485 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create request instance");
486 r = responseMessages.Construct();
487 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to create response instance");
489 String serviceId = _DEVICE_MANAGER_SERVICE_ID;
490 String commandId = _DEVICE_MANAGER_COMMAND_CLOSE;
491 String deviceId = _DEVICE_MANAGER_BLUETOOTH;
493 r = requestMessages.Add(serviceId);
494 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add service id");
495 r = requestMessages.Add(commandId);
496 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id");
497 r = requestMessages.Add(deviceId);
498 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
500 pRequest.reset(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
501 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send bluetooth event subscribe by IPC");
503 r = __pIpcClient->SendRequest(pRequest.get());
504 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add bluetooth id");
510 _DeviceManagerImpl::AddOnExistedListener(DeviceType deviceType, const IDeviceEventListener* pListener)
512 result r = E_OBJ_NOT_FOUND;
513 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(null);
515 if(__deviceEventList.GetCount() > 0)
517 pEnumerator.reset(__deviceEventList.GetEnumeratorN());
518 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
520 while(pEnumerator->MoveNext() == E_SUCCESS)
522 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
523 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
524 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
525 if(pDeviceEventListenerContainer->__pListener == pListener)
529 case DEVICE_TYPE_BLUETOOTH_HEADSET:
531 if(pDeviceEventListenerContainer->__bluetoothHeadset == true)
533 r = E_OBJ_ALREADY_EXIST;
537 pDeviceEventListenerContainer->__bluetoothHeadset = true;
538 RequireBluetoothEvent();
543 case DEVICE_TYPE_CHARGER:
545 if(pDeviceEventListenerContainer->__charger == true)
547 r = E_OBJ_ALREADY_EXIST;
551 pDeviceEventListenerContainer->__charger = true;
556 case DEVICE_TYPE_USB_CLIENT:
558 if(pDeviceEventListenerContainer->__usbClient == true)
560 r = E_OBJ_ALREADY_EXIST;
564 pDeviceEventListenerContainer->__usbClient = true;
569 case DEVICE_TYPE_TV_OUT:
572 _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
576 if(!_AppInfo::IsOspCompat())
578 r = E_UNSUPPORTED_OPERATION;
582 r = E_DEVICE_UNAVAILABLE;
587 if(pDeviceEventListenerContainer->__tvOut == true)
589 r = E_OBJ_ALREADY_EXIST;
593 pDeviceEventListenerContainer->__tvOut = true;
598 case DEVICE_TYPE_WIRED_HEADSET:
600 if(pDeviceEventListenerContainer->__wiredHeadset == true)
602 r = E_OBJ_ALREADY_EXIST;
606 pDeviceEventListenerContainer->__wiredHeadset = true;
611 case DEVICE_TYPE_WIRED_HEADPHONE:
613 if(pDeviceEventListenerContainer->__wiredHeadphone == true)
615 r = E_OBJ_ALREADY_EXIST;
619 pDeviceEventListenerContainer->__wiredHeadphone = true;
624 case DEVICE_TYPE_STORAGE_CARD:
626 if(pDeviceEventListenerContainer->__storageCard == true)
628 r = E_OBJ_ALREADY_EXIST;
632 pDeviceEventListenerContainer->__storageCard = true;
637 case DEVICE_TYPE_KEYBOARD:
639 bool keyboard = false;
640 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
642 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
644 if (keyboard == false)
646 if(!_AppInfo::IsOspCompat())
648 return E_UNSUPPORTED_OPERATION;
652 return E_DEVICE_UNAVAILABLE;
656 if(pDeviceEventListenerContainer->__keyboard == true)
658 r = E_OBJ_ALREADY_EXIST;
662 pDeviceEventListenerContainer->__keyboard = true;
667 case DEVICE_TYPE_HDMI:
671 bool supported = false;
672 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_HDMI, supported);
673 SysTryReturnResult(NID_SYS, supported == true, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
675 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
676 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
677 SysTryReturnResult(NID_SYS, value >= 0, E_UNSUPPORTED_OPERATION, "Current device does not support HDMI.");
679 if(pDeviceEventListenerContainer->__hdmi == true)
681 r = E_OBJ_ALREADY_EXIST;
685 pDeviceEventListenerContainer->__hdmi = true;
698 _DeviceManagerImpl::AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
700 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
701 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
702 result r = E_SUCCESS;
704 if(deviceType == DEVICE_TYPE_TV_OUT)
707 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
708 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
712 if(!_AppInfo::IsOspCompat())
714 r = E_UNSUPPORTED_OPERATION;
718 r = E_DEVICE_UNAVAILABLE;
723 else if(deviceType == DEVICE_TYPE_KEYBOARD)
725 bool keyboard = false;
726 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
728 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
730 if (keyboard == false)
732 if(!_AppInfo::IsOspCompat())
734 r = E_UNSUPPORTED_OPERATION;
738 r = E_DEVICE_UNAVAILABLE;
743 else if(deviceType == DEVICE_TYPE_HDMI)
747 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
748 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
751 return E_UNSUPPORTED_OPERATION;
755 r = AddOnExistedListener(deviceType, pListener);
757 if(r == E_OBJ_NOT_FOUND)
759 std::unique_ptr<_DeviceEventListenerContainer> pDeviceEventContainer(new (std::nothrow) _DeviceEventListenerContainer());
760 SysTryReturnResult(NID_SYS, pDeviceEventContainer != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceEventListenerContainer");
762 std::unique_ptr<_DeviceManagerEvent> pDeviceManagerEvent(new (std::nothrow) _DeviceManagerEvent());
763 SysTryReturnResult(NID_SYS, pDeviceManagerEvent != null, E_OUT_OF_MEMORY, "It is failed to create instance of _DeviceManagerEvent");
765 pDeviceManagerEvent->AddListener(*pListener);
766 pDeviceEventContainer->__pListener = pListener;
767 pDeviceEventContainer->__pEvent = pDeviceManagerEvent.release();
771 case DEVICE_TYPE_BLUETOOTH_HEADSET:
773 pDeviceEventContainer->__bluetoothHeadset = true;
774 RequireBluetoothEvent();
777 case DEVICE_TYPE_CHARGER:
779 pDeviceEventContainer->__charger = true;
782 case DEVICE_TYPE_USB_CLIENT:
784 pDeviceEventContainer->__usbClient = true;
787 case DEVICE_TYPE_TV_OUT:
790 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
791 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
795 if(!_AppInfo::IsOspCompat())
797 return E_UNSUPPORTED_OPERATION;
801 return E_DEVICE_UNAVAILABLE;
805 pDeviceEventContainer->__tvOut = true;
808 case DEVICE_TYPE_WIRED_HEADSET:
810 pDeviceEventContainer->__wiredHeadset = true;
813 case DEVICE_TYPE_WIRED_HEADPHONE:
815 pDeviceEventContainer->__wiredHeadphone = true;
818 case DEVICE_TYPE_STORAGE_CARD:
820 pDeviceEventContainer->__storageCard = true;
823 case DEVICE_TYPE_KEYBOARD:
825 bool keyboard = false;
826 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
828 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
830 if (keyboard == false)
832 if(!_AppInfo::IsOspCompat())
834 return E_UNSUPPORTED_OPERATION;
838 return E_DEVICE_UNAVAILABLE;
842 pDeviceEventContainer->__keyboard = true;
845 case DEVICE_TYPE_HDMI:
849 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
850 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
853 return E_UNSUPPORTED_OPERATION;
855 pDeviceEventContainer->__hdmi = true;
860 __deviceEventList.Add(pDeviceEventContainer.release());
867 _DeviceManagerImpl::RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener)
869 result r = E_SUCCESS;
871 SysTryReturnResult(NID_SYS, pListener != null, E_INVALID_ARG, "There is no listener isntance.");
872 SysTryReturnResult(NID_SYS, (deviceType >= DEVICE_TYPE_BLUETOOTH_HEADSET && deviceType <= DEVICE_TYPE_HDMI), E_INVALID_ARG, "There is no listener isntance.");
873 SysTryReturnResult(NID_SYS, __deviceEventList.GetCount() > 0, E_INVALID_ARG, "There is no registered listener.");
875 std::unique_ptr< IEnumeratorT<_DeviceEventListenerContainer*> > pEnumerator(__deviceEventList.GetEnumeratorN());
877 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
879 if(deviceType == DEVICE_TYPE_TV_OUT)
882 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_TVOUT_SUPPORTED, tvOut);
883 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get tvout option.");
887 if(!_AppInfo::IsOspCompat())
889 r = E_UNSUPPORTED_OPERATION;
893 r = E_DEVICE_UNAVAILABLE;
898 else if(deviceType == DEVICE_TYPE_KEYBOARD)
900 bool keyboard = false;
901 r = _SystemInfoImpl::GetSysInfo(_SYSTEM_INFO_INPUT_KEYBOARD, keyboard);
903 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Fail to get keyboard option");
905 if (keyboard == false)
907 if(!_AppInfo::IsOspCompat())
909 r = E_UNSUPPORTED_OPERATION;
913 r = E_DEVICE_UNAVAILABLE;
917 else if(deviceType == DEVICE_TYPE_HDMI)
921 ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &value);
922 SysTryReturnResult(NID_SYS, !(ret < 0), E_SYSTEM, "vconf_get_int failed Output value is %d", value);
925 return E_UNSUPPORTED_OPERATION;
929 while(pEnumerator->MoveNext() == E_SUCCESS)
931 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
932 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
933 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
935 if(pDeviceEventListenerContainer->__pListener == pListener)
939 case DEVICE_TYPE_BLUETOOTH_HEADSET:
941 if(pDeviceEventListenerContainer->__bluetoothHeadset == false)
943 return E_OBJ_NOT_FOUND;
945 pDeviceEventListenerContainer->__bluetoothHeadset = false;
946 ReleaseBluetoothEvent();
949 case DEVICE_TYPE_CHARGER:
951 if(pDeviceEventListenerContainer->__charger == false)
953 return E_OBJ_NOT_FOUND;
955 pDeviceEventListenerContainer->__charger = false;
958 case DEVICE_TYPE_USB_CLIENT:
960 if(pDeviceEventListenerContainer->__usbClient == false)
962 return E_OBJ_NOT_FOUND;
964 pDeviceEventListenerContainer->__usbClient = false;
967 case DEVICE_TYPE_TV_OUT:
969 if(pDeviceEventListenerContainer->__tvOut == false)
971 return E_OBJ_NOT_FOUND;
973 pDeviceEventListenerContainer->__tvOut = false;
976 case DEVICE_TYPE_WIRED_HEADSET:
978 if(pDeviceEventListenerContainer->__wiredHeadset == false)
980 return E_OBJ_NOT_FOUND;
982 pDeviceEventListenerContainer->__wiredHeadset = false;
985 case DEVICE_TYPE_WIRED_HEADPHONE:
987 if(pDeviceEventListenerContainer->__wiredHeadphone == false)
989 return E_OBJ_NOT_FOUND;
991 pDeviceEventListenerContainer->__wiredHeadphone = false;
994 case DEVICE_TYPE_STORAGE_CARD:
996 if(pDeviceEventListenerContainer->__storageCard == false)
998 return E_OBJ_NOT_FOUND;
1000 pDeviceEventListenerContainer->__storageCard = false;
1003 case DEVICE_TYPE_KEYBOARD:
1005 if(pDeviceEventListenerContainer->__keyboard == false)
1007 return E_OBJ_NOT_FOUND;
1009 pDeviceEventListenerContainer->__keyboard = false;
1012 case DEVICE_TYPE_HDMI:
1014 if(pDeviceEventListenerContainer->__hdmi == false)
1016 return E_OBJ_NOT_FOUND;
1018 pDeviceEventListenerContainer->__hdmi = false;
1023 if(pDeviceEventListenerContainer->IsInvalid() == true)
1025 __deviceEventList.Remove(pDeviceEventListenerContainer);
1026 delete pDeviceEventListenerContainer;
1031 return E_OBJ_NOT_FOUND;
1035 _DeviceManagerImpl::RemoveAllDeviceEventListeners(void)
1037 result r = E_SUCCESS;
1039 IEnumeratorT<_DeviceEventListenerContainer*>* pEnumerator = __deviceEventList.GetEnumeratorN();
1040 SysTryReturnResult(NID_SYS, pEnumerator != null, E_SYSTEM, "Enumerator is empty.");
1042 while(pEnumerator->MoveNext() == E_SUCCESS)
1044 _DeviceEventListenerContainer* pDeviceEventListenerContainer = null;
1045 pEnumerator->GetCurrent(pDeviceEventListenerContainer);
1046 SysTryReturnResult(NID_SYS, pDeviceEventListenerContainer != null, E_SYSTEM, "[E_SYSTEM] Device Event Container is empty.");
1047 __deviceEventList.Remove(pDeviceEventListenerContainer);
1048 delete pDeviceEventListenerContainer;
1052 __bluetoothReferenceCount = 1;
1054 ReleaseBluetoothEvent();
1059 _DeviceManagerImpl::SendEvent(runtime_info_key_e key)
1061 DeviceType type = DEVICE_TYPE_USB_CLIENT;
1068 case RUNTIME_INFO_KEY_USB_CONNECTED:
1070 flag = _DEVICE_MANAGER_USB_CLIENT;
1071 type = DEVICE_TYPE_USB_CLIENT;
1074 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &state);
1075 SysTryReturnVoidResult(NID_SYS, ret == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to get usb state.");
1079 value = _DEVICE_MANAGER_STATE_INSERTED;
1083 value = _DEVICE_MANAGER_STATE_REMOVED;
1087 case RUNTIME_INFO_KEY_CHARGER_CONNECTED:
1089 flag = _DEVICE_MANAGER_CHARGER;
1090 type = DEVICE_TYPE_CHARGER;
1093 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &state);
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