From: Rafal Walczyna Date: Tue, 8 Sep 2020 08:37:44 +0000 (+0200) Subject: [HAM] Remove WRIST_UP gesture X-Git-Tag: submit/tizen/20200909.074050~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06a201c977ae4a9252e8b6a2600f08aac71be9e8;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [HAM] Remove WRIST_UP gesture WRIST_UP is not supported natively since Tizen 6.0. TWDAPI-269 [Verification] Build successful Two tests fails - start and stop WRIST_UP (TypeMismatchError) Change-Id: If09be9c1ce578adab1ec518b03be2884ea07ed51 Signed-off-by: Rafal Walczyna --- diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index 7915248d..2271e4aa 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -41,7 +41,6 @@ var MIN_QUERY_INTERVAL = 0; var HumanActivityType = { PEDOMETER: 'PEDOMETER', - WRIST_UP: 'WRIST_UP', HRM: 'HRM', GPS: 'GPS', SLEEP_MONITOR: 'SLEEP_MONITOR', @@ -99,8 +98,6 @@ function convertActivityData(type, data) { return new HumanActivityPedometerData(data); case ACCUMULATIVE_PEDOMETER_DATA: return new HumanActivityAccumulativePedometerData(data); - case HumanActivityType.WRIST_UP: - return null; case HumanActivityType.HRM: return new HumanActivityHRMData(data); case HumanActivityType.GPS: @@ -377,13 +374,6 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) { { name: 'options', type: types_.DICTIONARY, optional: true, nullable: true } ]); - if (HumanActivityType.WRIST_UP === args.type) { - utils_.warn( - 'DEPRECATION WARNING: HumanActivityType.WRIST_UP is deprecated since ' + - 'Tizen 4.0.' - ); - } - if (HumanActivityType.STRESS_MONITOR == args.type) { utils_.printDeprecationWarningFor(HumanActivityType.STRESS_MONITOR); } @@ -482,14 +472,6 @@ HumanActivityMonitorManager.prototype.stop = function(type) { { name: 'type', type: types_.ENUM, values: Object.keys(HumanActivityType) } ]); - if (HumanActivityType.WRIST_UP === args.type) { - utils_.warn( - 'DEPRECATION WARNING: HumanActivityType.WRIST_UP is deprecated since ' + - 'Tizen 4.0. Use GestureType and addGestureRecognitionListener to ' + - 'monitor WRIST_UP gesture' - ); - } - if (HumanActivityType.STRESS_MONITOR == args.type) { utils_.printDeprecationWarningFor(HumanActivityType.STRESS_MONITOR); } diff --git a/src/humanactivitymonitor/humanactivitymonitor_instance.cc b/src/humanactivitymonitor/humanactivitymonitor_instance.cc index 5baa8c73..379da369 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_instance.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_instance.cc @@ -150,12 +150,6 @@ void HumanActivityMonitorInstance::HumanActivityMonitorManagerStart(const picojs CHECK_PRIVILEGE_ACCESS(kPrivilegeLocation, &out); } - if ("WRIST_UP" == type) { - LoggerW( - "DEPRECATION WARNING: HumanactivityType.WRIST_UP is deprecated since Tizen 4.0. " - "Use GestureType and addGestureRecognitionListener to monitor WRIST_UP gesture"); - } - PlatformResult result = Init(); if (!result) { LogAndReportError(result, &out, ("Failed: Init()")); @@ -198,12 +192,6 @@ void HumanActivityMonitorInstance::HumanActivityMonitorManagerStop(const picojso CHECK_PRIVILEGE_ACCESS(kPrivilegeLocation, &out); } - if ("WRIST_UP" == type) { - LoggerW( - "DEPRECATION WARNING: HumanactivityType.WRIST_UP is deprecated since Tizen 4.0. " - "Use GestureType and addGestureRecognitionListener to monitor WRIST_UP gesture"); - } - PlatformResult result = Init(); if (!result) { LogAndReportError(result, &out, ("Failed: Init()")); diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index a9957edb..437895a2 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -44,7 +44,6 @@ typedef std::map SensorRecorderQuer namespace { const std::string kActivityTypePedometer = "PEDOMETER"; -const std::string kActivityTypeWristUp = "WRIST_UP"; const std::string kActivityTypeHrm = "HRM"; const std::string kActivityTypeSleepMonitor = "SLEEP_MONITOR"; const std::string kActivityTypePressure = "PRESSURE"; @@ -269,7 +268,6 @@ const std::string kActivityTypeGps = "GPS"; class HumanActivityMonitorManager::Monitor { public: - class GestureMonitor; class SensorMonitor; class GpsMonitor; class PedometerMonitor; @@ -427,111 +425,6 @@ class HumanActivityMonitorManager::Monitor { JsonCallback event_callback_; }; -class HumanActivityMonitorManager::Monitor::GestureMonitor - : public HumanActivityMonitorManager::Monitor { - public: - explicit GestureMonitor(const std::string& t) : Monitor(t), handle_(nullptr) { - ScopeLogger("type %s", type().c_str()); - } - - virtual ~GestureMonitor() override { - ScopeLogger("type %s", type().c_str()); - UnsetListenerImpl(); - } - - protected: - virtual PlatformResult IsSupportedImpl(bool* s) const override { - ScopeLogger("type %s", type().c_str()); - - bool supported = false; - - // gesture_is_supported is deprecated since 6.0 - int ret = gesture_is_supported(GESTURE_WRIST_UP, &supported); - if (GESTURE_ERROR_NONE != ret) { - if (ret == GESTURE_ERROR_NOT_SUPPORTED) { - return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "WRIST_UP gesture check failed", - ("gesture_is_supported(GESTURE_WRIST_UP), error: %d (%s)", ret, - get_error_message(ret))); - } else { - return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "WRIST_UP gesture check failed", - ("gesture_is_supported(GESTURE_WRIST_UP), error: %d (%s)", ret, - get_error_message(ret))); - } - } - - *s = supported; - return PlatformResult(ErrorCode::NO_ERROR); - } - - virtual PlatformResult SetListenerImpl(const picojson::value&) override { - ScopeLogger("type %s", type().c_str()); - - if (!handle_) { - // gesture_create is not supported since 6.0 - int ret = gesture_create(&handle_); - if (GESTURE_ERROR_NONE != ret) { - return LogAndCreateResult( - ErrorCode::UNKNOWN_ERR, "Failed to create WRIST_UP listener", - ("Failed to create WRIST_UP handle, error: %d (%s)", ret, get_error_message(ret))); - } - - // gesture_start_recognition is not supported since 6.0 - ret = gesture_start_recognition(handle_, GESTURE_WRIST_UP, GESTURE_OPTION_DEFAULT, - OnWristUpEvent, this); - if (GESTURE_ERROR_NONE != ret) { - return LogAndCreateResult( - ErrorCode::UNKNOWN_ERR, "Failed to start WRIST_UP listener", - ("Failed to start WRIST_UP listener, error: %d (%s)", ret, get_error_message(ret))); - } - } - - return PlatformResult(ErrorCode::NO_ERROR); - } - - virtual PlatformResult UnsetListenerImpl() override { - ScopeLogger("type %s", type().c_str()); - - if (handle_) { - // gesture_stop_recognition is deprecated since 6.0 - int ret = gesture_stop_recognition(handle_); - if (GESTURE_ERROR_NONE != ret) { - LoggerE("Failed to stop WRIST_UP detection, error: %d", ret); - } - - // gesture_release is deprecated since 6.0 - ret = gesture_release(handle_); - if (GESTURE_ERROR_NONE != ret) { - LoggerE("Failed to release WRIST_UP handle, error: %d", ret); - } - - handle_ = nullptr; - } - - return PlatformResult(ErrorCode::NO_ERROR); - } - - // GetData is not supported by gesture monitor - - private: - static void OnWristUpEvent(gesture_type_e gesture, const gesture_data_h data, double timestamp, - gesture_error_e error, void* user_data) { - ScopeLogger(); - - auto monitor = static_cast(user_data); - auto& callback = monitor->event_callback(); - - if (!callback) { - LoggerE("No WRIST_UP event callback registered, skipping."); - return; - } - - picojson::value v = picojson::value(picojson::object()); - callback(&v); - } - - gesture_h handle_; -}; - class HumanActivityMonitorManager::Monitor::SensorMonitor : public HumanActivityMonitorManager::Monitor { public: @@ -1589,8 +1482,6 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() monitors_.insert( std::make_pair(kActivityTypePedometer, std::make_shared())); - monitors_.insert(std::make_pair(kActivityTypeWristUp, - std::make_shared(kActivityTypeWristUp))); monitors_.insert(std::make_pair(kActivityTypeSleepDetector, std::make_shared( kActivityTypeSleepDetector, SENSOR_HUMAN_SLEEP_DETECTOR,