Skip to main content

Writing & constraints

Points that control the device carry an access mode and, when writable, constraints that every runtime validates before a value reaches the wire.

Access modes

  • READ_ONLY: telemetry; writes are rejected.
  • READ_WRITE: a settable value you can also read back.
  • WRITE_ONLY: a setpoint with no read path.
  • COMMAND: a trigger (e.g. "reset alarms").

Attempting to write a READ_ONLY point is an error in every language, caught before any I/O.

Write constraints (§11.4)

A writable point can bound what is acceptable:

write:
behavior: DIRECT
constraints:
min_value: { numerator: 0, denominator: 1 }
max_value: { numerator: 100, denominator: 1 }
step: { numerator: 1, denominator: 1 }

or an explicit allow-list:

write:
behavior: DIRECT
constraints:
allowed_values: [0, 1, 2]

The runtime validates the engineering-unit value against these rules and returns a typed error (below minimum, above maximum, not a multiple of step, or not in allowed values) instead of writing an out-of-range setpoint.

The write path

On a valid write the runtime runs the transform in reverse: your engineering value is converted back to the exact raw register value (dividing by the scale, subtracting the offset, resolving any scale_ref), then written. What you read back decodes to what you wrote.

dev.write_point("stop_soc", 80.0).await?; // ok
dev.write_point("stop_soc", 101.0).await?; // Err(WriteConstraint(Max))