Expand description
The C ABI for the goal-named helper math.
These functions wrap [pamoja_kit] for callers that reach the SDK through the
flat C boundary: smoothing a noisy reading, holding a value with a PID,
switching a load with hysteresis, warning before a tank runs dry, and placing
a fix against a geofence.
The helpers are infallible pure math, so unlike the transport capabilities
nothing here returns a status for the work itself. Each stateful helper is an
opaque handle whose constructor returns null only when allocation is refused,
and whose methods document what they return for a null handle, following
pamoja_mqtt_client_is_connected.
Helpers that answer “maybe” return a bool and write the value through an
out-parameter.
Structs§
- Pamoja
Anomaly - An opaque handle to an anomaly detector.
- Pamoja
Calibration - An opaque handle to a raw-to-units calibration.
- Pamoja
Coordinate - A latitude and longitude in degrees.
- Pamoja
Debounce - An opaque handle to a boolean debouncer.
- Pamoja
Depletion - An opaque handle to a depletion estimator.
- Pamoja
Geofence - An opaque handle to a circular geofence.
- Pamoja
Kalman - An opaque handle to a one-dimensional Kalman filter.
- Pamoja
Median - An opaque handle to a median filter.
- Pamoja
Pid - An opaque handle to a PID controller.
- Pamoja
Ramp - An opaque handle to a rate limiter.
- Pamoja
Smoother - An opaque handle to an exponential smoother.
- Pamoja
Surge - An opaque handle to a step-change detector.
- Pamoja
Thermostat - An opaque handle to an on/off controller with hysteresis.
- Pamoja
Trend - An opaque handle to a trend estimator.
- Pamoja
Window - An opaque handle to a rolling window of readings.
Enums§
- Pamoja
Boundary - Where a fix sits relative to a geofence, including the moment it crosses.
Constants§
- PAMOJA_
WINDOW_ CAPACITY - The number of readings a windowed helper keeps.
Functions§
- pamoja_
anomaly_ ⚠check - Folds a reading in and reports whether it stands out from the window.
- pamoja_
anomaly_ ⚠free - Releases an anomaly detector handle.
- pamoja_
anomaly_ ⚠new - Creates an anomaly detector that flags a reading
sigmasdeviations out. - pamoja_
calibration_ ⚠apply - Converts a raw reading into calibrated units.
- pamoja_
calibration_ ⚠free - Releases a calibration handle.
- pamoja_
calibration_ ⚠linear - Creates a calibration applying
raw * scale + offset. - pamoja_
calibration_ ⚠two_ point - Creates a calibration fitted through two known reference points.
- pamoja_
coordinate_ bearing_ to - Returns the initial bearing from one coordinate to another, in degrees.
- pamoja_
coordinate_ distance_ to - Returns the great-circle distance between two coordinates, in metres.
- pamoja_
debounce_ ⚠free - Releases a debouncer handle.
- pamoja_
debounce_ ⚠new - Creates a debouncer that requires
samplesagreeing readings to change state. - pamoja_
debounce_ ⚠state - Reports a debouncer’s settled state without feeding it a reading.
- pamoja_
debounce_ ⚠update - Feeds a raw reading to a debouncer and returns the settled state.
- pamoja_
depletion_ ⚠free - Releases a depletion estimator handle.
- pamoja_
depletion_ ⚠new - Creates a depletion estimator that warns as a level approaches
threshold. - pamoja_
depletion_ ⚠update - Records a level and estimates how many samples remain before the threshold.
- pamoja_
geofence_ ⚠contains - Reports whether a fix lies inside a geofence, without recording a crossing.
- pamoja_
geofence_ ⚠free - Releases a geofence handle.
- pamoja_
geofence_ ⚠new - Creates a circular geofence of
radius_maroundcenter. - pamoja_
geofence_ ⚠update - Feeds a fix to a geofence and reports where it sits, including a crossing.
- pamoja_
kalman_ ⚠estimate - Reads a Kalman filter’s current estimate without folding in a reading.
- pamoja_
kalman_ ⚠free - Releases a Kalman filter handle.
- pamoja_
kalman_ ⚠new - Creates a one-dimensional Kalman filter.
- pamoja_
kalman_ ⚠update - Folds a reading into a Kalman filter and returns the new estimate.
- pamoja_
kit_ deadband - Suppresses movement within
widthofcenter, so noise does not act. - pamoja_
median_ ⚠free - Releases a median filter handle.
- pamoja_
median_ ⚠new - Creates an empty median filter over
PAMOJA_WINDOW_CAPACITYreadings. - pamoja_
median_ ⚠update - Folds a reading in and returns the median of the window.
- pamoja_
median_ ⚠value - Reads the current median without folding in a reading.
- pamoja_
pid_ ⚠free - Releases a PID controller handle.
- pamoja_
pid_ ⚠new - Creates a PID controller with the given gains and no output limits.
- pamoja_
pid_ ⚠new_ with_ limits - Creates a PID controller whose output is clamped to
[min, max]. - pamoja_
pid_ ⚠reset - Clears a PID controller’s accumulated integral and last error.
- pamoja_
pid_ ⚠update - Advances a PID controller by one step.
- pamoja_
ramp_ ⚠free - Releases a rate limiter handle.
- pamoja_
ramp_ ⚠new - Creates a rate limiter starting at
startand moving at mostmax_step. - pamoja_
ramp_ ⚠set - Forces a ramp to a value without rate limiting.
- pamoja_
ramp_ ⚠update - Moves a ramp one step toward
targetand returns the new value. - pamoja_
ramp_ ⚠value - Reads a ramp’s current value.
- pamoja_
smoother_ ⚠free - Releases a smoother handle.
- pamoja_
smoother_ ⚠new - Creates an exponential smoother.
- pamoja_
smoother_ ⚠reset - Clears a smoother back to its initial state.
- pamoja_
smoother_ ⚠update - Folds a sample into a smoother and returns the smoothed value.
- pamoja_
smoother_ ⚠value - Reads a smoother’s current value without folding in a sample.
- pamoja_
surge_ ⚠falling - Creates a detector for falls of at least
limitbetween readings. - pamoja_
surge_ ⚠free - Releases a surge detector handle.
- pamoja_
surge_ ⚠rising - Creates a detector for rises of at least
limitbetween readings. - pamoja_
surge_ ⚠update - Feeds a value to a surge detector.
- pamoja_
thermostat_ ⚠cooling - Creates a cooling thermostat, which switches on when the reading rises.
- pamoja_
thermostat_ ⚠free - Releases a thermostat handle.
- pamoja_
thermostat_ ⚠heating - Creates a heating thermostat, which switches on when the reading falls.
- pamoja_
thermostat_ ⚠is_ on - Reports a thermostat’s current output without feeding it a reading.
- pamoja_
thermostat_ ⚠update - Feeds a reading to a thermostat and returns whether the load should be on.
- pamoja_
trend_ ⚠free - Releases a trend estimator handle.
- pamoja_
trend_ ⚠new - Creates an empty trend estimator over
PAMOJA_WINDOW_CAPACITYreadings. - pamoja_
trend_ ⚠push - Adds a reading to a trend estimator.
- pamoja_
trend_ ⚠slope - Reads the slope a trend estimator has fitted, in units per reading.
- pamoja_
window_ ⚠capacity - Returns how many readings a window holds before it starts dropping.
- pamoja_
window_ ⚠free - Releases a rolling window handle.
- pamoja_
window_ ⚠len - Returns how many readings a window holds.
- pamoja_
window_ ⚠max - Reads the largest reading in a window.
- pamoja_
window_ ⚠mean - Reads the mean of a window’s readings.
- pamoja_
window_ ⚠min - Reads the smallest reading in a window.
- pamoja_
window_ ⚠new - Creates an empty rolling window of
PAMOJA_WINDOW_CAPACITYreadings. - pamoja_
window_ ⚠push - Adds a reading, dropping the oldest once the window is full.
- pamoja_
window_ ⚠range - Reads the spread between a window’s smallest and largest readings.
- pamoja_
window_ ⚠variance - Reads the variance of a window’s readings.