From 182f32a4f328f5a60d923f2c3313e00c89f2932e Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 11 Aug 2016 12:30:50 +0200 Subject: [PATCH 01/16] [PlayerUtil] Plugin implementation. [Verification] Code compiles. Plugin is seen. Getting and setting latency works correctly. Change-Id: I567860a26327e8da911796c30e1ef8f2478c3dd8 Signed-off-by: Piotr Kosko --- packaging/webapi-plugins.spec | 9 ++++ src/playerutil/playerutil.gyp | 37 +++++++++++++++ src/playerutil/playerutil_api.js | 59 ++++++++++++++++++++++++ src/playerutil/playerutil_extension.cc | 49 ++++++++++++++++++++ src/playerutil/playerutil_extension.h | 38 ++++++++++++++++ src/playerutil/playerutil_instance.cc | 83 ++++++++++++++++++++++++++++++++++ src/playerutil/playerutil_instance.h | 38 ++++++++++++++++ src/playerutil/playerutil_utils.cc | 66 +++++++++++++++++++++++++++ src/playerutil/playerutil_utils.h | 46 +++++++++++++++++++ src/tizen-wrt.gyp | 7 +++ 10 files changed, 432 insertions(+) create mode 100644 src/playerutil/playerutil.gyp create mode 100644 src/playerutil/playerutil_api.js create mode 100644 src/playerutil/playerutil_extension.cc create mode 100644 src/playerutil/playerutil_extension.h create mode 100644 src/playerutil/playerutil_instance.cc create mode 100644 src/playerutil/playerutil_instance.h create mode 100644 src/playerutil/playerutil_utils.cc create mode 100644 src/playerutil/playerutil_utils.h diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index b961512..f26ed42 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -62,6 +62,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_nfc_support 0 %define tizen_feature_notification_support 0 %define tizen_feature_package_support 1 +%define tizen_feature_player_util_support 0 %define tizen_feature_power_support 0 %define tizen_feature_preference_support 0 %define tizen_feature_push_support 0 @@ -137,6 +138,7 @@ Source0: %{name}-%{version}.tar.gz #%endif %define tizen_feature_notification_support 1 %define tizen_feature_package_support 1 +%define tizen_feature_player_util_support 1 %define tizen_feature_power_support 1 %define tizen_feature_preference_support 1 %define tizen_feature_push_support 1 @@ -241,6 +243,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_nfc_support 1 %define tizen_feature_notification_support 1 %define tizen_feature_package_support 1 +%define tizen_feature_player_util_support 1 %define tizen_feature_power_support 1 %define tizen_feature_preference_support 1 %define tizen_feature_push_support 1 @@ -322,6 +325,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_nfc_support 0 %define tizen_feature_notification_support 0 %define tizen_feature_package_support 1 +%define tizen_feature_player_util_support 0 %define tizen_feature_power_support 0 %define tizen_feature_preference_support 0 %define tizen_feature_push_support 0 @@ -430,6 +434,10 @@ BuildRequires: pkgconfig(sensor) BuildRequires: pkgconfig(iotcon) %endif +%if 0%{?tizen_feature_player_util_support} +BuildRequires: pkgconfig(chromium-efl) +%endif + %if 0%{?tizen_feature_power_support} BuildRequires: pkgconfig(deviced) %endif @@ -576,6 +584,7 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_emulation_support=%{?tizen_feature GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_support=%{?tizen_feature_nfc_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_notification_support=%{?tizen_feature_notification_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_package_support=%{?tizen_feature_package_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_player_util_support=%{?tizen_feature_player_util_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_power_support=%{?tizen_feature_power_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_preference_support=%{?tizen_feature_preference_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_push_support=%{?tizen_feature_push_support}" diff --git a/src/playerutil/playerutil.gyp b/src/playerutil/playerutil.gyp new file mode 100644 index 0000000..e1fe9e8 --- /dev/null +++ b/src/playerutil/playerutil.gyp @@ -0,0 +1,37 @@ +{ + 'includes':[ + '../common/common.gypi', + ], + 'targets': [ + { + 'target_name': 'tizen_playerutil', + 'type': 'loadable_module', + 'dependencies': [ + '../common/common.gyp:tizen_common', + ], + 'sources': [ + 'playerutil_api.js', + 'playerutil_extension.cc', + 'playerutil_extension.h', + 'playerutil_instance.cc', + 'playerutil_instance.h', + 'playerutil_utils.cc', + 'playerutil_utils.h', + ], + 'includes': [ + '../common/pkg-config.gypi', + ], + 'conditions': [ + ['tizen == 1', { + 'variables': { + 'packages': [ + 'chromium-efl', + 'eina', + 'evas' + ] + }, + }], + ], + }, + ], +} diff --git a/src/playerutil/playerutil_api.js b/src/playerutil/playerutil_api.js new file mode 100644 index 0000000..41ca4ab --- /dev/null +++ b/src/playerutil/playerutil_api.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var native = new xwalk.utils.NativeManager(extension); +var validator = xwalk.utils.validator; +var types = validator.Types; +var T = xwalk.utils.type; + +var LatencyMode = { + LOW: 'LOW', + MID: 'MID', + HIGH: 'HIGH', +}; + +function PlayerUtil() { +} + +PlayerUtil.prototype.getLatencyMode = function() { + var result = native.callSync('PlayerUtil_getLatencyMode', {}); + + if (native.isSuccess(result)) { + return native.getResultObject(result); + } else { + throw native.getErrorObject(result); + } +}; + +PlayerUtil.prototype.setLatencyMode = function() { + var args = validator.validateMethod(arguments, [{ + name: 'latencyMode', + type: types.ENUM, + values: T.getValues(LatencyMode) + }]); + + var callArgs = {}; + callArgs.latencyMode = args.latencyMode; + + var result = native.callSync('PlayerUtil_setLatencyMode', callArgs); + + if (native.isFailure(result)) { + throw native.getErrorObject(result); + } +}; + +// Exports +exports = new PlayerUtil(); diff --git a/src/playerutil/playerutil_extension.cc b/src/playerutil/playerutil_extension.cc new file mode 100644 index 0000000..a358fa4 --- /dev/null +++ b/src/playerutil/playerutil_extension.cc @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "playerutil/playerutil_extension.h" + +#include "playerutil/playerutil_instance.h" + +// This will be generated from playerutil_api.js +extern const char kSource_playerutil_api[]; + +namespace extension { +namespace playerutil { + +PlayerUtilExtension::PlayerUtilExtension() { + SetExtensionName("tizen.playerutil"); + SetJavaScriptAPI(kSource_playerutil_api); + + const char* entry_points[] = { + nullptr + }; + SetExtraJSEntryPoints(entry_points); +} + +PlayerUtilExtension::~PlayerUtilExtension() { +} + +common::Instance* PlayerUtilExtension::CreateInstance() { + return new PlayerUtilInstance(); +} + +} // namespace playerutil +} // namespace extension + +common::Extension* CreateExtension() { + return new extension::playerutil::PlayerUtilExtension(); +} diff --git a/src/playerutil/playerutil_extension.h b/src/playerutil/playerutil_extension.h new file mode 100644 index 0000000..3733611 --- /dev/null +++ b/src/playerutil/playerutil_extension.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLAYERUTIL_EXTENSION_H_ +#define PLAYERUTIL_EXTENSION_H_ + +#include "common/extension.h" + +namespace extension { +namespace playerutil { + +class PlayerUtilExtension : public common::Extension { + public: + PlayerUtilExtension(); + virtual ~PlayerUtilExtension(); + + private: + virtual common::Instance* CreateInstance(); +}; + +} // namespace playerutil +} // namespace extension + +#endif // PLAYERUTIL_EXTENSION_H_ + diff --git a/src/playerutil/playerutil_instance.cc b/src/playerutil/playerutil_instance.cc new file mode 100644 index 0000000..d295a8c --- /dev/null +++ b/src/playerutil/playerutil_instance.cc @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "playerutil/playerutil_instance.h" + +#include +#include + +#include "common/logger.h" +#include "common/scope_exit.h" +#include "common/tools.h" + +#include "playerutil/playerutil_utils.h" + +namespace extension { +namespace playerutil { + +PlayerUtilInstance::PlayerUtilInstance() { + ScopeLogger(); + + using std::placeholders::_1; + using std::placeholders::_2; + +#define REGISTER_SYNC(c, x) \ + RegisterSyncHandler(c, std::bind(&PlayerUtilInstance::x, this, _1)) + + REGISTER_SYNC("PlayerUtil_getLatencyMode", GetLatencyMode); + REGISTER_SYNC("PlayerUtil_setLatencyMode", SetLatencyMode); +#undef REGISTER_SYNC + +} + +PlayerUtilInstance::~PlayerUtilInstance() { + ScopeLogger(); +} + +common::TizenResult PlayerUtilInstance::GetLatencyMode(const picojson::object& args) { + ScopeLogger(); + + Ewk_Context *context = ewk_context_default_get(); + + Ewk_Audio_Latency_Mode latency_mode = ewk_context_audio_latency_mode_get(context); + + if (EWK_AUDIO_LATENCY_MODE_ERROR == latency_mode) { + LogAndReturnTizenError(common::AbortError(), ("ewk_context_audio_latency_mode_get() failed")); + } + + return common::TizenSuccess{picojson::value{PlayerUtilUtils::FromLatencyMode(latency_mode)}}; +} + +common::TizenResult PlayerUtilInstance::SetLatencyMode(const picojson::object& args) { + ScopeLogger(); + + CHECK_EXIST(args, kLatencyMode); + auto latency_it = args.find(kLatencyMode)->second; + if (latency_it.is()) { + Ewk_Audio_Latency_Mode latency_mode = PlayerUtilUtils::ToLatencyMode(latency_it.get()); + Ewk_Context *context = ewk_context_default_get(); + + auto ret = ewk_context_audio_latency_mode_set(context, latency_mode); + if (EINA_TRUE != ret) { + LogAndReturnTizenError(common::AbortError(), ("ewk_context_audio_latency_mode_set() failed")); + } + } + + return common::TizenSuccess(); +} + +} // namespace playerutil +} // namespace extension diff --git a/src/playerutil/playerutil_instance.h b/src/playerutil/playerutil_instance.h new file mode 100644 index 0000000..ebdbef3 --- /dev/null +++ b/src/playerutil/playerutil_instance.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLAYERUTIL_INSTANCE_H_ +#define PLAYERUTIL_INSTANCE_H_ + +#include "common/tizen_instance.h" + + +namespace extension { +namespace playerutil { + +class PlayerUtilInstance : public common::TizenInstance { + public: + PlayerUtilInstance(); + virtual ~PlayerUtilInstance(); + private: + common::TizenResult GetLatencyMode(const picojson::object& args); + common::TizenResult SetLatencyMode(const picojson::object& args); +}; + +} // namespace playerutil +} // namespace extension + +#endif // PLAYERUTIL_INSTANCE_H_ diff --git a/src/playerutil/playerutil_utils.cc b/src/playerutil/playerutil_utils.cc new file mode 100644 index 0000000..7861efd --- /dev/null +++ b/src/playerutil/playerutil_utils.cc @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "playerutil_utils.h" + +#include "common/logger.h" + +namespace extension { +namespace playerutil { + +namespace { +#define PLAYER_UTIL_LATENCY_MODE_E \ + X(EWK_AUDIO_LATENCY_MODE_HIGH, "HIGH") \ + X(EWK_AUDIO_LATENCY_MODE_MID, "MID") \ + X(EWK_AUDIO_LATENCY_MODE_LOW, "LOW") \ + XD(EWK_AUDIO_LATENCY_MODE_LOW, "unknown") + +} // namespace + +const std::string kLatencyMode = "latencyMode"; + +#define X(v, s) case v: return s; +#define XD(v, s) \ + default: \ + LoggerE("Unknown value: %d, returning default: %s", e, s); \ + return s; + +std::string PlayerUtilUtils::FromLatencyMode(Ewk_Audio_Latency_Mode e) { + ScopeLogger(); + + switch (e) { + PLAYER_UTIL_LATENCY_MODE_E + } +} + +#undef X +#undef XD + +#define X(v, s) if (e == s) return v; +#define XD(v, s) \ + LoggerE("Unknown value: %s, returning default: %d", e.c_str(), v); \ + return v; + +Ewk_Audio_Latency_Mode PlayerUtilUtils::ToLatencyMode(const std::string& e) { + ScopeLogger(); + + PLAYER_UTIL_LATENCY_MODE_E +} +#undef X +#undef XD + +} // namespace playerutil +} // namespace extension diff --git a/src/playerutil/playerutil_utils.h b/src/playerutil/playerutil_utils.h new file mode 100644 index 0000000..ad31e3f --- /dev/null +++ b/src/playerutil/playerutil_utils.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef WEBAPI_PLUGINS_PLAYER_UTIL_UTILS_H__ +#define WEBAPI_PLUGINS_PLAYER_UTIL_UTILS_H__ + +#include + +#include + +#include "common/tizen_instance.h" +#include "common/tizen_result.h" + +namespace extension { +namespace playerutil { + +#define CHECK_EXIST(args, name) \ + if (args.end() == args.find(name)) { \ + return common::TypeMismatchError(std::string(name) + " is required argument"); \ + } + +extern const std::string kLatencyMode; + +class PlayerUtilUtils { + public: + static std::string FromLatencyMode(Ewk_Audio_Latency_Mode e); + static Ewk_Audio_Latency_Mode ToLatencyMode(const std::string& e); +}; + +} // namespace playerutil +} // namespace extension + +#endif // WEBAPI_PLUGINS_PLAYER_UTIL_UTILS_H__ diff --git a/src/tizen-wrt.gyp b/src/tizen-wrt.gyp index 7cc8a10..c53aba3 100755 --- a/src/tizen-wrt.gyp +++ b/src/tizen-wrt.gyp @@ -225,6 +225,13 @@ }, ], [ + 'tizen_feature_player_util_support==1', { + 'dependencies': [ + 'playerutil/playerutil.gyp:*', + ], + }, + ], + [ 'tizen_feature_power_support==1', { 'dependencies': [ 'power/power.gyp:*', -- 2.7.4 From 6a480966d5c9589210de34b5415c34edcd9441e6 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Mon, 26 Sep 2016 19:41:07 +0900 Subject: [PATCH 02/16] [version] 1.35 Change-Id: Ia4cc45e76415d90263bd67bd9ba899a51cf2ceb5 --- 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 f26ed42..e1e15e6 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: 1.34 +Version: 1.35 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 78190b73660b21ae9602d946edba11164483e104 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 28 Sep 2016 13:55:01 +0900 Subject: [PATCH 03/16] fix web runtime service TCT's fail - no window case Change-Id: If7e24cd6ebc8ce6a35ddc974f626108fbb6ae0e4 --- src/tizen/tizen_api.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index eba3a46..f5f8085 100644 --- a/src/tizen/tizen_api.js +++ b/src/tizen/tizen_api.js @@ -10,6 +10,14 @@ // WebAPIException and WebAPIError definition moved to src/utils/utils_api.js // for compliance reasons. You can find more info there. +var _global = {}; +if (typeof window != 'undefined') { + _global = window; +} +else if (typeof global != 'undefiend') { + _global = global; +} + /** * Filter match flags. @@ -475,5 +483,5 @@ exports.SimpleCoordinates = function(lat, lng) { exports.SimpleCoordinates.prototype.constructor = exports.SimpleCoordinates; // Protect JSON.stringify from being overriden by application -Object.defineProperty( window, 'JSON', {value:JSON, writable:false, configurable:false} ); +Object.defineProperty( _global, 'JSON', {value:JSON, writable:false, configurable:false} ); Object.defineProperty( JSON, 'stringify', {value:JSON.stringify, writable:false, configurable:false} ); -- 2.7.4 From 6d1caa1a163a0d33e44384c78037797e710586db Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 28 Sep 2016 14:41:05 +0900 Subject: [PATCH 04/16] [version] 1.36 Change-Id: I89aa05ac6eebe383181d6b6d2332166d3db8faa5 --- 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 e1e15e6..f06c1b1 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: 1.35 +Version: 1.36 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 0555dc4a379a195c455a08c5dc5bb866ba3fa276 Mon Sep 17 00:00:00 2001 From: "sangrae.kim" Date: Thu, 29 Sep 2016 13:06:08 +0900 Subject: [PATCH 05/16] [convergence] Fix bug listener method name add,remove->set,unset Change-Id: Iafde157f24c2f4d14ca332896953c29a846b2c81 Signed-off-by: sangrae.kim --- src/convergence/convergence_api.js | 12 ++++++------ src/convergence/convergence_instance.cc | 8 ++++---- src/convergence/convergence_instance.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/convergence/convergence_api.js b/src/convergence/convergence_api.js index e570e07..dd7be5c 100644 --- a/src/convergence/convergence_api.js +++ b/src/convergence/convergence_api.js @@ -737,8 +737,8 @@ AppCommunicationService.prototype.send = function(channel, payload, successCallb throw native_.getErrorObject(result); }; -AppCommunicationService.prototype.addListener = function(listenerCallback) { - console.log('Entered AppCommunicationService.addListener()'); +AppCommunicationService.prototype.setListener = function(listenerCallback) { + console.log('Entered AppCommunicationService.setListener()'); var args = validator_.validateArgs(arguments, [ {name: 'listenerCallback', type: types_.FUNCTION} ]); @@ -753,7 +753,7 @@ AppCommunicationService.prototype.addListener = function(listenerCallback) { console.log('AppCommunicationServiceCommandListeners ADDED [' + lid + ']'); console.log(''); - var result = native_.callSync('AppCommunicationService_addListener', { + var result = native_.callSync('AppCommunicationService_setListener', { deviceId: this._deviceId, curListenerId: lid }); @@ -763,13 +763,13 @@ AppCommunicationService.prototype.addListener = function(listenerCallback) { return args.curListenerId; // TODO return proper index of listener }; -AppCommunicationService.prototype.removeListener = function(id) { - console.log('Entered AppCommunicationService.removeListener()'); +AppCommunicationService.prototype.unsetListener = function(id) { + console.log('Entered AppCommunicationService.unsetListener()'); var args = validator_.validateArgs(arguments, [ {name: 'id', type: types_.LONG, optional: false} ]); - var result = native_.callSync('AppCommunicationService_removeListener', { + var result = native_.callSync('AppCommunicationService_unsetListener', { deviceId: this._deviceId //curListenerId: id // not needed in below layers }); diff --git a/src/convergence/convergence_instance.cc b/src/convergence/convergence_instance.cc index 48b589b..e4221b2 100644 --- a/src/convergence/convergence_instance.cc +++ b/src/convergence/convergence_instance.cc @@ -67,8 +67,8 @@ ConvergenceInstance::ConvergenceInstance() { REGISTER_SYNC("ConvergenceManager_stopDiscovery", ConvergenceManagerStopDiscovery); - REGISTER_SYNC("AppCommunicationService_addListener", AppCommunicationServiceAddListener); - REGISTER_SYNC("AppCommunicationService_removeListener", AppCommunicationServiceRemoveListener); + REGISTER_SYNC("AppCommunicationService_setListener", AppCommunicationServiceSetListener); + REGISTER_SYNC("AppCommunicationService_unsetListener", AppCommunicationServiceUnsetListener); //REGISTER_SYNC("Service_createLocalService", ServiceCreateLocal); #undef REGISTER_SYNC #define REGISTER_ASYNC(c,x) \ @@ -509,7 +509,7 @@ void ConvergenceInstance::AppCommunicationServiceStop( ReportSuccess(out); } -void ConvergenceInstance::AppCommunicationServiceAddListener( +void ConvergenceInstance::AppCommunicationServiceSetListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); @@ -537,7 +537,7 @@ void ConvergenceInstance::AppCommunicationServiceAddListener( ReportSuccess(out); } -void ConvergenceInstance::AppCommunicationServiceRemoveListener( +void ConvergenceInstance::AppCommunicationServiceUnsetListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); diff --git a/src/convergence/convergence_instance.h b/src/convergence/convergence_instance.h index b38f631..cd0ead6 100644 --- a/src/convergence/convergence_instance.h +++ b/src/convergence/convergence_instance.h @@ -70,8 +70,8 @@ class ConvergenceInstance : public common::ParsedInstance { void AppCommunicationServiceStart(const picojson::value& args, picojson::object& out); void AppCommunicationServiceStop(const picojson::value& args, picojson::object& out); void AppCommunicationServiceSend(const picojson::value& args, picojson::object& out); - void AppCommunicationServiceAddListener(const picojson::value& args, picojson::object& out); - void AppCommunicationServiceRemoveListener(const picojson::value& args, picojson::object& out); + void AppCommunicationServiceSetListener(const picojson::value& args, picojson::object& out); + void AppCommunicationServiceUnsetListener(const picojson::value& args, picojson::object& out); // App Communication Server Service void AppCommunicationServerServiceConstructLocal(const picojson::value& args, picojson::object& out); -- 2.7.4 From b332c0e120415a71a1a62e860493e07d4e00a431 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 29 Sep 2016 13:29:50 +0900 Subject: [PATCH 06/16] [version] 1.37 Change-Id: Id057df5fd16d0a7a343a4857afac502371f20acd --- 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 f06c1b1..88974a1 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: 1.36 +Version: 1.37 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From e802e9937e7f7ab0120871638b35920667d73415 Mon Sep 17 00:00:00 2001 From: "jk.pu" Date: Tue, 27 Sep 2016 15:23:24 +0900 Subject: [PATCH 07/16] [iotcon] fix set deviceName, set/get timeInterval Change-Id: I491d892c953f3df3109be5c328c438870be17215 Signed-off-by: jk.pu --- src/iotcon/iotcon_api.js | 10 +--------- src/iotcon/iotcon_instance.cc | 6 +----- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/iotcon/iotcon_api.js b/src/iotcon/iotcon_api.js index 10f5a54..4cd400b 100644 --- a/src/iotcon/iotcon_api.js +++ b/src/iotcon/iotcon_api.js @@ -691,10 +691,7 @@ function RemoteResource(data) { }, timeInterval: { get: function() { - /* TODO Uncomment when the interface of the function iotcon_remote_resource_get_time_interval is changed var callArgs = prepareResourceInfo(this, true); - */ - var callArgs = {}; var result = native.callSync('IotconRemoteResource_getTimeInterval', callArgs); if (native.isSuccess(result)) { @@ -703,13 +700,8 @@ function RemoteResource(data) { return null; }.bind(this), set: function(val) { - /* TODO Uncomment when the interface of the function iotcon_remote_resource_set_time_interval is changed var callArgs = prepareResourceInfo(this, true); callArgs[timeInterval] = converter.toLong(val); - */ - var callArgs = { - timeInterval: converter.toLong(val) - }; native.callSync('IotconRemoteResource_setTimeInterval', callArgs); }.bind(this), @@ -1222,7 +1214,7 @@ function Server() { }, set: function(v) { if (v) { - var deviceName = converter.toString(v); + var deviceName = v; var callArgs = { deviceName: deviceName diff --git a/src/iotcon/iotcon_instance.cc b/src/iotcon/iotcon_instance.cc index 8476d4d..46d618e 100644 --- a/src/iotcon/iotcon_instance.cc +++ b/src/iotcon/iotcon_instance.cc @@ -1122,7 +1122,6 @@ common::TizenResult IotconInstance::RemoteResourceGetTimeInterval(const picojson if (!res) { LogAndReturnTizenError(res, ("iotcon_remote_resource_get_checking_interval() failed")); } - return common::TizenSuccess{picojson::value(static_cast(time_interval))}; } @@ -1145,10 +1144,7 @@ common::TizenResult IotconInstance::RemoteResourceSetTimeInterval(const picojson LogAndReturnTizenError(res, ("iotcon_remote_resource_set_checking_interval() failed")); } - // TODO Uncomment when the interface of the function iotcon_remote_resource_set_time_interval is changed - // return common::TizenSuccess{IotconClientManager::GetInstance().StoreRemoteResource(ptr)}; - - return common::TizenSuccess{}; + return common::TizenSuccess{IotconClientManager::GetInstance().StoreRemoteResource(ptr)}; } bool IotconInstance::ResourceFoundCallback(iotcon_remote_resource_h resource, -- 2.7.4 From f7a9babca1163854c8cd72d4ec0847fc029b71ae Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Fri, 30 Sep 2016 18:59:10 +0900 Subject: [PATCH 08/16] disable IotCon due to release schedule Change-Id: I97baa26895bd7d1e24bb3916cd80cfbaa11f5e1d --- packaging/webapi-plugins.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 88974a1..09c50af 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: 1.37 +Version: 1.38 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries @@ -117,7 +117,7 @@ Source0: %{name}-%{version}.tar.gz %else %define tizen_feature_ham_support 0 %endif -%define tizen_feature_iotcon_support 1 +%define tizen_feature_iotcon_support 0 %define tizen_feature_location_batch 0 %define tizen_feature_key_manager_support 1 %define tizen_feature_media_controller_support 1 -- 2.7.4 From 2b6ee05e9d2cc5c062727eb09d6a9fa956470db9 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Fri, 30 Sep 2016 13:13:16 +0200 Subject: [PATCH 09/16] [Sensor] Fix for GyroscopeRotationVectorSensor. [Verification] Code compiles. TCT pass rate: wearable - 100% (97/97/0/0/0) mobile - 100% (93/93/0/0/0) Change-Id: Idd2c87a1fbbfc82af7807c86d6521bda9a9a4d84 Signed-off-by: Tomasz Marciniak --- src/sensor/sensor_api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sensor/sensor_api.js b/src/sensor/sensor_api.js index 9c810e8..f30b58d 100755 --- a/src/sensor/sensor_api.js +++ b/src/sensor/sensor_api.js @@ -552,7 +552,7 @@ GyroscopeSensor.prototype.getGyroscopeSensorData = function() { //// GyroscopeRotationVectorSensor var GyroscopeRotationVectorSensor = function(data) { - Sensor.call(this, SensorType.GYROSCOPE); + Sensor.call(this, SensorType.GYROSCOPE_ROTATION_VECTOR); }; GyroscopeRotationVectorSensor.prototype = new Sensor(); -- 2.7.4 From ae2abcd0e25f44bfd9b1e7a9dc950c5643c20ad0 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Fri, 30 Sep 2016 20:30:42 +0900 Subject: [PATCH 10/16] [version] 1.39 Change-Id: I82e04b1a1a569276806c0f63f974a75ad0bec514 --- 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 09c50af..6aba3c0 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: 1.38 +Version: 1.39 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 4e08b69e81ae37ac18b6c60e7e50a6b6a4b9b4e8 Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Tue, 4 Oct 2016 11:43:00 +0200 Subject: [PATCH 11/16] [Filesystem] - update position and eof attributes of fileStream in read [Verification] - TCT results 100% Change-Id: If03b99e8b3ef0619f981353a096c1c5c414cabc8 Signed-off-by: Andrzej Popowski --- src/filesystem/js/file_stream.js | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/filesystem/js/file_stream.js b/src/filesystem/js/file_stream.js index 2036254..2abc68f 100644 --- a/src/filesystem/js/file_stream.js +++ b/src/filesystem/js/file_stream.js @@ -134,9 +134,17 @@ function read() { if (native_.isFailure(result)) { throw new WebAPIException(WebAPIException.IO_ERR, 'Could not read'); } - var encoded = native_.getResultObject(result); + var decoded = Base64.decodeString(native_.getResultObject(result)); + + if (decoded.length) { + can_change_size = true; + this.position += decoded.length; + can_change_size = false; + } else { + this.position += 1; // Set EOF + } - return Base64.decodeString(encoded); + return decoded; }; FileStream.prototype.read = function() { @@ -171,9 +179,18 @@ function readBytes() { if (native_.isFailure(result)) { throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Could not read'); } - var encoded = native_.getResultObject(result); - return Base64.decode(encoded); + var decoded = Base64.decode(native_.getResultObject(result)); + + if (decoded.length) { + can_change_size = true; + this.position += decoded.length; + can_change_size = false; + } else { + this.position += 1; // Set EOF + } + + return decoded; }; FileStream.prototype.readBytes = function() { @@ -221,6 +238,15 @@ function readBase64() { throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Could not read'); } var encoded = native_.getResultObject(result); + var decoded = Base64.decode(encoded); + + if (decoded.length) { + can_change_size = true; + this.position += decoded.length; + can_change_size = false; + } else { + this.position += 1; // Set EOF + } return encoded; }; @@ -338,6 +364,12 @@ function writeBase64() { if (native_.isFailure(result)) { throw new WebAPIException(WebAPIException.IO_ERR, 'Could not write'); } + + var decoded = Base64.decode(args.base64Data); + + can_change_size = true; + this.position += decoded.length; + can_change_size = false; }; FileStream.prototype.writeBase64 = function() { -- 2.7.4 From f29a412258da749b962729cf0062528f4526b901 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Tue, 4 Oct 2016 20:01:56 +0900 Subject: [PATCH 12/16] [version] 1.40 Change-Id: Iaf0f83e1764de4d53654b8fe945ed2f6457a39de --- 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 6aba3c0..98d6d90 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: 1.39 +Version: 1.40 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 5100832f58eeab3ec280f5795a03a8d646347749 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 5 Oct 2016 13:42:53 +0200 Subject: [PATCH 13/16] [Content] Fix for crash in createThumbnail(). [Verification] Code compiles. Creating thumbnail does not cause crash. Success callback is called and callback id is correctly retrieved. Change-Id: I1094730ded85f57bb0088f2f088e50f45d675a95 Signed-off-by: Tomasz Marciniak --- src/content/content_manager.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc index bda7506..1f2b001 100644 --- a/src/content/content_manager.cc +++ b/src/content/content_manager.cc @@ -665,6 +665,10 @@ void CreateThumbnailCallback(media_content_error_e err, const char* path, void* LoggerD("Enter"); unsigned int* callbackId = (unsigned int*) user_data; + if (nullptr == callbackId) { + LoggerD("Callback id is null"); + return; + } if (!(ContentManager::getInstance()->getContentInstance())) { // There is not instance already @@ -1656,7 +1660,7 @@ common::PlatformResult ContentManager::createThumbnail(const picojson::value& ar ("Getting media is failed: %d (%s)", ret, get_error_message(ret))); } - ret = media_info_create_thumbnail(media, CreateThumbnailCallback, /* (void*) callbackId */ nullptr); + ret = media_info_create_thumbnail(media, CreateThumbnailCallback, (void*)callbackId); media_info_destroy(media); if(MEDIA_CONTENT_ERROR_NONE != ret) { delete callbackId; @@ -1664,8 +1668,6 @@ common::PlatformResult ContentManager::createThumbnail(const picojson::value& ar ("Creating thumbnail failed: %d (%s)", ret, get_error_message(ret))); } - delete callbackId; - return PlatformResult(ErrorCode::NO_ERROR); } -- 2.7.4 From afa492aad4d8908a3baea06d8f89dc275bed88d9 Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Wed, 5 Oct 2016 15:11:15 +0200 Subject: [PATCH 14/16] [WidgetService] - calling errorCallback on empty widget list Change-Id: Ib823e3693a2665b889effda57b28ad9011e491c9 Signed-off-by: Andrzej Popowski --- src/widgetservice/widgetservice_instance.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgetservice/widgetservice_instance.cc b/src/widgetservice/widgetservice_instance.cc index 00599f1..91a4759 100755 --- a/src/widgetservice/widgetservice_instance.cc +++ b/src/widgetservice/widgetservice_instance.cc @@ -227,6 +227,8 @@ TizenResult WidgetServiceInstance::GetWidgets(const picojson::object& args, if (WIDGET_ERROR_NONE > ret) { LoggerE("widget_service_get_widget_list() failed"); result = WidgetServiceUtils::ConvertErrorCode(ret); + } else if (array->empty()) { + result = WidgetServiceUtils::ConvertErrorCode(WIDGET_ERROR_NOT_EXIST); } else { result = TizenSuccess{response}; } -- 2.7.4 From 5ec6695b864ffecb4e55d30e9988c420c2cf1e2a Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 6 Oct 2016 10:38:41 +0900 Subject: [PATCH 15/16] [version] 1.41 Change-Id: I8892674c4b70b27ac931b2380ff204903298cf43 --- 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 98d6d90..6611194 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: 1.40 +Version: 1.41 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From c6b7f70dd7b4c5a61bc6c721af31a965a640194a Mon Sep 17 00:00:00 2001 From: "jk.pu" Date: Fri, 7 Oct 2016 14:11:51 +0900 Subject: [PATCH 16/16] [WidgetService] fix getInstance error issue only negative ret value is error. positive value is instance count. Change-Id: I6fcd37209edcf6833693dd87ab6162d8a7d84363 Signed-off-by: jk.pu --- src/widgetservice/widgetservice_instance.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgetservice/widgetservice_instance.cc b/src/widgetservice/widgetservice_instance.cc index 91a4759..3832981 100755 --- a/src/widgetservice/widgetservice_instance.cc +++ b/src/widgetservice/widgetservice_instance.cc @@ -327,7 +327,7 @@ TizenResult WidgetServiceInstance::GetInstances(picojson::object const& args, co TizenResult result = TizenSuccess(); - if (WIDGET_ERROR_NONE != ret) { + if (WIDGET_ERROR_NONE != ret && ret < 0) { LoggerE("widget_service_get_widget_instance_list() failed"); result = WidgetServiceUtils::ConvertErrorCode(ret); } else { -- 2.7.4