tizen 2.3 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Systeminfo / SystemInfoPeripheral.cpp
1 #include "SystemInfoPeripheral.h"
2 #include <PlatformException.h>
3 #include <Logger.h>
4 #include <vconf.h>
5
6 namespace DeviceAPI {
7 namespace SystemInfo {
8
9 SystemInfoPeripheral::SystemInfoPeripheral() :
10                 m_is_video_output_on(fetchIsVideoOutputOn())
11 {
12     LOGD("Entered");
13 }
14
15 SystemInfoPeripheral::~SystemInfoPeripheral()
16 {
17     LOGD("Entered");
18 }
19
20 bool SystemInfoPeripheral::isVideoOutputOn() const
21 {
22     return m_is_video_output_on;
23 }
24
25 bool SystemInfoPeripheral::fetchIsVideoOutputOn()
26 {
27     LOGD("Entered");
28     int hdmi_status = 0, wireless_display_status = 0, popsync_status = 0;
29     int ret = 0;
30
31     ret = vconf_get_int(VCONFKEY_MIRACAST_WFD_SOURCE_STATUS, &wireless_display_status);
32     if (ret == VCONF_OK) {
33         if (VCONFKEY_MIRACAST_WFD_SOURCE_ON == wireless_display_status) {
34             return true;
35         }
36     } else {
37         LOGE("Failed to get wireless display status");
38     }
39
40     ret = vconf_get_int(VCONFKEY_SYSMAN_HDMI, &hdmi_status);
41     if (ret == VCONF_OK) {
42         if (VCONFKEY_SYSMAN_HDMI_CONNECTED == hdmi_status) {
43             return true;
44         }
45     } else {
46         LOGE("Failed to get hdmi status");
47     }
48
49     ret = vconf_get_int(VCONFKEY_POPSYNC_ACTIVATED_KEY, &popsync_status);
50     if (ret == VCONF_OK) {
51         if (1 == popsync_status) {
52             return true;
53         }
54     } else {
55         LOGE("Failed to get popsync status");
56     }
57
58     return false;
59 }
60
61 } // SystemInfo
62 } // DeviceAPI