Skip to main content

pamoja_profile_new_custom

Function pamoja_profile_new_custom 

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

Creates a profile of the host’s own whose control is a kind the library does not ship, decided by code the host registers.

§Arguments

  • name - the profile’s name, as null-terminated UTF-8.
  • topic - the topic each reading is published to, as null-terminated UTF-8.
  • kind - the kind as the manifest will name it, as null-terminated UTF-8.
  • params - the policy’s other fields, as the JSON object a manifest carries beside kind, each value a number, true or false, or text, as null-terminated UTF-8.
  • 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, params is not such an object, the kind is empty, names a built-in kind, or params holds a field named kind, or the name, topic, or schedule is one no node could run, with the reason available from pamoja_last_error_message.

§Safety

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