std::lock_guard<std::mutex> lock(sim_to_process_mutex_);
operator_name_ = name;
--to_process_;
- LOGD("Operator name: %s", operator_name_.c_str());
+ LoggerD("Operator name: %s", operator_name_.c_str());
};
void set_msisdn(const std::string& msisdn)
{
std::lock_guard<std::mutex> lock(sim_to_process_mutex_);
this->msisdn_ = msisdn;
--to_process_;
- LOGD("MSISDN number: %s", this->msisdn_.c_str());
+ LoggerD("MSISDN number: %s", this->msisdn_.c_str());
};
void set_spn(const std::string& spn)
{
std::lock_guard<std::mutex> lock(sim_to_process_mutex_);
this->spn_ = spn;
--to_process_;
- LOGD("SPN value: %s", this->spn_.c_str());
+ LoggerD("SPN value: %s", this->spn_.c_str());
};
};
if (TAPI_API_SUCCESS == result) {
++to_process_;
} else {
- LOGE("Failed getting cphs netname: %d", result);
+ LoggerE("Failed getting cphs netname: %d", result);
}
result = tel_get_sim_msisdn(handle, SimMsisdnValueCallback, nullptr);
if (TAPI_API_SUCCESS == result) {
++to_process_;
} else {
- LOGE("Failed getting msisdn: %d", result);
+ LoggerE("Failed getting msisdn: %d", result);
}
result = tel_get_sim_spn(handle, SimSpnValueCallback, nullptr);
if (TAPI_API_SUCCESS == result) {
++to_process_;
} else {
- LOGE("Failed getting spn: %d", result);
+ LoggerE("Failed getting spn: %d", result);
}
}
//prevent returning not filled result
void SimDetailsManager::FetchSimState(TapiHandle *tapi_handle)
{
- LOGD("Entered");
+ LoggerD("Entered");
if (nullptr == tapi_handle) {
- LOGE("Tapi handle is null");
+ LoggerE("Tapi handle is null");
state_ = kSimStatusUnknown;
} else {
int card_changed = 0;
void SimDetailsManager::FetchSimSyncProps(TapiHandle *tapi_handle)
{
- LOGD("Entered");
+ LoggerD("Entered");
TelSimImsiInfo_t imsi;
int error = tel_get_sim_imsi(tapi_handle, &imsi);
if (TAPI_API_SUCCESS == error) {
- LOGD("mcc: %s, mnc: %s, msin: %s", imsi.szMcc, imsi.szMnc, imsi.szMsin);
+ LoggerD("mcc: %s, mnc: %s, msin: %s", imsi.szMcc, imsi.szMnc, imsi.szMsin);
mcc_ = std::stoul(imsi.szMcc);
mnc_ = std::stoul(imsi.szMnc);
msin_ = imsi.szMsin;
}
else {
- LOGE("Failed to get sim imsi: %d", error);
+ LoggerE("Failed to get sim imsi: %d", error);
throw UnknownException("Failed to get sim imsi");
}
}
void SimDetailsManager::ReturnSimToJS(){
- LOGD("Entered");
+ LoggerD("Entered");
if (nullptr != sim_result_obj_) {
sim_result_obj_->insert(std::make_pair("state", state_));
sim_result_obj_->insert(std::make_pair("operatorName", operator_name_));
//everything returned, clear pointer
sim_result_obj_ = nullptr;
} else {
- LOGE("No sim returned JSON object pointer is null");
+ LoggerE("No sim returned JSON object pointer is null");
}
}
long SimDetailsManager::GetSimCount(TapiHandle **tapi_handle){
if (0 != sim_count_){
- LOGD("Sim counted already");
+ LoggerD("Sim counted already");
} else {
- LOGD("Gathering sim count");
+ LoggerD("Gathering sim count");
char **cp_list = tel_get_cp_name_list();
if (cp_list != NULL) {
while (cp_list[sim_count_]) {
tapi_handle[sim_count_] = tel_init(cp_list[sim_count_]);
if (tapi_handle[sim_count_] == NULL) {
- LOGE("Failed to connect with tapi, handle is null");
+ LoggerE("Failed to connect with tapi, handle is null");
break;
}
sim_count_++;
- LOGD("%d modem: %s", sim_count_, cp_list[sim_count_]);
+ LoggerD("%d modem: %s", sim_count_, cp_list[sim_count_]);
}
} else {
- LOGE("Failed to get cp list");
+ LoggerE("Failed to get cp list");
sim_count_ = TAPI_HANDLE_MAX;
}
g_strfreev(cp_list);
void SimDetailsManager::TryReturn(){
if (0 == to_process_){
- LOGD("Returning property to JS");
+ LoggerD("Returning property to JS");
ReturnSimToJS();
sim_info_mutex_.unlock();
} else {
- LOGD("Not ready yet - waiting");
+ LoggerD("Not ready yet - waiting");
}
}
"/Org/Tizen/System/Coord/Rotation",
"org.tizen.system.coord.rotation")
{
- LOGD("Entered");
+ LoggerD("Entered");
is_auto_rotation_ = FetchIsAutoRotation();
status_ = FetchStatus();
}
SystemInfoDeviceOrientation::~SystemInfoDeviceOrientation()
{
- LOGD("Entered");
+ LoggerD("Entered");
UnsetDeviceOrientationChangeListener();
}
bool SystemInfoDeviceOrientation::FetchIsAutoRotation()
{
- LOGD("Entered");
+ LoggerD("Entered");
int is_auto_rotation = 0;
if ( 0 == vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &is_auto_rotation)) {
return true;
}
} else {
- LOGE("VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL check failed");
+ LoggerE("VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL check failed");
throw UnknownException(
"VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL check failed");
}
std::string SystemInfoDeviceOrientation::FetchStatus()
{
- LOGD("Entered");
+ LoggerD("Entered");
DBusOperationArguments args;
args.AddArgumentString("lcddim");
status = kOrientationLandscapeSecondary;
break;
default:
- LOGD("Unknown rotation value");
+ LoggerD("Unknown rotation value");
break;
}
void SystemInfoDeviceOrientation::SetDeviceOrientationChangeListener()
{
- LOGD("Enter");
+ LoggerD("Enter");
if (registered_) {
- LOGD("already registered");
+ LoggerD("already registered");
} else {
RegisterDBus();
registered_ = true;
void SystemInfoDeviceOrientation::UnsetDeviceOrientationChangeListener()
{
- LOGD("Enter");
+ LoggerD("Enter");
if (!registered_) {
- LOGD("not registered");
+ LoggerD("not registered");
} else {
UnregisterDBus();
registered_ = false;
void SystemInfoDeviceOrientation::RegisterDBus()
{
- LOGD("Enter");
+ LoggerD("Enter");
int ret = 0;
DBusOperationArguments args;
ret = dbus_op_.InvokeSyncGetInt("StartRotation", &args);
if (ret != 0) {
- LOGE("Failed to start rotation broadcast");
+ LoggerE("Failed to start rotation broadcast");
throw UnknownException("Failed to start rotation broadcast");
}
dbus_op_.RegisterSignalListener("ChangedPhysicalRotation", this);
- LOGD("registerSignalListener: ChangedPhysicalRotation");
+ LoggerD("registerSignalListener: ChangedPhysicalRotation");
}
void SystemInfoDeviceOrientation::UnregisterDBus()
{
- LOGD("Enter");
+ LoggerD("Enter");
int ret = 0;
dbus_op_.UnregisterSignalListener("ChangedPhysicalRotation", this);
- LOGD("unregisterSignalListener: ChangedPhysicalRotation");
+ LoggerD("unregisterSignalListener: ChangedPhysicalRotation");
DBusOperationArguments args;
args.AddArgumentInt32(0);
ret = dbus_op_.InvokeSyncGetInt("StartRotation", &args);
if (ret != 0) {
- LOGE("Failed to stop rotation broadcast");
+ LoggerE("Failed to stop rotation broadcast");
throw UnknownException("Failed to stop rotation broadcast");
}
}
void SystemInfoDeviceOrientation::OnDBusSignal(int value)
{
- LOGD("value : %d", value);
+ LoggerD("value : %d", value);
switch (value) {
case 0:
case 1: //rotation 0
- LOGD("ORIENTATION_PORTRAIT_PRIMARY");
+ LoggerD("ORIENTATION_PORTRAIT_PRIMARY");
break;
case 2: //rotation 90
- LOGD("ORIENTATION_LANDSCAPE_PRIMARY");
+ LoggerD("ORIENTATION_LANDSCAPE_PRIMARY");
break;
case 3: //rotation 180
- LOGD("ORIENTATION_PORTRAIT_SECONDARY");
+ LoggerD("ORIENTATION_PORTRAIT_SECONDARY");
break;
case 4: //rotation 270
- LOGD("ORIENTATION_LANDSCAPE_SECONDARY");
+ LoggerD("ORIENTATION_LANDSCAPE_SECONDARY");
break;
default:
- LOGD("Unknown rotation value");
+ LoggerD("Unknown rotation value");
break;
}
- LOGD("call OnDeviceOrientationChangedCb");
+ LoggerD("call OnDeviceOrientationChangedCb");
OnDeviceOrientationChangedCb();
}
m_memory_listener(nullptr),
m_connection_handle(nullptr)
{
- LOGD("Entered");
+ LoggerD("Entered");
}
SystemInfoListeners::~SystemInfoListeners(){
void SystemInfoListeners::RegisterBatteryListener(const SysteminfoUtilsCallback& callback)
{
- LOGD("Entered");
+ LoggerD("Entered");
if (nullptr == m_battery_listener) {
RegisterVconfCallback(VCONFKEY_SYSMAN_BATTERY_CAPACITY, OnBatteryChangedCb);
RegisterVconfCallback(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, OnBatteryChangedCb);
- LOGD("Added callback for BATTERY");
+ LoggerD("Added callback for BATTERY");
m_battery_listener = callback;
}
}
if (nullptr != m_battery_listener) {
UnregisterVconfCallback(VCONFKEY_SYSMAN_BATTERY_CAPACITY, OnBatteryChangedCb);
UnregisterVconfCallback(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, OnBatteryChangedCb);
- LOGD("Removed callback for BATTERY");
+ LoggerD("Removed callback for BATTERY");
m_battery_listener = nullptr;
}
}
{
if (nullptr == m_cpu_listener) {
m_cpu_event_id = g_timeout_add_seconds(kPropertyWatcherTime, OnCpuChangedCb, nullptr);
- LOGD("Added callback for CPU");
+ LoggerD("Added callback for CPU");
m_cpu_listener = callback;
}
}
if (nullptr != m_cpu_listener) {
g_source_remove(m_cpu_event_id);
m_cpu_event_id = 0;
- LOGD("Removed callback for CPU");
+ LoggerD("Removed callback for CPU");
m_cpu_listener = nullptr;
}
}
// empty on purpose
}
m_storage_event_id = g_timeout_add_seconds(kPropertyWatcherTime, OnStorageChangedCb, nullptr);
- LOGD("Added callback for STORAGE");
+ LoggerD("Added callback for STORAGE");
m_storage_listener = callback;
}
}
}
g_source_remove(m_storage_event_id);
m_storage_event_id = 0;
- LOGD("Removed callback for STORAGE");
+ LoggerD("Removed callback for STORAGE");
m_storage_listener = nullptr;
}
}
{
if (nullptr == m_display_listener) {
RegisterVconfCallback(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, OnDisplayChangedCb);
- LOGD("Added callback for DISPLAY");
+ LoggerD("Added callback for DISPLAY");
m_display_listener = callback;
}
}
if (nullptr != m_display_listener) {
UnregisterVconfCallback(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, OnDisplayChangedCb);
- LOGD("Removed callback for DISPLAY");
+ LoggerD("Removed callback for DISPLAY");
m_display_listener = nullptr;
}
}
RegisterVconfCallback(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, OnDeviceAutoRotationChangedCb);
m_orientation->SetDeviceOrientationChangeListener();
- LOGD("Added callback for DEVICE_ORIENTATION");
+ LoggerD("Added callback for DEVICE_ORIENTATION");
m_device_orientation_listener = callback;
}
}
m_orientation.reset();
}
- LOGD("Removed callback for DEVICE_ORIENTATION");
+ LoggerD("Removed callback for DEVICE_ORIENTATION");
m_device_orientation_listener = nullptr;
}
}
if (RUNTIME_INFO_ERROR_NONE !=
runtime_info_set_changed_cb(RUNTIME_INFO_KEY_REGION,
OnLocaleChangedCb, nullptr) ) {
- LOGE("Country change callback registration failed");
+ LoggerE("Country change callback registration failed");
throw UnknownException("Country change callback registration failed");
}
if (RUNTIME_INFO_ERROR_NONE !=
runtime_info_set_changed_cb(RUNTIME_INFO_KEY_LANGUAGE,
OnLocaleChangedCb, nullptr) ) {
- LOGE("Language change callback registration failed");
+ LoggerE("Language change callback registration failed");
throw UnknownException("Language change callback registration failed");
}
- LOGD("Added callback for LOCALE");
+ LoggerD("Added callback for LOCALE");
m_locale_listener = callback;
}
}
if (nullptr != m_locale_listener) {
if (RUNTIME_INFO_ERROR_NONE !=
runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_LANGUAGE) ) {
- LOGE("Unregistration of language change callback failed");
+ LoggerE("Unregistration of language change callback failed");
}
if (RUNTIME_INFO_ERROR_NONE !=
runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_REGION) ) {
- LOGE("Unregistration of country change callback failed");
+ LoggerE("Unregistration of country change callback failed");
}
- LOGD("Removed callback for LOCALE");
+ LoggerD("Removed callback for LOCALE");
m_locale_listener = nullptr;
}
}
{
if (nullptr == m_network_listener) {
connection_set_type_changed_cb(GetConnectionHandle(), OnNetworkChangedCb, nullptr);
- LOGD("Added callback for NETWORK");
+ LoggerD("Added callback for NETWORK");
m_network_listener = callback;
}
}
{
if (nullptr != m_network_listener) {
- LOGD("Removed callback for NETWORK");
+ LoggerD("Removed callback for NETWORK");
m_network_listener = nullptr;
}
}
//register if there is no callback both for wifi and cellular
RegisterIpChangeCallback();
} else {
- LOGD("No need to register ip listener on platform, already registered");
+ LoggerD("No need to register ip listener on platform, already registered");
}
- LOGD("Added callback for WIFI_NETWORK");
+ LoggerD("Added callback for WIFI_NETWORK");
m_wifi_network_listener = callback;
}
}
//unregister if is wifi callback, but no cellular callback
if (nullptr != m_wifi_network_listener && nullptr == m_cellular_network_listener) {
UnregisterIpChangeCallback();
- LOGD("Removed callback for WIFI_NETWORK");
+ LoggerD("Removed callback for WIFI_NETWORK");
} else {
- LOGD("Removed callback for WIFI_NETWORK, but cellular listener still works");
+ LoggerD("Removed callback for WIFI_NETWORK, but cellular listener still works");
}
m_wifi_network_listener = nullptr;
}
//register if there is no callback both for wifi and cellular
RegisterIpChangeCallback();
} else {
- LOGD("No need to register ip listener on platform, already registered");
+ LoggerD("No need to register ip listener on platform, already registered");
}
RegisterVconfCallback(VCONFKEY_TELEPHONY_FLIGHT_MODE,
OnCellularNetworkValueChangedCb);
OnCellularNetworkValueChangedCb);
RegisterVconfCallback(VCONFKEY_TELEPHONY_SVC_ROAM,
OnCellularNetworkValueChangedCb);
- LOGD("Added callback for CELLULAR_NETWORK");
+ LoggerD("Added callback for CELLULAR_NETWORK");
m_cellular_network_listener = callback;
}
}
if (nullptr == m_wifi_network_listener) {
//register if there is no callback both for wifi and cellular
UnregisterIpChangeCallback();
- LOGD("Removed callback for CELLULAR_NETWORK");
+ LoggerD("Removed callback for CELLULAR_NETWORK");
} else {
- LOGD("Removed callback for CELLULAR_NETWORK, but cellular listener still works");
+ LoggerD("Removed callback for CELLULAR_NETWORK, but cellular listener still works");
}
}
m_cellular_network_listener = nullptr;
} catch (const PlatformException& e) {
// empty on purpose
}
- LOGD("Added callback for PERIPHERAL");
+ LoggerD("Added callback for PERIPHERAL");
m_peripheral_listener = callback;
}
}
} catch (const PlatformException& e) {
// empty on purpose
}
- LOGD("Removed callback for PERIPHERAL");
+ LoggerD("Removed callback for PERIPHERAL");
m_peripheral_listener = nullptr;
}
}
} catch (const PlatformException& e) {
// empty on purpose
}
- LOGD("Added callback for MEMORY");
+ LoggerD("Added callback for MEMORY");
m_memory_listener = callback;
}
}
} catch (const PlatformException& e) {
// empty on purpose
}
- LOGD("Removed callback for MEMORY");
+ LoggerD("Removed callback for MEMORY");
m_memory_listener = nullptr;
}
}
void SystemInfoListeners::OnCpuChangedCallback(void* /*event_ptr*/)
{
- LOGD("");
+ LoggerD("");
picojson::value result = picojson::value(picojson::object());
PlatformResult ret = SysteminfoUtils::GetPropertyValue(kPropertyIdCpu, false, result);
if (ret.IsSuccess()) {
void SystemInfoListeners::OnStorageChangedCallback(void* /*event_ptr*/)
{
- LOGD("");
+ LoggerD("");
picojson::value result = picojson::value(picojson::object());
PlatformResult ret = SysteminfoUtils::GetPropertyValue(kPropertyIdStorage, false, result);
if (ret.IsSuccess()) {
void SystemInfoListeners::OnMmcChangedCallback(keynode_t* /*node*/, void* /*event_ptr*/)
{
- LOGD("");
+ LoggerD("");
picojson::value result = picojson::value(picojson::object());
PlatformResult ret = SysteminfoUtils::GetPropertyValue(kPropertyIdStorage, false, result);
if (ret.IsSuccess()) {
void SystemInfoListeners::InitTapiHandles()
{
- LOGD("Entered");
+ LoggerD("Entered");
int sim_count = 0;
if (nullptr == m_tapi_handles){
char **cp_list = tel_get_cp_name_list();
while (cp_list[sim_count]) {
m_tapi_handles[sim_count] = tel_init(cp_list[sim_count]);
if (nullptr == m_tapi_handles[sim_count]) {
- LOGE("Failed to connect with tapi, handle is null");
+ LoggerE("Failed to connect with tapi, handle is null");
break;
}
sim_count++;
- LOGD("%d modem: %s", sim_count, cp_list[sim_count]);
+ LoggerD("%d modem: %s", sim_count, cp_list[sim_count]);
}
} else {
- LOGE("Failed to get cp list");
+ LoggerE("Failed to get cp list");
sim_count = TAPI_HANDLE_MAX;
}
g_strfreev(cp_list);
TapiHandle* SystemInfoListeners::GetTapiHandle()
{
- LOGD("Entered");
+ LoggerD("Entered");
InitTapiHandles();
return m_tapi_handles[0];
}
if (nullptr == m_connection_handle) {
int error = connection_create(&m_connection_handle);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to create connection: %d", error);
+ LoggerE("Failed to create connection: %d", error);
throw UnknownException("Cannot create connection");
}
}
void SystemInfoListeners::RegisterVconfCallback(const char *in_key, vconf_callback_fn cb)
{
if (0 != vconf_notify_key_changed(in_key, cb, nullptr)) {
- LOGE("Failed to register vconf callback: %s", in_key);
+ LoggerE("Failed to register vconf callback: %s", in_key);
throw UnknownException("Failed to register vconf callback");
}
}
void SystemInfoListeners::UnregisterVconfCallback(const char *in_key, vconf_callback_fn cb)
{
if (0 != vconf_ignore_key_changed(in_key, cb)) {
- LOGE("Failed to unregister vconf callback: %s", in_key);
+ LoggerE("Failed to unregister vconf callback: %s", in_key);
throw UnknownException("Failed to unregister vconf callback");
}
}
void SystemInfoListeners::RegisterIpChangeCallback()
{
- LOGD("Registering connection callback");
+ LoggerD("Registering connection callback");
connection_h handle = GetConnectionHandle();
int error = connection_set_ip_address_changed_cb(handle,
OnNetworkValueChangedCb, nullptr);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to register ip change callback: %d", error);
+ LoggerE("Failed to register ip change callback: %d", error);
throw UnknownException("Cannot register ip change callback");
}
}
void SystemInfoListeners::UnregisterIpChangeCallback()
{
- LOGD("Unregistering connection callback");
+ LoggerD("Unregistering connection callback");
connection_h handle = GetConnectionHandle();
int error = connection_unset_ip_address_changed_cb(handle);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to unregister ip change callback: %d", error);
+ LoggerE("Failed to unregister ip change callback: %d", error);
throw UnknownException("Cannot unregister ip change callback");
}
}
void OnBatteryChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnBatteryChangedCallback(node, event_ptr);
}
gboolean OnCpuChangedCb(gpointer event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnCpuChangedCallback(event_ptr);
return G_SOURCE_CONTINUE;
}
gboolean OnStorageChangedCb(gpointer event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnStorageChangedCallback(event_ptr);
return G_SOURCE_CONTINUE;
}
void OnMmcChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnMmcChangedCallback(node, event_ptr);
}
void OnDisplayChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnDisplayChangedCallback(node, event_ptr);
}
void OnDeviceAutoRotationChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnDeviceAutoRotationChangedCallback(node, event_ptr);
}
void OnDeviceOrientationChangedCb()
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnDeviceOrientationChangedCallback();
}
void OnLocaleChangedCb(runtime_info_key_e key, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnLocaleChangedCallback(key, event_ptr);
}
void OnNetworkChangedCb(connection_type_e type, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnNetworkChangedCallback(type, event_ptr);
}
void OnNetworkValueChangedCb(const char* ipv4_address,
const char* ipv6_address, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnNetworkValueCallback(ipv4_address, ipv6_address, event_ptr);
}
void OnCellularNetworkValueChangedCb(keynode_t *node, void *event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnCellularNetworkValueCallback(node, event_ptr);
}
void OnPeripheralChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnPeripheralChangedCallback(node, event_ptr);
}
void OnMemoryChangedCb(keynode_t* node, void* event_ptr)
{
- LOGD("");
+ LoggerD("");
system_info_listeners.OnMemoryChangedCallback(node, event_ptr);
}
/////////////////////////// SysteminfoUtils ////////////////////////////////
-static bool GetValueBool(const char *key) {
- bool value = false;
-
+PlatformResult SystemInfoDeviceCapability::GetValueBool(const char *key, bool& value) {
int ret = system_info_get_platform_bool(key, &value);
if (SYSTEM_INFO_ERROR_NONE != ret) {
std::string log_msg = "Platform error while getting bool value: ";
log_msg += std::string(key) + " " + std::to_string(ret);
- LOGE("%s", log_msg.c_str());
- throw UnknownException(log_msg);
+ LoggerE("%s", log_msg.c_str());
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
- LOGD("value[%s]: %s", key, value ? "true" : "false");
- return value;
+ LoggerD("value[%s]: %s", key, value ? "true" : "false");
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-static int GetValueInt(const char *key) {
- int value = 0;
-
+PlatformResult SystemInfoDeviceCapability::GetValueInt(const char *key, int& value) {
int ret = system_info_get_platform_int(key, &value);
if (SYSTEM_INFO_ERROR_NONE != ret) {
std::string log_msg = "Platform error while getting int value: ";
log_msg += std::string(key) + " " + std::to_string(ret);
- LOGE("%s", log_msg.c_str());
- throw UnknownException(log_msg);
+ LoggerE("%s", log_msg.c_str());
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
- LOGD("value[%s]: %d", key, value);
- return value;
+ LoggerD("value[%s]: %d", key, value);
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-static PlatformResult GetValueString(const char *key, std::string& str_value) {
+PlatformResult SystemInfoDeviceCapability::GetValueString(const char *key, std::string& str_value) {
char* value = nullptr;
int ret = system_info_get_platform_string(key, &value);
} else {
std::string log_msg = "Platform error while getting string value: ";
log_msg += std::string(key) + " " + std::to_string(ret);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
- LOGD("value[%s]: %s", key, str_value.c_str());
+ LoggerD("value[%s]: %s", key, str_value.c_str());
return PlatformResult(ErrorCode::NO_ERROR);
}
}
}
const char* error_msg = "Error when retrieving runtime information: " + err;
- LOGE("%s", error_msg);
+ LoggerE("%s", error_msg);
return PlatformResult(ErrorCode::UNKNOWN_ERR, error_msg);
}
if (SYSTEM_INFO_ERROR_NONE
== system_info_get_value_string(key, &platform_c_string)) {
if (platform_c_string) {
- LOGD("Build platfrom string %s", platform_c_string);
+ LoggerD("Build platfrom string %s", platform_c_string);
platform_string = platform_c_string;
free(platform_c_string);
return PlatformResult(ErrorCode::NO_ERROR);
}
const char* error_msg = "Error when retrieving value from platform API";
- LOGE("%s", error_msg);
+ LoggerE("%s", error_msg);
return PlatformResult(ErrorCode::UNKNOWN_ERR, error_msg);
}
return PlatformResult(ErrorCode::NO_ERROR);
} else {
const std::string error_msg = "Could not get " + std::string(key);
- LOGD("%s",error_msg.c_str());
+ LoggerD("%s",error_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, error_msg);
}
- LOGD("value[%s]: %d", key, value);
+ LoggerD("value[%s]: %d", key, value);
return PlatformResult(ErrorCode::NO_ERROR);
}
long long SysteminfoUtils::GetTotalMemory()
{
- LOGD("Entered");
+ LoggerD("Entered");
unsigned int value = 0;
int ret = device_memory_get_total(&value);
if (ret != DEVICE_ERROR_NONE) {
std::string log_msg = "Failed to get total memory: " + std::to_string(ret);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
throw UnknownException(log_msg.c_str());
}
long long SysteminfoUtils::GetAvailableMemory()
{
- LOGD("Entered");
+ LoggerD("Entered");
unsigned int value = 0;
int ret = device_memory_get_available(&value);
if (ret != DEVICE_ERROR_NONE) {
std::string log_msg = "Failed to get total memory: " + std::to_string(ret);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
throw UnknownException(log_msg.c_str());
}
PlatformResult SysteminfoUtils::GetCount(const std::string& property, unsigned long& count)
{
- LOGD("Enter");
+ LoggerD("Enter");
if ("BATTERY" == property || "CPU" == property || "STORAGE" == property ||
"DISPLAY" == property || "DEVICE_ORIENTATION" == property ||
} else if ("SIM" == property) {
count = sim_mgr.GetSimCount(system_info_listeners.GetTapiHandles());
} else {
- LOGD("Property with given id is not supported");
+ LoggerD("Property with given id is not supported");
return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, "Property with given id is not supported");
}
return PlatformResult(ErrorCode::NO_ERROR);
} else if ("MEMORY" == property) {
return ReportMemory(res_obj);
} else {
- LOGD("Property with given id is not supported");
+ LoggerD("Property with given id is not supported");
return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, "Property with given id is not supported");
}
return PlatformResult(ErrorCode::NO_ERROR);
PlatformResult SysteminfoUtils::GetPropertyValue(const std::string& property, bool is_array_type,
picojson::value& res)
{
- LOGD("Entered getPropertyValue");
+ LoggerD("Entered getPropertyValue");
if (!is_array_type) {
picojson::object& res_obj = res.get<picojson::object>();
int ret = vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, &value);
if (kVconfErrorNone != ret) {
std::string log_msg = "Platform error while getting battery detail: ";
- LOGE("%s%d", log_msg.c_str(), ret);
+ LoggerE("%s%d", log_msg.c_str(), ret);
return PlatformResult(ErrorCode::UNKNOWN_ERR, (log_msg + std::to_string(ret)));
}
ret = vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &value);
if (kVconfErrorNone != ret) {
std::string log_msg = "Platform error while getting battery charging: ";
- LOGE("%s%d",log_msg.c_str(), ret);
+ LoggerE("%s%d",log_msg.c_str(), ret);
return PlatformResult(ErrorCode::UNKNOWN_ERR, (log_msg + std::to_string(ret)));
}
out.insert(std::make_pair("level", static_cast<double>(value)/kRemainingBatteryChargeMax));
}
//TODO maybe make two functions later onGSourceFunc
PlatformResult SysteminfoUtils::ReportCpu(picojson::object& out) {
- LOGD("Entered");
+ LoggerD("Entered");
static CpuInfo cpu_info;
FILE *fp = nullptr;
fp = fopen("/proc/stat", "r");
if (nullptr == fp) {
std::string error_msg("Can not open /proc/stat for reading");
- LOGE( "%s", error_msg.c_str() );
+ LoggerE( "%s", error_msg.c_str() );
return PlatformResult(ErrorCode::UNKNOWN_ERR, error_msg);
}
cpu_info.idle = idle;
cpu_info.load = load;
} else {
- LOGW("Cannot calculate cpu load, previous value returned");
+ LoggerW("Cannot calculate cpu load, previous value returned");
load = cpu_info.load;
}
} else {
std::string error_msg( "Could not read /proc/stat" );
- LOGE( "%s", error_msg.c_str() );
+ LoggerE( "%s", error_msg.c_str() );
return PlatformResult(ErrorCode::UNKNOWN_ERR, error_msg);
}
system_info_listeners.SetCpuInfoLoad(cpu_info.load);
load = 100 - load;
- LOGD("Cpu load : %f", load );
+ LoggerD("Cpu load : %f", load );
out.insert(std::make_pair("load", load / 100.0));
return PlatformResult(ErrorCode::NO_ERROR);
}
// FETCH RESOLUTION
if (SYSTEM_INFO_ERROR_NONE != system_info_get_value_int(
SYSTEM_INFO_KEY_SCREEN_WIDTH, &screenWidth)) {
- LOGE("Cannot get value of screen width");
+ LoggerE("Cannot get value of screen width");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get value of screen width");
}
if (SYSTEM_INFO_ERROR_NONE != system_info_get_value_int(
SYSTEM_INFO_KEY_SCREEN_HEIGHT, &screenHeight)) {
- LOGE("Cannot get value of screen height");
+ LoggerE("Cannot get value of screen height");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get value of screen height");
}
dotsPerInchWidth = dots_per_inch;
dotsPerInchHeight = dots_per_inch;
} else {
- LOGE("Cannot get 'tizen.org/feature/screen.dpi' value");
+ LoggerE("Cannot get 'tizen.org/feature/screen.dpi' value");
return PlatformResult(ErrorCode::UNKNOWN_ERR,
"Cannot get 'tizen.org/feature/screen.dpi' value");
}
//FETCH PHYSICAL WIDTH
if (SYSTEM_INFO_ERROR_NONE != system_info_get_value_int(
SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, &physicalWidth)) {
- LOGE("Cannot get value of phisical screen width");
+ LoggerE("Cannot get value of phisical screen width");
//TODO uncomment when api would support this key
//return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get value of phisical screen width");
}
//FETCH PHYSICAL HEIGHT
if (SYSTEM_INFO_ERROR_NONE != system_info_get_value_int(
SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, &physicalHeight)) {
- LOGE("Cannot get value of phisical screen height");
+ LoggerE("Cannot get value of phisical screen height");
//TODO uncomment when api would support this key
//return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get value of phisical screen height");
}
if (kVconfErrorNone == vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness)) {
scaledBrightness = static_cast<double>(brightness)/kDisplayBrightnessDivideValue;
} else {
- LOGE("Cannot get brightness value of display");
+ LoggerE("Cannot get brightness value of display");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get brightness value of display");
}
PlatformResult SysteminfoUtils::ReportBuild(picojson::object& out) {
std::string model = "";
- PlatformResult ret = GetValueString("tizen.org/system/model_name", model);
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueString("tizen.org/system/model_name", model);
if (ret.IsError()) {
return ret;
}
type_string = kNetworkTypeUnknown;
break;
default:
- LOGE("Incorrect type: %d", type);
+ LoggerE("Incorrect type: %d", type);
return PlatformResult(ErrorCode::TYPE_MISMATCH_ERR, "Incorrect type");
}
return PlatformResult(ErrorCode::NO_ERROR);
int error = connection_create(&connection_handle);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot create connection: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
std::unique_ptr<std::remove_pointer<connection_h>::type, int(*)(connection_h)>
error = connection_get_type(connection_handle, &connection_type);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot get connection type: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
type = kEthernet;
break;
default:
- LOGE("Incorrect type: %d", connection_type);
+ LoggerE("Incorrect type: %d", connection_type);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Incorrect type");
}
std::string type_str = "";
CONNECTION_ADDRESS_FAMILY_IPV4,
&ip_addr);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to get ip address: %d", error);
+ LoggerE("Failed to get ip address: %d", error);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get ip address");
}
*ip_addr_str = ip_addr;
} else if (CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED != error) {
//core api returns error -97 = CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED
//it will be supported in the future. For now let's ignore this error
- LOGE("Failed to get ipv6 address: %d", error);
+ LoggerE("Failed to get ipv6 address: %d", error);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get ipv6 address");
}
return PlatformResult(ErrorCode::NO_ERROR);
int error = connection_create(&connection_handle);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot create connection: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
std::unique_ptr<std::remove_pointer<connection_h>::type, int(*)(connection_h)>
char* mac = NULL;
error = wifi_get_mac_address(&mac);
if(WIFI_ERROR_NONE == error) {
- LOGD("macAddress fetched: %s", mac);
+ LoggerD("macAddress fetched: %s", mac);
result_mac_address = mac;
free(mac);
} else {
std::string log_msg = "Failed to get mac address: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
error = connection_get_type(connection_handle, &connection_type);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot get connection type: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
if (CONNECTION_TYPE_WIFI == connection_type) {
error = connection_get_current_profile(connection_handle, &profile_handle);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot get connection profile: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
std::unique_ptr
}
else {
std::string log_msg = "Failed to get network ssid: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
}
else {
std::string log_msg = "Failed to get signal strength: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
}
else {
- LOGD("Connection type = %d. WIFI is disabled", connection_type);
+ LoggerD("Connection type = %d. WIFI is disabled", connection_type);
}
out.insert(std::make_pair("status", result_status ? kWifiStatusOn : kWifiStatusOff));
bool *result_is_roaming,
bool *result_is_flight_mode)
{
- LOGD("Entered");
+ LoggerD("Entered");
int result;
if (0 != vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &result)) {
- LOGE("Cannot get mcc value");
+ LoggerE("Cannot get mcc value");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get mcc value");
}
*result_mcc = static_cast<unsigned short>(result) / kMccDivider;
*result_mnc = static_cast<unsigned short>(result) % kMccDivider;
if (0 != vconf_get_int(VCONFKEY_TELEPHONY_CELLID, &result)) {
- LOGE("Cannot get cell_id value");
+ LoggerE("Cannot get cell_id value");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get cell_id value");
}
*result_cell_id = static_cast<unsigned short>(result);
if (0 != vconf_get_int(VCONFKEY_TELEPHONY_LAC, &result)) {
- LOGE("Cannot get lac value");
+ LoggerE("Cannot get lac value");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get lac value");
}
*result_lac = static_cast<unsigned short>(result);
if (0 != vconf_get_int(VCONFKEY_TELEPHONY_SVC_ROAM, &result)) {
- LOGE("Cannot get is_roaming value");
+ LoggerE("Cannot get is_roaming value");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get is_roaming value");
}
*result_is_roaming = (0 != result) ? true : false;
if (0 != vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &result)) {
- LOGE("Cannot get is_flight_mode value");
+ LoggerE("Cannot get is_flight_mode value");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get is_flight_mode value");
}
*result_is_flight_mode = (0 != result) ? true : false;
std::string* result_apn, std::string* result_ip_address,
std::string* result_ipv6_address, std::string* result_imei)
{
- LOGD("Entered");
+ LoggerD("Entered");
connection_type_e connection_type = CONNECTION_TYPE_DISCONNECTED;
connection_profile_h profile_handle = nullptr;
connection_h connection_handle = nullptr;
int error = connection_create(&connection_handle);
if (CONNECTION_ERROR_NONE != error) {
std::string log_msg = "Cannot create connection: " + std::to_string(error);
- LOGE("%s", log_msg.c_str());
+ LoggerE("%s", log_msg.c_str());
return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
std::unique_ptr<std::remove_pointer<connection_h>::type, int(*)(connection_h)>
error = connection_get_type(connection_handle, &connection_type);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to get connection type: %d", error);
+ LoggerE("Failed to get connection type: %d", error);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get connection type");
}
profile_handle_ptr(profile_handle, &connection_profile_destroy);
// automatically release the memory
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to get profile: %d", error);
+ LoggerE("Failed to get profile: %d", error);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get profile");
}
error = connection_profile_get_cellular_apn(profile_handle, &apn);
if (CONNECTION_ERROR_NONE != error) {
- LOGE("Failed to get apn name: %d", error);
+ LoggerE("Failed to get apn name: %d", error);
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Cannot get apn name");
}
*result_apn = apn;
*result_apn = apn;
free(apn);
} else {
- LOGE("Failed to get default apn name: %d. Failing silently",
+ LoggerE("Failed to get default apn name: %d. Failing silently",
error);
}
} else {
- LOGE("Failed to get default profile: %d. Failing silently",
+ LoggerE("Failed to get default profile: %d. Failing silently",
error);
}
}
*result_imei = imei;
free(imei);
} else {
- LOGE("Failed to get imei, nullptr pointer. Setting empty value.");
+ LoggerE("Failed to get imei, nullptr pointer. Setting empty value.");
*result_imei = "";
}
return PlatformResult(ErrorCode::NO_ERROR);
void SimCphsValueCallback(TapiHandle */*handle*/, int result, void *data, void */*user_data*/)
{
- LOGD("Entered");
+ LoggerD("Entered");
TelSimAccessResult_t access_rt = static_cast<TelSimAccessResult_t>(result);
TelSimCphsNetName_t *cphs_info = static_cast<TelSimCphsNetName_t*>(data);
}
result_operator = s.str();
} else {
- LOGW("Failed to retrieve cphs_info: %d", access_rt);
+ LoggerW("Failed to retrieve cphs_info: %d", access_rt);
}
sim_mgr.set_operator_name(result_operator);
sim_mgr.TryReturn();
void SimMsisdnValueCallback(TapiHandle */*handle*/, int result, void *data, void */*user_data*/)
{
- LOGD("Entered");
+ LoggerD("Entered");
TelSimAccessResult_t access_rt = static_cast<TelSimAccessResult_t>(result);
TelSimMsisdnList_t *msisdn_info = static_cast<TelSimMsisdnList_t*>(data);
if (nullptr != msisdn_info->list[0].num) {
result_msisdn = msisdn_info->list[0].num;
} else {
- LOGW("MSISDN number empty");
+ LoggerW("MSISDN number empty");
}
} else {
- LOGW("msisdn_info list empty");
+ LoggerW("msisdn_info list empty");
}
} else {
- LOGW("Failed to retrieve msisdn_: %d", access_rt);
+ LoggerW("Failed to retrieve msisdn_: %d", access_rt);
}
sim_mgr.set_msisdn(result_msisdn);
void SimSpnValueCallback(TapiHandle */*handle*/, int result, void *data, void */*user_data*/)
{
- LOGD("Entered");
+ LoggerD("Entered");
TelSimAccessResult_t access_rt = static_cast<TelSimAccessResult_t>(result);
TelSimSpn_t *spn_info = static_cast<TelSimSpn_t*>(data);
if (TAPI_SIM_ACCESS_SUCCESS == access_rt) {
result_spn = (char *)spn_info->spn;
} else {
- LOGW("Failed to retrieve spn_: %d", access_rt);
+ LoggerW("Failed to retrieve spn_: %d", access_rt);
}
sim_mgr.set_spn(result_spn);
picojson::object& internal_obj = array.back().get<picojson::object>();
if (statfs(kStorageInternalPath, &fs) < 0) {
- LOGE("There are no storage units detected");
+ LoggerE("There are no storage units detected");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "There are no storage units detected");
}
CreateStorageInfo(kTypeInternal, fs, &internal_obj);
if (0 == vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcardState)) {
if (VCONFKEY_SYSMAN_MMC_MOUNTED == sdcardState){
if (statfs(kStorageSdcardPath, &fs) < 0) {
- LOGE("MMC mounted, but not accessible");
+ LoggerE("MMC mounted, but not accessible");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "MMC mounted, but not accessible");
}
array.push_back(picojson::value(picojson::object()));
}
-static bool CheckStringCapability(const std::string& key, std::string* value)
+static PlatformResult CheckStringCapability(const std::string& key, std::string* value, bool& fetched)
{
- LOGD("Entered CheckStringCapability");
+ LoggerD("Entered CheckStringCapability");
if (key == kTizenFeatureOpenglesTextureFormat) {
- *value = SystemInfoDeviceCapability::GetOpenglesTextureFormat();
+ PlatformResult ret = SystemInfoDeviceCapability::GetOpenglesTextureFormat(*value);
+ if (ret.IsError()) {
+ return ret;
+ }
} else if (key == kTizenFeatureCoreApiVersion) {
*value = "2.3";
} else if (key == kTizenFeaturePlatfromCoreCpuArch) {
- *value = SystemInfoDeviceCapability::GetPlatfomCoreCpuArch();
+ PlatformResult ret = SystemInfoDeviceCapability::GetPlatfomCoreCpuArch(*value);
+ if (ret.IsError()) {
+ return ret;
+ }
} else if (key == kTizenFeaturePlatfromCoreFpuArch) {
- *value = SystemInfoDeviceCapability::GetPlatfomCoreFpuArch();
+ PlatformResult ret = SystemInfoDeviceCapability::GetPlatfomCoreFpuArch(*value);
+ if (ret.IsError()) {
+ return ret;
+ }
} else if (key == kTizenFeatureProfile) {
- *value = SystemInfoDeviceCapability::GetProfile();
+ PlatformResult ret = SystemInfoDeviceCapability::GetProfile(*value);
+ if (ret.IsError()) {
+ return ret;
+ }
} else if (key == kTizenSystemDuid) {
*value = SystemInfoDeviceCapability::GetDuid();
} else {
- PlatformResult ret = GetValueString(key.substr(strlen("http://")).c_str(), *value);
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueString(key.substr(strlen("http://")).c_str(), *value);
if (ret.IsError()){
- return false;
+ fetched = false;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
}
- return true;
+ fetched = true;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-static bool CheckBoolCapability(const std::string& key, bool* bool_value)
+static PlatformResult CheckBoolCapability(const std::string& key, bool* bool_value, bool& fetched)
{
- LOGD("Entered CheckBoolCapability");
- bool fetched = false;
+ LoggerD("Entered CheckBoolCapability");
+ fetched = false;
if(key == kTizenFeatureAccount) {
*bool_value = SystemInfoDeviceCapability::IsAccount();
fetched = true;
*bool_value = SystemInfoDeviceCapability::IsScreen();
fetched = true;
} else if(key == kTizenFeatureScreenSIZE_320_320) {
- *bool_value = SystemInfoDeviceCapability::IsScreenSize320_320();
+ PlatformResult ret = SystemInfoDeviceCapability::IsScreenSize320_320(*bool_value);
+ if (ret.IsError()) {
+ return ret;
+ }
fetched = true;
} else {
- try {
- *bool_value = GetValueBool(key.substr(strlen("http://")).c_str());
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueBool(
+ key.substr(strlen("http://")).c_str(), *bool_value);
+ if (ret.IsSuccess()) {
fetched = true;
- } catch (...){
- //empty for purpose - ignore that key was not found
}
}
- return fetched;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-static bool CheckIntCapability(const std::string& key, std::string* value)
+static PlatformResult CheckIntCapability(const std::string& key, std::string* value, bool& fetched)
{
- LOGD("Entered CheckIntCapability");
- try {
- *value = std::to_string(GetValueInt(key.substr(strlen("http://")).c_str()));
- return true;
- } catch (...) {
- //empty for purpose - ignore that key was not found
+ LoggerD("Entered CheckIntCapability");
+ int result = 0;
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueInt(
+ key.substr(strlen("http://")).c_str(), result);
+ if (ret.IsSuccess()) {
+ *value = std::to_string(result);
+ fetched = true;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
- return false;
+ fetched = false;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
/////////////////////// SystemInfoDeviceCapability //////////////////////////////////////
-picojson::value SystemInfoDeviceCapability::GetCapability(const std::string& key)
+PlatformResult SystemInfoDeviceCapability::GetCapability(const std::string& key,
+ picojson::value& result)
{
- picojson::value result = picojson::value(picojson::object());
picojson::object& result_obj = result.get<picojson::object>();
std::string value = "";
std::string type = "";
bool bool_value = false ;
- if (CheckStringCapability(key, &value)) {
+ bool fetched_string = false;
+ bool fetched_int = false;
+ bool fetched_bool = false;
+ PlatformResult ret = CheckStringCapability(key, &value, fetched_string);
+ if (ret.IsError()) {
+ return ret;
+ }
+ ret = CheckIntCapability(key, &value, fetched_int);
+ if (ret.IsError()) {
+ return ret;
+ }
+ ret = CheckBoolCapability(key, &bool_value, fetched_bool);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (fetched_string) {
type = "string";
- } else if (CheckIntCapability(key, &value)) {
+ } else if (fetched_int) {
type = "int";
- } else if(CheckBoolCapability(key, &bool_value)) {
+ } else if(fetched_bool) {
type = "bool";
}
} else if (type == "string" || type == "int") {
result_obj.insert(std::make_pair("value", value));
} else {
- LOGD("Value for given key was not found");
- throw NotSupportedException("Value for given key was not found");
+ LoggerD("Value for given key was not found");
+ return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, "Value for given key was not found");
}
result_obj.insert(std::make_pair("type", type));
- return result;
-}
-
-bool SystemInfoDeviceCapability::IsBluetooth() {
- return GetValueBool("tizen.org/feature/network.bluetooth");
-}
-
-bool SystemInfoDeviceCapability::IsNfc() {
- return GetValueBool("tizen.org/feature/network.nfc");
-}
-
-bool SystemInfoDeviceCapability::IsNfcReservedPush() {
- return GetValueBool("tizen.org/feature/network.nfc.reserved_push");
-}
-
-unsigned short SystemInfoDeviceCapability::GetMultiTouchCount() {
- return GetValueInt("tizen.org/feature/multi_point_touch.point_count");
-}
-
-bool SystemInfoDeviceCapability::IsInputKeyboard() {
- return GetValueBool("tizen.org/feature/input.keyboard");
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-bool SystemInfoDeviceCapability::IsInputKeyboardLayout() {
+PlatformResult SystemInfoDeviceCapability::IsInputKeyboardLayout(bool& result) {
std::string input_keyboard_layout = "";
PlatformResult ret = GetValueString("tizen.org/feature/input.keyboard.layout",
input_keyboard_layout);
-
- bool input_keyboard = GetValueBool("tizen.org/feature/input.keyboard");
+ if (ret.IsError()) {
+ return ret;
+ }
+ bool input_keyboard = false;
+ ret = GetValueBool("tizen.org/feature/input.keyboard", input_keyboard);
+ if (ret.IsError()) {
+ return ret;
+ }
// according to SystemInfo-DeviceCapabilities-dependency-table
// inputKeyboard inputKeyboardLayout
// X X Possible
// X O Impossible
- return input_keyboard ? !(input_keyboard_layout.empty()) : false;
-}
-
-bool SystemInfoDeviceCapability::IsWifi() {
- return GetValueBool("tizen.org/feature/network.wifi");
-}
-
-bool SystemInfoDeviceCapability::IsWifiDirect() {
- return GetValueBool("tizen.org/feature/network.wifi.direct");
-}
-
-bool SystemInfoDeviceCapability::IsFmRadio() {
- return GetValueBool("tizen.org/feature/fmradio");
-}
-
-bool SystemInfoDeviceCapability::IsOpengles() {
- return GetValueBool("tizen.org/feature/opengles");
-}
-
-bool SystemInfoDeviceCapability::IsOpenglesVersion11() {
- return GetValueBool("tizen.org/feature/opengles.version.1_1");
-}
-
-bool SystemInfoDeviceCapability::IsOpenglesVersion20() {
- return GetValueBool("tizen.org/feature/opengles.version.2_0");
+ result = input_keyboard ? !(input_keyboard_layout.empty()) : false;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-std::string SystemInfoDeviceCapability::GetOpenglesTextureFormat() {
- if (!GetValueBool("tizen.org/feature/opengles")) {
+PlatformResult SystemInfoDeviceCapability::GetOpenglesTextureFormat(std::string& result) {
+ bool bool_result = false;
+ PlatformResult ret = GetValueBool("tizen.org/feature/opengles", bool_result);
+ if (!bool_result) {
// this exception is converted to "Undefined" value in JS layer
std::string log_msg = "OpenGL-ES is not supported";
- LOGE("%s", log_msg.c_str());
- throw NotSupportedException(log_msg);
+ LoggerE("%s", log_msg.c_str());
+ return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, log_msg);
}
std::string texture_format = "";
- if (GetValueBool("tizen.org/feature/opengles.texture_format.utc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.utc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
texture_format += kOpenglesTextureUtc;
}
- if (GetValueBool("tizen.org/feature/opengles.texture_format.ptc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.ptc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!texture_format.empty()) {
texture_format += kOpenglesTextureDelimiter;
}
texture_format += kOpenglesTexturePtc;
}
- if (GetValueBool("tizen.org/feature/opengles.texture_format.etc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.etc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!texture_format.empty()) {
texture_format += kOpenglesTextureDelimiter;
}
texture_format += kOpenglesTextureEtc;
}
- if (GetValueBool("tizen.org/feature/opengles.texture_format.3dc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.3dc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!texture_format.empty()) {
texture_format += kOpenglesTextureDelimiter;
}
texture_format += kOpenglesTexture3dc;
}
- if (GetValueBool("tizen.org/feature/opengles.texture_format.atc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.atc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!texture_format.empty()) {
texture_format += kOpenglesTextureDelimiter;
}
texture_format += kOpenglesTextureAtc;
}
- if (GetValueBool("tizen.org/feature/opengles.texture_format.pvrtc")) {
+
+ ret = GetValueBool("tizen.org/feature/opengles.texture_format.pvrtc", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!texture_format.empty()) {
texture_format += kOpenglesTextureDelimiter;
}
texture_format += kOpenglesTexturePvrtc;
}
+
if (texture_format.empty()) {
// this exception is converted to "Undefined" value in JS layer
std::string log_msg = "Platform error while getting OpenGL-ES texture format";
- LOGE("%s", log_msg.c_str());
- throw UnknownException(log_msg);
+ LoggerE("%s", log_msg.c_str());
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg);
}
- return texture_format;
-}
-
-bool SystemInfoDeviceCapability::IsSpeechRecognition() {
- return GetValueBool("tizen.org/feature/speech.recognition");
-}
-
-bool SystemInfoDeviceCapability::IsSpeechSynthesis() {
- return GetValueBool("tizen.org/feature/speech.synthesis");
-}
-
-bool SystemInfoDeviceCapability::IsAccelerometer() {
- return GetValueBool("tizen.org/feature/sensor.accelerometer");
-}
-
-bool SystemInfoDeviceCapability::IsAccelerometerWakeup() {
- return GetValueBool("tizen.org/feature/sensor.accelerometer.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsBarometer() {
- return GetValueBool("tizen.org/feature/sensor.barometer");
-}
-
-bool SystemInfoDeviceCapability::IsBarometerWakeup() {
- return GetValueBool("tizen.org/feature/sensor.barometer.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsGyroscope() {
- return GetValueBool("tizen.org/feature/sensor.gyroscope");
-}
-
-bool SystemInfoDeviceCapability::IsGyroscopeWakeup() {
- return GetValueBool("tizen.org/feature/sensor.gyroscope.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsGraphicsAcceleration() {
- return GetValueBool("tizen.org/feature/graphics.acceleration");
-}
-
-bool SystemInfoDeviceCapability::IsPush() {
- return GetValueBool("tizen.org/feature/network.push");
-}
-
-bool SystemInfoDeviceCapability::IsTelephony() {
- return GetValueBool("tizen.org/feature/network.telephony");
-}
-
-bool SystemInfoDeviceCapability::IsTelephonyMMS() {
- return GetValueBool("tizen.org/feature/network.telephony.mms");
-}
-
-bool SystemInfoDeviceCapability::IsTelephonySMS() {
- return GetValueBool("tizen.org/feature/network.telephony.sms");
-}
-
-bool SystemInfoDeviceCapability::IsCamera() {
- return GetValueBool("tizen.org/feature/camera");
-}
-
-bool SystemInfoDeviceCapability::IsCameraFront() {
- return GetValueBool("tizen.org/feature/camera.front");
-}
-
-bool SystemInfoDeviceCapability::IsCameraFrontFlash() {
- return GetValueBool("tizen.org/feature/camera.front.flash");
-}
-
-bool SystemInfoDeviceCapability::IsCameraBack() {
- return GetValueBool("tizen.org/feature/camera.back");
-}
-
-bool SystemInfoDeviceCapability::IsCameraBackFlash() {
- return GetValueBool("tizen.org/feature/camera.back.flash");
-}
-
-bool SystemInfoDeviceCapability::IsLocation() {
- return GetValueBool("tizen.org/feature/location");
-}
-
-bool SystemInfoDeviceCapability::IsLocationGps() {
- return GetValueBool("tizen.org/feature/location.gps");
-}
-
-bool SystemInfoDeviceCapability::IsLocationWps() {
- return GetValueBool("tizen.org/feature/location.wps");
-}
-
-bool SystemInfoDeviceCapability::IsMicrophone() {
- return GetValueBool("tizen.org/feature/microphone");
-}
-
-bool SystemInfoDeviceCapability::IsUsbHost() {
- return GetValueBool("tizen.org/feature/usb.host");
-}
-
-bool SystemInfoDeviceCapability::IsUsbAccessory() {
- return GetValueBool("tizen.org/feature/usb.accessory");
-}
-
-bool SystemInfoDeviceCapability::IsScreenOutputRca() {
- return GetValueBool("tizen.org/feature/screen.output.rca");
-}
-
-bool SystemInfoDeviceCapability::IsScreenOutputHdmi() {
- return GetValueBool("tizen.org/feature/screen.output.hdmi");
+ result = texture_format;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-std::string SystemInfoDeviceCapability::GetPlatfomCoreCpuArch() {
+PlatformResult SystemInfoDeviceCapability::GetPlatfomCoreCpuArch(std::string& return_value) {
std::string result;
- if (GetValueBool("tizen.org/feature/platform.core.cpu.arch.armv6")) {
+ bool bool_result = false;
+ PlatformResult ret = GetValueBool("tizen.org/feature/platform.core.cpu.arch.armv6", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
result = kPlatformCoreArmv6;
}
- if (GetValueBool("tizen.org/feature/platform.core.cpu.arch.armv7")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.cpu.arch.armv7", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreArmv7;
}
- if (GetValueBool("tizen.org/feature/platform.core.cpu.arch.x86")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.cpu.arch.x86", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreX86;
}
+
if (result.empty()) {
- LOGE("Platform error while retrieving platformCoreCpuArch: result is empty");
- throw UnknownException("platformCoreCpuArch result is empty");
+ LoggerE("Platform error while retrieving platformCoreCpuArch: result is empty");
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, "platformCoreCpuArch result is empty");
}
- return result;
+ return_value = result;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-std::string SystemInfoDeviceCapability::GetPlatfomCoreFpuArch() {
+PlatformResult SystemInfoDeviceCapability::GetPlatfomCoreFpuArch(std::string& return_value) {
std::string result;
- if (GetValueBool("tizen.org/feature/platform.core.fpu.arch.sse2")) {
+ bool bool_result = false;
+ PlatformResult ret = GetValueBool("tizen.org/feature/platform.core.fpu.arch.sse2", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
result = kPlatformCoreSse2;
}
- if (GetValueBool("tizen.org/feature/platform.core.fpu.arch.sse3")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.fpu.arch.sse3", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreSse3;
}
- if (GetValueBool("tizen.org/feature/platform.core.fpu.arch.ssse3")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.fpu.arch.ssse3", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreSsse3;
}
- if (GetValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv2")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv2", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreVfpv2;
}
- if (GetValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv3")) {
+
+ ret = GetValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv3", bool_result);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (bool_result) {
if (!result.empty()) {
result += kPlatformCoreDelimiter;
}
result += kPlatformCoreVfpv3;
}
if (result.empty()) {
- LOGE("Platform error while retrieving platformCoreFpuArch: result is empty");
- throw UnknownException("platformCoreFpuArch result is empty");
+ LoggerE("Platform error while retrieving platformCoreFpuArch: result is empty");
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, "platformCoreFpuArch result is empty");
}
- return result;
-}
-
-bool SystemInfoDeviceCapability::IsSipVoip() {
- return GetValueBool("tizen.org/feature/sip.voip");
-}
-
-std::string SystemInfoDeviceCapability::GetPlatformName() {
- std::string result = "";
- GetValueString("tizen.org/system/platform.name", result);
- return result;
-}
-
-std::string SystemInfoDeviceCapability::GetPlatformVersion() {
- std::string result = "";
- GetValueString("tizen.org/feature/platform.version", result);
- return result;
-}
-
-std::string SystemInfoDeviceCapability::GetWebApiVersion() {
- std::string result = "";
- GetValueString("tizen.org/feature/platform.web.api.version", result);
- return result;
-}
-
-bool SystemInfoDeviceCapability::IsMagnetometer() {
- return GetValueBool("tizen.org/feature/sensor.magnetometer");
-}
-
-bool SystemInfoDeviceCapability::IsMagnetometerWakeup() {
- return GetValueBool("tizen.org/feature/sensor.magnetometer.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsPhotometer() {
- return GetValueBool("tizen.org/feature/sensor.photometer");
-}
-
-bool SystemInfoDeviceCapability::IsPhotometerWakeup() {
- return GetValueBool("tizen.org/feature/sensor.photometer.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsProximity() {
- return GetValueBool("tizen.org/feature/sensor.proximity");
-}
-
-bool SystemInfoDeviceCapability::IsProximityWakeup() {
- return GetValueBool("tizen.org/feature/sensor.proximity.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsTiltmeter() {
- return GetValueBool("tizen.org/feature/sensor.tiltmeter");
-}
-
-bool SystemInfoDeviceCapability::IsTiltmeterWakeup() {
- return GetValueBool("tizen.org/feature/sensor.tiltmeter.wakeup");
-}
-
-bool SystemInfoDeviceCapability::IsDataEncryption() {
- return GetValueBool("tizen.org/feature/database.encryption");
-}
-
-bool SystemInfoDeviceCapability::IsAutoRotation() {
- return GetValueBool("tizen.org/feature/screen.auto_rotation");
-}
-
-bool SystemInfoDeviceCapability::IsVisionImageRecognition() {
- return GetValueBool("tizen.org/feature/vision.image_recognition");
-}
-
-bool SystemInfoDeviceCapability::IsVisionQrcodeGeneration() {
- return GetValueBool("tizen.org/feature/vision.qrcode_generation");
-}
-
-bool SystemInfoDeviceCapability::IsVisionQrcodeRecognition() {
- return GetValueBool("tizen.org/feature/vision.qrcode_recognition");
-}
-
-bool SystemInfoDeviceCapability::IsVisionFaceRecognition() {
- return GetValueBool("tizen.org/feature/vision.face_recognition");
-}
-
-bool SystemInfoDeviceCapability::IsSecureElement() {
- return GetValueBool("tizen.org/feature/network.secure_element");
+ return_value = result;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
-std::string SystemInfoDeviceCapability::GetProfile() {
+PlatformResult SystemInfoDeviceCapability::GetProfile(std::string& return_value) {
std::string profile = "";
- GetValueString("tizen.org/feature/profile", profile);
+ PlatformResult ret = GetValueString("tizen.org/feature/profile", profile);
+ if (ret.IsError()) {
+ return ret;
+ }
+ return_value = kProfileFull;
if ( kPlatformFull == profile ) {
- return kProfileFull;
+ return_value = kProfileFull;
} else if ( kPlatformMobile == profile ) {
- return kProfileMobile;
+ return_value = kProfileMobile;
} else if ( kPlatformWearable == profile ) {
- return kProfileWearable;
+ return_value = kProfileWearable;
}
- return kProfileFull;
-}
-
-std::string SystemInfoDeviceCapability::GetNativeAPIVersion()
-{
- std::string result = "";
- GetValueString("tizen.org/feature/platform.native.api.version", result);
- return result;
+ return PlatformResult(ErrorCode::NO_ERROR);
}
//Implementation ported from devel/webapi/refactoring branch,
//all flags are hardcoded for Kiran on top of this file
std::string SystemInfoDeviceCapability::GenerateDuid()
{
- LOGD("Entered");
+ LoggerD("Entered");
bool supported = false;
std::string duid = "";
#ifdef FEATURE_OPTIONAL_TELEPHONY
ret = system_info_get_platform_bool("tizen.org/feature/network.telephony", &supported);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- LOGE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.telephony).");
+ LoggerE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.telephony).");
return duid;
}
- LOGD("telephony is %s", supported ? "supported." : "not supported.");
+ LoggerD("telephony is %s", supported ? "supported." : "not supported.");
if (supported) {
int time_count = 0;
ret = tel_check_modem_power_status(handle, &status);
if (ret != TAPI_API_SUCCESS) {
tel_deinit(handle);
- LOGD("It is failed to get IMEI.");
+ LoggerD("It is failed to get IMEI.");
return duid;
}
tel_deinit(handle);
} else {
tel_deinit(handle);
- LOGD("Modem is not ready to get IMEI.");
+ LoggerD("Modem is not ready to get IMEI.");
return duid;
}
- LOGD("telephony.- device_string : %s", device_string);
+ LoggerD("telephony.- device_string : %s", device_string);
} else {
- LOGD("Modem handle is not ready.");
+ LoggerD("Modem handle is not ready.");
return duid;
}
} else {
- LOGD("It is failed to generate DUID from telephony information");
+ LoggerD("It is failed to generate DUID from telephony information");
}
#elif FEATURE_OPTIONAL_BT
ret = system_info_get_platform_bool("tizen.org/feature/network.bluetooth", &supported);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- LOGE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.bluetooth).");
+ LoggerE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.bluetooth).");
return duid;
}
- LOGD("bluetooth is %s", supported ? "supported." : "not supported.");
+ LoggerD("bluetooth is %s", supported ? "supported." : "not supported.");
if (supported) {
#ifdef ENABLE_KIRAN
}
free(bt_address);
- LOGD("BT - device_string : %s", device_string);
+ LoggerD("BT - device_string : %s", device_string);
}
#else
FILE* fp = nullptr;
strcat(device_string, "BLU");
strcat(device_string, buffer);
- LOGD("BT - device_string : %s", device_string);
+ LoggerD("BT - device_string : %s", device_string);
} else {
- LOGD("fail file open.");
+ LoggerD("fail file open.");
}
#endif
} else {
- LOGD("It is failed to generate DUID from bluetooth information");
+ LoggerD("It is failed to generate DUID from bluetooth information");
}
#elif FEATURE_OPTIONAL_WI_FI
ret = system_info_get_platform_bool("tizen.org/feature/network.wifi", &supported);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- LOGE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.wifi).");
+ LoggerE("It is failed to call system_info_get_platform_bool(tizen.org/feature/network.wifi).");
return duid;
}
- LOGD("Wi-Fi is %s", supported ? "supported." : "not supported.");
+ LoggerD("Wi-Fi is %s", supported ? "supported." : "not supported.");
if (supported) {
char* wifi_mac_address = nullptr;
}
free(wifi_mac_address);
- LOGD("wifi - device_string : %s", pDeviceString);
+ LoggerD("wifi - device_string : %s", pDeviceString);
} else {
- LOGD("It is failed to get mac address");
+ LoggerD("It is failed to get mac address");
}
} else {
- LOGD("It is failed to generate DUID from wi-fi information");
+ LoggerD("It is failed to generate DUID from wi-fi information");
}
#else
- LOGD("It is failed to generate DUID");
+ LoggerD("It is failed to generate DUID");
#endif
if (device_string != nullptr) {
}
device_string = nullptr;
- LOGD("duid : %s", duid.c_str());
+ LoggerD("duid : %s", duid.c_str());
return duid;
}
std::string SystemInfoDeviceCapability::GenerateId(char* pDeviceString)
{
- LOGD("Entered");
+ LoggerD("Entered");
unsigned long long value = 0;
byte result[8] {0,};
void SystemInfoDeviceCapability::GenerateCrc64(char* device_string, unsigned long long int* value)
{
- LOGD("Entered");
+ LoggerD("Entered");
byte first_crypt[SEED_LENGTH + 1] = {0,};
*value = crc_table[(*value ^ *pu8++) & 0xff] ^ (*value >> 8);
}
- LOGD("value : %llu", value);
+ LoggerD("value : %llu", value);
}
std::string SystemInfoDeviceCapability::Base32Encode(byte* value)
{
- LOGD("Entered");
+ LoggerD("Entered");
byte* encoding_pointer = nullptr;
byte* src_pointer = nullptr;
return GenerateDuid();
}
-bool SystemInfoDeviceCapability::IsScreenSizeNormal()
-{
- return GetValueBool("tizen.org/feature/screen.size.normal");
-}
-
-bool SystemInfoDeviceCapability::IsScreenSize480_800()
-{
- return GetValueBool("tizen.org/feature/screen.size.normal.480.800");
-}
-
-bool SystemInfoDeviceCapability::IsScreenSize720_1280()
-{
- return GetValueBool("tizen.org/feature/screen.size.normal.720.1280");
-}
-
-bool SystemInfoDeviceCapability::IsShellAppWidget()
-{
- return GetValueBool("tizen.org/feature/shell.appwidget");
-}
-
-bool SystemInfoDeviceCapability::IsNativeOspCompatible()
-{
- return GetValueBool("tizen.org/feature/platform.native.osp_compatible");
-}
-
-////additional capabilities
+//////additional capabilities
bool SystemInfoDeviceCapability::IsAccount()
{
#ifdef FEATURE_OPTIONAL_ACCOUNT
return true;
}
-bool SystemInfoDeviceCapability::IsScreenSize320_320()
+PlatformResult SystemInfoDeviceCapability::IsScreenSize320_320(bool& return_value)
{
- int height = GetValueInt("tizen.org/feature/screen.height");
- int width = GetValueInt("tizen.org/feature/screen.width");
+ int height = 0;
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueInt(
+ "tizen.org/feature/screen.height", height);
+ if (ret.IsError()) {
+ return ret;
+ }
+ int width = 0;
+ ret = SystemInfoDeviceCapability::GetValueInt(
+ "tizen.org/feature/screen.width", width);
+ if (ret.IsError()) {
+ return ret;
+ }
if (height != 320 || width != 320) {
- return false;
+ return_value = false;
} else {
- return true;
+ return_value = true;
}
+ return PlatformResult(ErrorCode::NO_ERROR);
}
} // namespace systeminfo
const std::string kPropertyIdSim = "SIM";
const std::string kPropertyIdPeripheral = "PERIPHERAL";
const std::string kPropertyIdMemory= "MEMORY";
+
+#define DEFAULT_REPORT_BOOL_CAPABILITY(str_name, feature_name) \
+ ret = SystemInfoDeviceCapability::GetValueBool(feature_name, bool_value); \
+ if (ret.IsError()) { \
+ ReportError(ret,&out); \
+ return; \
+ } \
+ result_obj.insert(std::make_pair(str_name, bool_value));
+
+#define REPORT_BOOL_CAPABILITY(str_name, method) \
+ ret = method(bool_value); \
+ if (ret.IsError()) { \
+ ReportError(ret,&out); \
+ return; \
+ } \
+ result_obj.insert(std::make_pair(str_name, bool_value));
+
+#define DEFAULT_REPORT_INT_CAPABILITY(str_name, feature_name) \
+ ret = SystemInfoDeviceCapability::GetValueInt(feature_name, int_value); \
+ if (ret.IsError()) { \
+ ReportError(ret,&out); \
+ return; \
+ } \
+ result_obj.insert(std::make_pair(str_name, std::to_string(int_value)));
+
+#define DEFAULT_REPORT_STRING_CAPABILITY(str_name, feature_name) \
+ ret = SystemInfoDeviceCapability::GetValueString(feature_name, str_value); \
+ if (ret.IsError()) { \
+ ReportError(ret,&out); \
+ return; \
+ } \
+ result_obj.insert(std::make_pair(str_name, str_value));
+
+#define REPORT_STRING_CAPABILITY(str_name, method) \
+ ret = method(str_value); \
+ if (ret.IsError()) { \
+ ReportError(ret,&out); \
+ return; \
+ } \
+ result_obj.insert(std::make_pair(str_name, str_value));
}
+
SysteminfoInstance& SysteminfoInstance::getInstance() {
static SysteminfoInstance instance;
return instance;
picojson::value result = picojson::value(picojson::object());
picojson::object& result_obj = result.get<picojson::object>();
- result_obj.insert(std::make_pair("bluetooth",
- SystemInfoDeviceCapability::IsBluetooth() ));
- result_obj.insert(std::make_pair("nfc",
- SystemInfoDeviceCapability::IsNfc() ));
- result_obj.insert(std::make_pair("nfcReservedPush",
- SystemInfoDeviceCapability::IsNfcReservedPush() ));
- result_obj.insert(std::make_pair("multiTouchCount",
- std::to_string(SystemInfoDeviceCapability::GetMultiTouchCount())));
- result_obj.insert(std::make_pair("inputKeyboard",
- SystemInfoDeviceCapability::IsInputKeyboard() ));
- result_obj.insert(std::make_pair("inputKeyboardLayout",
- SystemInfoDeviceCapability::IsInputKeyboardLayout() ));
- result_obj.insert(std::make_pair("wifi",
- SystemInfoDeviceCapability::IsWifi() ));
- result_obj.insert(std::make_pair("wifiDirect",
- SystemInfoDeviceCapability::IsWifiDirect() ));
- result_obj.insert(std::make_pair("platformName",
- SystemInfoDeviceCapability::GetPlatformName() ));
- result_obj.insert(std::make_pair("platformVersion",
- SystemInfoDeviceCapability::GetPlatformVersion() ));
- result_obj.insert(std::make_pair("webApiVersion",
- SystemInfoDeviceCapability::GetWebApiVersion() ));
- result_obj.insert(std::make_pair("fmRadio",
- SystemInfoDeviceCapability::IsFmRadio() ));
- result_obj.insert(std::make_pair("opengles",
- SystemInfoDeviceCapability::IsOpengles() ));
- result_obj.insert(std::make_pair("openglesVersion1_1",
- SystemInfoDeviceCapability::IsOpenglesVersion11() ));
- result_obj.insert(std::make_pair("openglesVersion2_0",
- SystemInfoDeviceCapability::IsOpenglesVersion20() ));
- result_obj.insert(std::make_pair("openglestextureFormat",
- SystemInfoDeviceCapability::GetOpenglesTextureFormat() ));
- result_obj.insert(std::make_pair("speechRecognition",
- SystemInfoDeviceCapability::IsSpeechRecognition() ));
- result_obj.insert(std::make_pair("speechSynthesis",
- SystemInfoDeviceCapability::IsSpeechSynthesis() ));
- result_obj.insert(std::make_pair("accelerometer",
- SystemInfoDeviceCapability::IsAccelerometer( ) ));
- result_obj.insert(std::make_pair("accelerometerWakeup",
- SystemInfoDeviceCapability::IsAccelerometerWakeup() ));
- result_obj.insert(std::make_pair("barometer",
- SystemInfoDeviceCapability::IsBarometer() ));
- result_obj.insert(std::make_pair("barometerWakeup",
- SystemInfoDeviceCapability::IsBarometerWakeup() ));
- result_obj.insert(std::make_pair("gyroscope",
- SystemInfoDeviceCapability::IsGyroscope() ));
- result_obj.insert(std::make_pair("gyroscopeWakeup",
- SystemInfoDeviceCapability::IsGyroscopeWakeup() ));
- result_obj.insert(std::make_pair("camera",
- SystemInfoDeviceCapability::IsCamera() ));
- result_obj.insert(std::make_pair("cameraFront",
- SystemInfoDeviceCapability::IsCameraFront() ));
- result_obj.insert(std::make_pair("cameraFrontFlash",
- SystemInfoDeviceCapability::IsCameraFrontFlash() ));
- result_obj.insert(std::make_pair("cameraBack",
- SystemInfoDeviceCapability::IsCameraBack() ));
- result_obj.insert(std::make_pair("cameraBackFlash",
- SystemInfoDeviceCapability::IsCameraBackFlash() ));
- result_obj.insert(std::make_pair("location",
- SystemInfoDeviceCapability::IsLocation() ));
- result_obj.insert(std::make_pair("locationGps",
- SystemInfoDeviceCapability::IsLocationGps() ));
- result_obj.insert(std::make_pair("locationWps",
- SystemInfoDeviceCapability::IsLocationWps() ));
- result_obj.insert(std::make_pair("microphone",
- SystemInfoDeviceCapability::IsMicrophone() ));
- result_obj.insert(std::make_pair("usbHost",
- SystemInfoDeviceCapability::IsUsbHost() ));
- result_obj.insert(std::make_pair("usbAccessory",
- SystemInfoDeviceCapability::IsUsbAccessory() ));
- result_obj.insert(std::make_pair("screenOutputRca",
- SystemInfoDeviceCapability::IsScreenOutputRca() ));
- result_obj.insert(std::make_pair("screenOutputHdmi",
- SystemInfoDeviceCapability::IsScreenOutputHdmi() ));
- result_obj.insert(std::make_pair("graphicsAcceleration",
- SystemInfoDeviceCapability::IsGraphicsAcceleration() ));
- result_obj.insert(std::make_pair("push",
- SystemInfoDeviceCapability::IsPush() ));
- result_obj.insert(std::make_pair("telephony",
- SystemInfoDeviceCapability::IsTelephony() ));
- result_obj.insert(std::make_pair("telephonyMms",
- SystemInfoDeviceCapability::IsTelephonyMMS() ));
- result_obj.insert(std::make_pair("telephonySms",
- SystemInfoDeviceCapability::IsTelephonySMS() ));
- result_obj.insert(std::make_pair("platformCoreCpuArch",
- SystemInfoDeviceCapability::GetPlatfomCoreCpuArch() ));
- result_obj.insert(std::make_pair("platformCoreFpuArch",
- SystemInfoDeviceCapability::GetPlatfomCoreFpuArch() ));
- result_obj.insert(std::make_pair("sipVoip",
- SystemInfoDeviceCapability::IsSipVoip() ));
- result_obj.insert(std::make_pair("magnetometer",
- SystemInfoDeviceCapability::IsMagnetometer() ));
- result_obj.insert(std::make_pair("magnetometerWakeup",
- SystemInfoDeviceCapability::IsMagnetometerWakeup() ));
- result_obj.insert(std::make_pair("photometer",
- SystemInfoDeviceCapability::IsPhotometer() ));
- result_obj.insert(std::make_pair("photometerWakeup",
- SystemInfoDeviceCapability::IsPhotometerWakeup() ));
- result_obj.insert(std::make_pair("proximity",
- SystemInfoDeviceCapability::IsProximity() ));
- result_obj.insert(std::make_pair("proximityWakeup",
- SystemInfoDeviceCapability::IsProximityWakeup() ));
- result_obj.insert(std::make_pair("tiltmeter",
- SystemInfoDeviceCapability::IsTiltmeter() ));
- result_obj.insert(std::make_pair("tiltmeterWakeup",
- SystemInfoDeviceCapability::IsTiltmeterWakeup() ));
- result_obj.insert(std::make_pair("dataEncryption",
- SystemInfoDeviceCapability::IsDataEncryption() ));
- result_obj.insert(std::make_pair("autoRotation",
- SystemInfoDeviceCapability::IsAutoRotation() ));
- result_obj.insert(std::make_pair("visionImageRecognition",
- SystemInfoDeviceCapability::IsVisionImageRecognition() ));
- result_obj.insert(std::make_pair("visionQrcodeGeneration",
- SystemInfoDeviceCapability::IsVisionQrcodeGeneration() ));
- result_obj.insert(std::make_pair("visionQrcodeRecognition",
- SystemInfoDeviceCapability::IsVisionQrcodeRecognition() ));
- result_obj.insert(std::make_pair("visionFaceRecognition",
- SystemInfoDeviceCapability::IsVisionFaceRecognition() ));
- result_obj.insert(std::make_pair("secureElement",
- SystemInfoDeviceCapability::IsSecureElement() ));
- result_obj.insert(std::make_pair("profile",
- SystemInfoDeviceCapability::GetProfile() ));
- result_obj.insert(std::make_pair("nativeApiVersion",
- SystemInfoDeviceCapability::GetNativeAPIVersion() ));
- result_obj.insert(std::make_pair("duid",
- SystemInfoDeviceCapability::GetDuid() ));
- result_obj.insert(std::make_pair("screenSizeNormal",
- SystemInfoDeviceCapability::IsScreenSizeNormal() ));
- result_obj.insert(std::make_pair("screenSize480_800",
- SystemInfoDeviceCapability::IsScreenSize480_800() ));
- result_obj.insert(std::make_pair("screenSize720_1280",
- SystemInfoDeviceCapability::IsScreenSize720_1280() ));
- result_obj.insert(std::make_pair("shellAppWidget",
- SystemInfoDeviceCapability::IsShellAppWidget() ));
- result_obj.insert(std::make_pair("nativeOspCompatible",
- SystemInfoDeviceCapability::IsNativeOspCompatible() ));
+ bool bool_value = false;
+ int int_value = 0;
+ std::string str_value = "";
+ PlatformResult ret(ErrorCode::NO_ERROR);
+ DEFAULT_REPORT_BOOL_CAPABILITY("bluetooth", "tizen.org/feature/network.bluetooth")
+ DEFAULT_REPORT_BOOL_CAPABILITY("nfc", "tizen.org/feature/network.nfc")
+ DEFAULT_REPORT_BOOL_CAPABILITY("nfcReservedPush", "tizen.org/feature/network.nfc.reserved_push")
+ DEFAULT_REPORT_INT_CAPABILITY("multiTouchCount", "tizen.org/feature/multi_point_touch.point_count")
+ DEFAULT_REPORT_BOOL_CAPABILITY("inputKeyboard", "tizen.org/feature/input.keyboard")
+ REPORT_BOOL_CAPABILITY("inputKeyboardLayout", SystemInfoDeviceCapability::IsInputKeyboardLayout)
+ DEFAULT_REPORT_BOOL_CAPABILITY("wifi", "tizen.org/feature/network.wifi")
+ DEFAULT_REPORT_BOOL_CAPABILITY("wifiDirect", "tizen.org/feature/network.wifi.direct")
+ DEFAULT_REPORT_STRING_CAPABILITY("platformName", "tizen.org/system/platform.name")
+ DEFAULT_REPORT_STRING_CAPABILITY("platformVersion", "tizen.org/feature/platform.version")
+ DEFAULT_REPORT_STRING_CAPABILITY("webApiVersion", "tizen.org/feature/platform.web.api.version")
+ DEFAULT_REPORT_BOOL_CAPABILITY("fmRadio", "tizen.org/feature/fmradio")
+ DEFAULT_REPORT_BOOL_CAPABILITY("opengles", "tizen.org/feature/opengles")
+ DEFAULT_REPORT_BOOL_CAPABILITY("openglesVersion1_1", "tizen.org/feature/opengles.version.1_1")
+ DEFAULT_REPORT_BOOL_CAPABILITY("openglesVersion2_0", "tizen.org/feature/opengles.version.2_0")
+ REPORT_STRING_CAPABILITY("openglestextureFormat",
+ SystemInfoDeviceCapability::GetOpenglesTextureFormat)
+ DEFAULT_REPORT_BOOL_CAPABILITY("speechRecognition", "tizen.org/feature/speech.recognition")
+ DEFAULT_REPORT_BOOL_CAPABILITY("speechSynthesis", "tizen.org/feature/speech.synthesis")
+ DEFAULT_REPORT_BOOL_CAPABILITY("accelerometer", "tizen.org/feature/sensor.accelerometer")
+ DEFAULT_REPORT_BOOL_CAPABILITY("accelerometerWakeup", "tizen.org/feature/sensor.accelerometer.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("barometer", "tizen.org/feature/sensor.barometer")
+ DEFAULT_REPORT_BOOL_CAPABILITY("barometerWakeup", "tizen.org/feature/sensor.barometer.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("gyroscope", "tizen.org/feature/sensor.gyroscope")
+ DEFAULT_REPORT_BOOL_CAPABILITY("gyroscopeWakeup", "tizen.org/feature/sensor.gyroscope.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("camera", "tizen.org/feature/camera")
+ DEFAULT_REPORT_BOOL_CAPABILITY("cameraFront", "tizen.org/feature/camera.front")
+ DEFAULT_REPORT_BOOL_CAPABILITY("cameraFrontFlash", "tizen.org/feature/camera.front.flash")
+ DEFAULT_REPORT_BOOL_CAPABILITY("cameraBack", "tizen.org/feature/camera.back")
+ DEFAULT_REPORT_BOOL_CAPABILITY("cameraBackFlash", "tizen.org/feature/camera.back.flash")
+ DEFAULT_REPORT_BOOL_CAPABILITY("location", "tizen.org/feature/location")
+ DEFAULT_REPORT_BOOL_CAPABILITY("locationGps", "tizen.org/feature/location.gps")
+ DEFAULT_REPORT_BOOL_CAPABILITY("locationWps", "tizen.org/feature/location.wps")
+ DEFAULT_REPORT_BOOL_CAPABILITY("microphone", "tizen.org/feature/microphone")
+ DEFAULT_REPORT_BOOL_CAPABILITY("usbHost", "tizen.org/feature/usb.host")
+ DEFAULT_REPORT_BOOL_CAPABILITY("usbAccessory", "tizen.org/feature/usb.accessory")
+ DEFAULT_REPORT_BOOL_CAPABILITY("screenOutputRca", "tizen.org/feature/screen.output.rca")
+ DEFAULT_REPORT_BOOL_CAPABILITY("screenOutputHdmi", "tizen.org/feature/screen.output.hdmi")
+ DEFAULT_REPORT_BOOL_CAPABILITY("graphicsAcceleration", "tizen.org/feature/graphics.acceleration")
+ DEFAULT_REPORT_BOOL_CAPABILITY("push", "tizen.org/feature/network.push")
+ DEFAULT_REPORT_BOOL_CAPABILITY("telephony", "tizen.org/feature/network.telephony")
+ DEFAULT_REPORT_BOOL_CAPABILITY("telephonyMms", "tizen.org/feature/network.telephony.mms")
+ DEFAULT_REPORT_BOOL_CAPABILITY("telephonySms", "tizen.org/feature/network.telephony.sms")
+ REPORT_STRING_CAPABILITY("platformCoreCpuArch",
+ SystemInfoDeviceCapability::GetPlatfomCoreCpuArch)
+ REPORT_STRING_CAPABILITY("platformCoreFpuArch",
+ SystemInfoDeviceCapability::GetPlatfomCoreFpuArch)
+ DEFAULT_REPORT_BOOL_CAPABILITY("sipVoip", "tizen.org/feature/sip.voip")
+ DEFAULT_REPORT_BOOL_CAPABILITY("magnetometer", "tizen.org/feature/sensor.magnetometer")
+ DEFAULT_REPORT_BOOL_CAPABILITY("magnetometerWakeup", "tizen.org/feature/sensor.magnetometer.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("photometer", "tizen.org/feature/sensor.photometer")
+ DEFAULT_REPORT_BOOL_CAPABILITY("photometerWakeup", "tizen.org/feature/sensor.photometer.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("proximity", "tizen.org/feature/sensor.proximity")
+ DEFAULT_REPORT_BOOL_CAPABILITY("proximityWakeup", "tizen.org/feature/sensor.proximity.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("tiltmeter", "tizen.org/feature/sensor.tiltmeter")
+ DEFAULT_REPORT_BOOL_CAPABILITY("tiltmeterWakeup", "tizen.org/feature/sensor.tiltmeter.wakeup")
+ DEFAULT_REPORT_BOOL_CAPABILITY("dataEncryption", "tizen.org/feature/database.encryption")
+ DEFAULT_REPORT_BOOL_CAPABILITY("autoRotation", "tizen.org/feature/screen.auto_rotation")
+ DEFAULT_REPORT_BOOL_CAPABILITY("visionImageRecognition", "tizen.org/feature/vision.image_recognition")
+ DEFAULT_REPORT_BOOL_CAPABILITY("visionQrcodeGeneration", "tizen.org/feature/vision.qrcode_generation")
+ DEFAULT_REPORT_BOOL_CAPABILITY("visionQrcodeRecognition", "tizen.org/feature/vision.qrcode_recognition")
+ DEFAULT_REPORT_BOOL_CAPABILITY("visionFaceRecognition", "tizen.org/feature/vision.face_recognition")
+ DEFAULT_REPORT_BOOL_CAPABILITY("secureElement", "tizen.org/feature/network.secure_element")
+ REPORT_STRING_CAPABILITY("profile", SystemInfoDeviceCapability::GetProfile)
+ DEFAULT_REPORT_STRING_CAPABILITY("nativeApiVersion", "tizen.org/feature/platform.native.api.version")
+ result_obj.insert(std::make_pair("duid", SystemInfoDeviceCapability::GetDuid() ));
+ DEFAULT_REPORT_BOOL_CAPABILITY("screenSizeNormal", "tizen.org/feature/screen.size.normal")
+ DEFAULT_REPORT_BOOL_CAPABILITY("screenSize480_800", "tizen.org/feature/screen.size.normal.480.800")
+ DEFAULT_REPORT_BOOL_CAPABILITY("screenSize720_1280", "tizen.org/feature/screen.size.normal.720.1280")
+ DEFAULT_REPORT_BOOL_CAPABILITY("shellAppWidget", "tizen.org/feature/shell.appwidget")
+ DEFAULT_REPORT_BOOL_CAPABILITY("nativeOspCompatible", "tizen.org/feature/platform.native.osp_compatible")
+
ReportSuccess(result, out);
LoggerD("Success");
}
const std::string& key = args.get("key").get<std::string>();
LoggerD("Getting capability with key: %s ", key.c_str());
- picojson::value result = SystemInfoDeviceCapability::GetCapability(key);
- ReportSuccess(result, out);
+ picojson::value result = picojson::value(picojson::object());
+ PlatformResult ret = SystemInfoDeviceCapability::GetCapability(key, result);
+ if (ret.IsSuccess()) {
+ ReportSuccess(result, out);
+ } else {
+ ReportError(ret, &out);
+ }
LoggerD("Success");
}