static sensor_type_t _sensor_type_to_internal_type(sensor_type_e type)
{
+ int size;
+ size = sizeof(_TYPE) / sizeof(sensor_type_t);
+
+ if (type >= size) {
+ _E("Failed to change internal type: type[%d]", type);
+ return UNKNOWN_SENSOR;
+ }
return (type == SENSOR_ALL) ? ALL_SENSOR : _TYPE[type];
}
internal_type = _sensor_type_to_internal_type(type);
+ if (internal_type == UNKNOWN_SENSOR)
+ return SENSOR_ERROR_INVALID_PARAMETER;
+
sensor = sensord_get_sensor(internal_type);
_supported = false;
internal_type = _sensor_type_to_internal_type(type);
+ if (internal_type == UNKNOWN_SENSOR)
+ return SENSOR_ERROR_INVALID_PARAMETER;
+
_sensor = sensord_get_sensor(internal_type);
if (!_sensor)
internal_type = _sensor_type_to_internal_type(type);
+ if (internal_type == UNKNOWN_SENSOR)
+ return SENSOR_ERROR_INVALID_PARAMETER;
+
sensord_get_sensor_list(internal_type, &_list, &count);
if (count == 0)