MotionSensorPresenter::~MotionSensorPresenter()
{
if (m_gesture) {
- gesture_stop_recognition(m_gesture);
- gesture_release(m_gesture);
+ hand_gesture_stop_recognition(m_gesture);
+ hand_gesture_destroy(m_gesture);
}
}
Result MotionSensorPresenter::prepare()
{
- int res = gesture_create(&m_gesture);
- if (res != GESTURE_ERROR_NONE) {
+ int res = hand_gesture_create(&m_gesture);
+ if (res != HAND_GESTURE_ERROR_NONE) {
LOG_RETURN(RES_FAIL, "gesture_create() failed. "
"res[%d] msg[%s]", res, get_error_message(res));
}
- res = gesture_start_recognition(m_gesture, GESTURE_WRIST_UP,
- GESTURE_OPTION_ALWAYS_ON,
+ res = hand_gesture_start_recognition(m_gesture, HAND_GESTURE_WRIST_UP,
CALLBACK_B(MotionSensorPresenter::onGestureCb),
this);
- if (res != GESTURE_ERROR_NONE) {
+ if (res != HAND_GESTURE_ERROR_NONE) {
LOG_RETURN(RES_FAIL, "gesture_start_recognition() failed. "
"res[%d] msg[%s]", res, get_error_message(res));
}
+
+ res = hand_gesture_set_option(m_gesture, HAND_GESTURE_OPTION_ALWAYS_ON);
+ if (res != HAND_GESTURE_ERROR_NONE) {
+ LOG_RETURN(RES_FAIL, "hand_gesture_set_option() failed. "
+ "res[%d] msg[%s]", res, get_error_message(res));
+ }
+
return RES_OK;
}
- void MotionSensorPresenter::onGestureCb(gesture_type_e motion,
- const gesture_data_h data,
+ void MotionSensorPresenter::onGestureCb(hand_gesture_h handle,
+ hand_gesture_type_e gesture,
double timeStamp,
- gesture_error_e error)
+ hand_gesture_error_e error,
+ void *user_data)
{
if (error) {
LOG_RETURN_VOID(RES_FAIL, "Error occured. "
"err[%d] msg[%s]", error, get_error_message(error));
}
- if (motion == GESTURE_WRIST_UP) {
- gesture_event_e event;
- int res = gesture_get_event(data, &event);
- if (res != GESTURE_ERROR_NONE) {
- LOG_RETURN_VOID(RES_FAIL, "gesture_get_event() failed. "
- "err[%d] msg[%s]", res, get_error_message(res));
- }
-
- if (event == GESTURE_EVENT_DETECTED) {
- if (const auto handler = m_handler.lock()) {
- handler();
- }
+ if (gesture == HAND_GESTURE_WRIST_UP) {
+ if (const auto handler = m_handler.lock()) {
+ handler();
}
}
}
#ifndef __CALL_UI_PRESENTERS_MISC_MOTION_SENSOR_PRESENTER_H__
#define __CALL_UI_PRESENTERS_MISC_MOTION_SENSOR_PRESENTER_H__
-#include <gesture_recognition.h>
+#include <gesture.h>
#include "call-ui/presenters/types.h"
ucl::Result prepare();
- void onGestureCb(gesture_type_e motion,
- const gesture_data_h data,
- double timeStamp,
- gesture_error_e error);
+ void onGestureCb(hand_gesture_h handle,
+ hand_gesture_type_e gesture,
+ double timestamp,
+ hand_gesture_error_e error,
+ void *user_data);
private:
const NotiHandler m_handler;
- gesture_h m_gesture;
+ hand_gesture_h m_gesture;
friend class ucl::ReffedObj<MotionSensorPresenter>;
};