case EEZE_SENSOR_TYPE_ACCELEROMETER:
return SENSOR_ACCELEROMETER;
+ case EEZE_SENSOR_TYPE_GRAVITY:
+ return SENSOR_GRAVITY;
+
+ case EEZE_SENSOR_TYPE_LINEAR_ACCELERATION:
+ return SENSOR_LINEAR_ACCELERATION;
+
+ case EEZE_SENSOR_TYPE_DEVICE_ORIENTATION:
+ return SENSOR_DEVICE_ORIENTATION;
+
case EEZE_SENSOR_TYPE_MAGNETIC:
return SENSOR_MAGNETIC;
case EEZE_SENSOR_TYPE_MOTION_PANNING:
return SENSOR_MOTION_PANNING;
+ case EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE:
+ return SENSOR_MOTION_PANNING_BROWSE;
+
+ case EEZE_SENSOR_TYPE_MOTION_TILT:
+ return SENSOR_MOTION_TILT;
+
case EEZE_SENSOR_TYPE_MOTION_FACEDOWN:
return SENSOR_MOTION_FACEDOWN;
+ case EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL:
+ return SENSOR_MOTION_DIRECTCALL;
+
+ case EEZE_SENSOR_TYPE_MOTION_SMART_ALERT:
+ return SENSOR_MOTION_SMART_ALERT;
+
+ case EEZE_SENSOR_TYPE_MOTION_NO_MOVE:
+ return SENSOR_MOTION_NO_MOVE;
+
default:
ERR("No matching Tizen sensor type available.");
return -1;
sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
}
+void
+gravity_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GRAVITY);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
+}
+
+void
+linear_acceleration_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
+}
+
+void
+device_orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
+ float pitch, float roll, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = yaw;
+ obj->data[1] = pitch;
+ obj->data[2] = roll;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
+}
+
void
magnetic_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
{
sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
}
+void
+panning_browse_cb(unsigned long long timestamp, int x, int y, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
+}
+
+void
+tilt_cb(unsigned long long timestamp, int x, int y, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_TILT);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
+}
+
void
facedown_cb(unsigned long long timestamp, void *user_data)
{
*/
}
+void
+directcall_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, NULL, NULL);
+ /* We are not stopping the sensor here because we want to keep it as a motion
+ * event coming in at any time.
+ */
+}
+
+void
+smart_alert_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, NULL, NULL);
+ /* We are not stopping the sensor here because we want to keep it as a motion
+ * event coming in at any time.
+ */
+}
+
+void
+no_move_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_NO_MOVE);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, NULL, NULL);
+ /* We are not stopping the sensor here because we want to keep it as a motion
+ * event coming in at any time.
+ */
+}
+
void
doubletap_cb(unsigned long long timestamp, void *user_data)
{
sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
}
+void
+gravity_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_gravity_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GRAVITY);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
+}
+
+void
+linear_acceleration_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_linear_acceleration_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
+}
+
+void
+device_orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
+ float pitch, float roll, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_device_orientation_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ obj->accuracy = accuracy;
+ obj->data[0] = yaw;
+ obj->data[1] = pitch;
+ obj->data[2] = roll;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
+}
+
void
magnetic_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
{
sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE));
}
+void
+doubletap_read_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_motion_doubletap_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP));
+}
+
void
panning_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
{
sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
}
+void
+panning_browse_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_motion_panning_browse_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
+}
+
+void
+tilt_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_motion_tilt_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_TILT);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
+}
+
void
facedown_read_cb(unsigned long long timestamp, void *user_data)
{
}
void
-doubletap_read_cb(unsigned long long timestamp, void *user_data)
+directcall_read_cb(unsigned long long timestamp, void *user_data)
{
Eeze_Sensor_Obj *obj = NULL;
- sensor_motion_doubletap_unset_cb(sensor_handle);
+ sensor_motion_directcall_unset_cb(sensor_handle);
- obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP);
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL);
if (obj == NULL)
{
ERR("No matching sensor object found in list.");
/* We have to set this ourselves because we don't get it for this type */
obj->accuracy = -1;
obj->timestamp = timestamp;
- ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, NULL, NULL);
- sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP));
+ ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL));
+}
+
+void
+smart_alert_read_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_motion_smart_alert_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT));
+}
+
+void
+no_move_read_cb(unsigned long long timestamp, void *user_data)
+{
+ Eeze_Sensor_Obj *obj = NULL;
+
+ sensor_motion_no_move_unset_cb(sensor_handle);
+
+ obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_NO_MOVE);
+ if (obj == NULL)
+ {
+ ERR("No matching sensor object found in list.");
+ return;
+ }
+ /* We have to set this ourselves because we don't get it for this type */
+ obj->accuracy = -1;
+ obj->timestamp = timestamp;
+ ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, NULL, NULL);
+ sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_NO_MOVE));
}
/* Synchronous read function for sensor data. It uses the blocking calls to read
{
sensor_data_accuracy_e accuracy;
float x, y, z;
- float azimuth, pitch, roll, lux, distance;
+ float azimuth, pitch, roll, lux, distance, yaw;
bool supported;
sensor_type_e type;
Eeze_Sensor_Obj *obj;
obj->timestamp = 0;
break;
+ case SENSOR_GRAVITY:
+ sensor_gravity_read_data(sensor_handle, &accuracy, &x, &y, &z);
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = 0;
+ break;
+
+ case SENSOR_LINEAR_ACCELERATION:
+ sensor_linear_acceleration_read_data(sensor_handle, &accuracy, &x, &y, &z);
+ obj->accuracy = accuracy;
+ obj->data[0] = x;
+ obj->data[1] = y;
+ obj->data[2] = z;
+ obj->timestamp = 0;
+ break;
+
+ case SENSOR_DEVICE_ORIENTATION:
+ sensor_device_orientation_read_data(sensor_handle, &accuracy, &yaw, &pitch, &roll);
+ obj->accuracy = accuracy;
+ obj->data[0] = yaw;
+ obj->data[1] = pitch;
+ obj->data[2] = roll;
+ obj->timestamp = 0;
+ break;
+
case SENSOR_MAGNETIC:
sensor_magnetic_read_data(sensor_handle, &accuracy, &x, &y, &z);
obj->accuracy = accuracy;
sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_cb, handle);
break;
+ case SENSOR_GRAVITY:
+ sensor_gravity_set_cb(sensor_handle, 0, gravity_cb, handle);
+ break;
+
+ case SENSOR_LINEAR_ACCELERATION:
+ sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_cb, handle);
+ break;
+
+ case SENSOR_DEVICE_ORIENTATION:
+ sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_cb, handle);
+ break;
+
case SENSOR_MAGNETIC:
sensor_magnetic_set_cb(sensor_handle, 0, magnetic_cb, handle);
break;
sensor_motion_shake_set_cb(sensor_handle, shake_cb, handle);
break;
+ case SENSOR_MOTION_DOUBLETAP:
+ sensor_motion_doubletap_set_cb(sensor_handle, doubletap_cb, handle);
+ break;
+
case SENSOR_MOTION_PANNING:
sensor_motion_panning_set_cb(sensor_handle, panning_cb, handle);
break;
+ case SENSOR_MOTION_PANNING_BROWSE:
+ sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_cb, handle);
+ break;
+
+ case SENSOR_MOTION_TILT:
+ sensor_motion_tilt_set_cb(sensor_handle, tilt_cb, handle);
+ break;
+
+ case SENSOR_MOTION_FACEDOWN:
+ sensor_motion_facedown_set_cb(sensor_handle, facedown_cb, handle);
+ break;
+
+ case SENSOR_MOTION_DIRECTCALL:
+ sensor_motion_directcall_set_cb(sensor_handle, directcall_cb, handle);
+ break;
+
+ case SENSOR_MOTION_SMART_ALERT:
+ sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_cb, handle);
+ break;
+
+ case SENSOR_MOTION_NO_MOVE:
+ sensor_motion_no_move_set_cb(sensor_handle, no_move_cb, handle);
+ break;
+
default:
ERR("Not possible to set a callback for this sensor type.");
return EINA_FALSE;
sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_read_cb, NULL);
break;
+ case SENSOR_GRAVITY:
+ sensor_gravity_set_cb(sensor_handle, 0, gravity_read_cb, NULL);
+ break;
+
+ case SENSOR_LINEAR_ACCELERATION:
+ sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_read_cb, NULL);
+ break;
+
+ case SENSOR_DEVICE_ORIENTATION:
+ sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_read_cb, NULL);
+ break;
+
case SENSOR_MAGNETIC:
sensor_magnetic_set_cb(sensor_handle, 0, magnetic_read_cb, NULL);
break;
sensor_motion_panning_set_cb(sensor_handle, panning_read_cb, NULL);
break;
+ case SENSOR_MOTION_PANNING_BROWSE:
+ sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_read_cb, NULL);
+ break;
+
+ case SENSOR_MOTION_TILT:
+ sensor_motion_tilt_set_cb(sensor_handle, tilt_read_cb, NULL);
+ break;
+
case SENSOR_MOTION_FACEDOWN:
sensor_motion_facedown_set_cb(sensor_handle, facedown_read_cb, NULL);
break;
+ case SENSOR_MOTION_DIRECTCALL:
+ sensor_motion_directcall_set_cb(sensor_handle, directcall_read_cb, NULL);
+ break;
+
+ case SENSOR_MOTION_SMART_ALERT:
+ sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_read_cb, NULL);
+ break;
+
+ case SENSOR_MOTION_NO_MOVE:
+ sensor_motion_no_move_set_cb(sensor_handle, no_move_read_cb, NULL);
+ break;
+
default:
ERR("Not possible to set a callback for this sensor type.");
return EINA_FALSE;