From b755d40f522cbd1c3c584ba5ff72e2d74fac4fab Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 9 Jun 2016 11:10:06 +0900 Subject: [PATCH 01/16] [version] 0.92 Change-Id: I436db85b64c3294de62ec5078b687055c36f9bde --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 51f5fb2..823ca89 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.91 +Version: 0.92 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 2d5652fc1b9511f1cb40d19bc49acd6655756c43 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 9 Jun 2016 18:49:04 +0900 Subject: [PATCH 02/16] [wearable][SE] enable secure element feature - native team adds feature on model-config Change-Id: I0e53d1b53ed830eb7b9f3e3ea6f80a147ed35318 --- packaging/webapi-plugins.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 823ca89..2f307cb 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.92 +Version: 0.93 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries @@ -187,11 +187,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_power_support 1 %define tizen_feature_preference_support 1 %define tizen_feature_push_support 1 -%if 0%{?model_build_feature_smartcard } %define tizen_feature_se_support 1 -%else -%define tizen_feature_se_support 0 -%endif %define tizen_feature_sensor_support 1 %define tizen_feature_sound_support 1 %define tizen_feature_system_info_support 1 -- 2.7.4 From 396f5d66ffe6c026f3bf7598f3b5c074a2c7adff Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 9 Jun 2016 19:32:19 +0900 Subject: [PATCH 03/16] [wearable] disable Secure element module on emulator Change-Id: I35b37bffee2e8d545a871316e24bdec4b9336d24 --- packaging/webapi-plugins.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 2f307cb..ac302c4 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -187,7 +187,11 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_power_support 1 %define tizen_feature_preference_support 1 %define tizen_feature_push_support 1 +%if 0%{?tizen_is_emulator} +%define tizen_feature_se_support 0 +%else %define tizen_feature_se_support 1 +%endif %define tizen_feature_sensor_support 1 %define tizen_feature_sound_support 1 %define tizen_feature_system_info_support 1 -- 2.7.4 From c6f96879a2496eb30c56222dc937ddcd0fdbe462 Mon Sep 17 00:00:00 2001 From: Jakub Skowron Date: Thu, 9 Jun 2016 12:56:15 +0200 Subject: [PATCH 04/16] [Push] add attribute for full message Add fullMessage field returned in PushMessage object, containing full result string from native call push_service_get_notification_message Change-Id: I84470c7fd88b400f479ce0fee825a3d77974ea8d Signed-off-by: Jakub Skowron --- src/push/push_manager.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/push/push_manager.cc b/src/push/push_manager.cc index 0e2e513..9b6711c 100644 --- a/src/push/push_manager.cc +++ b/src/push/push_manager.cc @@ -279,15 +279,16 @@ void PushManager::notificationToJson(push_service_notification_h noti, picojson: (*obj)["appData"] = picojson::value(temp); free(temp); - temp = nullptr; - ret = push_service_get_notification_message(noti, &temp); + char* fullMessage = nullptr; + ret = push_service_get_notification_message(noti, &fullMessage); if (ret != PUSH_SERVICE_ERROR_NONE) { LoggerE("Failed to get message"); return; } + (*obj)["message"] = picojson::value(fullMessage); // parse query string and find value for alertMessage - pcrecpp::StringPiece input(temp); + pcrecpp::StringPiece input(fullMessage); pcrecpp::RE re("([^=]+)=([^&]*)&?"); string key; string value; @@ -297,7 +298,7 @@ void PushManager::notificationToJson(push_service_notification_h noti, picojson: break; } } - free(temp); + free(fullMessage); long long int date = -1; ret = push_service_get_notification_time(noti, &date); -- 2.7.4 From a5a2a21dc8979a1f9dcb6f6684ee4e5a6e9dfd18 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Mon, 13 Jun 2016 17:44:33 +0900 Subject: [PATCH 05/16] [version] 0.94 Change-Id: Ib171ad69e93a21ef61f820025dcca40d6c821af5 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index ac302c4..9450643 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.93 +Version: 0.94 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 49d960bf6dd2eb51ff9e7c8a9475bc2df9a246a7 Mon Sep 17 00:00:00 2001 From: "bg.chun" Date: Mon, 13 Jun 2016 17:44:04 +0900 Subject: [PATCH 06/16] [Application] impliment app_control_foreach_app_matched_internal() for handling NOT_FOUND_ERR on findAppControl Public CAPI do not handling NOT_FOUND_ERR For handling NOT_FOUND_ERR impliment internal api using appsvc_usr_get_list(); Change-Id: If24a8368c669e6f01adaf83d4a5661c09db5ad60 Signed-off-by: bg.chun --- packaging/webapi-plugins.spec | 1 + src/application/application.gyp | 1 + src/application/application_manager.cc | 81 +++++++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 9450643..3f8f0a6 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -309,6 +309,7 @@ BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-content-media-content) BuildRequires: pkgconfig(capi-media-metadata-extractor) BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(appsvc) %if %{with wayland} %define display_type wayland diff --git a/src/application/application.gyp b/src/application/application.gyp index 5199d22..40b614f 100644 --- a/src/application/application.gyp +++ b/src/application/application.gyp @@ -38,6 +38,7 @@ 'pkgmgr', 'pkgmgr-info', 'pkgmgr-installer', + 'appsvc', ] }, }], diff --git a/src/application/application_manager.cc b/src/application/application_manager.cc index e840bb9..721f7c3 100755 --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "common/current_application.h" #include "common/logger.h" @@ -649,6 +651,73 @@ void ApplicationManager::LaunchAppControl(const picojson::value& args) { TaskQueue::GetInstance().Queue(launch, launch_response, response); } +//internal impl of app_control_foreach_app_matched() for handling APP_CONTROL_ERROR_APP_NOT_FOUND +//public CAPI did not handling APP_CONTROL_ERROR_APP_NOT_FOUND +int app_control_foreach_app_matched_internal(app_control_h app_control, app_control_app_matched_cb callback, void* user_data){ + typedef struct { + app_control_h app_control; + app_control_app_matched_cb callback; + void *user_data; + bool foreach_break; + } foreach_context_launchable_app_t_internal; + + //internal impl of app_control_cb_broker_foreach_app_matched() + auto app_control_cb_broker_foreach_app_matched_internal = [](const char *package, void *data) -> int { + foreach_context_launchable_app_t_internal *foreach_context; + app_control_app_matched_cb app_matched_cb; + + if (package == NULL || data == NULL) { + LoggerE("APP_CONTROL_ERROR_INVALID_PARAMETER"); + return -1; + } + + foreach_context = (foreach_context_launchable_app_t_internal *)data; + if (foreach_context->foreach_break == true) + return -1; + + app_matched_cb = foreach_context->callback; + if (app_matched_cb != NULL) { + bool stop_foreach = false; + + stop_foreach = !app_matched_cb(foreach_context->app_control, package, foreach_context->user_data); + + foreach_context->foreach_break = stop_foreach; + } + + return 0; + }; + + foreach_context_launchable_app_t_internal foreach_context = { + .app_control = app_control, + .callback = callback, + .user_data = user_data, + .foreach_break = false + }; + + bundle *bundle_data = NULL; + app_control_to_bundle(app_control, &bundle_data); + + int ret = appsvc_usr_get_list(bundle_data, app_control_cb_broker_foreach_app_matched_internal, &foreach_context, getuid()); + + if (ret < 0 ){ + switch (ret){ + case APPSVC_RET_EINVAL: + return APP_CONTROL_ERROR_INVALID_PARAMETER; + + case APPSVC_RET_ENOMATCH: + return APP_CONTROL_ERROR_APP_NOT_FOUND; + + default: + return APP_CONTROL_ERROR_LAUNCH_FAILED; + } + }else{ + return APP_CONTROL_ERROR_NONE; + } + + return APP_CONTROL_ERROR_NONE; +} + + void ApplicationManager::FindAppControl(const picojson::value& args) { LoggerD("Entered"); @@ -712,12 +781,20 @@ void ApplicationManager::FindAppControl(const picojson::value& args) { auto array = result_obj.insert( std::make_pair("informationArray", picojson::value(picojson::array()))); - int ret = app_control_foreach_app_matched( + int ret = app_control_foreach_app_matched_internal( app_control_ptr.get(), app_control_matched, &array.first->second.get()); if (APP_CONTROL_ERROR_NONE != ret) { - LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,"Unknown error"), &response_obj, + if(APP_CONTROL_ERROR_APP_NOT_FOUND == ret){ + LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR,"Matched Application not found"), &response_obj, ("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret))); + }else if(APP_CONTROL_ERROR_LAUNCH_FAILED == ret){ + LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,"Unknown error"), &response_obj, + ("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret))); + }else if(APP_CONTROL_ERROR_INVALID_PARAMETER == ret){ + LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR,"Invalid parameter passed"), &response_obj, + ("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret))); + } // remove copied ApplicationControl from result response_obj.erase(it_result); } else { -- 2.7.4 From 42e9404975194c69d82185b269044f96d4b7c9c8 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Tue, 14 Jun 2016 16:37:24 +0900 Subject: [PATCH 07/16] [version] 0.95 Change-Id: Ib2a72ee61e68344940b4e53b88c506479cb71b05 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 3f8f0a6..4510904 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.94 +Version: 0.95 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 22e3924923a8d6940401e3014c24a38dcae6f34c Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Tue, 14 Jun 2016 15:27:40 +0200 Subject: [PATCH 08/16] [DataControl] Added missing check of the returned value. [Verification] Code compiles. TCT pass rate 100% Change-Id: Ib128455b4d6da20cc5e47afbd21c2145d08a86b6 Signed-off-by: Tomasz Marciniak --- src/datacontrol/datacontrol_instance.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/datacontrol/datacontrol_instance.cc b/src/datacontrol/datacontrol_instance.cc index cfb1521..a55ab14 100755 --- a/src/datacontrol/datacontrol_instance.cc +++ b/src/datacontrol/datacontrol_instance.cc @@ -136,6 +136,11 @@ static bool SQLColumnValue(result_set_cursor cursor, int columnIndex, } case DATA_CONTROL_SQL_COLUMN_TYPE_TEXT: { int size = data_control_sql_get_column_item_size(cursor, columnIndex); + if (DATA_CONTROL_ERROR_NONE > size) { + LoggerE("Getting column item size is failed with error : %s", + ::get_error_message(size)); + return false; + } char *buffer = new char[size + 1]; result = data_control_sql_get_text_data(cursor, columnIndex, buffer); if (result != DATA_CONTROL_ERROR_NONE) { @@ -149,6 +154,11 @@ static bool SQLColumnValue(result_set_cursor cursor, int columnIndex, } case DATA_CONTROL_SQL_COLUMN_TYPE_BLOB: { int size = data_control_sql_get_column_item_size(cursor, columnIndex); + if (DATA_CONTROL_ERROR_NONE > size) { + LoggerE("Getting column item size is failed with error : %s", + ::get_error_message(size)); + return false; + } char *buffer = new char[size + 1]; result = data_control_sql_get_blob_data(cursor, columnIndex, buffer, size); -- 2.7.4 From ccdef5356b0689284b75105cd5509535a41a6563 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Tue, 14 Jun 2016 15:29:22 +0200 Subject: [PATCH 09/16] [KeyManager] Added checking if data is not equal to null. [Verification] Code compiles. TCT pass rate 100% Change-Id: I41e7b070bdca4b63a34cf01132100e792d9a4389 Signed-off-by: Tomasz Marciniak --- src/keymanager/keymanager_instance.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keymanager/keymanager_instance.cc b/src/keymanager/keymanager_instance.cc index 62ce7bf..cc3d3f7 100644 --- a/src/keymanager/keymanager_instance.cc +++ b/src/keymanager/keymanager_instance.cc @@ -206,7 +206,7 @@ void KeyManagerInstance::GetData(const picojson::value& args, ckmc_raw_buffer_s* data = nullptr; int ret = ckmc_get_data(data_alias.c_str(), password, &data); - if (CKMC_ERROR_NONE == ret) { + if (CKMC_ERROR_NONE == ret && data) { picojson::object result; result["rawData"] = picojson::value(std::string (data->data, data->data + data->size)); -- 2.7.4 From c5cb557cb434f1c08c1bad4380a98ea66a47b2ae Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Tue, 14 Jun 2016 15:31:16 +0200 Subject: [PATCH 10/16] [Common] Added checking if error is not equal to null. [Verification] Code compiles. Change-Id: I4f21b360f851a58108a96a3e5c805af4715f6e4c Signed-off-by: Tomasz Marciniak --- src/common/filesystem/filesystem_provider_deviced.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/filesystem/filesystem_provider_deviced.cc b/src/common/filesystem/filesystem_provider_deviced.cc index 4f17cc6..cf6a7ad 100644 --- a/src/common/filesystem/filesystem_provider_deviced.cc +++ b/src/common/filesystem/filesystem_provider_deviced.cc @@ -249,7 +249,8 @@ Storages FilesystemProviderDeviced::GetStorages() { NULL, &error); if (!variant || error) { - LoggerE("Failed to call GetDeviceList method - %s", error->message); + std::string message = error ? error->message : ""; + LoggerE("Failed to call GetDeviceList method - %s", message.c_str()); return Storages(); } return GetStoragesFromGVariant(variant); -- 2.7.4 From 070c3612c0ae93d4dd115e9abd63929ebe873366 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 15 Jun 2016 07:46:34 +0900 Subject: [PATCH 11/16] [version] 0.96 Change-Id: Idfbe1ab5d862fabbd3894ea5257111f7edc66fa2 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 4510904..539f3a2 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.95 +Version: 0.96 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 004230d4418a02e803bfc1da77f7e2abca307ebc Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 16 Jun 2016 15:03:37 +0900 Subject: [PATCH 12/16] [iotcon] modify code to use changed native API/enum 1. state -> attribute 2. properties -> policies Change-Id: Ic8718ce6cd928a89c631c5c370d8c826a376ccbe --- src/iotcon/iotcon_instance.cc | 3 +- src/iotcon/iotcon_utils.cc | 176 +++++++++++++++++++++--------------------- src/iotcon/iotcon_utils.h | 6 +- 3 files changed, 92 insertions(+), 93 deletions(-) diff --git a/src/iotcon/iotcon_instance.cc b/src/iotcon/iotcon_instance.cc index de73ff2..ba67255 100644 --- a/src/iotcon/iotcon_instance.cc +++ b/src/iotcon/iotcon_instance.cc @@ -30,7 +30,7 @@ namespace extension { namespace iotcon { namespace { -const std::string kPrivilegeIotcon = "http://tizen.org/privilege/internet"; +const std::string kPrivilegeIotcon = "http://tizen.org/privilege/d2d.datasharing"; struct CallbackData { common::PostCallback fun; @@ -464,7 +464,6 @@ common::TizenResult IotconInstance::ResponseSend(const picojson::object& args) { result = IotconUtils::ConvertIotconError( iotcon_response_set_representation( response.get(), - IotconUtils::GetArg(args, kInterface).get().c_str(), representation)); if (!result) { LogAndReturnTizenError(result, ("iotcon_response_set_representation() failed")); diff --git a/src/iotcon/iotcon_utils.cc b/src/iotcon/iotcon_utils.cc index b0a2c7e..dbf4d0e 100644 --- a/src/iotcon/iotcon_utils.cc +++ b/src/iotcon/iotcon_utils.cc @@ -154,25 +154,25 @@ const picojson::value& IotconUtils::GetArg(const picojson::object& args, const s } int IotconUtils::GetProperties(const picojson::object& args) { - int properties = IOTCON_RESOURCE_NO_PROPERTY; + int properties = IOTCON_RESOURCE_NO_POLICY; const auto& observable = IotconUtils::GetArg(args, kIsObservable); - properties |= (observable.is() ? observable.get() : false) ? IOTCON_RESOURCE_OBSERVABLE : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (observable.is() ? observable.get() : false) ? IOTCON_RESOURCE_OBSERVABLE : IOTCON_RESOURCE_NO_POLICY; const auto& discoverable = IotconUtils::GetArg(args, kIsDiscoverable); - properties |= (discoverable.is() ? discoverable.get() : true) ? IOTCON_RESOURCE_DISCOVERABLE : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (discoverable.is() ? discoverable.get() : true) ? IOTCON_RESOURCE_DISCOVERABLE : IOTCON_RESOURCE_NO_POLICY; const auto& active = IotconUtils::GetArg(args, kIsActive); - properties |= (active.is() ? active.get() : false) ? IOTCON_RESOURCE_ACTIVE : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (active.is() ? active.get() : false) ? IOTCON_RESOURCE_ACTIVE : IOTCON_RESOURCE_NO_POLICY; const auto& slow = IotconUtils::GetArg(args, kIsSlow); - properties |= (slow.is() ? slow.get() : false) ? IOTCON_RESOURCE_SLOW : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (slow.is() ? slow.get() : false) ? IOTCON_RESOURCE_SLOW : IOTCON_RESOURCE_NO_POLICY; const auto& secure = IotconUtils::GetArg(args, kIsSecure); - properties |= (secure.is() ? secure.get() : false) ? IOTCON_RESOURCE_SECURE : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (secure.is() ? secure.get() : false) ? IOTCON_RESOURCE_SECURE : IOTCON_RESOURCE_NO_POLICY; const auto& explicit_discoverable = IotconUtils::GetArg(args, kIsExplicitDiscoverable); - properties |= (explicit_discoverable.is() ? explicit_discoverable.get() : false) ? IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE : IOTCON_RESOURCE_NO_PROPERTY; + properties |= (explicit_discoverable.is() ? explicit_discoverable.get() : false) ? IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE : IOTCON_RESOURCE_NO_POLICY; return properties; } @@ -304,7 +304,7 @@ TizenResult IotconUtils::ExtractFromResource(const ResourceInfoPtr& pointer, LogAndReturnTizenError(result, ("Gathering resource interfaces failed")); } - result = ConvertIotconError(iotcon_resource_get_properties(pointer->handle, properties)); + result = ConvertIotconError(iotcon_resource_get_policies(pointer->handle, properties)); if (!result) { LogAndReturnTizenError(result, ("Gathering resource properties failed")); } @@ -393,7 +393,7 @@ TizenResult IotconUtils::ExtractFromRemoteResource(RemoteResourceInfo* resource) } result = ConvertIotconError( - iotcon_remote_resource_get_properties(resource->resource, &resource->properties)); + iotcon_remote_resource_get_policies(resource->resource, &resource->properties)); if (!result) { LogAndReturnTizenError(result, ("Gathering properties failed")); } @@ -673,15 +673,15 @@ common::TizenResult IotconUtils::RepresentationToJson(iotcon_representation_h re { // states - iotcon_state_h state = nullptr; - auto result = ConvertIotconError(iotcon_representation_get_state(representation, &state)); + iotcon_attributes_h attributes = nullptr; + auto result = ConvertIotconError(iotcon_representation_get_attributes(representation, &attributes)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_representation_get_state() failed")); + LogAndReturnTizenError(result, ("iotcon_representation_get_attributes() failed")); } picojson::value v{picojson::object{}}; - result = StateToJson(state, &v.get()); + result = AttributesToJson(attributes, &v.get()); if (!result) { - LogAndReturnTizenError(result, ("StateToJson() failed")); + LogAndReturnTizenError(result, ("AttributesToJson() failed")); } out->insert(std::make_pair(kStates, v)); } @@ -711,14 +711,14 @@ common::TizenResult IotconUtils::RepresentationToJson(iotcon_representation_h re return TizenSuccess(); } -common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, +common::TizenResult IotconUtils::AttributesToJson(iotcon_attributes_h attributes, picojson::object* out) { ScopeLogger(); - if (state) { - auto result = ConvertIotconError(iotcon_state_foreach(state, [](iotcon_state_h state, const char* key, void* user_data) -> bool { + if (attributes) { + auto result = ConvertIotconError(iotcon_attributes_foreach(attributes, [](iotcon_attributes_h attributes, const char* key, void* user_data) -> bool { iotcon_type_e type = IOTCON_TYPE_NONE; - auto result = ConvertIotconError(iotcon_state_get_type(state, key, &type)); + auto result = ConvertIotconError(iotcon_attributes_get_type(attributes, key, &type)); if (result) { auto out = static_cast(user_data); @@ -731,11 +731,11 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, case IOTCON_TYPE_INT: { int value = 0; - result = ConvertIotconError(iotcon_state_get_int(state, key, &value)); + result = ConvertIotconError(iotcon_attributes_get_int(attributes, key, &value)); if (result) { out->insert(std::make_pair(key, picojson::value{static_cast(value)})); } else { - LoggerE("iotcon_state_get_int() failed"); + LoggerE("iotcon_attributes_get_int() failed"); } } break; @@ -743,11 +743,11 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, case IOTCON_TYPE_BOOL: { bool value = false; - result = ConvertIotconError(iotcon_state_get_bool(state, key, &value)); + result = ConvertIotconError(iotcon_attributes_get_bool(attributes, key, &value)); if (result) { out->insert(std::make_pair(key, picojson::value{value})); } else { - LoggerE("iotcon_state_get_bool() failed"); + LoggerE("iotcon_attributes_get_bool() failed"); } } break; @@ -755,11 +755,11 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, case IOTCON_TYPE_DOUBLE: { double value = 0.0; - result = ConvertIotconError(iotcon_state_get_double(state, key, &value)); + result = ConvertIotconError(iotcon_attributes_get_double(attributes, key, &value)); if (result) { out->insert(std::make_pair(key, picojson::value{value})); } else { - LoggerE("iotcon_state_get_double() failed"); + LoggerE("iotcon_attributes_get_double() failed"); } } break; @@ -767,11 +767,11 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, case IOTCON_TYPE_STR: { char* value = nullptr; - result = ConvertIotconError(iotcon_state_get_str(state, key, &value)); + result = ConvertIotconError(iotcon_attributes_get_str(attributes, key, &value)); if (result && value) { out->insert(std::make_pair(key, picojson::value{value})); } else { - LoggerE("iotcon_state_get_str() failed"); + LoggerE("iotcon_attributes_get_str() failed"); } } break; @@ -780,14 +780,14 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, { unsigned char* value = nullptr; int length = 0; - result = ConvertIotconError(iotcon_state_get_byte_str(state, key, &value, &length)); + result = ConvertIotconError(iotcon_attributes_get_byte_str(attributes, key, &value, &length)); if (result && length) { std::unique_ptr data{new char[2 * length]}; common::tools::BinToHex(value, length, data.get(), 2 * length); out->insert(std::make_pair(key, picojson::value{kHexPrefix + data.get()})); } else { - LoggerE("iotcon_state_get_byte_str() failed"); + LoggerE("iotcon_attributes_get_byte_str() failed"); } } break; @@ -799,7 +799,7 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, case IOTCON_TYPE_LIST: { iotcon_list_h list = nullptr; - result = ConvertIotconError(iotcon_state_get_list(state, key, &list)); + result = ConvertIotconError(iotcon_attributes_get_list(attributes, key, &list)); if (result) { picojson::value value{picojson::array{}}; @@ -810,32 +810,32 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, LoggerE("StateListToJson() failed"); } } else { - LoggerE("iotcon_state_get_list() failed"); + LoggerE("iotcon_attributes_get_list() failed"); } } break; - case IOTCON_TYPE_STATE: + case IOTCON_TYPE_ATTRIBUTES: { - iotcon_state_h child = nullptr; - result = ConvertIotconError(iotcon_state_get_state(state, key, &child)); + iotcon_attributes_h child = nullptr; + result = ConvertIotconError(iotcon_attributes_get_attributes(attributes, key, &child)); if (result) { picojson::value value{picojson::object{}}; - result = StateToJson(child, &value.get()); + result = AttributesToJson(child, &value.get()); if (result) { out->insert(std::make_pair(key, picojson::value{value})); } else { - LoggerE("StateToJson() failed"); + LoggerE("AttributesToJson() failed"); } } else { - LoggerE("iotcon_state_get_state() failed"); + LoggerE("iotcon_attributes_get_attributes() failed"); } } break; } } else { - LoggerE("iotcon_state_get_type() failed"); + LoggerE("iotcon_attributes_get_type() failed"); } // always continue with iteration @@ -843,10 +843,10 @@ common::TizenResult IotconUtils::StateToJson(iotcon_state_h state, }, out)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_foreach() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_foreach() failed")); } } else { - LoggerW("State handle is null, ignoring"); + LoggerW("attributes handle is null, ignoring"); } return TizenSuccess(); @@ -958,21 +958,21 @@ common::TizenResult IotconUtils::StateListToJson(iotcon_list_h list, } break; - case IOTCON_TYPE_STATE: - result = ConvertIotconError(iotcon_list_foreach_state(list, [](int, iotcon_state_h state, void* user_data) -> bool { + case IOTCON_TYPE_ATTRIBUTES: + result = ConvertIotconError(iotcon_list_foreach_attributes(list, [](int, iotcon_attributes_h attributes, void* user_data) -> bool { picojson::value value{picojson::object{}}; - auto result = StateToJson(state, &value.get()); + auto result = AttributesToJson(attributes, &value.get()); if (result) { auto out = static_cast(user_data); out->push_back(picojson::value{value}); } else { - LoggerE("StateToJson() failed"); + LoggerE("AttributesToJson() failed"); } // always continue with iteration return true; }, out)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_list_foreach_state() failed")); + LogAndReturnTizenError(result, ("iotcon_list_foreach_attributes() failed")); } break; } @@ -1230,17 +1230,17 @@ common::TizenResult IotconUtils::RepresentationFromResource(const ResourceInfoPt { auto& state = states.get(std::to_string(resource->id)); if (state.is()) { - iotcon_state_h state_handle = nullptr; - result = IotconUtils::StateFromJson(state.get(), &state_handle); + iotcon_attributes_h attributes_handle = nullptr; + result = IotconUtils::AttributesFromJson(state.get(), &attributes_handle); if (!result) { - LogAndReturnTizenError(result, ("StateFromJson() failed")); + LogAndReturnTizenError(result, ("AttributesFromJson() failed")); } SCOPE_EXIT { - iotcon_state_destroy(state_handle); + iotcon_attributes_destroy(attributes_handle); }; - result = IotconUtils::ConvertIotconError(iotcon_representation_set_state(representation, state_handle)); + result = IotconUtils::ConvertIotconError(iotcon_representation_set_attributes(representation, attributes_handle)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_representation_set_state() failed")); + LogAndReturnTizenError(result, ("iotcon_representation_set_attributes() failed")); } } } @@ -1284,36 +1284,36 @@ common::TizenResult IotconUtils::RepresentationFromResource(const ResourceInfoPt return TizenSuccess(); } -common::TizenResult IotconUtils::StateFromJson(const picojson::object& s, - iotcon_state_h* out) { +common::TizenResult IotconUtils::AttributesFromJson(const picojson::object& s, + iotcon_attributes_h* out) { ScopeLogger(); - iotcon_state_h state = nullptr; + iotcon_attributes_h attributes = nullptr; - auto result = IotconUtils::ConvertIotconError(iotcon_state_create(&state)); + auto result = IotconUtils::ConvertIotconError(iotcon_attributes_create(&attributes)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_create() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_create() failed")); } - std::unique_ptr::type, void(*)(iotcon_state_h)> ptr{state, &iotcon_state_destroy}; + std::unique_ptr::type, void(*)(iotcon_attributes_h)> ptr{attributes, &iotcon_attributes_destroy}; for (const auto& property : s) { const auto& key = property.first; if (property.second.is()) { - result = IotconUtils::ConvertIotconError(iotcon_state_add_null(state, key.c_str())); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_null(attributes, key.c_str())); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_null() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_null() failed")); } } else if (property.second.is()) { - result = IotconUtils::ConvertIotconError(iotcon_state_add_bool(state, key.c_str(), property.second.get())); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_bool(attributes, key.c_str(), property.second.get())); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_bool() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_bool() failed")); } } else if (property.second.is()) { - result = IotconUtils::ConvertIotconError(iotcon_state_add_double(state, key.c_str(), property.second.get())); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_double(attributes, key.c_str(), property.second.get())); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_double() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_attributes_double() failed")); } } else if (property.second.is()) { const auto& value = property.second.get(); @@ -1324,14 +1324,14 @@ common::TizenResult IotconUtils::StateFromJson(const picojson::object& s, auto length = size / 2; std::unique_ptr hex{new unsigned char[length]}; common::tools::HexToBin(data, size, hex.get(), length); - result = IotconUtils::ConvertIotconError(iotcon_state_add_byte_str(state, key.c_str(), hex.get(), length)); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_byte_str(attributes, key.c_str(), hex.get(), length)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_byte_str() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_byte_str() failed")); } } else { - result = IotconUtils::ConvertIotconError(iotcon_state_add_str(state, key.c_str(), const_cast(value.c_str()))); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_str(attributes, key.c_str(), const_cast(value.c_str()))); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_str() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_str() failed")); } } } else if (property.second.is()) { @@ -1344,23 +1344,23 @@ common::TizenResult IotconUtils::StateFromJson(const picojson::object& s, SCOPE_EXIT { iotcon_list_destroy(list); }; - result = IotconUtils::ConvertIotconError(iotcon_state_add_list(state, key.c_str(), list)); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_list(attributes, key.c_str(), list)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_list() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_list() failed")); } } } else if (property.second.is()) { - iotcon_state_h sub_state = nullptr; - result = StateFromJson(property.second.get(), &sub_state); + iotcon_attributes_h sub_attributes = nullptr; + result = AttributesFromJson(property.second.get(), &sub_attributes); if (!result) { - LogAndReturnTizenError(result, ("StateFromJson() failed")); + LogAndReturnTizenError(result, ("AttributesFromJson() failed")); } SCOPE_EXIT { - iotcon_state_destroy(sub_state); + iotcon_attributes_destroy(sub_attributes); }; - result = IotconUtils::ConvertIotconError(iotcon_state_add_state(state, key.c_str(), sub_state)); + result = IotconUtils::ConvertIotconError(iotcon_attributes_add_attributes(attributes, key.c_str(), sub_attributes)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_state_add_state() failed")); + LogAndReturnTizenError(result, ("iotcon_attributes_add_attributes() failed")); } } } @@ -1391,7 +1391,7 @@ common::TizenResult IotconUtils::StateListFromJson(const picojson::array& l, } else if (l[0].is()) { type = IOTCON_TYPE_LIST; } else if (l[0].is()) { - type = IOTCON_TYPE_STATE; + type = IOTCON_TYPE_ATTRIBUTES; } } @@ -1473,19 +1473,19 @@ common::TizenResult IotconUtils::StateListFromJson(const picojson::array& l, } break; - case IOTCON_TYPE_STATE: + case IOTCON_TYPE_ATTRIBUTES: if (v.is()) { - iotcon_state_h state = nullptr; - result = StateFromJson(v.get(), &state); + iotcon_attributes_h attributes = nullptr; + result = AttributesFromJson(v.get(), &attributes); if (!result) { - LogAndReturnTizenError(result, ("StateFromJson() failed")); + LogAndReturnTizenError(result, ("AttributesFromJson() failed")); } SCOPE_EXIT { - iotcon_state_destroy(state); + iotcon_attributes_destroy(attributes); }; - result = IotconUtils::ConvertIotconError(iotcon_list_add_state(list, state, position++)); + result = IotconUtils::ConvertIotconError(iotcon_list_add_attributes(list, attributes, position++)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_list_add_state() failed")); + LogAndReturnTizenError(result, ("iotcon_list_add_attributes() failed")); } } break; @@ -1710,19 +1710,19 @@ common::TizenResult IotconUtils::RepresentationFromJson(const picojson::object& { const auto& states = r.find(kStates); if (r.end() != states && states->second.is()) { - iotcon_state_h s = nullptr; + iotcon_attributes_h s = nullptr; - result = StateFromJson(states->second.get(), &s); + result = AttributesFromJson(states->second.get(), &s); if (!result) { - LogAndReturnTizenError(result, ("StateFromJson() failed")); + LogAndReturnTizenError(result, ("AttributesFromJson() failed")); } SCOPE_EXIT { - iotcon_state_destroy(s); + iotcon_attributes_destroy(s); }; - result = ConvertIotconError(iotcon_representation_set_state(representation, s)); + result = ConvertIotconError(iotcon_representation_set_attributes(representation, s)); if (!result) { - LogAndReturnTizenError(result, ("iotcon_representation_set_state() failed")); + LogAndReturnTizenError(result, ("iotcon_representation_set_attributes() failed")); } } } diff --git a/src/iotcon/iotcon_utils.h b/src/iotcon/iotcon_utils.h index 1a783a0..42d9c06 100644 --- a/src/iotcon/iotcon_utils.h +++ b/src/iotcon/iotcon_utils.h @@ -157,7 +157,7 @@ class IotconUtils { picojson::object* out); static common::TizenResult RepresentationToJson(iotcon_representation_h representation, picojson::object* out); - static common::TizenResult StateToJson(iotcon_state_h state, + static common::TizenResult AttributesToJson(iotcon_attributes_h attributes, picojson::object* out); static common::TizenResult StateListToJson(iotcon_list_h list, picojson::array* out); @@ -191,8 +191,8 @@ class IotconUtils { const picojson::value& states, iotcon_representation_h* representation); - static common::TizenResult StateFromJson(const picojson::object& state, - iotcon_state_h* out); + static common::TizenResult AttributesFromJson(const picojson::object& state, + iotcon_attributes_h* out); static common::TizenResult StateListFromJson(const picojson::array& list, iotcon_list_h* out); static common::TizenResult OptionsFromJson(const picojson::array& options, -- 2.7.4 From 9065cf1c83bc5fece83cf87ca21b5e267dd9547b Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 16 Jun 2016 18:58:20 +0900 Subject: [PATCH 13/16] enable telephony feature on mobile/wearable emulator - due to telephony feature is enable on model-config Change-Id: If6d3f3c6b0cde1797dba9ff8249ba1c4aad4c7f9 --- packaging/webapi-plugins.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 539f3a2..2bfe7a0 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.96 +Version: 0.97 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries @@ -92,11 +92,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_sound_support 1 %define tizen_feature_system_info_support 1 %define tizen_feature_system_setting_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_feature_telephony_support 0 -%else %define tizen_feature_telephony_support 1 -%endif %define tizen_feature_time_support 1 %define tizen_feature_web_setting_support 1 %define tizen_feature_widget_service_support 1 @@ -196,7 +192,11 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_sound_support 1 %define tizen_feature_system_info_support 1 %define tizen_feature_system_setting_support 1 +%if 0%{?tizen_is_emulator} +%define tizen_feature_telephony_support 1 +%else %define tizen_feature_telephony_support 0 +%endif %define tizen_feature_time_support 1 %define tizen_feature_web_setting_support 0 %define tizen_feature_widget_service_support 1 -- 2.7.4 From 07186af49fc5e4f8993ec8f24fe45464bd268386 Mon Sep 17 00:00:00 2001 From: "sangrae.kim" Date: Thu, 16 Jun 2016 23:45:50 +0900 Subject: [PATCH 14/16] [HAM] fix the wrong code about option dictionary param Change-Id: I7538d58a6bcf174af023a9e556971af3ff426b34 Signed-off-by: sangrae.kim --- src/humanactivitymonitor/humanactivitymonitor_api.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index fd442d9..412f0c5 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -238,22 +238,24 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) { {name: 'type', type: types_.ENUM, values: Object.keys(HumanActivityType)}, {name: 'changedCallback', type: types_.FUNCTION, optional: true, nullable: true}, {name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true}, - {name : 'option', type : types_.DICTIONARY, optional : true, nullable : true} + {name: 'options', type : types_.DICTIONARY, optional : true, nullable : true} ]); var listenerId = 'HumanActivityMonitor_' + args.type; + var optionsAttributes = ["callbackInterval", "sampleInterval"], options = args.options || {}; + var callbackInterval = null, sampleInterval = null; switch (args.type) { case HumanActivityType.GPS: - callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ? + callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ? args.option.callbackInterval : 150000; - sampleInterval = !type_.isNullOrUndefined(args.option.sampleInterval) ? + sampleInterval = !type_.isNullOrUndefined(options[optionsAttributes[1]]) ? args.option.sampleInterval : 1000; break; case HumanActivityType.HRM: - callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ? - args.option.callbackInterval : 100; + callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ? + options[optionsAttributes[0]] : 100; if (callbackInterval < 10 || callbackInterval > 1000) { throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'callbackInterval is out of range'); -- 2.7.4 From caf730d8127ba14da305be6b9e0d882414bc5932 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Fri, 17 Jun 2016 12:52:43 +0900 Subject: [PATCH 15/16] [version] 0.98 Change-Id: I61b786c2b2926756a2542dd100a85e5cae13e45a --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 2bfe7a0..6fda070 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.97 +Version: 0.98 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From afa597af0c3d9ffc3620a6213b25be8b50ddc4ed Mon Sep 17 00:00:00 2001 From: "sangrae.kim" Date: Fri, 17 Jun 2016 14:37:54 +0900 Subject: [PATCH 16/16] [HAM] fix the wrong code about option dictionary param (GPS) Change-Id: Icbc2a92a8c655835f6cb7481e32288da55bc8321 Signed-off-by: sangrae.kim --- src/humanactivitymonitor/humanactivitymonitor_api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index 412f0c5..d9c3bf0 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -249,9 +249,9 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) { switch (args.type) { case HumanActivityType.GPS: callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ? - args.option.callbackInterval : 150000; + options[optionsAttributes[0]] : 150000; sampleInterval = !type_.isNullOrUndefined(options[optionsAttributes[1]]) ? - args.option.sampleInterval : 1000; + options[optionsAttributes[1]] : 1000; break; case HumanActivityType.HRM: callbackInterval = !type_.isNullOrUndefined(options[optionsAttributes[0]]) ? -- 2.7.4