//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
* @file FSys_SystemInfoImpl.cpp
* @brief This is the implementation file for _SystemInfoImpl class.
*/
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <media/sound_manager.h>
-#include <sim.h>
-#include <sensor.h>
-#include <sensors.h>
+#include <unique_ptr.h>
+#include <unistd.h>
+
#include <system_info.h>
-#include <telephony_network.h>
-#include <locations.h>
+#include <ITapiModem.h>
-#include <FBaseColIMapEnumerator.h>
+#include <FBaseBoolean.h>
#include <FBaseInteger.h>
-#include <FBaseSysLog.h>
+#include <FBaseColHashMap.h>
#include <FBaseUtilStringUtil.h>
-#include <FBaseUtilStringTokenizer.h>
#include <FIoRegistry.h>
-#include <FSysIDeviceEventListener.h>
-#include <FSysIScreenEventListener.h>
-#include <FSysIChargingEventListener.h>
-#include <FSysIBatteryEventListener.h>
#include <FBase_NativeError.h>
+#include <FBase_StringConverter.h>
#include <FIo_RegistryImpl.h>
-#include <FSys_DeviceId.h>
#include <FSys_SystemInfoImpl.h>
+#include <FIo_AppServiceIpcMessages.h>
+#include <FIo_IpcClient.h>
+
+#include "FSys_Types.h"
+#include "FSys_SystemClient.h"
+#include "FSys_CommunicationDispatcherClient.h"
+
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Utility;
using namespace Tizen::Io;
+using namespace Tizen::Base::Utility;
namespace Tizen { namespace System
{
-static const wchar_t* _REGISTRY_PATH = L"/usr/etc/system-info.ini";
-static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInfo";
+static const wchar_t* _REGISTRY_PATH = L"/opt/usr/etc/system_info_cache.ini";
+static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInformation";
//Bluetooth
static const wchar_t* _BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
static const wchar_t* _BLUETOOTH_SUPPORTED = L"BluetoothSupported";
//Camera
-static const wchar_t* _CAMERA = L"http://tizen.org/feature/camera";
+
static const wchar_t* _CAMERA_FRONT = L"http://tizen.org/feature/camera.front";
-static const wchar_t* _CAMERA_FRONT_FLASH = L"http://tizen.org/feature/camera.front.flash";
+
static const wchar_t* _CAMERA_BACK = L"http://tizen.org/feature/camera.back";
-static const wchar_t* _CAMERA_BACK_FLASH = L"http://tizen.org/feature/camera.back.flash";
-static const wchar_t* _CAMERA_COUNT = L"CameraCount";
-//Database
-static const wchar_t* _DATABASE_ENCRYPTION = L"http://tizen.org/feature/database.encryption";
-static const char* _DATABASE_LIBRARY_PATH = "/usr/lib/libsqlite3.so.0";
-static const char* _DATABASE_ENCRYPTION_SYMBOL = "sqlite3_key";
+static const wchar_t* _CAMERA_COUNT = L"CameraCount";
//DUID
static const wchar_t* _DUID = L"http://tizen.org/system/duid";
//Keyboard
static const wchar_t* _KEYBOARD_TYPE = L"KeyboardType";
-static const wchar_t* _INPUT_KEYBOARD = L"http://tizen.org/feature/input.keyboard";
static const wchar_t* _INPUT_KEYBOARD_LAYOUT = L"http://tizen.org/feature/input.keyboard.layout";
//Location
-static const wchar_t* _LOCATION = L"http://tizen.org/feature/location";
static const wchar_t* _GPS_SUPPORTED = L"GPSSupported";
static const wchar_t* _LOCATION_GPS = L"http://tizen.org/feature/location.gps";
static const wchar_t* _WPS_SUPPORTED = L"WPSSupported";
static const wchar_t* _LOCATION_WPS = L"http://tizen.org/feature/location.wps";
-//Microphone
-static const wchar_t* _MICROPHONE = L"http://tizen.org/feature/microphone";
-
//Model name
static const wchar_t* _MODELNAME = L"http://tizen.org/system/model_name";
static const wchar_t* _MODEL_NAME = L"ModelName";
static const wchar_t* _MULTIPOINT_TOUCH_COUNT = L"MultiPointTouchCount";
//NFC
-static const wchar_t* _NFC = L"http://tizen.org/feature/nfc";
static const wchar_t* _NETWORK_NFC = L"http://tizen.org/feature/network.nfc";
static const wchar_t* _NFC_SUPPORTED = L"NFCSupported";
//Opengles
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_UTC = L"http://tizen.org/feature/opengles.texture_format.utc";
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_PTC = L"http://tizen.org/feature/opengles.texture_format.ptc";
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_ETC = L"http://tizen.org/feature/opengles.texture_format.etc";
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_3DC = L"http://tizen.org/feature/opengles.texture_format.3dc";
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_ATC = L"http://tizen.org/feature/opengles.texture_format.atc";
-static const wchar_t* _OPENGLES_TEXTUREFORMAT_PVRTC = L"http://tizen.org/feature/opengles.texture_format.pvrtc";
-
static const wchar_t* _OPENGLES_VERSION_1_1 = L"http://tizen.org/feature/opengles.version.1_1";
static const wchar_t* _OPENGLES_VERSION_2_0 = L"http://tizen.org/feature/opengles.version.2_0";
static const wchar_t* _OPENGL_ES_VERSION = L"OpenGLESVersion";
-//Platform name
-static const wchar_t* _PLATFORM_NAME = L"http://tizen.org/system/platform.name";
-
-//CPU
-static const wchar_t* _PLATFORM_CORE_CPU_ARCH_ARMV6 = L"http://tizen.org/feature/platform.core.cpu.arch.armv6";
-static const wchar_t* _PLATFORM_CORE_CPU_ARCH_ARMV7 = L"http://tizen.org/feature/platform.core.cpu.arch.armv7";
-static const wchar_t* _PLATFORM_CORE_CPU_ARCH_X86 = L"http://tizen.org/feature/platform.core.cpu.arch.x86";
-
-//FPU
-static const wchar_t* _PLATFORM_CORE_FPU_ARCH_VFPV2 = L"http://tizen.org/feature/platform.core.fpu.arch.vfpv2";
-static const wchar_t* _PLATFORM_CORE_FPU_ARCH_VFPV3 = L"http://tizen.org/feature/platform.core.fpu.arch.vfpv3";
-static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSE2 = L"http://tizen.org/feature/platform.core.fpu.arch.sse2";
-static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSE3 = L"http://tizen.org/feature/platform.core.fpu.arch.sse3";
-static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSSE3 = L"http://tizen.org/feature/platform.core.fpu.arch.ssse3";
-
// Screen
static const wchar_t* _SCREEN_BPP = L"http://tizen.org/feature/screen.bpp";
static const wchar_t* _SCREEN_BITS_PER_PIXEL = L"ScreenBitsPerPixel";
-static const wchar_t* _SCREEN_DESKTOPMODE = L"http://tizen.org/feature/screen.desktop_mode";
static const wchar_t* _SCREEN_DPI = L"http://tizen.org/feature/screen.dpi";
static const wchar_t* _SCREEN_HEIGHT = L"http://tizen.org/feature/screen.height";
static const wchar_t* _SCREENHEIGHT = L"ScreenHeight";
static const wchar_t* _SCREENDPI = L"ScreenDPI";
//HDMI RCA
-static const wchar_t* _SCREEN_OUTPUT_HDMI = L"http://tizen.org/feature/screen.output.hdmi";
static const wchar_t* _SCREEN_OUTPUT_RCA = L"http://tizen.org/feature/screen.output.rca";
static const wchar_t* _TV_OUT_SUPPORTED = L"TvOutSupported";
-//Sensors
-static const wchar_t* _SENSOR_ACCELEROMETER = L"http://tizen.org/feature/sensor.accelerometer";
-static const wchar_t* _SENSOR_ACCELEROMETER_WAKEUP = L"http://tizen.org/feature/sensor.accelerometer.wakeup";
-static const wchar_t* _SENSOR_BAROMETER = L"http://tizen.org/feature/sensor.barometer";
-static const wchar_t* _SENSOR_BAROMETER_WAKEUP = L"http://tizen.org/feature/sensor.barometer.wakeup";
-static const wchar_t* _SENSOR_MAGNETOMETER = L"http://tizen.org/feature/sensor.magnetometer";
-static const wchar_t* _SENSOR_MAGNETOMETER_WAKEUP = L"http://tizen.org/feature/sensor.magnetometer.wakeup";
-static const wchar_t* _SENSOR_GYROSCOPE = L"http://tizen.org/feature/sensor.gyroscope";
-static const wchar_t* _SENSOR_GYROSCOPE_WAKEUP = L"http://tizen.org/feature/sensor.gyroscope.wakeup";
-static const wchar_t* _SENSOR_PHOTOMETER = L"http://tizen.org/feature/sensor.photometer";
-static const wchar_t* _SENSOR_PHOTOMETER_WAKEUP = L"http://tizen.org/feature/sensor.photometer.wakeup";
-static const wchar_t* _SENSOR_TILTMETER = L"http://tizen.org/feature/sensor.tiltmeter";
-static const wchar_t* _SENSOR_TILTMETER_WAKEUP = L"http://tizen.org/feature/sensor.tiltmeter.wakeup";
-static const wchar_t* _SENSOR_PROXIMITY = L"http://tizen.org/feature/sensor.proximity";
-static const wchar_t* _SENSOR_PROXIMITY_WAKEUP = L"http://tizen.org/feature/sensor.proximity.wakeup";
-
-//VOIP
-static const wchar_t* _SIP_VOIP = L"http://tizen.org/feature/sip.voip";
-
//Sound
static const wchar_t* _SOUND_MEDIA_VOLUME_MAX = L"http://tizen.org/system/sound.media.volume.resolution.max";
static const wchar_t* _MAX_MEDIA_SOUND_VOLUME = L"MaxMediaSoundVolume";
static const wchar_t* _SOUND_SYSTEM_VOLUME_MAX = L"http://tizen.org/system/sound.system.volume.resolution.max";
static const wchar_t* _MAX_SYSTEM_SOUND_VOLUME = L"MaxSystemSoundVolume";
-//Speech Recognition
-static const wchar_t* _SPEECH_RECOGNITION = L"http://tizen.org/feature/speech.recognition";
-
//Telephony
static const wchar_t* _TELEPHONY = L"http://tizen.org/feature/network.telephony";
static const wchar_t* _TELEPHONY_SERVICE_GSM = L"http://tizen.org/feature/network.telephony.service.gsm";
static const wchar_t* _TELEPHONY_SERVICE_CDMA = L"http://tizen.org/feature/network.telephony.service.cdma";
static const wchar_t* _NETWORK_TYPE = L"NetworkType";
static const wchar_t* _NETWORK_EMERGENCY = L"Emergency";
-
-//USB
-static const wchar_t* _USB_HOST = L"http://tizen.org/feature/usb.host";
-static const wchar_t* _USB_ACCESSORY = L"http://tizen.org/feature/usb.accessory";
+static const wchar_t* _NETWORK_NO_SERVICE = L"NoService";
//WIFI
static const wchar_t* _WIFI = L"http://tizen.org/feature/network.wifi";
static const wchar_t* _WIFI_SUPPORTED = L"WiFiSupported";
-static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported";
static const wchar_t* _WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct";
+static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported";
//Version
static const wchar_t* _PLATFORM_VERSION = L"http://tizen.org/feature/platform.version";
static const wchar_t* _PLATFORM_NATIVE_API_VERSION = L"http://tizen.org/feature/platform.native.api.version";
static const wchar_t* _PLATFORM_WEB_API_VERSION = L"http://tizen.org/feature/platform.web.api.version";
+static const wchar_t* _BUILD_STRING = L"http://tizen.org/system/build.string";
static const wchar_t* _WAC_VERSION = L"WACVersion";
static const wchar_t* _SUPPORTED = L"Supported";
static const wchar_t* _UNSUPPORTED = L"Unsupported";
-result
-_SystemInfoImpl::GetSysInfo(const String& key, String& value)
-{
- int ret = 0;
- result r = E_SYSTEM;
- char* pValue = null;
-
- if (key == _NETWORK_TYPE)
- {
- sim_state_e simState;
- ret = sim_get_state(&simState);
-
- SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "Failed to get the SIM state");
-
- if (simState == SIM_STATE_UNAVAILABLE)
- {
- value.Append(_NETWORK_EMERGENCY);
- return E_SUCCESS;
- }
-
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_NETWORK_TYPE, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_NETWORK_TYPE\"failed");
+static bool firstRequest = false;
+static HashMap integerList(SingleObjectDeleter);
+static HashMap boolList(SingleObjectDeleter);
+static HashMap stringList(SingleObjectDeleter);
- if(pValue == null)
- {
- value.Clear();
- return E_SUCCESS;
- }
-
- r = StringUtil::Utf8ToString(pValue, value);
- SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- }
- else if (key == _DEVICE_ID || key == _DUID)
+void
+PrepareCache(void)
+{
+ if(firstRequest == false)
{
- r = _DeviceId::GetId(value);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Failed to get the key[%ls]", key.GetPointer());
- return E_SUCCESS;
+ integerList.Construct();
+ boolList.Construct();
+ stringList.Construct();
+ firstRequest = true;
}
- else if (key == _MODEL_NAME || key == _MODELNAME)
- {
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pValue, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_MODEL");
+}
- r = StringUtil::Utf8ToString(pValue, value);
- SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- }
- else if (key == _OPENGL_ES_VERSION)
- {
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pValue, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT\"failed");
+String
+_SystemInfoImpl::ConvertToTizen(const String& key)
+{
+ String code(key);
- r = StringUtil::Utf8ToString(pValue, value);
- SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- }
- else if (key == _KEYBOARD_TYPE || key == _INPUT_KEYBOARD_LAYOUT)
+ if(code == _DEVICE_ID)
{
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_KEYBOARD_TYPE\"failed");
-
- if(pValue == null)
- {
- value.Clear();
- return E_SUCCESS;
- }
-
- r = StringUtil::Utf8ToString(pValue, value);
- SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
-
- if(key == _INPUT_KEYBOARD_LAYOUT)
- {
- value.ToLowerCase();
- }
+ code = _DUID;
}
- else if (key == _WAC_VERSION)
+ else if(code == _MODEL_NAME)
{
- value = "";
- return E_SUCCESS;
+ code = _MODELNAME;
}
- else if (key == _BLUETOOTH_SUPPORTED)
+ else if(code == _KEYBOARD_TYPE)
{
- value.Clear();
- bool bluetoothSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetoothSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__BLUETOOTH_SUPPORTED");
- if(bluetoothSupported == true)
- {
- value = _SUPPORTED;
- }
- else
- {
- value = _UNSUPPORTED;
- }
-
- r = E_SUCCESS;
+ code = _INPUT_KEYBOARD_LAYOUT;
}
- else if (key == _GPS_SUPPORTED)
+ else if(code == _SCREEN_BITS_PER_PIXEL)
{
- value.Clear();
- bool gpsSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__GPS_SUPPORTED");
- if(gpsSupported == true)
- {
- value = _SUPPORTED;
- }
- else
- {
- value = _UNSUPPORTED;
- }
- r = E_SUCCESS;
+ code = _SCREEN_BPP;
}
- else if (key == _WIFI_SUPPORTED)
+ else if(code == _SCREENHEIGHT)
{
- value.Clear();
- bool wiFiSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wiFiSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__WIFI_SUPPORTED");
- if(wiFiSupported == true)
- {
- value = _SUPPORTED;
- }
- else
- {
- value = _UNSUPPORTED;
- }
- r = E_SUCCESS;
- }
- else if (key == _PLATFORM_VERSION)
- {
- char* pPlatformVersion = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &pPlatformVersion);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_PLATFORM_NAME\"failed");
-
- r = StringUtil::Utf8ToString(pPlatformVersion, value);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- free(pPlatformVersion);
- return r;
-
- }
- else if (key == _PLATFORM_NAME)
- {
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_PLATFORM_NAME\"failed");
-
- r = StringUtil::Utf8ToString(pValue, value);
- SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
+ code = _SCREEN_HEIGHT;
}
- else if (key == _PLATFORM_NATIVE_API_VERSION)
+ else if(code == _SCREENWIDTH)
{
- return E_OBJ_NOT_FOUND;
+ code = _SCREEN_WIDTH;
}
- else if (key == _PLATFORM_WEB_API_VERSION)
+ else if(code == _SCREENDPI)
{
- return E_OBJ_NOT_FOUND;
+ code = _SCREEN_DPI;
}
- else
+ else if(code == _MAX_SYSTEM_SOUND_VOLUME)
{
- r = GetFromRegistry(key, value);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
- return E_SUCCESS;
+ code = _SOUND_SYSTEM_VOLUME_MAX;
}
-CATCH:
- if(pValue != null)
+ else if(code == _MAX_MEDIA_SOUND_VOLUME)
{
- free(pValue);
+ code = _SOUND_MEDIA_VOLUME_MAX;
}
- return r;
-}
-
-
-result
-_SystemInfoImpl::GetSysInfo(const String& key, int& value)
-{
- int ret = -1;
- result r = E_SUCCESS;
-
- if (key == _CAMERA_COUNT)
+ else if(code == _MAX_RINGTONE_SOUND_VOLUME)
{
- int cameraCount = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &cameraCount);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__CAMERA_COUNT");
- value = cameraCount;
+ code = _SOUND_RINGTONE_VOLUME_MAX;
}
- else if (key == _SCREEN_BITS_PER_PIXEL ||key == _SCREEN_BPP)
+ else if(code == _MAX_NOTIFICATION_SOUND_VOLUME)
{
- int screenBitsPerPixel = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_BITS_PER_PIXEL, &screenBitsPerPixel);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_BITS_PER_PIXEL");
- value = screenBitsPerPixel;
+ code = _SOUND_NOTIFICATION_VOLUME_MAX;
}
- else if (key == _SCREENHEIGHT || key == _SCREEN_HEIGHT)
+ else if(code == _MULTIPOINT_TOUCH_COUNT)
{
- int screenHeight = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &screenHeight);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_HEIGHT");
- value = screenHeight;
+ code = _MULTIPOINTTOUCH_POINTCOUNT;
}
- else if (key == _SCREENWIDTH || key == _SCREEN_WIDTH)
+ else if(code == _BLUETOOTH_SUPPORTED)
{
- int screenWidth = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &screenWidth);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_WIDTH");
- value = screenWidth;
+ code = _BLUETOOTH;
}
- else if (key == _SCREENDPI || key == _SCREEN_DPI)
+ else if(code == _GPS_SUPPORTED)
{
- int screenDPI = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &screenDPI);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_DPI");
- value = screenDPI;
+ code = _LOCATION_GPS;
}
- else if (key == _MAX_SYSTEM_SOUND_VOLUME || key == _SOUND_SYSTEM_VOLUME_MAX)
+ else if(code == _WPS_SUPPORTED)
{
- int maxVolume = 0;
- int ret = sound_manager_get_max_volume(SOUND_TYPE_SYSTEM, &maxVolume);
- SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
- value = maxVolume;
+ code = _LOCATION_WPS;
}
- else if (key == _MAX_MEDIA_SOUND_VOLUME || key == _SOUND_MEDIA_VOLUME_MAX)
+ else if(code == _WIFI_SUPPORTED)
{
- int maxVolume = 0;
- int ret = sound_manager_get_max_volume(SOUND_TYPE_MEDIA, &maxVolume);
- SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
-
- value = maxVolume;
+ code = _WIFI;
}
- else if (key == _MAX_RINGTONE_SOUND_VOLUME || key == _SOUND_RINGTONE_VOLUME_MAX)
+ else if(code == _WIFI_DIRECT_SUPPORTED)
{
- int maxVolume = 0;
- int ret = sound_manager_get_max_volume(SOUND_TYPE_RINGTONE, &maxVolume);
- SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
-
- value = maxVolume;
+ code = _WIFI_DIRECT;
}
- else if (key == _MAX_NOTIFICATION_SOUND_VOLUME || key == _SOUND_NOTIFICATION_VOLUME_MAX)
+ else if(code == _FM_RADIO_SUPPORTED)
{
- int maxVolume = 0;
- int ret = sound_manager_get_max_volume(SOUND_TYPE_NOTIFICATION, &maxVolume);
- SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
- value = maxVolume;
+ code = _FMRADIO;
}
- else if (key == _MULTIPOINT_TOUCH_COUNT || key == _MULTIPOINTTOUCH_POINTCOUNT)
+ else if(code == _TV_OUT_SUPPORTED)
{
- int multiPointTouchCount = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiPointTouchCount);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the ISYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT");
- value = multiPointTouchCount;
+ code = _SCREEN_OUTPUT_RCA;
}
- else
+ else if(code == _NFC_SUPPORTED)
{
- r = GetFromRegistry(key, value);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
+ code = _NETWORK_NFC;
}
-
- return E_SUCCESS;
-}
-
-
-result
-_SystemInfoImpl::GetSysInfo(const String& key, long long& value)
-{
- return E_OBJ_NOT_FOUND;
+ return code;
}
-
result
-_SystemInfoImpl::GetSysInfo(const String& key, double& value)
+_SystemInfoImpl::GetSysInfo(const String& key, String& value)
{
- return E_OBJ_NOT_FOUND;
-}
+ result r = E_OBJ_NOT_FOUND;
+ String tizenKey = ConvertToTizen(key);
+ SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
-result
-_SystemInfoImpl::GetSysInfo(const String& key, bool& value)
-{
- int ret = 0;
- result r = E_SUCCESS;
-
- if (key == _BLUETOOTH_SUPPORTED || key == _BLUETOOTH)
+ if (firstRequest == false)
{
- bool bluetoothSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetoothSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED");
- value = bluetoothSupported;
+ PrepareCache();
}
- else if (key == _CAMERA)
- {
- int cameraCount = 0;
- ret = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &cameraCount);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__CAMERA_COUNT");
- if (cameraCount > 0)
- {
- value = true;
- }
- else
- {
- value = false;
- }
- }
- else if (key == _CAMERA_FRONT)
- {
- bool frontCameraSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &frontCameraSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED");
- value = frontCameraSupported;
- }
- else if (key == _CAMERA_FRONT_FLASH)
- {
- bool frontCameraFlashSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &frontCameraFlashSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED");
- value = frontCameraFlashSupported;
- }
- else if (key == _CAMERA_BACK)
- {
- bool backCameraSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &backCameraSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED");
- value = backCameraSupported;
- }
- else if ( key == _CAMERA_BACK_FLASH)
+ String* pValue = (String*)stringList.GetValue(tizenKey);
+
+ if(pValue != null)
{
- bool backCameraFlashSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &backCameraFlashSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED");
- value = backCameraFlashSupported;
+ value = *pValue;
+ return E_SUCCESS;
}
- else if (key == _DATABASE_ENCRYPTION)
+
+ if (key == _NETWORK_TYPE) //Compatibility
{
-#ifndef _OSP_EMUL_
- void* handle = dlopen(_DATABASE_LIBRARY_PATH, RTLD_NOW);
- SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "Failed to open database library file");
- void* function = dlsym(handle, _DATABASE_ENCRYPTION_SYMBOL);
- if (function != null)
+ bool supported = false;
+ GetSysInfo(_TELEPHONY, supported);
+ if(supported == false)
{
- value = true;
+ value = _NETWORK_EMERGENCY;
}
- else
- {
- value = false;
- }
- dlclose(handle);
-#else
- value = true;
-#endif
- }
- else if (key == _LOCATION)
- {
- bool gpsSupported = false;
- bool wpsSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_GPS_SUPPORTED");
- wpsSupported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
+ bool supportedGsm = false;
+ bool supportedGprs = false;
+ bool supportedEdge = false;
+ bool supportedUmts = false;
+ bool supportedHsdpa = false;
+ bool supportedHsupa = false;
+ bool supportedHspa = false;
+ bool supportedLte = false;
+ bool supportedCdma = false;
- if(gpsSupported == true || wpsSupported == true)
- {
- value = true;
- }
- else
- {
- value = false;
- }
- }
- else if (key == _GPS_SUPPORTED || key == _LOCATION_GPS)
- {
- bool gpsSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_GPS_SUPPORTED");
- value = gpsSupported;
- }
- else if (key == _WPS_SUPPORTED || key == _LOCATION_WPS)
- {
- bool wpsSupported = false;
- wpsSupported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
- value = wpsSupported;
- }
- else if (key == _MICROPHONE)
- {
- bool micSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, &micSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED");
- value = micSupported;
- }
- else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV6)
- {
- char* cpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
+ GetSysInfo(_TELEPHONY_SERVICE_GSM, supportedGsm);
+ GetSysInfo(_TELEPHONY_SERVICE_GPRS, supportedGprs);
+ GetSysInfo(_TELEPHONY_SERVICE_EDGE, supportedEdge);
+ GetSysInfo(_TELEPHONY_SERVICE_UMTS, supportedUmts);
+ GetSysInfo(_TELEPHONY_SERVICE_HSDPA, supportedHsdpa);
+ GetSysInfo(_TELEPHONY_SERVICE_HSUPA, supportedHsupa);
+ GetSysInfo(_TELEPHONY_SERVICE_HSPA, supportedHspa);
+ GetSysInfo(_TELEPHONY_SERVICE_LTE, supportedLte);
+ GetSysInfo(_TELEPHONY_SERVICE_CDMA, supportedCdma);
- if(strcmp(cpu, "ARMv6") == 0)
- {
- value = true;
- }
- else
+ value.Clear();
+ if(supportedGsm == false && supportedGprs == false
+ && supportedEdge == false && supportedUmts == false
+ && supportedHsdpa == false && supportedHsupa == false
+ && supportedHspa == false && supportedLte == false
+ && supportedCdma == false)
{
- value = false;
+ value = _NETWORK_NO_SERVICE;
}
- free(cpu);
- }
- else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV7)
- {
- char* cpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
-
- if(strcmp(cpu, "ARMv7") == 0)
+ else if(supportedGsm == true)
{
- value = true;
+ value.Append(L"GSM");
}
- else
+ else if(supportedGprs == true)
{
- value = false;
- }
- free(cpu);
- }
- else if (key == _PLATFORM_CORE_CPU_ARCH_X86)
- {
- char* cpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(cpu, "x86") == 0)
- {
- value = true;
+ value.Append(L"GPRS");
}
- else
+ else if(supportedEdge == true)
{
- value = false;
- }
- free(cpu);
- }
- else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV2)
- {
- char* fpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(fpu, "vfpv2") == 0)
- {
- value = true;
+ value.Append(L"EDGE");
}
- else
+ else if(supportedUmts == true)
{
- value = false;
- }
- free(fpu);
- }
- else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV3)
- {
- char* fpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(fpu, "vfpv3") == 0)
- {
- value = true;
+ value.Append(L"UMTS");
}
- else
+ else if(supportedHsdpa == true)
{
- value = false;
- }
- free(fpu);
- }
- else if (key == _PLATFORM_CORE_FPU_ARCH_SSE2)
- {
- char* fpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(fpu, "sse2") == 0)
- {
- value = true;
+ value.Append(L"HSDPA");
}
- else
+ else if(supportedHsupa == true)
{
- value = false;
- }
- free(fpu);
- }
- else if (key == _PLATFORM_CORE_FPU_ARCH_SSE3)
- {
- char* fpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(fpu, "sse3") == 0)
- {
- value = true;
+ value.Append(L"HSUPA");
}
- else
+ else if(supportedHspa == true)
{
- value = false;
- }
- free(fpu);
- }
- else if (key == _PLATFORM_CORE_FPU_ARCH_SSSE3)
- {
- char* fpu = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(strcmp(fpu, "ssse3") == 0)
- {
- value = true;
+ value.Append(L"HSPA");
}
- else
+ else if(supportedLte == true)
{
- value = false;
- }
- free(fpu);
- }
- else if (key == _WIFI_SUPPORTED || key == _WIFI)
- {
- bool wifiSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifiSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_WIFI_SUPPORTED");
- value = wifiSupported;
- }
- else if (key == _WIFI_DIRECT || key == _WIFI_DIRECT_SUPPORTED)
- {
- bool wifiDirectSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirectSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED");
- value = wifiDirectSupported;
- }
- else if (key == _FM_RADIO_SUPPORTED || key == _FMRADIO)
- {
- bool fmRadioSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadioSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FMRADIO_SUPPORTED");
- value = fmRadioSupported;
- }
- else if (key == _TV_OUT_SUPPORTED)
- {
- bool tvOutSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_TVOUT_SUPPORTED, &tvOutSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_TVOUT_SUPPORTED");
- value = tvOutSupported;
- }
- else if (key == _SCREEN_OUTPUT_RCA)
- {
- bool rcaSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &rcaSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_RCA_SUPPORTED");
- value = rcaSupported;
- }
- else if (key == _SCREEN_OUTPUT_HDMI)
- {
- bool hdmiSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &hdmiSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_HDMI_SUPPORTED");
- value = hdmiSupported;
- }
- else if (key == _NFC_SUPPORTED || key == _NFC || key == _NETWORK_NFC)
- {
- bool nfcSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfcSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_NFC_SUPPORTED");
- value = nfcSupported;
- }
- else if (key == _TELEPHONY)
- {
- sim_state_e simState;
- ret = sim_get_state(&simState);
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
- if(ret == 0)
- {
- value = true;
+ value.Append(L"LTE");
}
- else
+ else if(supportedCdma == true)
{
- value = false;
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
+
+ value.Append(L"CDMA");
}
+ r = E_SUCCESS;
}
- else if (key == _TELEPHONY_SERVICE_GSM || key == _TELEPHONY_SERVICE_GPRS || key == _TELEPHONY_SERVICE_EDGE
- || key == _TELEPHONY_SERVICE_UMTS || key == _TELEPHONY_SERVICE_HSDPA || key == _TELEPHONY_SERVICE_HSUPA
- || key == _TELEPHONY_SERVICE_HSPA || key == _TELEPHONY_SERVICE_LTE || key == _TELEPHONY_SERVICE_CDMA)
+ else if (key == _OPENGL_ES_VERSION)
{
- String telephonyInfo;
- char* pValue = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_NETWORK_TYPE, &pValue);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_NETWORK_TYPE\"failed");
+ bool opengles_11 = false;
+ bool opengles_20 = false;
- if(pValue == null)
- {
- value = false;
- return E_SUCCESS;
- }
+ GetSysInfo(_OPENGLES_VERSION_1_1, opengles_11);
+ GetSysInfo(_OPENGLES_VERSION_2_0, opengles_20);
- r = StringUtil::Utf8ToString(pValue, telephonyInfo);
- if(r != E_SUCCESS)
- {
- free(pValue);
- return E_SYSTEM;
- }
- telephonyInfo.ToLowerCase();
- if(key == _TELEPHONY_SERVICE_GSM && telephonyInfo.Contains("gsm"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_GPRS && telephonyInfo.Contains("gprs"))
+ if(opengles_11 == true)
{
- value = true;
+ value.Append(L"1.1");
}
- else if(key == _TELEPHONY_SERVICE_EDGE && telephonyInfo.Contains("edge"))
+ else if(opengles_20 == true)
{
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_UMTS && telephonyInfo.Contains("umts"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_HSDPA && telephonyInfo.Contains("hsdpa"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_HSUPA && telephonyInfo.Contains("hsupa"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_HSPA && telephonyInfo.Contains("hspa"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_LTE && telephonyInfo.Contains("lte"))
- {
- value = true;
- }
- else if(key == _TELEPHONY_SERVICE_CDMA && telephonyInfo.Contains("cdma"))
- {
- value = true;
- }
- else
- {
- value = false;
+ if(value.GetLength() > 0)
+ value.Append(L" | ");
+
+ value.Append(L"2.0");
}
- free(pValue);
+ r = E_SUCCESS;
}
- else if (key == _SENSOR_BAROMETER)
+ else if(key == _BLUETOOTH_SUPPORTED)
{
- bool barometerSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &barometerSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED");
- value = barometerSupported;
+ bool supported = false;
+ GetSysInfo(_BLUETOOTH, supported);
+ if(supported == false)
+ value = _SUPPORTED;
+ else
+ value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
- else if (key == _SENSOR_BAROMETER_WAKEUP)
+ else if (key == _GPS_SUPPORTED)
{
- bool barometerWakeupSupported = false;
- ret = sf_is_wakeup_supported(BAROMETER_SENSOR);
- if(ret == 0)
- {
- barometerWakeupSupported = true;
- }
- value = barometerWakeupSupported;
+ bool supported = false;
+ GetSysInfo(_LOCATION_GPS, supported);
+ if(supported == false)
+ value = _SUPPORTED;
+ else
+ value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
- else if (key == _SENSOR_ACCELEROMETER)
+ else if (key == _WIFI_SUPPORTED)
{
- bool accelerometerSupported = false;
- ret = sensor_is_supported(SENSOR_ACCELEROMETER, &accelerometerSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_ACCELEROMETER");
- value = accelerometerSupported;
+ bool supported = false;
+ GetSysInfo(_WIFI, supported);
+ if(supported == false)
+ value = _SUPPORTED;
+ else
+ value = _UNSUPPORTED;
+ r = E_SUCCESS;
}
- else if (key == _SENSOR_ACCELEROMETER_WAKEUP)
+ else if (key == _WAC_VERSION)
{
- bool accelerometerWakeupSupported = false;
- ret = sf_is_wakeup_supported(ACCELEROMETER_SENSOR);
- if(ret == 0)
- {
- accelerometerWakeupSupported = true;
- }
- value = accelerometerWakeupSupported;
+ value.Clear();
+ r = E_SUCCESS;
}
- else if (key == _SENSOR_MAGNETOMETER)
+ else if (key == _PLATFORM_NATIVE_API_VERSION || key == _PLATFORM_WEB_API_VERSION || key == _PLATFORM_VERSION || key == _BUILD_STRING)
{
- bool magnetometerSupported = false;
- ret = sensor_is_supported(SENSOR_MAGNETIC, &magnetometerSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_MAGNETOMETER");
- value = magnetometerSupported;
+ r = E_OBJ_NOT_FOUND;
}
- else if (key == _SENSOR_MAGNETOMETER_WAKEUP)
+ else if (tizenKey == _DUID)
{
- bool magnetometerWakeupSupported = false;
- ret = sf_is_wakeup_supported(GEOMAGNETIC_SENSOR);
- if(ret == 0)
+ r = GetFromRegistry(tizenKey, value);
+
+ if(r != E_SUCCESS || value == L"ERROR")
{
- magnetometerWakeupSupported = true;
+ ArrayList requestMessage;
+ ArrayList responseMessage;
+
+ _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
+
+ _IpcClient* pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
+ SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
+
+ requestMessage.Construct();
+ responseMessage.Construct();
+
+ String serviceId(_SYSTEM_SERVICE_ID);
+ String commandId(L"osp.system.command.get.duid.internal");
+
+ requestMessage.Add(serviceId);
+ requestMessage.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessage, &responseMessage));
+ SysTryReturnResult(NID_SYS, pMsg != null, E_OUT_OF_MEMORY, "It is failed to create Ipc message");
+
+ r = pIpcClient->SendRequest(pMsg.get());
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA);
+ String* pDuid = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1);
+
+ SysTryReturn(NID_SYS, pResult != null, r = E_SYSTEM, r, "It is failed to receive result on IPC response message.");
+ SysTryReturn(NID_SYS, pDuid != null, r = E_SYSTEM, r, "It is failed to receive IMEI value on IPC response message.");
+
+ SysTryReturn(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, r = E_PRIVILEGE_DENIED, r, "It is failed to get privilege.");
+ SysTryReturn(NID_SYS, *pResult == _SYSTEM_RESULT_OK, r = E_SYSTEM, r, "It is failed to get DUID value.");
+
+ value = *pDuid;
+
+ responseMessage.RemoveAll(true);
}
- value = magnetometerWakeupSupported;
}
- else if (key == _SENSOR_PHOTOMETER)
- {
- bool lightSupported = false;
- ret = sensor_is_supported(SENSOR_LIGHT, &lightSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_PHOTOMETER");
- value = lightSupported;
- }
- else if (key == _SENSOR_PHOTOMETER_WAKEUP)
+ else
{
- bool photometerWakeupSupported = false;
- ret = sf_is_wakeup_supported(LIGHT_SENSOR);
- if(ret == 0)
+ r = GetFromRegistry(tizenKey, value);
+
+ if(r != E_SUCCESS)
{
- photometerWakeupSupported = true;
+ char* pStringValue = null;
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
+ if (ret != SYSTEM_INFO_ERROR_NONE)
+ {
+ ret = system_info_get_custom_string(systemKey.get(), &pStringValue);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+ }
+ r = StringUtil::Utf8ToString(pStringValue, value);
+ free(pStringValue);
+ r = E_SUCCESS;
}
- value = photometerWakeupSupported;
}
- else if (key == _SENSOR_GYROSCOPE)
+ if( r == E_SUCCESS)
{
- bool gyroscopeSupported = false;
- ret = sensor_is_supported(SENSOR_GYROSCOPE, &gyroscopeSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_GYROSCOPE");
- value = gyroscopeSupported;
+ stringList.Add(new String(tizenKey), new String(value));
}
- else if (key == _SENSOR_GYROSCOPE_WAKEUP)
- {
- bool gyroscopeWakeupSupported = false;
- ret = sf_is_wakeup_supported(GYROSCOPE_SENSOR);
- if(ret == 0)
- {
- gyroscopeWakeupSupported = true;
- }
- value = gyroscopeWakeupSupported;
- }
- else if (key == _SENSOR_PROXIMITY)
+ return r;
+}
+
+result
+_SystemInfoImpl::GetSysInfo(const String& key, int& value)
+{
+ result r = E_SUCCESS;
+ String tizenKey = ConvertToTizen(key);
+
+ SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
+
+ if (firstRequest == false)
{
- bool proximitySupported = false;
- ret = sensor_is_supported(SENSOR_PROXIMITY, &proximitySupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_PROXIMITY");
- value = proximitySupported;
+ PrepareCache();
}
- else if (key == _SENSOR_PROXIMITY_WAKEUP)
+
+ Integer* pValue = (Integer*)integerList.GetValue(tizenKey);
+
+ if(pValue != null)
{
- bool proximityWakeupSupported = false;
- ret = sf_is_wakeup_supported(PROXIMITY_SENSOR);
- if(ret == 0)
- {
- proximityWakeupSupported = true;
- }
- value = proximityWakeupSupported;
+ value = pValue->value;
+ return E_SUCCESS;
}
- else if (key == _SENSOR_TILTMETER)
+
+ if (key == _CAMERA_COUNT)
{
- bool magnetometerSupported = false;
- ret = sensor_is_supported(SENSOR_MAGNETIC, &magnetometerSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_MAGNETOMETER");
+ bool supported = false;
+ int cameraCount = 0;
- bool accelerometerSupported = false;
- ret = sensor_is_supported(SENSOR_ACCELEROMETER, &accelerometerSupported);
- SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_ACCELEROMETER");
+ GetSysInfo(_CAMERA_FRONT, supported);
+ if(supported == true)
+ cameraCount++;
- if(magnetometerSupported == true && accelerometerSupported == true)
- {
- value = true;
- }
- else
- {
- value = false;
- }
- }
- else if (key == _SENSOR_TILTMETER_WAKEUP)
- {
- int magnetic = 0;
- int accelerometer = 0;
- magnetic = sf_is_wakeup_supported(GEOMAGNETIC_SENSOR);
- accelerometer = sf_is_wakeup_supported(ACCELEROMETER_SENSOR);
- if(magnetic == 0 && accelerometer == 0)
- {
- value = true;
- }
- else
- {
- value = false;
- }
+ GetSysInfo(_CAMERA_BACK, supported);
+ if(supported == true)
+ cameraCount++;
+
+ value = cameraCount;
}
- else if (key == _OPENGLES_VERSION_1_1)
+ else
{
- char* pOpenglVersion = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pOpenglVersion);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pOpenglVersion, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
- if(strcmp(pOpenglVersion, "1.1") != -1)
+ r = GetFromRegistry(tizenKey, value);
+ if(r != E_SUCCESS || tizenKey == _SCREEN_WIDTH || tizenKey == _SCREEN_HEIGHT || tizenKey == _SCREEN_DPI)
{
- value = true;
- }
- else
- {
- value = false;
+ int ret = 0;
+ String tKey;
+
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ ret = system_info_get_platform_int(systemKey.get(), &value);
+ if (ret != SYSTEM_INFO_ERROR_NONE)
+ {
+ ret = system_info_get_custom_int(systemKey.get(), &value);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND,
+ "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+ }
+ r = E_SUCCESS;
}
- free(pOpenglVersion);
}
- else if (key == _OPENGLES_VERSION_2_0)
+
+ if(r == E_SUCCESS)
{
- char* pOpenglVersion = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pOpenglVersion);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pOpenglVersion, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
- if(strcmp(pOpenglVersion + strlen(pOpenglVersion) - 3, "2.0") != -1)
- {
- value = true;
- }
- else
- {
- value = false;
- }
- free(pOpenglVersion);
+ integerList.Add(new String(tizenKey), new Integer(value));
}
- else if(key == _OPENGLES_TEXTUREFORMAT_UTC || key == _OPENGLES_TEXTUREFORMAT_PTC || key == _OPENGLES_TEXTUREFORMAT_ETC
- || key == _OPENGLES_TEXTUREFORMAT_3DC || key == _OPENGLES_TEXTUREFORMAT_ATC || key == _OPENGLES_TEXTUREFORMAT_PVRTC)
- {
- int ret = 0;
- String openglesTexture;
-
- char* pTextureFormat = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, &pTextureFormat);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pTextureFormat, E_SYSTEM, "system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
+ return r;
+}
- r = StringUtil::Utf8ToString(pTextureFormat, openglesTexture);
+result
+_SystemInfoImpl::GetSysInfo(const String& key, long long& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
- if (r != E_SUCCESS)
- {
- free(pTextureFormat);
- SysLog(NID_SYS, "Fail to convert string");
- }
+result
+_SystemInfoImpl::GetSysInfo(const String& key, double& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
- openglesTexture.ToUpperCase();
- if (key == _OPENGLES_TEXTUREFORMAT_UTC && openglesTexture.Contains(L"UTC") == true)
- {
- value = true;
- }
- else if (key == _OPENGLES_TEXTUREFORMAT_PTC && openglesTexture.Contains(L"PTC") == true)
- {
- value = true;
- }
- else if (key == _OPENGLES_TEXTUREFORMAT_ETC && openglesTexture.Contains(L"ETC") == true)
- {
- value = true;
- }
- else if (key == _OPENGLES_TEXTUREFORMAT_3DC && openglesTexture.Contains(L"3DC") == true)
- {
- value = true;
- }
- else if (key == _OPENGLES_TEXTUREFORMAT_ATC && openglesTexture.Contains(L"ATC") == true)
- {
- value = true;
- }
- else if (key == _OPENGLES_TEXTUREFORMAT_PVRTC && openglesTexture.Contains(L"PVRTC") == true)
- {
- value = true;
- }
- else
- {
- value = false;
- }
- }
- else if (key == _SCREEN_DESKTOPMODE)
- {
- value = false;
- }
- else if (key == _SPEECH_RECOGNITION)
- {
- bool speechRecognitionSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognitionSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED");
- value = speechRecognitionSupported;
- }
- else if (key == _SIP_VOIP)
- {
- bool sipVoipSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoipSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED");
- value = sipVoipSupported;
- }
- else if (key == _USB_HOST)
+result
+_SystemInfoImpl::GetSysInfo(const String& key, bool& value)
+{
+ result r = E_SUCCESS;
+ String tizenKey = ConvertToTizen(key);
+
+ SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
+
+ if (firstRequest == false)
{
- bool usbHostSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHostSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_USB_HOST_SUPPORTED");
- value = usbHostSupported;
+ PrepareCache();
}
- else if (key == _USB_ACCESSORY)
+
+ Boolean* pValue = (Boolean*)boolList.GetValue(tizenKey);
+
+ if(pValue != null)
{
- bool usbAccessorytSupported = false;
- ret = system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessorytSupported);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_USB_HOST_SUPPORTED");
- value = usbAccessorytSupported;
+ value = pValue->value;
+ return E_SUCCESS;
}
- else if (key == _INPUT_KEYBOARD)
+
+ r = GetFromRegistry(tizenKey, value);
+ if(r != E_SUCCESS)
{
- char* pKeyboardType = null;
- ret = system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &pKeyboardType);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_KEYBOARD_TYPE\"failed");
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_OBJ_NOT_FOUND, "Required key should be longer than 0.");
- value = false;
- if(pKeyboardType != null)
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ bool supported = false;
+ int ret = system_info_get_platform_bool(systemKey.get(), &supported);
+ if(ret != SYSTEM_INFO_ERROR_NONE)
{
- if(strlen(pKeyboardType) > 0)
+ ret = system_info_get_custom_bool(systemKey.get(), &supported);
+ if (ret != SYSTEM_INFO_ERROR_NONE)
{
- value = true;
+ String screenKey(L"http://tizen.org/feature/screen.size");
+ String requiredKey;
+ tizenKey.SubString(0, screenKey.GetLength(), requiredKey);
+
+ if(requiredKey == screenKey)
+ {
+ value = false;
+ }
}
}
- free(pKeyboardType);
- return r;
+
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+ value = supported;
+ r = E_SUCCESS;
}
- else
+
+ if(r == E_SUCCESS)
{
- r = GetFromRegistry(key, value);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
+ boolList.Add(new String(tizenKey), new Boolean(value));
}
- return E_SUCCESS;
+ return r;
}
-
result
_SystemInfoImpl::GetSysInfo(const String& key, UuId& value)
{
return E_OBJ_NOT_FOUND;
}
-
Collection::IList*
_SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type)
-{
+{
SetLastResult(E_OBJ_NOT_FOUND);
return null;
}
_SystemInfoImpl::GetPlatformVersion(String& platformVersion)
{
result r = E_SUCCESS;
- char* pPlatformVersion = null;
- int ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &pPlatformVersion);
- SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_TIZEN_VERSION_NAME\"failed");
+ String tizenKey(_PLATFORM_VERSION);
+
+ r = GetFromRegistry(tizenKey, platformVersion);
+
+ if(r != E_SUCCESS)
+ {
+ char* pStringValue = null;
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+
+ r = StringUtil::Utf8ToString(pStringValue, platformVersion);
+ free(pStringValue);
+ r = E_SUCCESS;
+ }
+ return r;
+}
+
+result
+_SystemInfoImpl::GetBuildInfo(String& buildInfo)
+{
+ result r = E_SUCCESS;
+ String tizenKey(_BUILD_STRING);
- r = StringUtil::Utf8ToString(pPlatformVersion, platformVersion);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- free(pPlatformVersion);
+ r = GetFromRegistry(tizenKey, buildInfo);
+
+ if(r != E_SUCCESS)
+ {
+ char* pStringValue = null;
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+
+ r = StringUtil::Utf8ToString(pStringValue, buildInfo);
+ free(pStringValue);
+ r = E_SUCCESS;
+ }
return r;
}
result
_SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion)
{
- return GetFromRegistry(_PLATFORM_NATIVE_API_VERSION, nativeApiVersion);
+ result r = E_SUCCESS;
+ String tizenKey(_PLATFORM_NATIVE_API_VERSION);
+
+ r = GetFromRegistry(tizenKey, nativeApiVersion);
+
+ if(r != E_SUCCESS)
+ {
+ char* pStringValue = null;
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+
+ r = StringUtil::Utf8ToString(pStringValue, nativeApiVersion);
+ free(pStringValue);
+ r = E_SUCCESS;
+ }
+ return r;
}
result
_SystemInfoImpl::GetWebApiVersion(String& webApiVersion)
{
- return GetFromRegistry(_PLATFORM_WEB_API_VERSION, webApiVersion);
+ result r = E_SUCCESS;
+ String tizenKey(_PLATFORM_WEB_API_VERSION);
+
+ r = GetFromRegistry(tizenKey, webApiVersion);
+
+ if(r != E_SUCCESS)
+ {
+ char* pStringValue = null;
+ String tKey;
+ tizenKey.SubString(7, tKey);
+ SysTryReturnResult(NID_SYS, tKey.GetLength() > 0, E_SYSTEM, "Required key should be longer than 0.");
+
+ ClearLastResult();
+ unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
+ r = GetLastResult();
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
+
+ int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
+ SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
+
+ r = StringUtil::Utf8ToString(pStringValue, webApiVersion);
+ free(pStringValue);
+ r = E_SUCCESS;
+ }
+ return r;
}
result
_SystemInfoImpl::GetImei(String& imei)
{
result r = E_SUCCESS;
- int error = -1;
- char* pImei = null;
- error = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &pImei);
- SysTryReturnResult(NID_SYS, error == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_MOBILE_DEVICE_ID\"failed");
+ int ret = 0;
+ TapiHandle* handle = null;
+ int time_count = 0;
+ int status = 0;
+
+ handle = tel_init(null);
+ SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "It is failed to get handle of telephony.");
+ while(time_count < 30) //Wait 30 second.
+ {
+ ret = tel_check_modem_power_status(handle, &status);
+ SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
+ if(ret != TAPI_API_SUCCESS)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status.");
+ tel_deinit(handle);
+ return E_SYSTEM;
+ }
+
+ if(status == 0)
+ {
+ break;
+ }
+
+ usleep(1000000);
+ time_count++;
+ }
+ tel_deinit(handle);
- r = StringUtil::Utf8ToString(pImei, imei);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
- free(pImei);
+ ArrayList requestMessage;
+ ArrayList responseMessage;
+
+ _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
+
+ _IpcClient* pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
+ SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
+
+ requestMessage.Construct();
+ responseMessage.Construct();
+
+ String serviceId(_SYSTEM_SERVICE_ID);
+ String commandId(L"osp.system.command.get.imei.internal");
+
+ requestMessage.Add(serviceId);
+ requestMessage.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessage, &responseMessage));
+ SysTryReturnResult(NID_SYS, pMsg != null, E_OUT_OF_MEMORY, "It is failed to create Ipc message");
+
+ r = pIpcClient->SendRequest(pMsg.get());
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA);
+ String* pImei = (String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1);
+
+ SysTryReturn(NID_SYS, pResult != null, r = E_SYSTEM, r, "It is failed to receive result on IPC response message.");
+ SysTryReturn(NID_SYS, pImei != null, r = E_SYSTEM, r, "It is failed to receive IMEI value on IPC response message.");
+
+ SysTryReturn(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, r = E_PRIVILEGE_DENIED, r, "It is failed to get privilege.");
+ SysTryReturn(NID_SYS, *pResult == _SYSTEM_RESULT_OK, r = E_SYSTEM, r, "It is failed to get IMEI value.");
+
+ imei = *pImei;
+ responseMessage.RemoveAll(true);
return r;
}
String valStr;
r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue is failed, %ls", key.GetPointer());
if(valStr == L"true" || valStr == L"false")
{
result r = E_SUCCESS;
_RegistryImpl _reg;
String valStr;
+
r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
- SysTryReturnResult(NID_SYS, !IsFailed(r), E_SYSTEM, " Registry GetValue Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, %ls", key.GetPointer());
r = Integer::Parse(valStr, value);
- SysTryReturnResult(NID_SYS, !IsFailed(r), E_OBJ_NOT_FOUND, " Integer::Parse() Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse() is failed");
return E_SUCCESS;
}
result r = E_SUCCESS;
_RegistryImpl _reg;
String valStr;
+
r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
- SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
- SysTryReturnResult(NID_SYS, !IsFailed(r), E_SYSTEM, " Registry GetValue Failed");
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed, [%ls]", key.GetPointer());
if(valStr == L"true")
{
value = true;
}
return E_SUCCESS;
}
+
_SystemInfoImpl*
_SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
{