Air Quality Monitor
Portable C application for collecting, storing, and analyzing air quality sensor readings
Loading...
Searching...
No Matches
SensorPlugin Struct Reference

Runtime contract every sensor plugin (.so/.dylib/.dll) must implement. More...

#include <sensor.h>

Public Attributes

int api_version
 Must equal SENSOR_PLUGIN_API_VERSION at build time.
 
const char * name
 Human-readable sensor name, e.g.
 
const char * plugin_version
 Plugin version string, e.g.
 
const char * description
 Short description shown in sensor info/listing screens.
 
int sensor_id
 Numeric identifier stored alongside readings in the database.
 
int(* init )(void)
 Called once after loading.
 
int(* read_sample )(AirQualityData *out)
 Reads one sample into *out.
 
int(* shutdown )(void)
 Called once before unloading, for cleanup.
 

Detailed Description

Runtime contract every sensor plugin (.so/.dylib/.dll) must implement.

A plugin exports a single global symbol named sensor_plugin of this type. sensor_module_load() validates api_version and the three required function pointers before the plugin is considered usable.

Definition at line 35 of file sensor.h.

Member Data Documentation

◆ init

int(* SensorPlugin::init) (void)

Called once after loading.

Returns 0 on success.

Definition at line 47 of file sensor.h.

◆ name

const char* SensorPlugin::name

Human-readable sensor name, e.g.

"PMS5003".

Definition at line 39 of file sensor.h.

◆ plugin_version

const char* SensorPlugin::plugin_version

Plugin version string, e.g.

"1.0.0". Informational only.

Definition at line 41 of file sensor.h.

◆ read_sample

int(* SensorPlugin::read_sample) (AirQualityData *out)

Reads one sample into *out.

Returns
0 on success; non-zero on failure (e.g. hardware unavailable) — callers should fall back gracefully.

Definition at line 53 of file sensor.h.

◆ shutdown

int(* SensorPlugin::shutdown) (void)

Called once before unloading, for cleanup.

Returns 0 on success.

Definition at line 55 of file sensor.h.


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