Sensor Library Overview

The Sensor library provides an application with a consistent interface to simultaneously access up to sixty-four sensors connected to the hardware platform.

Overview

The Sensor library is one of the main components of the Sensor Framework. It allows applications to access all sensors that are available through the Sensor Framework. In the context of the Sensor library, a sensor can be any one of camera, lidar, radar, or GPS system.



Figure 1. Sensor Library and the Sensor Framework

The Sensor library provides the following functions:

Sensor configuration

The sensors that are available to your application is based on a static configuration file that the Sensor service loads once on its startup.

For more information, see the Sensor configuration file section in the System Services guide.

If you're using a camera specifically, and need to change its settings dynamically, then you need to use the Camera library instead. See the Camera Developer's Guide.

Interim data configuration

The interim data units that are used for interim data are based on a static configuration file that the Sensor service loads once on its startup.

For more information, see the Interim data configuration file section in the System Services guide.

Sensor library header files

To use the Sensor library, these are the header files that you can use:
sensor_api.h
This is the main interface to the Sensor library. You must always include this header file to use the Sensor library. For more information, see sensor_api.h in the Sensor Library Reference.
sensor_interim_data.h
This file includes interfaces to publish interim data to the Sensor Framework. For more information, see sensor_interim_data.h in the Sensor Library Reference.

Using the Sensor API

Most sensor applications follow a similar workflow:

  1. Open a connection to the logical sensor or interim data unit.
  2. Register callback functions or events to receive sensor and interim data and status.
  3. Start the sensor or interim data unit to stream data.
  4. While sensor is streaming, your application may:
    • access sensor (or interim) data or status (e.g., handle sensor events that you've registered for)
    • record sensor or interim data
    • subscribe or publish interim data
  5. Stop the sensor or interim data unit from streaming data.
  6. Close the connection to the sensor or interim data unit.