merge from tizen_2.1
authorJoohyun Kim <joohyune.kim@samsung.com>
Wed, 5 Jun 2013 05:56:15 +0000 (14:56 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Wed, 5 Jun 2013 05:56:15 +0000 (14:56 +0900)
Change-Id: I5456d23693f185e68b855ae692e9963ceade46ec
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/FSys_SystemService.cpp
src/system/FSys_DeviceId.cpp
src/system/FSys_RuntimeInfo.cpp
src/system/FSys_SystemInfo.cpp

index b2fc822..d211303 100644 (file)
@@ -24,6 +24,8 @@
 #include <sys/time.h>
 #include <system_info.h>
 #include <sysman_managed.h>
+#include <telephony_network.h>
+#include <telephony-client/ITapiModem.h>
 #include <vconf.h>
 
 #include <FBaseSysLog.h>
@@ -206,7 +208,7 @@ _SystemService::OnRequestOccured(AppId appId, int pid, ArrayList* request, Array
                        else
                        {
                                bool supported = false;
-                               r = __systemInfo.GetValue(L"http://tizen.org/feature/telephony", supported);
+                               r = __systemInfo.GetValue(L"http://tizen.org/feature/network.telephony", supported);
                                if(r != E_SUCCESS || supported == false)
                                {
                                        SysLogException(NID_SYS, E_SYSTEM, "Current device does not support telephony feature.");
@@ -215,16 +217,58 @@ _SystemService::OnRequestOccured(AppId appId, int pid, ArrayList* request, Array
                                else
                                {
                                        char* pImei = null;
-                                       ret = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &pImei);
-                                       if(ret != SYSTEM_INFO_ERROR_NONE || pImei == null)
+                                       int time_count = 0;
+                                       int status = 0;
+                                       TapiHandle* handle = null;
+                                       handle = tel_init(null);
+                                       if(handle == null)
                                        {
-                                               SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                                               SysLogException(NID_SYS, E_SYSTEM, "It is failed to init TAPI.");
                                                resultId = new (std::nothrow) String(_SYSTEM_RESULT_ERROR);
                                        }
                                        else
                                        {
-                                               resultId = new (std::nothrow) String(_SYSTEM_RESULT_OK);
-                                               returnValue = new (std::nothrow) String(pImei);
+                                               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.");
+                                                               break;
+                                                       }
+
+                                                       if(status == 0)
+                                                       {
+                                                               break;
+                                                       }
+
+                                                       usleep(1000000);
+                                                       time_count++;
+                                               }
+
+                                               if(ret != TAPI_API_SUCCESS)
+                                               {
+                                                       tel_deinit(handle);
+                                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                                                       resultId = new (std::nothrow) String(_SYSTEM_RESULT_ERROR);
+                                               }
+                                               else
+                                               {
+                                                       pImei = tel_get_misc_me_imei_sync(handle);
+                                                       tel_deinit(handle);
+                                                       if(pImei == null)
+                                                       {
+                                                               SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                                                               resultId = new (std::nothrow) String(_SYSTEM_RESULT_ERROR);
+                                                       }
+                                                       else
+                                                       {
+                                                               resultId = new (std::nothrow) String(_SYSTEM_RESULT_OK);
+                                                               returnValue = new (std::nothrow) String(pImei);
+                                                               free(pImei);
+                                                       }
+                                               }
                                        }
                                }
                        }
index ec9331d..6f384c8 100644 (file)
@@ -25,6 +25,8 @@
 #include <bluetooth.h>
 
 #include <system_info.h>
+#include <telephony_network.h>
+#include <telephony-client/ITapiModem.h>
 
 #include <FSys_SystemInfoImpl.h>
 #include <FTextUtf8Encoder.h>
@@ -120,9 +122,9 @@ String _DeviceId::__deviceId = "";
 result
 _DeviceId::GetId(Tizen::Base::String& deviceId, int type)
 {
+       int ret = 0;
        result r = E_SUCCESS;
 
-
        if(__deviceId != "")
        {
                deviceId = __deviceId;
@@ -145,14 +147,44 @@ _DeviceId::GetId(Tizen::Base::String& deviceId, int type)
 
        if(type == 0)
        {
-               int ret = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &pDeviceString);
-               SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pDeviceString != null, E_SYSTEM, "It is failed to get SYSTEM_INFO_KEY_MOBILE_DEVICE_ID.");
-               SysLog(NID_SYS, "IMEI is [%s]", pDeviceString);
+               int time_count = 0;
+               int status = 0;
+               TapiHandle* handle = null;
+               handle = tel_init(null);
+               SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "It is failed to init TAPI.");
+
+               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);
+                       SysTryReturnResult(NID_SYS, ret == TAPI_API_SUCCESS, E_SYSTEM,  "It is failed to get Modem status.");
+
+                       if(status == 0)
+                       {
+                               break;
+                       }
+
+                       usleep(1000000);
+                       time_count++;
+               }
+
+               if(ret != TAPI_API_SUCCESS)
+               {
+                       tel_deinit(handle);
+                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                       return E_SYSTEM;
+               }
+               else
+               {
+                       pDeviceString = tel_get_misc_me_imei_sync(handle);
+                       tel_deinit(handle);
+                       SysTryReturnResult(NID_SYS, pDeviceString != null, E_SYSTEM, "It is failed to get IMEI");
+               }
        }
        else if(type == 1)
        {
                char* wifiMacAddress = null;
-               int ret = wifi_get_mac_address(&wifiMacAddress);
+               ret = wifi_get_mac_address(&wifiMacAddress);
                SysTryReturnResult(NID_SYS, ret == WIFI_ERROR_NONE && wifiMacAddress != null, E_SYSTEM, "It is failed to get Wi-Fi MAC address.");
 
                SysLog(NID_SYS, "Wifi Address is [%s]", wifiMacAddress);
index 17953ec..150fbc9 100644 (file)
@@ -216,10 +216,8 @@ _RuntimeInfo::SendResponse(int pid, int msg_id, long long size, result rcode)
        data->Add(new (std::nothrow) String(_RUNTIME_SERVICE_ID));
        data->Add(new (std::nothrow) String(_RUNTIME_GET_SIZE));
        data->Add(new (std::nothrow) String(msg_id));
-       value = new String();
+       value = new (std::nothrow) String();
        value->Append(size);
-       data->Add(*value);
-
        data->Add(value);
 
        if(rcode == E_SUCCESS)
index 4d590ce..6434adc 100644 (file)
@@ -90,6 +90,7 @@ static const wchar_t* _FMRADIO = L"http://tizen.org/feature/fmradio";
 //Keyboard
 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";
+static const wchar_t* _INPUT_OPTIONKEY = L"http://tizen.org/feature/input.option_key";
 
 //Location
 static const wchar_t* _LOCATION = L"http://tizen.org/feature/location";
@@ -379,6 +380,14 @@ _SystemInfo::CachingSystemInformation(void)
        reg.AddValue(_SYSTEM_CACHING_SECTION, _INPUT_KEYBOARD_LAYOUT, sValue);
        reg.Flush();
 
+       this->GetValue(_INPUT_OPTIONKEY, bValue);
+       if(bValue == true)
+               systemValue = _SYSTEM_CACHING_TRUE;
+       else
+               systemValue = _SYSTEM_CACHING_FALSE;
+       reg.AddValue(_SYSTEM_CACHING_SECTION, _INPUT_OPTIONKEY, systemValue);
+       reg.Flush();
+
        this->GetValue(_LOCATION, bValue);
        if(bValue == true)
                systemValue = _SYSTEM_CACHING_TRUE;
@@ -1988,6 +1997,10 @@ _SystemInfo::GetValue(const String& key, bool& value)
                }
                free(pKeyboardType);
        }
+       else if (key == _INPUT_OPTIONKEY)
+       {
+               value = true;
+       }
        else if (key == _NETWORK_PUSH)
        {
                value = File::IsFileExist(_NETWORK_PUSH_BIN);