[DeviceDrivers] Fix sensor_poll issue.

This commit is contained in:
bernard 2015-01-04 20:01:52 +08:00
parent 06454fd484
commit f6ed27b863
1 changed files with 11 additions and 6 deletions

View File

@ -189,21 +189,27 @@ int SensorManager::pollSensor(SensorBase *sensor, sensors_event_t *events, int n
return index;
}
int rt_sensor_subscribe(int type, SensorEventHandler_t *handler, void *user_data)
{
return SensorManager::subscribe(type, handler, user_data);
}
rt_sensor_t rt_sensor_get_default(int type)
{
return (rt_sensor_t)SensorManager::getDefaultSensor(type);
}
int rt_sensor_subscribe(rt_sensor_t sensor, SensorEventHandler_t *handler, void *user_data)
{
SensorBase *sensor_base;
if (sensor == NULL) return -1;
sensor_base = (SensorBase*)sensor;
return sensor_base->subscribe(handler, user_data);
}
int rt_sensor_poll(rt_sensor_t sensor, sensors_event_t *event)
{
SensorBase *sensor_base;
if (sensor == NULL || event == NULL) return -1;
sensor_base = (SensorBase*)sensor;
return sensor_base->poll(event);
}
@ -224,4 +230,3 @@ int rt_sensor_activate(rt_sensor_t sensor, int enable)
sensor_base = (SensorBase*)sensor;
return sensor_base->activate(enable);
}