[HAM] Remove WRIST_UP gesture 83/243583/2
authorRafal Walczyna <r.walczyna@samsung.com>
Tue, 8 Sep 2020 08:37:44 +0000 (10:37 +0200)
committerRafal Walczyna <r.walczyna@samsung.com>
Tue, 8 Sep 2020 09:48:24 +0000 (11:48 +0200)
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 <r.walczyna@samsung.com>
src/humanactivitymonitor/humanactivitymonitor_api.js
src/humanactivitymonitor/humanactivitymonitor_instance.cc
src/humanactivitymonitor/humanactivitymonitor_manager.cc

index 7915248..2271e4a 100755 (executable)
@@ -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);
     }
index 5baa8c7..379da36 100644 (file)
@@ -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()"));
index a9957ed..437895a 100644 (file)
@@ -44,7 +44,6 @@ typedef std::map<sensor_recorder_query_e, const std::string&> 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<GestureMonitor*>(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<Monitor::PedometerMonitor>()));
-  monitors_.insert(std::make_pair(kActivityTypeWristUp,
-                                  std::make_shared<Monitor::GestureMonitor>(kActivityTypeWristUp)));
   monitors_.insert(std::make_pair(kActivityTypeSleepDetector,
                                   std::make_shared<Monitor::SensorMonitor>(
                                       kActivityTypeSleepDetector, SENSOR_HUMAN_SLEEP_DETECTOR,