fetcher 0.0.0
A command line utility for reading sensor data over I2C and providing it over stdout.
Sensor Struct Reference

#include <sensor_api.h>

Data Fields

SensorLocation loc
 
SensorTagList tag_list
 
SensorContext context
 
SensorPrecision precision
 
errno_t(* open )(struct sensor_t *sensor)
 
errno_t(* read )(struct sensor_t *sensor, const SensorTag tag, void *buf, size_t *nbytes)
 

Detailed Description

The generic interface to interact with all sensors.

Field Documentation

◆ context

SensorContext Sensor::context

Data structure for the sensor to store context it needs between operations.

◆ loc

SensorLocation Sensor::loc

The I2C address and bus of the sensor.

◆ open

errno_t(* Sensor::open) (struct sensor_t *sensor)

Function responsible for opening and setting up the sensor.

Parameters
sensorThe sensor who this open method belongs to.
Returns
Error status of setting up the sensor. EOK if successful.

◆ precision

SensorPrecision Sensor::precision

What precision the sensor should measure. Can be changed between reads.

◆ read

errno_t(* Sensor::read) (struct sensor_t *sensor, const SensorTag tag, void *buf, size_t *nbytes)

Function responsible for reading the data associated with tag from the sensor.

Parameters
sensorThe sensor who this read method belongs to.
tagThe tag of the data type that should be read.
bufA pointer to the memory location to store the data. Should be large enough to fit the max_return_size bytes.
nbytesThe number of bytes that were written into the byte array buffer.
Returns
Error status of reading from the sensor. EOK if successful.

◆ tag_list

SensorTagList Sensor::tag_list

A list of all the tags the sensor is capable of reading.


The documentation for this struct was generated from the following file: