proximity.h
Go to the documentation of this file.
/*
* Copyright © 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
*/
#ifndef UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_
#define UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_
#include <ubuntu/status.h>
#include <ubuntu/visibility.h>
#include <ubuntu/application/sensors/event/proximity.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void UASensorsProximity;
typedef void (*on_proximity_event_cb)(UASProximityEvent* event,
void* context);
UBUNTU_DLL_PUBLIC UASensorsProximity*
ua_sensors_proximity_new();
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_enable(
UASensorsProximity* sensor);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_disable(
UASensorsProximity* sensor);
UBUNTU_DLL_PUBLIC uint32_t
ua_sensors_proximity_get_min_delay(
UASensorsProximity* sensor);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_get_min_value(
UASensorsProximity* sensor,
float* value);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_get_max_value(
UASensorsProximity* sensor,
float* value);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_get_resolution(
UASensorsProximity* sensor,
float* value);
UBUNTU_DLL_PUBLIC void
ua_sensors_proximity_set_reading_cb(
UASensorsProximity* sensor,
on_proximity_event_cb cb,
void *ctx);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_proximity_set_event_rate(
UASensorsProximity* sensor,
uint32_t rate);
#ifdef __cplusplus
}
#endif
#endif /* UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ */
UASProximityEvent
void UASProximityEvent
Opaque type describing an accelerometer reading.
Definition: proximity.h:45
UbuntuStatus
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
ua_sensors_proximity_new
UBUNTU_DLL_PUBLIC UASensorsProximity * ua_sensors_proximity_new()
Create a new object for accessing the proximity sensor.
ua_sensors_proximity_get_resolution
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_resolution(UASensorsProximity *sensor, float *value)
Queries the numeric resolution supported by the sensor.
ua_sensors_proximity_set_event_rate
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_set_event_rate(UASensorsProximity *sensor, uint32_t rate)
Set the sensor event delivery rate in nanoseconds..
on_proximity_event_cb
void(* on_proximity_event_cb)(UASProximityEvent *event, void *context)
Callback type used by applications to subscribe to proximity sensor events.
Definition: proximity.h:41
ua_sensors_proximity_get_max_value
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_max_value(UASensorsProximity *sensor, float *value)
Queries the maximum value that can be reported by the sensor.
visibility.h
status.h
UBUNTU_DLL_PUBLIC
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:26
ua_sensors_proximity_enable
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_enable(UASensorsProximity *sensor)
Enables the supplied proximity sensor.
ua_sensors_proximity_disable
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_disable(UASensorsProximity *sensor)
Disables the supplied proximity sensor.
ua_sensors_proximity_get_min_value
UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_min_value(UASensorsProximity *sensor, float *value)
Queries the minimum value that can be reported by the sensor.
UASensorsProximity
void UASensorsProximity
Opaque type that models the proximity sensor.
Definition: proximity.h:35
proximity.h
ua_sensors_proximity_set_reading_cb
UBUNTU_DLL_PUBLIC void ua_sensors_proximity_set_reading_cb(UASensorsProximity *sensor, on_proximity_event_cb cb, void *ctx)
Set the callback to be invoked whenever a new sensor reading is available.
ua_sensors_proximity_get_min_delay
UBUNTU_DLL_PUBLIC uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity *sensor)
Queries the minimum delay between two readings for the supplied sensor.