Skip to main content

parse_value_for

Function parse_value_for 

Source
pub fn parse_value_for(
    object_type: ObjectType,
    property: PropertyIdentifier,
    index: Option<u32>,
    text: &str,
) -> Result<PropertyValue, String>
Expand description

Parse a value typed for property of an object of object_type, at index when the write names one, knowing the property’s datatype:

  • an enumeration by name, in kebab case, UPPER_SNAKE or any case (offnormal, HIGH_LIMIT), or by number; a binary object’s state as active/inactive, with or without the object’s text after it (active (On));
  • a named bit string by its set bits (in-alarm,fault, in-alarm | fault), as 0/1 digits first bit first, or none for no bit set;
  • a plain number for the value of an analog or integer object (its Present_Value, Relinquish_Default, a Priority_Array slot, COV_Increment, High_Limit, Low_Limit and Deadband) as that property’s datatype: REAL for the analog objects, Double for a Large Analog Value, INTEGER or Unsigned for the integer objects;
  • a BACnetDateTime as 2026-10-19 07:00 (a date alone leaves the time unspecified), and a timestamp as seq 42, a time, or a date and time;
  • a Weekly_Schedule day, an Exception_Schedule special event, a Date_List calendar entry or a Recipient_List destination as JSON, or the whole list of them for a write of the whole property, in the shapes of the Python bindings’ typed constructors (docs/CLI.md, “Constructed values as JSON”);
  • anything else, and the explicit forms (null, true, a quoted string, enumerated:N, date:, time:, object:, bits(0101)), as parse_value reads them.

A mistyped name is refused with the valid names, or the nearest few when there are many.