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 presentation layer, which declares how a profile appears on a dashboard, crosses as the JSON object a manifest carries under presentation, through pamoja_profile_presentation_json and pamoja_profile_with_presentation_json. That keeps one representation of a profile across every language, and it is the same JSON the dashboard already consumes; each binding gives it a typed shape on its own side.

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.

Constants§

PAMOJA_ALERT_CODE_LEN
The most bytes a custom alert’s code carries across the boundary, terminator included; a longer code is cut to fit.

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_control_kind⚠
Returns the control kind a profile names, as its manifest writes it.
pamoja_profile_control_params_json⚠
Returns the parameters a custom control kind carries, as the JSON object of every field the manifest wrote beside kind.
pamoja_profile_controller⚠
Builds the decision logic a profile describes.
pamoja_profile_description⚠
Returns what a profile is for, in the words its manifest carries.
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_new⚠
Creates a profile of the host’s own from its parts, with no description and no presentation.
pamoja_profile_new_custom⚠
Creates a profile of the host’s own whose control is a kind the library does not ship, decided by code the host registers.
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_presentation_json⚠
Returns how a profile presents itself on a dashboard, as the JSON object its manifest carries under presentation.
pamoja_profile_reads_quantity⚠
Returns the quantity a profile says it reads, such as temperature.
pamoja_profile_reads_unit⚠
Returns the unit a profile’s numbers are in, such as celsius.
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.
pamoja_profile_with_description⚠
Returns a copy of a profile carrying a description of what it is for.
pamoja_profile_with_presentation_json⚠
Returns a copy of a profile carrying a dashboard presentation.
pamoja_profile_with_reads⚠
Returns a copy of a profile that says what it reads.