From 9c9f5b4d8ea1a31fdb0e6b545ea7fa7c133a61fd Mon Sep 17 00:00:00 2001 From: Rafal Walczyna Date: Tue, 17 Apr 2018 14:39:23 +0200 Subject: [PATCH 01/16] [IoTcon] Fix query creation for requests [Bug] query was not created properly when there was no resource interface set [Verification] 100% passrate on TM1 Change-Id: Iea1db9418fe10e9fad56a9bb7de1c34c95cbc5dd Signed-off-by: Rafal Walczyna --- src/iotcon/iotcon_utils.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/iotcon/iotcon_utils.cc b/src/iotcon/iotcon_utils.cc index 70546a4..abbe5d8 100644 --- a/src/iotcon/iotcon_utils.cc +++ b/src/iotcon/iotcon_utils.cc @@ -1106,11 +1106,14 @@ common::TizenResult IotconUtils::QueryToJson(iotcon_query_h query, picojson::obj { // resourceInterface char* interface = nullptr; - auto result = ConvertIotconError(iotcon_query_get_interface(query, &interface)); - if (!result || !interface) { - LogAndReturnTizenError(result, ("iotcon_query_get_interface() failed")); + int err_code = iotcon_query_get_interface(query, &interface); + if (IOTCON_ERROR_NONE != err_code) { + // if no interface is set to query we continue execution to set other values + LoggerW("iotcon_query_get_interface() failed: %d, ignoring resource interface in query", + err_code); + } else { + out->insert(std::make_pair(kResourceInterface, picojson::value{interface})); } - out->insert(std::make_pair(kResourceInterface, picojson::value{interface})); } { -- 2.7.4 From 87e3fe5c183776964cd7ff227748f58a332355cb Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 18 Apr 2018 10:28:21 +0200 Subject: [PATCH 02/16] [version] 2.21 Change-Id: Id7ba90815fd7970998c28343c0b1e5cce6fac32f Signed-off-by: Piotr Kosko --- 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 cc1902f..58f41cb 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: 2.20 +Version: 2.21 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From c617a8c0d69ef6cdfd499cafcbfe729042c89199 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Tue, 24 Apr 2018 12:40:19 +0200 Subject: [PATCH 03/16] [Filesystem] Fixing file filter [Bug] 1. FileFilter name was not matching '%' wildcard on the beginning of filename 2. wildcard escaping need to be done by using '\\%' not '\%' - proper comment added in code to ease future investigations. [Verification] Code compiles successfully. TCT passrate is 100%. Below code: var filter = "piotr\\%kosko%"; function onsuccess(files) { console.log("There are " + files.length + " in the selected folder"); for (var i =0; i < files.length; ++i) { console.log(files[i].name) } } function onerror(error) { console.log("The error " + error.message + " occurred when listing the files in the selected folder"); } tizen.filesystem.resolve("documents", function(dir) { dir.listFiles(onsuccess, onerror, {name: filter}); }, function(e) { console.log("Error " + e.message);}, "r"); for filter "piotr\\%kosko%" filters file: piotr%koskoTest for filter "%kosko%" filter files: piotrkoskoTest piotrkosko piotrTestkoskoTest kosko piotr%koskoTest piotr%kosko Change-Id: If7e6c3c3ad97a3d01a800916ba73c5f7749ae0cb Signed-off-by: Piotr Kosko --- src/filesystem/js/file.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/filesystem/js/file.js b/src/filesystem/js/file.js index 524d7b6..d5d2d20 100644 --- a/src/filesystem/js/file.js +++ b/src/filesystem/js/file.js @@ -73,7 +73,7 @@ function stringToRegex(str) { if (str === '') { return new RegExp(_regString, 'i'); } - + // single '\' sign is not visible in JS string, escaping % wildcard need to be done by '\\%' str = str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); var _percentTokens = str.split('%'); @@ -81,11 +81,13 @@ function stringToRegex(str) { for (i = 0; i < _percentTokens.length - 1; ++i) { _regString = _regString + _percentTokens[i]; if (_regString[_regString.length - 1] === '\\') { + // special handling \\% sequence - '%' sign is threaten as regular sign - not wildcard _regString = _regString.split(''); _regString.pop(); _regString = _regString.join('') + '%'; } - else if (_regString.lastIndexOf('\*') !== _regString.length - 2) { + else { + // handling '%' as a wildcard _regString = _regString + '.*'; } } -- 2.7.4 From 5b2319f7afd43f17fb7515e7879bc63e7138e188 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 25 Apr 2018 12:42:27 +0200 Subject: [PATCH 04/16] [version] 2.22 Change-Id: I75c3fdd794b62946720fc5cb537c437ab33843bd Signed-off-by: Piotr Kosko --- 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 58f41cb..f271a81 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: 2.21 +Version: 2.22 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From bb922e7477cb08f24622e3ae2edc86f774c0ab64 Mon Sep 17 00:00:00 2001 From: Lukasz Bardeli Date: Thu, 10 May 2018 08:43:35 +0200 Subject: [PATCH 05/16] [Iotcon] Prevent iotcon from call timeout after found resource In ResourceFoundCallback after some resource was found, timeout will never be called. [Verification] Code compiles without error. TCT tests passrate 100% Change-Id: I96ca592eb94e14c374b6eab99ca1956108f37154 Signed-off-by: Lukasz Bardeli --- src/iotcon/iotcon_instance.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/iotcon/iotcon_instance.cc b/src/iotcon/iotcon_instance.cc index 705fb1f..6bc88a8 100644 --- a/src/iotcon/iotcon_instance.cc +++ b/src/iotcon/iotcon_instance.cc @@ -40,8 +40,10 @@ const std::string kPrivilegeIotcon = "http://tizen.org/privilege/internet"; struct CallbackData { common::PostCallback fun; + bool was_called; CallbackData(common::PostCallback f) { fun = f; + was_called = false; } }; @@ -1305,10 +1307,16 @@ bool IotconInstance::ResourceFoundCallback(iotcon_remote_resource_h resource, io common::TizenResult ret = common::TizenSuccess(); switch (result) { case IOTCON_ERROR_NONE: + // Mark that this callback was called at leas once (some resource was found) + data->was_called = true; ret = IotconUtils::RemoteResourceToJson(resource, &v.get()); break; case IOTCON_ERROR_TIMEOUT: LoggerD("IOTCON_TIMEOUT"); + // if TIMEOUT was called after some resource was found then do not call errorCallback + if (data->was_called) { + return IOTCON_FUNC_STOP; + } default: ret = IotconUtils::ConvertIotconError(result); } -- 2.7.4 From 9acb235d0ea732dda1dc80de145224fa090af494 Mon Sep 17 00:00:00 2001 From: Rafal Walczyna Date: Wed, 16 May 2018 14:29:03 +0200 Subject: [PATCH 06/16] [humanactivitymonitor] Fixing rRinterval value in heartRate data rRinterval was always 0. This value is now available, but measurement is not present in unified builds. It was tested on R765 and R600 with solis binaries and it worked fine. [verification] AutoTCT - 100% pass Change-Id: I3c181c53e0832f429774f86277bcaeda4708c0b7 Signed-off-by: Rafal Walczyna --- src/humanactivitymonitor/humanactivitymonitor_manager.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index 22d52b5..9a52f2f 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -1371,15 +1371,18 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "To few values of HRM event"); } - LOGGER(DEBUG) << " |- values[0]: " << event->values[0]; - LOGGER(DEBUG) << " |- values[1]: " << event->values[1]; + LOGGER(DEBUG) << " |- values[0][HR ]: " << event->values[0]; + LOGGER(DEBUG) << " |- values[2][RRI]: " << event->values[2]; float hr = floor(event->values[0] + 0.5); // heart beat rate 0 ~ 220 integer (bpm) - // there are no public native api for peak to peak interval. + // there are no public native api documentation for peak to peak interval. // but RRI = (60 / HR) * 1000 - // or unofficially values[1] is rri (0 ~ 5000 ms) - float rri = floor(event->values[1] + 0.5); + // @ 18.05.2018 + // in capi, rri is in values[2], but it is not documented because value can be unstable + // and it is not available on all devices. On solis it works fine. + + float rri = floor(event->values[2] + 0.5); // rr-interval 0 ~ 5000 integer (ms) data->insert(std::make_pair("heartRate", picojson::value(static_cast(hr)))); data->insert(std::make_pair("rRInterval", picojson::value(static_cast(rri)))); -- 2.7.4 From 91163a0cef0b132df874079d69b714b8d4e25866 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Fri, 18 May 2018 13:44:31 +0200 Subject: [PATCH 07/16] [version] 2.23 Change-Id: I7634bdecaab795b4f9db8b76ecc92a8ee00da755 Signed-off-by: Piotr Kosko --- 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 f271a81..c6a0ee0 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: 2.22 +Version: 2.23 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From e0bb8cb548c52464703190e668624a13fa68f718 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarczyk Date: Tue, 10 Jul 2018 15:35:36 +0200 Subject: [PATCH 08/16] [HRM] Fix for resetting pedometer data after calling start [Bug] Pedometer properties were not reset back to zero after calling start again. [Verification] Auto TCT passrate 100% Manual (wearable and mobile emulators) 100% Change-Id: I4b961a5c05224accb7ff482c570b3dd3aa352bb4 Signed-off-by: Pawel Kaczmarczyk --- .../humanactivitymonitor_manager.cc | 212 ++++++++++++--------- 1 file changed, 121 insertions(+), 91 deletions(-) diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index 9a52f2f..1dc5779 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -269,6 +269,7 @@ class HumanActivityMonitorManager::Monitor { class GestureMonitor; class SensorMonitor; class GpsMonitor; + class PedometerMonitor; explicit Monitor(const std::string& t) : type_(t) { ScopeLogger(type()); @@ -533,10 +534,10 @@ class HumanActivityMonitorManager::Monitor::SensorMonitor SensorMonitor(const std::string& t, sensor_type_e s, const SensorEventConverter& c, const SensorRecordedConverter& r) : Monitor(t), - sensor_(s), - handle_(nullptr), converter_(c), converter_recorded_(r), + sensor_(s), + handle_(nullptr), recorded_data_(nullptr) { ScopeLogger(type()); } @@ -764,6 +765,9 @@ class HumanActivityMonitorManager::Monitor::SensorMonitor recorded_data_->push_back(*data); } + SensorEventConverter converter_; + SensorRecordedConverter converter_recorded_; + private: static void OnSensorEvent(sensor_h, sensor_event_s* event, void* user_data) { ScopeLogger(); @@ -869,12 +873,123 @@ class HumanActivityMonitorManager::Monitor::SensorMonitor sensor_type_e sensor_; sensor_listener_h handle_; - SensorEventConverter converter_; - SensorRecordedConverter converter_recorded_; picojson::array* recorded_data_; std::mutex mutex_; }; +class HumanActivityMonitorManager::Monitor::PedometerMonitor + : public HumanActivityMonitorManager::Monitor::SensorMonitor { + private: + bool is_first_read; + + public: + PedometerMonitor() + : SensorMonitor(kActivityTypePedometer, SENSOR_HUMAN_PEDOMETER, nullptr, nullptr), + is_first_read(true) { + ScopeLogger(); + converter_ = [this](sensor_event_s* event, picojson::object* data) -> PlatformResult { + + ScopeLogger("Entered into asynchronous function, convert_pedometer"); + + const auto pedometer_data = (PedometerDataWrapper*)event; + + static PedometerDataWrapper initial_pedometer_data; + + if (this->is_first_read) { + initial_pedometer_data = *pedometer_data; + this->is_first_read = false; + } + + static float steps_so_far = 0.0; + + const auto state = pedometer_data->state(); + + data->insert(std::make_pair(kStepStatus, picojson::value(FromSensorPedometerState(state)))); + data->insert(std::make_pair(kSpeed, picojson::value(pedometer_data->speed()))); + data->insert(std::make_pair(kWalkingFrequency, picojson::value(pedometer_data->frequency()))); + + data->insert(std::make_pair( + kCumulativeDistance, + picojson::value(pedometer_data->distance() - initial_pedometer_data.distance()))); + data->insert(std::make_pair( + kCumulativeCalorie, + picojson::value(pedometer_data->calories() - initial_pedometer_data.calories()))); + data->insert(std::make_pair( + kCumulativeTotalStepCount, + picojson::value(pedometer_data->steps() - initial_pedometer_data.steps()))); + data->insert(std::make_pair( + kCumulativeWalkStepCount, + picojson::value(pedometer_data->walk_steps() - initial_pedometer_data.walk_steps()))); + data->insert(std::make_pair( + kCumulativeRunStepCount, + picojson::value(pedometer_data->run_steps() - initial_pedometer_data.run_steps()))); + + data->insert( + std::make_pair(kAccumulativeDistance, picojson::value(pedometer_data->distance()))); + data->insert( + std::make_pair(kAccumulativeCalorie, picojson::value(pedometer_data->calories()))); + data->insert( + std::make_pair(kAccumulativeTotalStepCount, picojson::value(pedometer_data->steps()))); + data->insert(std::make_pair(kAccumulativeWalkStepCount, + picojson::value(pedometer_data->walk_steps()))); + data->insert( + std::make_pair(kAccumulativeRunStepCount, picojson::value(pedometer_data->run_steps()))); + + auto& diffs = + data->insert(std::make_pair(kStepCountDifferences, picojson::value{picojson::array{}})) + .first->second.get(); + LoggerD("pedometer_data->diffs_count: %d", pedometer_data->diffs_count); + if (pedometer_data->diffs_count > 0) { + for (int i = 0; i < pedometer_data->diffs_count; ++i) { + InsertStepDifference(pedometer_data->diffs[i].steps, + getCurrentTimeStamp(pedometer_data->diffs[i].timestamp) / 1000, + &diffs); + } + } else { + InsertStepDifference(steps_so_far > 0.0 ? pedometer_data->steps() - steps_so_far : 0.0, + getCurrentTimeStamp(pedometer_data->timestamp) / 1000, &diffs); + } + + steps_so_far = pedometer_data->steps(); + + return PlatformResult(ErrorCode::NO_ERROR); + }; + + converter_recorded_ = [](void* data, picojson::object* obj) -> PlatformResult { + ScopeLogger("Entered into asynchronous function, convert_recorded_pedometer"); + + SensorRecorderDataMap map_int{{SENSOR_RECORDER_DATA_STEPS, kRecordedTotalStepCount}, + {SENSOR_RECORDER_DATA_WALK_STEPS, kRecordedWalkStepCount}, + {SENSOR_RECORDER_DATA_RUN_STEPS, kRecordedRunStepCount}}; + + SensorRecorderDataMap map_double{{SENSOR_RECORDER_DATA_DISTANCE, kRecordedDistance}, + {SENSOR_RECORDER_DATA_CALORIE, kRecordedCalorie}}; + + auto result = ConvertRecordedInt(data, obj, map_int); + if (!result) { + return result; + } + + result = ConvertRecordedDouble(data, obj, map_double); + if (!result) { + return result; + } + + return ConvertRecordedTime(data, obj); + }; + } + + virtual ~PedometerMonitor() { + ScopeLogger(); + } + + virtual PlatformResult SetListenerImpl(const picojson::value& args) override { + ScopeLogger(); + is_first_read = true; + return HumanActivityMonitorManager::Monitor::SensorMonitor::SetListenerImpl(args); + } +}; + class HumanActivityMonitorManager::Monitor::GpsMonitor : public HumanActivityMonitorManager::Monitor { public: @@ -1299,66 +1414,6 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() : activity_recognition_(std::make_shared()) { ScopeLogger(); - auto convert_pedometer = [](sensor_event_s* event, picojson::object* data) -> PlatformResult { - ScopeLogger("Entered into asynchronous function, convert_pedometer"); - - const auto pedometer_data = (PedometerDataWrapper*)event; - - static const auto initial_pedometer_data = *pedometer_data; // will be initialized only once - static float steps_so_far = 0.0; - - const auto state = pedometer_data->state(); - - data->insert(std::make_pair(kStepStatus, picojson::value(FromSensorPedometerState(state)))); - data->insert(std::make_pair(kSpeed, picojson::value(pedometer_data->speed()))); - data->insert(std::make_pair(kWalkingFrequency, picojson::value(pedometer_data->frequency()))); - - data->insert(std::make_pair( - kCumulativeDistance, - picojson::value(pedometer_data->distance() - initial_pedometer_data.distance()))); - data->insert(std::make_pair( - kCumulativeCalorie, - picojson::value(pedometer_data->calories() - initial_pedometer_data.calories()))); - data->insert( - std::make_pair(kCumulativeTotalStepCount, - picojson::value(pedometer_data->steps() - initial_pedometer_data.steps()))); - data->insert(std::make_pair( - kCumulativeWalkStepCount, - picojson::value(pedometer_data->walk_steps() - initial_pedometer_data.walk_steps()))); - data->insert(std::make_pair( - kCumulativeRunStepCount, - picojson::value(pedometer_data->run_steps() - initial_pedometer_data.run_steps()))); - - data->insert( - std::make_pair(kAccumulativeDistance, picojson::value(pedometer_data->distance()))); - data->insert(std::make_pair(kAccumulativeCalorie, picojson::value(pedometer_data->calories()))); - data->insert( - std::make_pair(kAccumulativeTotalStepCount, picojson::value(pedometer_data->steps()))); - data->insert( - std::make_pair(kAccumulativeWalkStepCount, picojson::value(pedometer_data->walk_steps()))); - data->insert( - std::make_pair(kAccumulativeRunStepCount, picojson::value(pedometer_data->run_steps()))); - - auto& diffs = - data->insert(std::make_pair(kStepCountDifferences, picojson::value{picojson::array{}})) - .first->second.get(); - LOGGER(DEBUG) << " pedometer_data->diffs_coun: " << pedometer_data->diffs_count; - if (pedometer_data->diffs_count > 0) { - for (int i = 0; i < pedometer_data->diffs_count; ++i) { - InsertStepDifference(pedometer_data->diffs[i].steps, - getCurrentTimeStamp(pedometer_data->diffs[i].timestamp) / 1000, - &diffs); - } - } else { - InsertStepDifference(steps_so_far > 0.0 ? pedometer_data->steps() - steps_so_far : 0.0, - getCurrentTimeStamp(pedometer_data->timestamp) / 1000, &diffs); - } - - steps_so_far = pedometer_data->steps(); - - return PlatformResult(ErrorCode::NO_ERROR); - }; - auto convert_hrm = [](sensor_event_s* event, picojson::object* data) -> PlatformResult { ScopeLogger("Entered into asynchronous function, convert_hrm"); @@ -1425,29 +1480,6 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() return PlatformResult(ErrorCode::NO_ERROR); }; - auto convert_recorded_pedometer = [](void* data, picojson::object* obj) -> PlatformResult { - ScopeLogger("Entered into asynchronous function, convert_recorded_pedometer"); - - SensorRecorderDataMap map_int{{SENSOR_RECORDER_DATA_STEPS, kRecordedTotalStepCount}, - {SENSOR_RECORDER_DATA_WALK_STEPS, kRecordedWalkStepCount}, - {SENSOR_RECORDER_DATA_RUN_STEPS, kRecordedRunStepCount}}; - - SensorRecorderDataMap map_double{{SENSOR_RECORDER_DATA_DISTANCE, kRecordedDistance}, - {SENSOR_RECORDER_DATA_CALORIE, kRecordedCalorie}}; - - auto result = ConvertRecordedInt(data, obj, map_int); - if (!result) { - return result; - } - - result = ConvertRecordedDouble(data, obj, map_double); - if (!result) { - return result; - } - - return ConvertRecordedTime(data, obj); - }; - auto convert_recorded_hrm = [](void* data, picojson::object* obj) -> PlatformResult { ScopeLogger("Entered into asynchronous function, convert_recorded_hrm"); @@ -1491,10 +1523,8 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() return ConvertRecordedTime(data, obj); }; - monitors_.insert(std::make_pair( - kActivityTypePedometer, - std::make_shared(kActivityTypePedometer, SENSOR_HUMAN_PEDOMETER, - convert_pedometer, convert_recorded_pedometer))); + monitors_.insert(std::make_pair(kActivityTypePedometer, + std::make_shared())); monitors_.insert(std::make_pair(kActivityTypeWristUp, std::make_shared(kActivityTypeWristUp))); monitors_.insert(std::make_pair( -- 2.7.4 From 8cacc6d48ce88fefad4fc89c3f41bacad4e13e06 Mon Sep 17 00:00:00 2001 From: Lukasz Bardeli Date: Thu, 12 Jul 2018 07:38:20 +0200 Subject: [PATCH 09/16] [version] 2.24 Change-Id: I612a9ec9977025efbbb35fa2c58e4c3ec8226b79 Signed-off-by: Lukasz Bardeli --- 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 c6a0ee0..70ab9fb 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: 2.23 +Version: 2.24 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From 41ee8a49f96c04e9b9c69382b140e9e07ce384c2 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarczyk Date: Thu, 26 Jul 2018 09:05:03 +0200 Subject: [PATCH 10/16] [NFC] Minor fixes [Bugs] 1. In special cases records objects were created as empty 2. If NFCPeerDetectCallback or NFCTagDetectCallback did not have defined function to call on action an TypeError would be thrown. [Verification] tct-nfc-tizen-tests passrate 100% Change-Id: I32d6cbdc05c491f42100580a1cfe021c4c877bfc Signed-off-by: Pawel Kaczmarczyk --- src/nfc/nfc_api.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js index c282348..4dcead5 100644 --- a/src/nfc/nfc_api.js +++ b/src/nfc/nfc_api.js @@ -347,7 +347,7 @@ function setTagListener() { return; } } - args.listener[message.action](tagObject); + native_.callIfPossible(args.listener[message.action], tagObject); }; // Register (acivate) core listener if not done yet @@ -380,7 +380,7 @@ function setPeerListener() { if ('onattach' === msg.action) { data = new NFCPeer(msg.id); } - args.listener[msg.action](data); + native_.callIfPossible(args.listener[msg.action], data); }; if (!native_.isListenerSet(PEER_LISTENER)) { @@ -924,7 +924,7 @@ var toRecordsArray = function(array) { var data = new InternalRecordData(array[i].tnf, array[i].type, array[i].payload, array[i].id); if (array[i].recordType == 'Record') { - result.push(new tizen.NDEFRecord(data.tnf_, data.type_, data.payload_, data.id_)); + result.push(new tizen.NDEFRecord(data.tnf, data.type, data.payload, data.id)); continue; } @@ -940,7 +940,7 @@ var toRecordsArray = function(array) { } if (array[i].recordType == 'RecordMedia') { - result.push(new tizen.NDEFRecordMedia(array[i].mimeType, array[i].data, data)); + result.push(new tizen.NDEFRecordMedia(array[i].mimeType, null, data)); continue; } } @@ -1528,11 +1528,11 @@ tizen.NDEFRecordMedia = function(mimeType, data, internal_) { try { if (arguments.length >= 2) { mimeType_ = converter_.toString(mimeType); - data_ = toByteArray(data, Math.pow(2, 32) - 1); if (!type_.isNullOrUndefined(internal_) && (internal_ instanceof InternalRecordData)) { tizen.NDEFRecord.call(this, internal_.tnf, internal_.type, internal_.payload, internal_.id); } else { + data_ = toByteArray(data, Math.pow(2, 32) - 1); var result = native_.callSync( 'NDEFRecordMedia_constructor', { 'mimeType': mimeType_, -- 2.7.4 From fb3a4a2c7b41a2f4af08c606427e467707a3c559 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarczyk Date: Wed, 18 Jul 2018 15:45:45 +0200 Subject: [PATCH 11/16] [HAM] Fix throwing exceptions for getHumanActivityData [Bug] getHumanActivityData method accepts only 'PEDOMETER' and 'HRM' values of HumanActivityType enum as type parameter. Any other value should cause NotSupportedError, but implementation leaded to UnknownError instead. [Verification] AutoTCT 100% passrate Change-Id: Id5145d76f8957527e28f42c9b1c3141b11b8e5ca Signed-off-by: Pawel Kaczmarczyk --- src/humanactivitymonitor/humanactivitymonitor_api.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index 3f06004..dccf34c 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -191,12 +191,10 @@ HumanActivityMonitorManager.prototype.getHumanActivityData = function(type, succ {name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true} ]); - if (args.type === HumanActivityType.WRIST_UP) { + if (-1 === [HumanActivityType.HRM, HumanActivityType.PEDOMETER].indexOf(args.type)) { throw new WebAPIException(WebAPIException.NOT_SUPPORTED_ERR); } - var listenerId = 'HumanActivityMonitor_' + args.type; - var data = { type: args.type }; -- 2.7.4 From d7bc239b135e68a98e9c960f09d020962e64bfb8 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarczyk Date: Wed, 8 Aug 2018 14:32:16 +0200 Subject: [PATCH 12/16] [SystemInfo][Bluetooth][Push] Add misssing deprecation warnings since Tizen 3.0 [Verification] Code compiles tct-systeminfo-tizen-tests passrate 100% Change-Id: I41db5325ac94ca042069551a41161e5b968e51d3 Signed-off-by: Pawel Kaczmarczyk --- src/bluetooth/bluetooth_adapter.cc | 3 +++ src/bluetooth/bluetooth_api.js | 3 +++ src/push/push_instance.cc | 12 ++++++++++++ src/systeminfo/systeminfo_api.js | 12 +++++++++--- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/bluetooth/bluetooth_adapter.cc b/src/bluetooth/bluetooth_adapter.cc index 9fbf87e..0da34d5 100644 --- a/src/bluetooth/bluetooth_adapter.cc +++ b/src/bluetooth/bluetooth_adapter.cc @@ -641,6 +641,9 @@ void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object& void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object& out) { ScopeLogger(); + LoggerW( + "DEPRECATION WARNING: setVisible() is deprecated and will be removed from next release. " + "Let the user change the Bluetooth visibility through the Settings application instead."); CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothManager, &out); diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js index 09979b3..9fb4266 100755 --- a/src/bluetooth/bluetooth_api.js +++ b/src/bluetooth/bluetooth_api.js @@ -2078,6 +2078,9 @@ BluetoothAdapter.prototype.setPowered = function() { // This method is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. BluetoothAdapter.prototype.setVisible = function() { privUtils_.log('Entered BluetoothAdapter.setVisible()'); + privUtils_.warn('DEPRECATION WARNING: setVisible() is deprecated and will be removed from next release. ' + + 'Let the user change the Bluetooth visibility through the Settings application instead.'); + var args = AV.validateMethod(arguments, [ { name : 'visible', diff --git a/src/push/push_instance.cc b/src/push/push_instance.cc index f7b277d..f05e04b 100644 --- a/src/push/push_instance.cc +++ b/src/push/push_instance.cc @@ -64,6 +64,9 @@ PushInstance::PushInstance() { void PushInstance::registerService(const picojson::value& args, picojson::object& out) { ScopeLogger(); + LoggerW( + "DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. " + "Use register() instead."); CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out); common::PlatformResult result = impl->registerService(args.get("callbackId").get()); @@ -88,6 +91,9 @@ void PushInstance::registerApplication(const picojson::value& args, picojson::ob void PushInstance::unregisterService(const picojson::value& args, picojson::object& out) { ScopeLogger(); + LoggerW( + "DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next " + "release. Use unregister() instead."); CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out); @@ -114,6 +120,9 @@ void PushInstance::unregisterApplication(const picojson::value& args, picojson:: void PushInstance::connectService(const picojson::value& args, picojson::object& out) { ScopeLogger(); + LoggerW( + "DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. " + "Use connect() instead."); CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out); @@ -140,6 +149,9 @@ void PushInstance::connect(const picojson::value& args, picojson::object& out) { void PushInstance::disconnectService(const picojson::value& args, picojson::object& out) { ScopeLogger(); + LoggerW( + "DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next " + "release. Use disconnect() instead."); CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out); diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index 63b3e5e..a14be23 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -441,6 +441,8 @@ function SystemInfoCpu(data) { //class SystemInfoStorageUnit //////////////////////////////////////////////////// function SystemInfoStorageUnit(data) { + var _isRemovable = data.isRemovable; + Object.defineProperties(this, { type : { value: data.type, @@ -463,9 +465,13 @@ function SystemInfoStorageUnit(data) { enumerable : true }, isRemoveable : { - value : data.isRemovable, - writable : false, - enumerable : true + enumerable : true, + get: function() { + privUtils_.warn('DEPRECATION WARNING: SystemInfoStorageUnit.isRemoveable is is deprecated and will be ' + + 'removed from next release. Use SystemInfoStorageUnit.isRemovable instead.'); + return _isRemovable; + }, + set: function() {} } }); } -- 2.7.4 From 9a312f8db865b205dd4a8c5377486921604c198d Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 16 Aug 2018 10:42:15 +0200 Subject: [PATCH 13/16] [version] 2.25 Change-Id: If58254886f7fa6188e597e4d20dcb30f0ef60234 Signed-off-by: Piotr Kosko --- 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 70ab9fb..f9c4b20 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: 2.24 +Version: 2.25 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From 1fec04d00442f27bbec233f517b31ad5a5e01634 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 20 Sep 2018 08:40:06 +0200 Subject: [PATCH 14/16] [Bluetooth] Fixing the memory releasing issue [Verification] Code compiles without errors. TCT passrate 100%. Change-Id: I4a7b516635b7d2a3bfc96359fa4d51543b0eb4e0 Signed-off-by: Piotr Kosko --- src/bluetooth/bluetooth_health_profile_handler.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bluetooth/bluetooth_health_profile_handler.cc b/src/bluetooth/bluetooth_health_profile_handler.cc index 2aeacb5..06a1f90 100644 --- a/src/bluetooth/bluetooth_health_profile_handler.cc +++ b/src/bluetooth/bluetooth_health_profile_handler.cc @@ -238,6 +238,7 @@ void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, switch (ret) { case BT_ERROR_NONE: { LoggerD("Registered app: %s", app_id); + std::unique_ptr app_id_ptr(app_id, &std::free); this->registered_health_apps_.insert(app_id); -- 2.7.4 From 4ee0e2219a3be9cbe851c422711986ac32e7925c Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 20 Sep 2018 09:01:37 +0200 Subject: [PATCH 15/16] [version] 2.26 Change-Id: Ibb8feb4665aee4761dc2592147bdd41743bed13d Signed-off-by: Piotr Kosko --- 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 f9c4b20..b5169ac 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: 2.25 +Version: 2.26 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From debf5d373ae98ce8c864bebb9bd2e8dd4f0cd733 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Tue, 2 Oct 2018 13:25:19 +0200 Subject: [PATCH 16/16] [Archive][Exif] Added missing error checking [Verification] Code compiles without errors. Change-Id: I588a1d08f4dea4a19038653b2889a1daa5b45673 Signed-off-by: Piotr Kosko --- src/archive/zip_add_request.cc | 6 +++++- src/exif/jpeg_file.cc | 6 +++++- src/humanactivitymonitor/humanactivitymonitor_manager.cc | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc index d8cb38d..d6e862f 100644 --- a/src/archive/zip_add_request.cc +++ b/src/archive/zip_add_request.cc @@ -360,7 +360,11 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) // Get file length fseek(m_input_file, 0, SEEK_END); const size_t in_file_size = ftell(m_input_file); - fseek(m_input_file, 0, SEEK_SET); + int res = fseek(m_input_file, 0, SEEK_SET); + if (0 != res) { + return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Reading input file failed", + ("fseek failed with error! [%d]", res)); + } LoggerD("Source file: [%s] size: %d - %s", src_file_path.c_str(), in_file_size, bytesToReadableString(in_file_size).c_str()); diff --git a/src/exif/jpeg_file.cc b/src/exif/jpeg_file.cc index aefd179..39bf00c 100644 --- a/src/exif/jpeg_file.cc +++ b/src/exif/jpeg_file.cc @@ -148,7 +148,11 @@ PlatformResult JpegFile::load(const std::string& path) { ("Couldn't open Jpeg file: [%s]", path.c_str())); } - fseek(m_in_file, 0, SEEK_END); + int res = fseek(m_in_file, 0, SEEK_END); + if (0 != res) { + return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Reading JPEG file failed", + ("fseek failed with error! [%d]", res)); + } long ftell_val = ftell(m_in_file); if (0 > ftell_val) { diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index 1dc5779..13f3a0c 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -1523,8 +1523,8 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() return ConvertRecordedTime(data, obj); }; - monitors_.insert(std::make_pair(kActivityTypePedometer, - std::make_shared())); + monitors_.insert( + std::make_pair(kActivityTypePedometer, std::make_shared())); monitors_.insert(std::make_pair(kActivityTypeWristUp, std::make_shared(kActivityTypeWristUp))); monitors_.insert(std::make_pair( -- 2.7.4