Skip to main content

pamoja_profile_new

Function pamoja_profile_new 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_profile_new( name: *const c_char, topic: *const c_char, control: *const PamojaControlSpec, power: *const PamojaPowerSchedule, ) -> *mut PamojaProfile
Expand description

Creates a profile of the host’s own from its parts, with no description and no presentation.

§Arguments

  • name - the profile’s name, as null-terminated UTF-8.
  • topic - the topic each reading is published to, as null-terminated UTF-8.
  • control - the control policy; only the fields belonging to its kind are read. A custom kind carries parameters this call has no room for, so it is refused: build such a profile with pamoja_profile_new_custom.
  • power - the sampling schedule.

§Returns

A handle the caller must release with pamoja_profile_free, or null if a pointer is null, a string is not UTF-8, the control kind is custom or not one this library knows, or the profile is one no node could run, such as a hysteresis of zero or intervals that shorten as the battery drains, with the reason available from pamoja_last_error_message.

§Safety

name and topic must be valid null-terminated UTF-8 strings for the duration of the call, and control and power must point at readable values; any may be null.