Skip to main content

Module profile

Module profile 

Source
Expand description

The C ABI for device profiles.

These wrap [pamoja_profile] for callers that reach the SDK through the flat C boundary. A profile is a named, pre-wired bundle: a control policy, a publish topic, and a power schedule, so someone who can put a sensor to good use does not also have to choose algorithms and tuning constants by hand.

Two things cross. A PamojaProfile is the manifest, which loads from and saves to JSON, so a profile ships as a file that a community can publish and a device can read. A PamojaController is the decision logic that manifest describes: hand it a reading and it says what the output should do and whether the reading crossed a threshold worth raising.

The whole presentation layer, which declares how a profile appears on a dashboard, travels inside the manifest JSON rather than as its own set of calls. That keeps one representation of a profile across every language, and it is the same JSON the dashboard already consumes.

Assembling a running node from a profile stays in Rust, because the Rust Node is generic over its sensor, actuator, transport, and codec, and the four together do not cross a C ABI. Nothing is lost: the controller holds the decisions, and the caller drives their own hardware around it.

Structs§

PamojaControlSpec
A control policy, flattened so every variant crosses as one value.
PamojaController
An opaque handle to a profile’s decision logic.
PamojaPowerSchedule
How often a node samples as its battery drains, in whole seconds.
PamojaProfile
An opaque handle to a device profile.
PamojaReaction
What a controller decided about one reading.

Enums§

PamojaAlertKind
Which threshold a reading crossed, if any.
PamojaControlKind
Which control policy a profile applies to each reading.

Functions§

pamoja_controller_evaluate
Decides what one reading calls for.
pamoja_controller_free
Releases a controller handle.
pamoja_controller_level
Creates a controller that warns before a falling level reaches empty.
pamoja_controller_monitor
Creates a controller that reports readings without judging them.
pamoja_controller_setpoint
Creates a controller that holds a reading near a setpoint.
pamoja_controller_surge
Creates a controller that warns when a reading changes too fast.
pamoja_profile_control
Returns the control policy a profile applies.
pamoja_profile_controller
Builds the decision logic a profile describes.
pamoja_profile_flood_sensor
Creates a flood sensor, which warns when a level rises too fast.
pamoja_profile_free
Releases a profile handle.
pamoja_profile_from_json
Loads a profile from its JSON manifest.
pamoja_profile_irrigation_node
Creates an irrigation node, which opens a valve as soil moisture falls.
pamoja_profile_name
Returns a profile’s stable name.
pamoja_profile_power
Returns the sampling schedule a profile keeps as its battery drains.
pamoja_profile_power_plan
Assembles a profile’s schedule into a power governor.
pamoja_profile_to_json
Serializes a profile to its JSON manifest.
pamoja_profile_topic
Returns the topic a profile publishes each reading to.
pamoja_profile_vaccine_fridge_monitor
Creates a cold-chain fridge monitor, which holds 5 C and flags an excursion.
pamoja_profile_well_level
Creates a well-level monitor, which warns before a tank runs dry.