*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
*
*
*/
* @brief Checks whether a given sensor type is available on a device.
* @details Availability of a sensor should be checked first because this sensor may not be supported on the device.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks For getting a handle of HRM Sensor(including HRM_LED_GREEN, HRM_LED_IR and HRM_LED_RED)
- * the privilege should be set to, %http://tizen.org/privilege/healthinfo.
*
* @param[in] type The sensor type to check
* @param[out] supported If @c true this sensor type is supported,
/**
* @brief Gets sensor data.
+ * @details This function may fail (return #SENSOR_ERROR_OPERATION_FAILED) if it is called before the sensor is ready.
+ * In case of interval-driven sensors,
+ * it is recommended to call the function after at least one sensor event is delivered.
+ * Otherwise, applications can retry to call this function to be sure that the sensor is ready.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] listener The listener handle
* @retval #SENSOR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SENSOR_ERROR_NOT_SUPPORTED The sensor type is not supported in the current device
* @retval #SENSOR_ERROR_IO_ERROR I/O error
+ * @retval #SENSOR_ERROR_OPERATION_FAILED Operation failed
*
* @pre In order to read sensor data, an application should call sensor_listener_start().
*/
/**
* @brief Changes the option of the sensor.
- * @details If it is default, sensor data cannot be recieved when the LCD is off and in the power save mode.
+ * @details If it is default, sensor data cannot be received when the LCD is off and in the power save mode.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] listener The listener handle
int sensor_is_supported(sensor_type_e type, bool *supported)
{
+ int result;
sensor_t sensor;
- bool _supported;
sensor_type_t internal_type;
if (type < SENSOR_ALL || type > SENSOR_CUSTOM)
internal_type = _sensor_type_to_internal_type(type);
- sensor = sensord_get_sensor(internal_type);
- _supported = false;
+ result = sensord_get_default_sensor(internal_type, &sensor);
- if (sensor)
- _supported = true;
+ if (result == -EIO)
+ return SENSOR_ERROR_OPERATION_FAILED;
+
+ *supported = false;
- *supported = _supported;
+ /*
+ * because sensor_is_supported() is N/P API,
+ * it must not return SENSOR_ERROR_PERMISSION_DENIED error
+ * -EACCES means that there is at least one sensor.
+ */
+ if (sensor || (result == -EACCES))
+ *supported = true;
- _D("success sensor(%d) is supported[%d] : sensor[0x%x]",
- type, _supported, sensor);
+ _D("success sensor(%d) is supported[%d]", type, *supported);
return SENSOR_ERROR_NONE;
}
int sensor_get_default_sensor(sensor_type_e type, sensor_h *sensor)
{
+ int result;
sensor_t _sensor;
sensor_privilege_t privilege;
sensor_type_t internal_type;
internal_type = _sensor_type_to_internal_type(type);
- _sensor = sensord_get_sensor(internal_type);
+ result = sensord_get_default_sensor(internal_type, &_sensor);
- if (!_sensor)
+ if (result == -EACCES)
+ return SENSOR_ERROR_PERMISSION_DENIED;
+ else if (result == -EPERM)
+ return SENSOR_ERROR_OPERATION_FAILED;
+ else if (result == -ENODATA)
return SENSOR_ERROR_NOT_SUPPORTED;
sensord_get_privilege(_sensor, &privilege);
int sensor_get_sensor_list(sensor_type_e type, sensor_h **list, int *sensor_count)
{
+ int result;
sensor_h *_list = NULL;
int count;
sensor_type_t internal_type;
- _D("called sensor_get_list : type[%d]");
+ _D("called sensor_get_list : type[%d]", type);
if (type < SENSOR_ALL || type > SENSOR_CUSTOM)
return SENSOR_ERROR_INVALID_PARAMETER;
internal_type = _sensor_type_to_internal_type(type);
- sensord_get_sensor_list(internal_type, &_list, &count);
+ result = sensord_get_sensors(internal_type, &_list, &count);
+
+ if (result == -EACCES)
+ return SENSOR_ERROR_PERMISSION_DENIED;
+ else if (result == -EIO)
+ return SENSOR_ERROR_OPERATION_FAILED;
+ else if (result == -ENODATA)
+ return SENSOR_ERROR_NOT_SUPPORTED;
int i, j;
int count_public = 0;