Skip to main content

IWriteData

Interface for writing data to items with validation support.

Namespace: ControlBee.Interfaces

Methods

WriteData

Writes data to an item location with optional range validation.

void WriteData(ItemDataWriteArgs args);

Parameters:

ItemDataWriteArgs

A class that encapsulates data write operation parameters.

Properties:

  • Location (object[]) — The hierarchical location path to the data item.
  • NewValue (object) — The new value to write.
  • MinValue (double?) — Optional minimum value constraint for validation.
  • MaxValue (double?) — Optional maximum value constraint for validation.

Methods:

  • EnsureNewValueInRange() — Validates that the new value is within the specified min/max range. Throws ValueError if validation fails.

Usage Example

IWriteData writer = ...;

// Write a value with range validation
var args = new ItemDataWriteArgs
{
Location = new object[] { "Motor", "Speed" },
NewValue = 1500.0,
MinValue = 0.0,
MaxValue = 3000.0
};

// Validate before writing
args.EnsureNewValueInRange();

// Write the data
writer.WriteData(args);

Exceptions

  • ValueError — Thrown by EnsureNewValueInRange() when the new value is outside the specified range.

See Also