#include "plugin_config.h"
#include <Logger.h>
+#define MAXBUFSIZE 256
+#define DEVICE_PROFILE "MOBILE_FULL"
+#define DUID_KEY_STRING 28
+#define DUID_BUFFER_SIZE 100
+
namespace DeviceAPI {
namespace Systeminfo {
using namespace WrtDeviceApis::CommonsJavaScript;
const char* DEVICE_CAPABILITIES_VISION_FACE_RECOGNITION = "visionFaceRecognition";
const char* DEVICE_CAPABILITIES_SECURE_ELEMENT = "secureElement";
const char* DEVICE_CAPABILITIES_NATIVE_OSP_COMPATIBLE = "nativeOspCompatible";
+const char* DEVICE_CAPABILITIES_PROFILE = "profile";
}
JSClassRef JSDeviceCapabilitiesInfo::m_classRef = NULL;
{ DEVICE_CAPABILITIES_VISION_FACE_RECOGNITION, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ DEVICE_CAPABILITIES_SECURE_ELEMENT, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ DEVICE_CAPABILITIES_NATIVE_OSP_COMPATIBLE, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { DEVICE_CAPABILITIES_PROFILE, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ 0, 0, 0, 0 }
};
if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BLUETOOTH)) {
bool bluetooth = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("bluetooth : " << bluetooth);
+ if(system_info_get_platform_bool("tizen.org/feature/network.bluetooth", &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->bluetooth = bluetooth;
+ } else {
+ LoggerE("get fail bluetooth value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->bluetooth);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC)) {
bool nfc = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("nfc : " << nfc);
+ if(system_info_get_platform_bool("tizen.org/feature/network.nfc", &nfc) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->nfc = nfc;
+ } else {
+ LoggerE("get fail nfc value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->nfc);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC_RESERVED_PUSH)) {
bool nfcReservedPush = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_RESERVED_PUSH_SUPPORTED, &nfcReservedPush) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("nfcReservedPush : " << nfcReservedPush);
+ if(system_info_get_platform_bool("tizen.org/feature/network.nfc.reserved_push", &nfcReservedPush) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->nfcReservedPush = nfcReservedPush;
+ } else {
+ LoggerE("get fail nfc reserved push value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->nfcReservedPush);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MULTITOUCHCOUNT)) {
int multiTouchCount = 0;
- if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("multiTouchCount : " << multiTouchCount);
+ if(system_info_get_platform_int("tizen.org/feature/multi_point_touch.point_count", &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->multiTouchCount = multiTouchCount;
+ } else {
+ LoggerE("get fail multiTouchCount value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->multiTouchCount);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD)) {
- char* inputKeyboard = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
- if (inputKeyboard != NULL) {
- LoggerD("inputKeyboard : " << inputKeyboard);
- if (strcmp(inputKeyboard, "NULL") == 0) {
- deviceCapabilitiesInfo->inputKeyboard = false;
- } else {
- deviceCapabilitiesInfo->inputKeyboard = true;
- }
- free(inputKeyboard);
- }
+ bool inputKeyboard = false;
+ if(system_info_get_platform_bool("tizen.org/feature/input.keyboard", &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->inputKeyboard = inputKeyboard;
+ } else {
+ LoggerE("get fail inputKeyboard value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboard);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD_LAYOUT)) {
- char* inputKeyboard = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
- if (inputKeyboard != NULL) {
- LoggerD("inputKeyboard : " << inputKeyboard);
- if (strcmp(inputKeyboard, "NULL") == 0) {
- deviceCapabilitiesInfo->inputKeyboard = false;
- } else {
- deviceCapabilitiesInfo->inputKeyboard = true;
- }
- free(inputKeyboard);
+ char* inputKeyboardLayout = NULL;
+ if(system_info_get_platform_string("tizen.org/feature/input.keyboard.layout", &inputKeyboardLayout) == SYSTEM_INFO_ERROR_NONE) {
+ if (inputKeyboardLayout) {
+ deviceCapabilitiesInfo->inputKeyboardLayout = true;
+ free(inputKeyboardLayout);
+ } else {
+ deviceCapabilitiesInfo->inputKeyboardLayout = false;
}
+ } else {
+ LoggerE("get fail inputKeyboardLayout value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboardLayout);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFI)) {
bool wifi = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("wifi : " << wifi);
+ if(system_info_get_platform_bool("tizen.org/feature/network.wifi", &wifi) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->wifi = wifi;
+ } else {
+ LoggerE("get fail wifi value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->wifi);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFIDIRECT)) {
bool wifiDirect = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("wifiDirect : " << wifiDirect);
+ if(system_info_get_platform_bool("tizen.org/feature/network.wifi.direct", &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->wifiDirect = wifiDirect;
+ } else {
+ LoggerE("get fail wifiDirect value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->wifiDirect);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES)) {
- char* openglesVersion = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (openglesVersion!= NULL) {
- LoggerD("openglesVersion : " << openglesVersion);
- deviceCapabilitiesInfo->opengles = true;
- free(openglesVersion);
- }
+ bool opengles = NULL;
+ if(system_info_get_platform_bool("tizen.org/feature/opengles", &opengles) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->opengles = opengles;
+ } else {
+ LoggerE("get fail opengles value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->opengles);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES_TEXTURE_FORMAT)) {
+ bool texture = false;
+ bool data = false;
char* textureFormat = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, &textureFormat) == SYSTEM_INFO_ERROR_NONE) {
- if (textureFormat!= NULL) {
- LoggerD("textureFormat : " << textureFormat);
- deviceCapabilitiesInfo->openglestextureFormat = textureFormat;
- free(textureFormat);
+ char textureFormatFull[MAXBUFSIZE];
+ textureFormatFull[0] = '\0';
+
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.utc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ strcat(textureFormatFull, "utc");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.ptc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ if (data) {
+ strcat(textureFormatFull, " | ");
}
- }
+ strcat(textureFormatFull, "ptc");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.etc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ if (data) {
+ strcat(textureFormatFull, " | ");
+ }
+ strcat(textureFormatFull, "etc");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.3dc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ if (data) {
+ strcat(textureFormatFull, " | ");
+ }
+ strcat(textureFormatFull, "3dc");
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.atc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ if (data) {
+ strcat(textureFormatFull, " | ");
+ }
+ strcat(textureFormatFull, "atc");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.pvrtc", &texture) == SYSTEM_INFO_ERROR_NONE && texture == true) {
+ if (data) {
+ strcat(textureFormatFull, " | ");
+ }
+ strcat(textureFormatFull, "pvrtc");
+ }
+
+ textureFormat = strdup(textureFormatFull);
+
+ if (textureFormat == NULL) {
+ LoggerE("get fail openglestextureFormat value");
+ return JSValueMakeUndefined(context);
+ }
+
+ deviceCapabilitiesInfo->openglestextureFormat = textureFormat;
+ free(textureFormat);
+
return convert.toJSValueRef(deviceCapabilitiesInfo->openglestextureFormat);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION1_1)) {
- char* openglesVersion = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (openglesVersion!= NULL) {
- LoggerD("openglesVersion : " << openglesVersion);
- if (strcmp(openglesVersion, "1.1") == 0) {
- deviceCapabilitiesInfo->openglesVersion1_1 = true;
- } else if (strcmp(openglesVersion, "1.1/2.0") == 0) {
- deviceCapabilitiesInfo->openglesVersion1_1 = true;
- }
- free(openglesVersion);
- }
+ bool openglesVersion1_1 = false;
+ if(system_info_get_platform_bool("tizen.org/feature/opengles.version.1_1", &openglesVersion1_1) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->openglesVersion1_1 = openglesVersion1_1;
+ } else {
+ LoggerE("get fail openglesVersion1_1 value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion1_1);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION2_0)) {
- char* openglesVersion = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (openglesVersion!= NULL) {
- LoggerD("openglesVersion : " << openglesVersion);
- if (strcmp(openglesVersion, "2.0") == 0) {
- deviceCapabilitiesInfo->openglesVersion2_0 = true;
- } else if (strcmp(openglesVersion, "1.1/2.0") == 0) {
- deviceCapabilitiesInfo->openglesVersion2_0 = true;
- }
- free(openglesVersion);
- }
- }
+ bool openglesVersion2_0 = false;
+ if(system_info_get_platform_bool("tizen.org/feature/opengles.version.2_0", &openglesVersion2_0) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->openglesVersion2_0 = openglesVersion2_0;
+ } else {
+ LoggerE("get fail openglesVersion2_0 value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion2_0);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_FMRADIO)) {
bool fmRadio = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("fmRadio : " << fmRadio);
+ if(system_info_get_platform_bool("tizen.org/feature/fmradio", &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->fmRadio = fmRadio;
+ } else {
+ LoggerE("get fail fmRadio value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->fmRadio);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
char* platformVersion = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (platformVersion) {
- LoggerD("platformVersion : " << platformVersion);
- deviceCapabilitiesInfo->platformVersion = platformVersion;
- free(platformVersion);
- }
- }
+ if(system_info_get_platform_string("tizen.org/feature/platform.version", &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->platformVersion = platformVersion;
+ free(platformVersion);
+ } else {
+ LoggerE("get fail platformVersion value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMNAME)) {
char* platformName = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) {
- if (platformName) {
- LoggerD("platformName : " << platformName);
- deviceCapabilitiesInfo->platformName = platformName;
- free(platformName);
- }
- }
+ if(system_info_get_platform_string("tizen.org/system/platform.name", &platformName) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->platformName = platformName;
+ free(platformName);
+ } else {
+ LoggerE("get fail platformName value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformName);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WEBAPIVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
- std::ifstream file("/usr/etc/system-info.ini");
- std::string line;
- std::string webApiVersionMajor = "";
- std::string webApiVersionMinor = "";
-
- if(!file) {
- LoggerD("api/native version info file not found");
- } else {
- while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
- if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) {
- deviceCapabilitiesInfo->webApiVersion = webApiVersionMajor;
- deviceCapabilitiesInfo->webApiVersion += ".";
- deviceCapabilitiesInfo->webApiVersion += webApiVersionMinor;
- LoggerD("web api version : " << deviceCapabilitiesInfo->webApiVersion);
- break;
- }
- }
- file.close();
- }
-
+ char* webApiVersion = NULL;
+ if(system_info_get_platform_string("tizen.org/feature/platform.web.api.version", &webApiVersion) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->webApiVersion = webApiVersion;
+ free(webApiVersion);
+ } else {
+ LoggerE("get fail webApiVersion value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->webApiVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NATIVEAPIVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
- std::ifstream file("/usr/etc/system-info.ini");
- std::string line;
- std::string nativeApiVersionMajor = "";
- std::string nativeApiVersionMinor = "";
-
- if(!file) {
- LoggerD("api/native version info file not found");
- } else {
- while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
- if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) {
- deviceCapabilitiesInfo->nativeApiVersion = nativeApiVersionMajor;
- deviceCapabilitiesInfo->nativeApiVersion += ".";
- deviceCapabilitiesInfo->nativeApiVersion += nativeApiVersionMinor;
- LoggerD("native api version : " << deviceCapabilitiesInfo->nativeApiVersion);
- break;
- }
- }
- file.close();
- }
-
+ char* nativeApiVersion = NULL;
+ if(system_info_get_platform_string("tizen.org/feature/platform.native.api.version", &nativeApiVersion) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->nativeApiVersion = nativeApiVersion;
+ free(nativeApiVersion);
+ } else {
+ LoggerE("get fail nativeApiVersion value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->nativeApiVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONT)) {
bool cameraFront = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("cameraFront : " << cameraFront);
+ if(system_info_get_platform_bool("tizen.org/feature/camera.front", &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->cameraFront = cameraFront;
+ } else {
+ LoggerE("get fail cameraFront value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFront);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERA)) {
- int cameraCount = 0;
- if (system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &cameraCount) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("cameraCount : " << cameraCount);
- if (cameraCount > 0) {
- deviceCapabilitiesInfo->camera = true;
- } else {
- deviceCapabilitiesInfo->camera = false;
- }
+ bool camera = false;
+ if(system_info_get_platform_bool("tizen.org/feature/camera", &camera) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->camera = camera;
+ } else {
+ LoggerE("get fail camera value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->camera);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONTFLASH)) {
bool cameraFrontFlash = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("cameraFrontFlash : " << cameraFrontFlash);
+ if(system_info_get_platform_bool("tizen.org/feature/camera.front.flash", &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->cameraFrontFlash = cameraFrontFlash;
+ } else {
+ LoggerE("get fail cameraFrontFlash value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFrontFlash);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACK)) {
bool cameraBack = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("cameraBack : " << cameraBack);
+ if(system_info_get_platform_bool("tizen.org/feature/camera.back", &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->cameraBack = cameraBack;
+ } else {
+ LoggerE("get fail cameraBack value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBack);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACKFLASH)) {
bool cameraBackFlash = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("cameraBackFlash : " << cameraBackFlash);
+ if(system_info_get_platform_bool("tizen.org/feature/camera.back.flash", &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->cameraBackFlash = cameraBackFlash;
+ } else {
+ LoggerE("get fail cameraBackFlash value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBackFlash);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATION)) {
bool location = false;
- bool locationGps = false;
- bool locationWps = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("locationGps : " << locationGps);
- }
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("locationWps : " << locationWps);
- }
- if (locationGps || locationWps) {
- location = true;
+ if(system_info_get_platform_bool("tizen.org/feature/location", &location) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->location = location;
+ } else {
+ LoggerE("get fail location value");
+ return JSValueMakeUndefined(context);
}
- deviceCapabilitiesInfo->location = location;
return convert.toJSValueRef(deviceCapabilitiesInfo->location);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONGPS)) {
bool locationGps = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("locationGps : " << locationGps);
+ if(system_info_get_platform_bool("tizen.org/feature/location.gps", &locationGps) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->locationGps = locationGps;
+ } else {
+ LoggerE("get fail locationGps value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->locationGps);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONWPS)) {
bool locationWps = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("locationWps : " << locationWps);
+ if(system_info_get_platform_bool("tizen.org/feature/location.wps", &locationWps) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->locationWps = locationWps;
+ } else {
+ LoggerE("get fail locationWps value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->locationWps);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MICROPHONE)) {
bool microphone = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, µphone) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("microphone : " << microphone);
+ if(system_info_get_platform_bool("tizen.org/feature/microphone", µphone) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->microphone = microphone;
+ } else {
+ LoggerE("get fail microphone value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->microphone);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBHOST)) {
bool usbHost = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("usbHost : " << usbHost);
+ if(system_info_get_platform_bool("tizen.org/feature/usb.host", &usbHost) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->usbHost = usbHost;
+ } else {
+ LoggerE("get fail usbHost value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->usbHost);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBACCESSORY)) {
bool usbAccessory = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("usbAccessory : " << usbAccessory);
+ if(system_info_get_platform_bool("tizen.org/feature/usb.accessory", &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->usbAccessory = usbAccessory;
+ } else {
+ LoggerE("get fail usbAccessory value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->usbAccessory);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTRCA)) {
bool screenOutputRca = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("screenOutputRca : " << screenOutputRca);
+ if(system_info_get_platform_bool("tizen.org/feature/screen.output.rca", &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->screenOutputRca = screenOutputRca;
+ } else {
+ LoggerE("get fail screenOutputRca value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputRca);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTHDMI)) {
bool screenOutputHdmi = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("screenOutputHdmi : " << screenOutputHdmi);
+ if(system_info_get_platform_bool("tizen.org/feature/screen.output.hdmi", &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->screenOutputHdmi = screenOutputHdmi;
+ } else {
+ LoggerE("get fail screenOutputHdmi value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputHdmi);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCORECPUARCH)) {
+ bool cpuArch = false;
+ bool data = false;
char* platformCoreCpuArch = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) {
- if (platformCoreCpuArch) {
- LoggerD("platformCoreCpuArch : " << platformCoreCpuArch);
- deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreCpuArch;
- free(platformCoreCpuArch);
+ char platformCoreCpuArchFull[MAXBUFSIZE];
+ platformCoreCpuArchFull[0] = '\0';
+
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv6", &cpuArch) == SYSTEM_INFO_ERROR_NONE && cpuArch == true) {
+ strcat(platformCoreCpuArchFull, "armv6");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv7", &cpuArch) == SYSTEM_INFO_ERROR_NONE && cpuArch == true) {
+ if (data) {
+ strcat(platformCoreCpuArchFull, " | ");
}
+ strcat(platformCoreCpuArchFull, "armv7");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.x86", &cpuArch) == SYSTEM_INFO_ERROR_NONE && cpuArch == true) {
+ if (data) {
+ strcat(platformCoreCpuArchFull, " | ");
+ }
+ strcat(platformCoreCpuArchFull, "x86");
+ }
+
+ platformCoreCpuArch = strdup(platformCoreCpuArchFull);
+
+ if (platformCoreCpuArch == NULL) {
+ LoggerE("get fail platformCoreCpuArch value");
+ return JSValueMakeUndefined(context);
}
+
+ deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreCpuArch;
+ free(platformCoreCpuArch);
+
return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreCpuArch);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCOREFPUARCH)) {
+ bool fpuArch = false;
+ bool data = true;
char* platformCoreFpuArch = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) {
- if (platformCoreFpuArch) {
- LoggerD("platformCoreFpuArch : " << platformCoreFpuArch);
- deviceCapabilitiesInfo->platformCoreFpuArch = platformCoreFpuArch;
- free(platformCoreFpuArch);
+ char platformCoreFpuArchFull[MAXBUFSIZE];
+ platformCoreFpuArchFull[0] = '\0';
+
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.sse2", &fpuArch) == SYSTEM_INFO_ERROR_NONE && fpuArch == true) {
+ data = true;
+ strcat(platformCoreFpuArchFull, "sse2");
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.sse3", &fpuArch) == SYSTEM_INFO_ERROR_NONE && fpuArch == true) {
+ if(data) {
+ strcat(platformCoreFpuArchFull, " | ");
+ }
+ strcat(platformCoreFpuArchFull, "sse3");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.ssse3", &fpuArch) == SYSTEM_INFO_ERROR_NONE && fpuArch == true) {
+ if(data) {
+ strcat(platformCoreFpuArchFull, " | ");
+ }
+ strcat(platformCoreFpuArchFull, "ssse3");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.vfpv2", &fpuArch) == SYSTEM_INFO_ERROR_NONE && fpuArch == true) {
+ if(data) {
+ strcat(platformCoreFpuArchFull, " | ");
}
+ strcat(platformCoreFpuArchFull, "vfpv2");
+ data = true;
+ }
+ if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.vfpv3", &fpuArch) == SYSTEM_INFO_ERROR_NONE && fpuArch == true) {
+ if(data) {
+ strcat(platformCoreFpuArchFull, " | ");
+ }
+ strcat(platformCoreFpuArchFull, "vfpv3");
+ }
+ platformCoreFpuArch = strdup(platformCoreFpuArchFull);
+
+ if (platformCoreFpuArch == NULL) {
+ LoggerE("get fail platformCoreFpuArch value");
+ return JSValueMakeUndefined(context);
}
+
+ deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreFpuArch;
+ free(platformCoreFpuArch);
+
return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreFpuArch);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SIPVOIP)) {
bool sipVoip = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("sipVoip : " << sipVoip);
+ if(system_info_get_platform_bool("tizen.org/feature/sip.voip", &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->sipVoip = sipVoip;
+ } else {
+ LoggerE("get fail sipVoip value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
- char* duid = NULL;
- if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) {
- if (duid) {
+ FILE *fp = NULL;
+ char duid[DUID_BUFFER_SIZE] = {0,};
+ fp = fopen("/opt/usr/etc/system_info_cache.ini", "r");
+
+ if(fp == NULL) {
+ LoggerD("fail file open.");
+ return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
+ }
+
+ while(fgets(duid, DUID_BUFFER_SIZE-1, fp)) {
+ if (strncmp(duid, "http://tizen.org/system/duid", DUID_KEY_STRING) == 0) {
LoggerD("duid : " << duid);
- deviceCapabilitiesInfo->duid = duid;
- free(duid);
+ deviceCapabilitiesInfo->duid = duid;
+ break;
}
}
+ fclose(fp);
return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) {
bool speechRecognition = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("speechRecognition : " << speechRecognition);
+ if(system_info_get_platform_bool("tizen.org/feature/speech.recognition", &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->speechRecognition = speechRecognition;
+ } else {
+ LoggerE("get fail speechRecognition value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->speechRecognition);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_SYNTHESIS)) {
- void* handle = dlopen("/usr/lib/libtts.so",RTLD_NOW);
- if(handle!=NULL) {
- deviceCapabilitiesInfo->speechSynthesis = true;
+ bool speechSynthesis = false;
+ if(system_info_get_platform_bool("tizen.org/feature/speech.synthesis", &speechSynthesis) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->speechSynthesis = speechSynthesis;
} else {
- deviceCapabilitiesInfo->speechSynthesis = false;
+ LoggerE("get fail speechSynthesis value");
+ return JSValueMakeUndefined(context);
}
- LoggerD("speechSynthesis : " << deviceCapabilitiesInfo->speechSynthesis);
return convert.toJSValueRef(deviceCapabilitiesInfo->speechSynthesis);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER)) {
- bool isAccelerometer = false;
- if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) {
- LoggerD("accelerometer : " << isAccelerometer);
- deviceCapabilitiesInfo->accelerometer = isAccelerometer;
+ bool accelerometer = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.accelerometer", &accelerometer) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->accelerometer = accelerometer;
+ } else {
+ LoggerE("get fail accelerometer value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER_WAKEUP)) {
- bool isAccelerometerWakeup = false;
- if (sensor_awake_is_supported(SENSOR_ACCELEROMETER, &isAccelerometerWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isAccelerometerWakeup : " << isAccelerometerWakeup);
- deviceCapabilitiesInfo->accelerometerWakeup = isAccelerometerWakeup;
+ bool accelerometerWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.accelerometer.wakeup", &accelerometerWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->accelerometerWakeup = accelerometerWakeup;
+ } else {
+ LoggerE("get fail accelerometerWakeup value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER)) {
- bool isBarometer = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("barometer : " << isBarometer);
- deviceCapabilitiesInfo->barometer = isBarometer;
+ bool barometer = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.barometer", &barometer) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->barometer = barometer;
+ } else {
+ LoggerE("get fail barometer value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->barometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER_WAKEUP)) {
+ bool barometerWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.barometer.wakeup", &barometerWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->barometerWakeup = barometerWakeup;
+ } else {
+ LoggerE("get fail barometerWakeup value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->barometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE)) {
- bool isGyroscope = false;
- if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) {
- LoggerD("gyroscope : " << isGyroscope);
- deviceCapabilitiesInfo->gyroscope = isGyroscope;
+ bool gyroscope = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.gyroscope", &gyroscope) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->gyroscope = gyroscope;
+ } else {
+ LoggerE("get fail gyroscope value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscope);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE_WAKEUP)) {
- bool isGyroscopeWakeup = false;
- if (sensor_awake_is_supported(SENSOR_GYROSCOPE, &isGyroscopeWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isGyroscopeWakeup : " << isGyroscopeWakeup);
- deviceCapabilitiesInfo->gyroscopeWakeup = isGyroscopeWakeup;
+ bool gyroscopeWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.gyroscope.wakeup", &gyroscopeWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->gyroscopeWakeup = gyroscopeWakeup;
+ } else {
+ LoggerE("get fail gyroscopeWakeup value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscopeWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER)) {
- bool isMagnetometer = false;
- if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) {
- LoggerD("magnetometer : " << isMagnetometer);
- deviceCapabilitiesInfo->magnetometer = isMagnetometer;
+ bool magnetometer = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.magnetometer", &magnetometer) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->magnetometer = magnetometer;
+ } else {
+ LoggerE("get fail magnetometer value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER_WAKEUP)) {
- bool isMagnetometerWakeup = false;
- if (sensor_awake_is_supported(SENSOR_MAGNETIC, &isMagnetometerWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isMagnetometerWakeup : " << isMagnetometerWakeup);
- deviceCapabilitiesInfo->magnetometerWakeup = isMagnetometerWakeup;
+ bool magnetometerWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.magnetometer.wakeup", &magnetometerWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->magnetometerWakeup = magnetometerWakeup;
+ } else {
+ LoggerE("get fail magnetometerWakeup value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PHOTOMETER)) {
- bool isPhotometer = false;
- if (sensor_is_supported(SENSOR_LIGHT, &isPhotometer) == SENSOR_ERROR_NONE) {
- LoggerD("isPhotometer : " << isPhotometer);
- deviceCapabilitiesInfo->photometer = isPhotometer;
- }
+ bool photometer = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.photometer", &photometer) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->photometer = photometer;
+ } else {
+ LoggerE("get fail photometer value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->photometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PHOTOMETER_WAKEUP)) {
- bool isphotometerWakeup = false;
- if (sensor_awake_is_supported(SENSOR_LIGHT, &isphotometerWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isphotometerWakeup : " << isphotometerWakeup);
- deviceCapabilitiesInfo->photometerWakeup = isphotometerWakeup;
- }
+ bool photometerWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.photometer.wakeup", &photometerWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->photometerWakeup = photometerWakeup;
+ } else {
+ LoggerE("get fail photometerWakeup value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->photometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY)) {
- bool isProximity = false;
- if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) {
- LoggerD("proximity : " << isProximity);
- deviceCapabilitiesInfo->proximity = isProximity;
+ bool proximity = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.proximity", &proximity) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->proximity = proximity;
+ } else {
+ LoggerE("get fail proximity value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->proximity);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY_WAKEUP)) {
- bool isProximityWakeup = false;
- if (sensor_awake_is_supported(SENSOR_PROXIMITY, &isProximityWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isProximityWakeup : " << isProximityWakeup);
- deviceCapabilitiesInfo->proximityWakeup = isProximityWakeup;
- }
+ bool proximityWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.proximity.wakeup", &proximityWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->proximityWakeup = proximityWakeup;
+ } else {
+ LoggerE("get fail proximityWakeup value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->proximityWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_TILTMETER)) {
- bool isTiltmeter = false;
- if (sensor_is_supported(SENSOR_MOTION_TILT, &isTiltmeter) == SENSOR_ERROR_NONE) {
- LoggerD("isTiltmeter : " << isTiltmeter);
- deviceCapabilitiesInfo->tiltmeter = isTiltmeter;
- }
+ bool tiltmeter = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.tiltmeter", &tiltmeter) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->tiltmeter = tiltmeter;
+ } else {
+ LoggerE("get fail tiltmeter value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->tiltmeter);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_TILTMETER_WAKEUP)) {
- bool isTiltmeterWakeup = false;
- if (sensor_awake_is_supported(SENSOR_MOTION_TILT, &isTiltmeterWakeup) == SENSOR_ERROR_NONE) {
- LoggerD("isTiltmeterWakeup : " << isTiltmeterWakeup);
- deviceCapabilitiesInfo->tiltmeterWakeup = isTiltmeterWakeup;
- }
+ bool tiltmeterWakeup = false;
+ if(system_info_get_platform_bool("tizen.org/feature/sensor.tiltmeter.wakeup", &tiltmeterWakeup) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->tiltmeterWakeup = tiltmeterWakeup;
+ } else {
+ LoggerE("get fail tiltmeterWakeup value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->tiltmeterWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DATA_ENCRYPTION)) {
- void* handle = dlopen("/usr/lib/libsqlite3.so.0",RTLD_NOW);
- if(handle != NULL) {
- deviceCapabilitiesInfo->dataEncryption = true;
+ bool dataEncryption = false;
+ if(system_info_get_platform_bool("tizen.org/feature/database.encryption", &dataEncryption) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->dataEncryption = dataEncryption;
} else {
- deviceCapabilitiesInfo->dataEncryption = false;
+ LoggerE("get fail dataEncryption value");
+ return JSValueMakeUndefined(context);
}
- LoggerD("dataEncryption : " << deviceCapabilitiesInfo->dataEncryption);
return convert.toJSValueRef(deviceCapabilitiesInfo->dataEncryption);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GRAPHICS_ACCELERATION)) {
- bool isGraphicsAccelerationSupported = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_GRAPHICS_HWACCEL_SUPPORTED , &isGraphicsAccelerationSupported) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("graphicsAcceleration : " << isGraphicsAccelerationSupported);
- deviceCapabilitiesInfo->graphicsAcceleration = isGraphicsAccelerationSupported;
+ bool graphicsAcceleration = false;
+ if(system_info_get_platform_bool("tizen.org/feature/graphics.acceleration", &graphicsAcceleration) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->graphicsAcceleration = graphicsAcceleration;
+ } else {
+ LoggerE("get fail graphicsAcceleration value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->graphicsAcceleration);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PUSH)) {
- deviceCapabilitiesInfo->push = isExist("/usr/bin/pushd");
- LoggerD("push : " << deviceCapabilitiesInfo->push);
+ bool push = false;
+ if(system_info_get_platform_bool("tizen.org/feature/network.push", &push) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->push = push;
+ } else {
+ LoggerE("get fail push value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->push);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_TELEPHONY)) {
- deviceCapabilitiesInfo->telephony = isExist("/usr/bin/telephony-daemon");
- LoggerD("telephony : " << deviceCapabilitiesInfo->telephony);
+ bool telephony = false;
+ if(system_info_get_platform_bool("tizen.org/feature/network.telephony", &telephony) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->telephony = telephony;
+ } else {
+ LoggerE("get fail telephony value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->telephony);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_TELEPHONY_MMS)) {
bool telephonyMms = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_MMS_SUPPORTED, &telephonyMms) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("telephonyMms : " << telephonyMms);
+ if(system_info_get_platform_bool("tizen.org/feature/network.telephony.mms", &telephonyMms) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->telephonyMms = telephonyMms;
+ } else {
+ LoggerE("get fail telephonyMms value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->telephonyMms);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_TELEPHONY_SMS)) {
bool telephonySms = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_SMS_SUPPORTED, &telephonySms) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("telephonySms : " << telephonySms);
+ if(system_info_get_platform_bool("tizen.org/feature/network.telephony.sms", &telephonySms) == SYSTEM_INFO_ERROR_NONE) {
deviceCapabilitiesInfo->telephonySms = telephonySms;
+ } else {
+ LoggerE("get fail telephonySms value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->telephonySms);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENSIZE_NORMAL)) {
- deviceCapabilitiesInfo->screenSizeNormal = getRegistry("screen.coordinate_system.size.normal");
- LoggerD("screenSizeNormal : " << deviceCapabilitiesInfo->screenSizeNormal);
+ bool screenSizeNormal = false;
+ if(system_info_get_platform_bool("tizen.org/feature/screen.size.normal", &screenSizeNormal) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->screenSizeNormal = screenSizeNormal;
+ } else {
+ LoggerE("get fail screenSizeNormal value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->screenSizeNormal);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENSIZE_480_800)) {
- deviceCapabilitiesInfo->screenSize480_800 = getRegistry("screen.coordinate_system.physical.normal_480x800");
- LoggerD("screenSize480_800 : " << deviceCapabilitiesInfo->screenSize480_800);
+ bool screenSize480_800 = false;
+ if(system_info_get_platform_bool("tizen.org/feature/screen.size.normal.480.800", &screenSize480_800) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->screenSize480_800 = screenSize480_800;
+ } else {
+ LoggerE("get fail screenSize480_800 value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->screenSize480_800);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENSIZE_720_1280)) {
- deviceCapabilitiesInfo->screenSize720_1280 = getRegistry("screen.coordinate_system.physical.normal_720x1280");
- LoggerD("screenSize720_1280 : " << deviceCapabilitiesInfo->screenSize720_1280);
+ bool screenSize720_1280 = false;
+ if(system_info_get_platform_bool("tizen.org/feature/screen.size.normal.720.1280", &screenSize720_1280) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->screenSize720_1280 = screenSize720_1280;
+ } else {
+ LoggerE("get fail screenSize720_1280 value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->screenSize720_1280);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_AUTO_ROTATION)) {
- bool isAutoRotation = false;
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FEATURE_AUTO_ROTATION_SUPPORTED, &isAutoRotation) == SYSTEM_INFO_ERROR_NONE) {
- LoggerD("auto rotation : " << isAutoRotation);
- deviceCapabilitiesInfo->autoRotation = isAutoRotation;
+ bool autoRotation = false;
+ if(system_info_get_platform_bool("tizen.org/feature/screen.auto_rotation", &autoRotation) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->autoRotation = autoRotation;
+ } else {
+ LoggerE("get fail autoRotation value");
+ return JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->autoRotation);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SHELL_APP_WIDGET)) {
- bool isShellAppWidgetSupported = false;
- pkgmgrinfo_pkginfo_h handle;
- if (pkgmgrinfo_pkginfo_get_pkginfo("gi2qxenosh",&handle) == PMINFO_R_OK) {
- isShellAppWidgetSupported = true;
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- LoggerD("shellAppWidget : " << isShellAppWidgetSupported);
- }
- deviceCapabilitiesInfo->shellAppWidget = isShellAppWidgetSupported;
+ bool shellAppWidget = false;
+ if(system_info_get_platform_bool("tizen.org/feature/shell.appwidget", &shellAppWidget) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->shellAppWidget = shellAppWidget;
+ } else {
+ LoggerE("get fail shellAppWidget value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->shellAppWidget);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_VISION_IMAGE_RECOGNITION)) {
- deviceCapabilitiesInfo->visionImageRecognition = isExist("/usr/lib/osp/libarengine.so");
- LoggerD("visionImageRecognition : " << deviceCapabilitiesInfo->visionImageRecognition);
+ bool visionImageRecognition = false;
+ if(system_info_get_platform_bool("tizen.org/feature/vision.image_recognition", &visionImageRecognition) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->visionImageRecognition = visionImageRecognition;
+ } else {
+ LoggerE("get fail visionImageRecognition value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->visionImageRecognition);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_VISION_QRCODE_GENERATION)) {
- deviceCapabilitiesInfo->visionQrcodeGeneration = isExist("/usr/lib/osp/libarengine.so");
- LoggerD("visionQrcodeGeneration : " << deviceCapabilitiesInfo->visionQrcodeGeneration);
+ bool visionQrcodeGeneration = false;
+ if(system_info_get_platform_bool("tizen.org/feature/vision.qrcode_generation", &visionQrcodeGeneration) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->visionQrcodeGeneration = visionQrcodeGeneration;
+ } else {
+ LoggerE("get fail visionQrcodeGeneration value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->visionQrcodeGeneration);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_VISION_QRCODE_RECOGNITION)) {
- deviceCapabilitiesInfo->visionQrcodeRecognition = isExist("/usr/lib/osp/libarengine.so");
- LoggerD("visionQrcodeRecognition : " << deviceCapabilitiesInfo->visionQrcodeRecognition);
+ bool visionQrcodeRecognition = false;
+ if(system_info_get_platform_bool("tizen.org/feature/vision.qrcode_recognition", &visionQrcodeRecognition) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->visionQrcodeRecognition = visionQrcodeRecognition;
+ } else {
+ LoggerE("get fail visionQrcodeRecognition value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->visionQrcodeRecognition);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_VISION_FACE_RECOGNITION)) {
- deviceCapabilitiesInfo->visionFaceRecognition = isExist("/usr/lib/osp/libarengine.so");
- LoggerD("visionFaceRecognition : " << deviceCapabilitiesInfo->visionFaceRecognition);
+ bool visionFaceRecognition = false;
+ if(system_info_get_platform_bool("tizen.org/feature/vision.face_recognition", &visionFaceRecognition) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->visionFaceRecognition = visionFaceRecognition;
+ } else {
+ LoggerE("get fail visionFaceRecognition value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->visionFaceRecognition);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SECURE_ELEMENT)) {
- deviceCapabilitiesInfo->secureElement = isExist("/usr/bin/smartcard-daemon");
- LoggerD("secureElement : " << deviceCapabilitiesInfo->secureElement);
+ bool secureElement = false;
+ if(system_info_get_platform_bool("tizen.org/feature/network.secure_element", &secureElement) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->secureElement = secureElement;
+ } else {
+ LoggerE("get fail secureElement value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->secureElement);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NATIVE_OSP_COMPATIBLE)) {
- deviceCapabilitiesInfo->nativeOspCompatible = getRegistry("platform.native.osp_compatible");
- LoggerD("nativeOspCompatible : " << deviceCapabilitiesInfo->nativeOspCompatible);
+ bool nativeOspCompatible = false;
+ if(system_info_get_platform_bool("tizen.org/feature/platform.native.osp_compatible", &nativeOspCompatible) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->nativeOspCompatible = nativeOspCompatible;
+ } else {
+ LoggerE("get fail nativeOspCompatible value");
+ return JSValueMakeUndefined(context);
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->nativeOspCompatible);
+ } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROFILE)) {
+ deviceCapabilitiesInfo->profile = DEVICE_PROFILE;
+ return convert.toJSValueRef(deviceCapabilitiesInfo->profile);
}
}
Catch(Exception)
{
LoggerE("Exception: " << _rethrown_exception.GetMessage());
+ JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR);
}
return JSValueMakeUndefined(context);
}
-bool JSDeviceCapabilitiesInfo::isExist(const char* path)
-{
- if (0 == access(path ,F_OK))
- return true;
- return false;
-}
-
-bool JSDeviceCapabilitiesInfo::getRegistry(std::string key)
-{
- std::ifstream file("/usr/etc/system-info.ini");
- std::string line;
- std::string _key;
- _key.append(key);
- _key.append("=(\\w+)");
- std::string value = "";
- bool ret = false;
-
- if(!file) {
- LoggerD("Registry file not found");
- } else {
- while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
- if (pcrecpp::RE(_key).PartialMatch(line, &value)) {
- LoggerD("Key[" << key << "] : " << value; );
- if(0==value.compare("true")) {
- ret = true;
- } else {
- ret = false;
- }
- break;
- }
- }
- file.close();
- }
- return ret;
-}
-
}
}