ACCELEROMETER_BASE_DATA_SET and ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME were the same
ACCELEROMETER_BASE_DATA_SET has been removed.
ACCELEROMETER_BASE_DATA_SET was used for polling events and ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME was used for event driven
Since both these represent the same accelerometer event, DATA_SET type has been removed.
And ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME has been renamed to ACCELEROMETER_RAW_DATA_EVENT to make it simpler.
The change has been tested on rd-pq device for all sensord API and all API were found to be working.
Change-Id: I7602335045a1847b9ea3e58247b6ddcc82bbda7f
m_name = string(SENSOR_NAME);
vector<unsigned int> supported_events = {
- ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME,
- ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME,
+ ACCELEROMETER_RAW_DATA_EVENT,
+ ACCELEROMETER_UNPROCESSED_DATA_EVENT,
};
for_each(supported_events.begin(), supported_events.end(),
AUTOLOCK(m_mutex);
AUTOLOCK(m_client_info_mutex);
- if (get_client_cnt(ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME)) {
+ if (get_client_cnt(ACCELEROMETER_UNPROCESSED_DATA_EVENT)) {
base_event.sensor_id = get_id();
- base_event.event_type = ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME;
+ base_event.event_type = ACCELEROMETER_UNPROCESSED_DATA_EVENT;
push(base_event);
}
- if (get_client_cnt(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME)) {
+ if (get_client_cnt(ACCELEROMETER_RAW_DATA_EVENT)) {
base_event.sensor_id = get_id();
- base_event.event_type = ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME;
+ base_event.event_type = ACCELEROMETER_RAW_DATA_EVENT;
raw_to_base(base_event.data);
push(base_event);
}
return -1;
}
- if (type == ACCELEROMETER_BASE_DATA_SET) {
+ if (type == ACCELEROMETER_RAW_DATA_EVENT) {
raw_to_base(data);
} else {
ERR("Does not support type: 0x%x", type);
m_alg->start();
- m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->add_interval((int)this , SAMPLING_TIME, true);
m_accel_sensor->start();
bool auto_rotation_sensor::on_stop(void)
{
- m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->delete_interval((int)this , true);
m_accel_sensor->stop();
{
AUTOLOCK(m_mutex);
- if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) {
+ if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) {
int rotation;
float acc[3];
acc[0] = event.data.values[0];
FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_EVENT_DISTANCE_DATA_REPORT_ON_TIME, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, CONTEXT_EVENT_REPORT, 0, 1),
FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_EVENT_CHANGE_STATE, 0, 1),
- FILL_LOG_ELEMENT(LOG_ID_EVENT, ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
+ FILL_LOG_ELEMENT(LOG_ID_EVENT, ACCELEROMETER_RAW_DATA_EVENT, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, PRESSURE_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
- FILL_LOG_ELEMENT(LOG_ID_DATA, ACCELEROMETER_BASE_DATA_SET, 0, 25),
FILL_LOG_ELEMENT(LOG_ID_DATA, GYRO_BASE_DATA_SET, 0, 25),
FILL_LOG_ELEMENT(LOG_ID_DATA, PROXIMITY_BASE_DATA_SET, 0, 25),
FILL_LOG_ELEMENT(LOG_ID_DATA, PROXIMITY_DISTANCE_DATA_SET, 0, 25),
bool is_ontime_event(unsigned int event_type)
{
switch (event_type ) {
- case ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME:
+ case ACCELEROMETER_RAW_DATA_EVENT:
case PROXIMITY_EVENT_STATE_REPORT_ON_TIME:
case GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME:
case LIGHT_EVENT_LEVEL_DATA_REPORT_ON_TIME:
* @{
*/
-enum accelerometer_data_id {
- ACCELEROMETER_BASE_DATA_SET = (ACCELEROMETER_SENSOR << 16) | 0x0001,
-};
-
enum accelerometer_event_type {
- ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME = (ACCELEROMETER_SENSOR << 16) | 0x0001,
- ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME = (ACCELEROMETER_SENSOR << 16) | 0x0002,
+ ACCELEROMETER_RAW_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0001,
+ ACCELEROMETER_UNPROCESSED_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0002,
};
/**
m_gravity_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
m_gravity_sensor->start();
- m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
m_accel_sensor->start();
m_gravity_sensor->delete_interval((intptr_t)this, false);
m_gravity_sensor->stop();
- m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->delete_interval((intptr_t)this, false);
m_accel_sensor->stop();
unsigned long long diff_time;
- if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) {
+ if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) {
diff_time = event.data.timestamp - m_time;
if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
{
sensor_data_t gravity_data, accel_data;
((virtual_sensor *)m_gravity_sensor)->get_sensor_data(GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME, gravity_data);
- m_accel_sensor->get_sensor_data(ACCELEROMETER_BASE_DATA_SET, accel_data);
+ m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data);
accel_data.values[0] = m_accel_rotation_direction_compensation[0] * (accel_data.values[0] - m_accel_static_bias[0]) / m_accel_scale;
accel_data.values[1] = m_accel_rotation_direction_compensation[1] * (accel_data.values[1] - m_accel_static_bias[1]) / m_accel_scale;
{
AUTOLOCK(m_mutex);
- m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
m_accel_sensor->start();
m_gyro_sensor->add_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
{
AUTOLOCK(m_mutex);
- m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->delete_interval((intptr_t)this, false);
m_accel_sensor->stop();
m_gyro_sensor->delete_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
euler_angles<float> euler_orientation;
float azimuth_offset;
- if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) {
+ if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) {
diff_time = event.data.timestamp - m_time;
if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
if (event_type != ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME)
return -1;
- m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data);
+ m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data);
m_gyro_sensor->get_sensor_data(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, gyro_data);
m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data);
{
AUTOLOCK(m_mutex);
- m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
m_accel_sensor->start();
m_magnetic_sensor->add_client(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
{
AUTOLOCK(m_mutex);
- m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->delete_interval((intptr_t)this, false);
m_accel_sensor->stop();
m_magnetic_sensor->delete_client(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
sensor_event_t rv_event;
quaternion<float> quaternion_geo_rv;
- if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) {
+ if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) {
diff_time = event.data.timestamp - m_time;
if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
if (event_type != GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME)
return -1;
- m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data);
+ m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data);
m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data);
pre_process_data(accel, accel_data.values, m_accel_static_bias, m_accel_rotation_direction_compensation, m_accel_scale);
{
AUTOLOCK(m_mutex);
- m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
m_accel_sensor->start();
m_gyro_sensor->add_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
{
AUTOLOCK(m_mutex);
- m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT);
m_accel_sensor->delete_interval((intptr_t)this, false);
m_accel_sensor->stop();
m_gyro_sensor->delete_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
sensor_event_t rv_event;
quaternion<float> quaternion_orientation;
- if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) {
+ if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) {
diff_time = event.data.timestamp - m_time;
if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
if (event_type != ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME)
return -1;
- m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data);
+ m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data);
m_gyro_sensor->get_sensor_data(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, gyro_data);
m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data);
event_type == LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME ||
event_type == GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME ||
event_type == ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) {
- priority_list.insert(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT);
priority_list.insert(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME);
priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
}
if (event_type == GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME) {
- priority_list.insert(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME);
+ priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT);
priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
}
}
fp = fopen("auto_test.output", "w+");
- result = check_sensor_api(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, interval);
+ result = check_sensor_api(ACCELEROMETER_RAW_DATA_EVENT, interval);
fprintf(fp, "Accelerometer - RAW_DATA_REPORT_ON_TIME - %d\n", result);
result = check_sensor_api(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, interval);
switch (sensor_type) {
case ACCELEROMETER_SENSOR:
if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
- return ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME;
+ return ACCELEROMETER_RAW_DATA_EVENT;
break;
case GYROSCOPE_SENSOR:
if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
if (strcmp(argv[1], "accelerometer") == 0) {
sensor_type = ACCELEROMETER_SENSOR;
- event = ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME;
+ event = ACCELEROMETER_RAW_DATA_EVENT;
}
else if (strcmp(argv[1], "gyroscope") == 0) {
sensor_type = GYROSCOPE_SENSOR;