Sign in

    moonbit-modbus

    A portable Modbus RTU, ASCII, and TCP protocol stack with device simulation and gateway primitives for MoonBit.

    modbus
    industrial
    protocol
    rtu
    ascii
    tcp
    plc
    Download zip
    Version
    0.2.2
    License
    Apache-2.0
    Last updated
    last month
    Downloads
    28

    #moonbit-modbus

    moonbit-modbus 是一个面向工业设备接入的 MoonBit Modbus 协议栈。它把 PDU、RTU、ASCII 和 TCP MBAP 统一到同一套类型安全 API,并提供设备内存、客户端事务、轮询、网关和虚拟链路等可组合模块,适合 PLC、变频器、仪表、数据采集器和协议测试工具。

    #核心能力

    • 协议编解码:Modbus RTU、ASCII、TCP,CRC16、LRC、MBAP 事务标识和异常响应。
    • 功能码覆盖:线圈、离散输入、保持寄存器、输入寄存器的读写,以及掩码写、读写组合、诊断、事件计数器、文件记录、设备识别和 FIFO。
    • 流式处理:有界增量解析器支持分段输入、多帧输入和坏帧恢复,避免无界缓存。
    • 设备与内存:寄存器/线圈 bank、地址空间、schema、文件记录存储、设备状态和异常统计。
    • 应用层服务:设备 profile、缩放校准、质量管线、告警引擎、历史聚合、维护工单、设备库存和快照对账。
    • 集成组件:客户端重试与超时、请求规划、轮询分组合并、命令中心、事务批处理、网关策略、租约和事件总线。
    • 运行保障:协议准入防护、容量账本、可靠性熔断、确定性故障场景、健康汇总、指标导出和配置迁移回滚。
    • 工程质量:无第三方运行时依赖,支持 native、wasm 和 wasm-gc 目标;公共接口生成 .mbti 文件并由 CI 校验。

    #快速开始

    需要已安装 MoonBit stable 工具链。仓库根目录执行:

    moon update moon check --target all --deny-warn moon test --target all --deny-warn moon run cmd/main

    最小 API 示例:

    ///|
    let request = @moonbit-modbus.read_holding(1, 0, 4)

    ///|
    let rtu_bytes = @moonbit-modbus.encode_rtu(request)

    ///|
    let parsed = @moonbit-modbus.decode_rtu(rtu_bytes)

    增量解析示例:

    ///|
    let parser = @moonbit-modbus.IncrementalParser::new(@moonbit-modbus.rtu_mode())

    ///|
    let frames = parser.feed(rtu_bytes)

    #CLI

    仓库包含两个可直接运行的示例程序:

    # 展示请求编码、虚拟设备处理和响应格式化 moon run --target native cmd/main # 运行 1000 次 CRC、RTU、TCP 和设备读工作负载 moon run --target native cmd/bench

    cmd/bench 输出确定性的迭代次数、成功数、失败数和处理字节数;独立的端到端命令耗时记录在 BENCHMARK.md。

    #架构

    代码按协议边界拆分为几个层次:

    1. types.mbt、validation.mbt 和 limits.mbt 定义公共类型、功能码、异常码和边界规则。
    2. codec.mbt、checksum.mbt、parser.mbt 和 frame_text.mbt 负责 PDU/ADU 编解码、校验和流式解析。
    3. functions.mbt、responses.mbt、coils.mbt、register_codec.mbt 和 file_records.mbt 提供功能码与数据表示。
    4. banks.mbt、device.mbt、register_schema.mbt 和 address_space.mbt 组成可测试的设备内存层。
    5. client.mbt、transport.mbt、polling.mbt、poll_groups.mbt、gateway.mbt、gateway_policy.mbt、server_pool.mbt 和 simulation.mbt 提供系统集成能力。
    6. profiles.mbt、scaling.mbt、quality_pipeline.mbt、alarms.mbt、historian.mbt、maintenance.mbt、device_inventory.mbt 和 device_services.mbt 提供设备应用层能力。
    7. commands.mbt、transaction_batch.mbt、scheduler.mbt、lease_manager.mbt、event_bus.mbt、protocol_guard.mbt 和 capacity.mbt 负责控制面编排与资源边界。
    8. reliability.mbt、analytics.mbt、fleet_health.mbt、observability.mbt、transport_metrics.mbt、scenarios.mbt、data_migration.mbt 和 frame_contracts.mbt 提供运维、验证和可观测性。

    核心层只依赖 MoonBit 标准能力;真实串口和 TCP socket 可在上层适配,而不改变协议模型和测试夹具。

    #基准

    基准使用 native 目标和固定的 1000 次迭代,覆盖 CRC16、RTU 编解码往返、TCP 编解码往返和设备读路径。结果分为确定性工作量统计与主机端到端耗时两部分,避免把不同机器的时钟结果伪装成协议吞吐率。复现实验方法和原始测量值见 BENCHMARK.md。

    #测试

    测试覆盖正常路径和边界路径,包括:

    • 地址、单位号、数量、PDU/ADU 长度、字节计数和广播请求边界;
    • CRC/LRC、ASCII/TCP/RTU 错帧、分段输入、多帧输入和截断输入;
    • 线圈 bit packing、寄存器字节序、32/64 位数值、游标越界和写入器容量;
    • 设备读写、异常响应、busy 状态、文件记录、设备识别、客户端事务和网关映射;
    • schema、轮询分组、批处理、事务回滚、配置迁移、租约、协议准入、事件死信、设备快照对账和文本帧工具;
    • 拓扑路径、可靠性熔断、告警迟滞、质量边界、维护到期、确定性故障注入和容量超限。

    本地质量门槛:

    moon fmt --check moon info moon check --target all --deny-warn moon test --target all --deny-warn

    #CI

    .github/workflows/check.yml 在 Ubuntu、macOS 和 Windows 上安装 MoonBit stable,执行 moon update、格式检查、全目标检查、构建、测试、CLI smoke test 和 .mbti 清洁工作树校验。.github/workflows/publish.yml 仅支持手动触发,用于在配置发布凭据后执行 Mooncakes 发布流程。

    #许可证

    本项目采用 Apache-2.0 许可证。协议实现依据公开的 Modbus 应用协议与串行链路规范重新实现,源码和测试夹具均保留在本仓库中。

    AccessOperation

    pub(all) enum AccessOperation {
    ReadOperation
    WriteOperation
    DiagnosticsOperation
    IdentificationOperation
    } derive(Eq,
    Debug
    )

    High-level operation guarded by an access policy.

    AccessPolicy

    pub(all) struct AccessPolicy {
    rules : Array[AccessRule]
    max_rules : Int
    default_allow : Bool
    }

    A first-match access policy with an explicit default decision.

    AccessPolicy::add

    fn AccessPolicy::add(self : AccessPolicy, rule : AccessRule) -> Result[Unit, ModbusError]

    AccessPolicy::allows

    fn AccessPolicy::allows(self : AccessPolicy, role : AccessRole, operation : AccessOperation, frame : Frame) -> Bool

    AccessPolicy::decision

    fn AccessPolicy::decision(self : AccessPolicy, role : AccessRole, operation : AccessOperation, frame : Frame) -> Result[Unit, ModbusError]

    AccessPolicy::length

    fn AccessPolicy::length(self : AccessPolicy) -> Int

    AccessPolicy::new

    fn AccessPolicy::new(default_allow? : Bool, max_rules? : Int) -> Result[AccessPolicy, ModbusError]

    AccessPolicy::remove

    fn AccessPolicy::remove(self : AccessPolicy, name : String) -> Result[AccessRule, ModbusError]

    AccessPolicy::rules

    AccessPolicy::set_default

    fn AccessPolicy::set_default(self : AccessPolicy, allow : Bool) -> Unit

    AccessPolicy::summary

    fn AccessPolicy::summary(self : AccessPolicy) -> String

    AccessRole

    pub(all) enum AccessRole {
    Observer
    Operator
    Engineer
    Administrator
    } derive(Eq,
    Debug
    )

    Role used by a deployment policy.

    AccessRule

    pub(all) struct AccessRule {
    name : String
    role : AccessRole
    operation : AccessOperation
    unit_start : Byte
    unit_end : Byte
    functions : Array[Byte]
    enabled : Bool
    }

    A rule matching unit ids and function codes.

    AccessRule::enabled

    fn AccessRule::enabled(self : AccessRule) -> Bool

    AccessRule::matches

    fn AccessRule::matches(self : AccessRule, role : AccessRole, operation : AccessOperation, frame : Frame) -> Bool

    AccessRule::name

    fn AccessRule::name(self : AccessRule) -> String

    AccessRule::new

    fn AccessRule::new(name : String, role : AccessRole, operation : AccessOperation, unit_start : Byte, unit_end : Byte, functions : Array[Byte]) -> Result[AccessRule, ModbusError]

    AccessRule::operation

    fn AccessRule::operation(self : AccessRule) -> AccessOperation

    AccessRule::role

    fn AccessRule::role(self : AccessRule) -> AccessRole

    AccessRule::set_enabled

    fn AccessRule::set_enabled(self : AccessRule, value : Bool) -> Unit

    AccessRule::summary

    fn AccessRule::summary(self : AccessRule) -> String

    AddressAllocator

    pub struct AddressAllocator {
    capacity : Int
    used : Array[AddressRange]
    }

    A first-fit allocator for contiguous register or coil ranges.

    AddressAllocator::allocate

    fn AddressAllocator::allocate(self : AddressAllocator, length : Int) -> Result[AddressRange, ModbusError]

    AddressAllocator::free_capacity

    fn AddressAllocator::free_capacity(self : AddressAllocator) -> Int

    AddressAllocator::new

    fn AddressAllocator::new(capacity : Int) -> Result[AddressAllocator, ModbusError]

    AddressAllocator::release

    fn AddressAllocator::release(self : AddressAllocator, range : AddressRange) -> Result[Unit, ModbusError]

    AddressAllocator::snapshot

    AddressAllocator::used_capacity

    fn AddressAllocator::used_capacity(self : AddressAllocator) -> Int

    AddressAllocator::used_count

    fn AddressAllocator::used_count(self : AddressAllocator) -> Int

    AddressRange

    pub(all) struct AddressRange {
    start : UInt16
    length : Int
    }

    A half-open address range in the Modbus 16-bit address space.

    AddressRange::contains

    fn AddressRange::contains(self : AddressRange, address : UInt16) -> Bool

    AddressRange::contains_range

    fn AddressRange::contains_range(self : AddressRange, other : AddressRange) -> Bool

    AddressRange::end_exclusive

    fn AddressRange::end_exclusive(self : AddressRange) -> Int

    AddressRange::length

    fn AddressRange::length(self : AddressRange) -> Int

    AddressRange::new

    fn AddressRange::new(start : UInt16, length : Int) -> Result[AddressRange, ModbusError]

    AddressRange::offset

    fn AddressRange::offset(self : AddressRange, address : UInt16) -> Result[Int, ModbusError]

    AddressRange::overlaps

    fn AddressRange::overlaps(self : AddressRange, other : AddressRange) -> Bool

    AddressRange::slice

    fn AddressRange::slice(self : AddressRange, offset : Int, length : Int) -> Result[AddressRange, ModbusError]

    AddressRange::split

    fn AddressRange::split(self : AddressRange, segment_length : Int) -> Result[Array[AddressRange], ModbusError]

    Split a range into non-overlapping segments of at most segment_length.

    AddressRange::start

    fn AddressRange::start(self : AddressRange) -> UInt16

    Aggregation

    pub(all) enum Aggregation {
    LastValue
    MinimumValue
    MaximumValue
    SumValue
    AverageValue
    CountValue
    } derive(Eq,
    Debug
    )

    Aggregation used when reducing samples for a dashboard or export.

    AlarmCondition

    pub(all) enum AlarmCondition {
    Below
    AtOrBelow
    Equal
    NotEqual
    AtOrAbove
    Above
    Outside
    Inside
    } derive(Eq,
    Debug
    )

    Comparison used by an alarm rule.

    AlarmEngine

    pub(all) struct AlarmEngine {
    instances : Array[AlarmInstance]
    events : Array[AlarmEvent]
    max_events : Int
    next_sequence : Int
    }

    A bounded alarm engine suitable for a device server or polling loop.

    AlarmEngine::acknowledge

    fn AlarmEngine::acknowledge(self : AlarmEngine, rule_id : String, operator : String, timestamp : Int) -> Result[AlarmEvent, ModbusError]

    AlarmEngine::active

    AlarmEngine::active_count

    fn AlarmEngine::active_count(self : AlarmEngine) -> Int

    AlarmEngine::add_rule

    fn AlarmEngine::add_rule(self : AlarmEngine, rule : AlarmRule) -> Result[Unit, ModbusError]

    AlarmEngine::clear_events

    fn AlarmEngine::clear_events(self : AlarmEngine) -> Unit

    AlarmEngine::evaluate

    fn AlarmEngine::evaluate(self : AlarmEngine, point_id : String, value : Int, timestamp : Int) -> Result[Array[AlarmEvent], ModbusError]

    AlarmEngine::event_count

    fn AlarmEngine::event_count(self : AlarmEngine) -> Int

    AlarmEngine::events

    fn AlarmEngine::events(self : AlarmEngine) -> Array[AlarmEvent]

    AlarmEngine::events_for_point

    fn AlarmEngine::events_for_point(self : AlarmEngine, point_id : String) -> Array[AlarmEvent]

    AlarmEngine::instance

    fn AlarmEngine::instance(self : AlarmEngine, rule_id : String) -> AlarmInstance?

    AlarmEngine::new

    fn AlarmEngine::new(max_events? : Int) -> Result[AlarmEngine, ModbusError]

    AlarmEngine::remove_rule

    fn AlarmEngine::remove_rule(self : AlarmEngine, rule_id : String) -> Result[Unit, ModbusError]

    AlarmEngine::reset

    fn AlarmEngine::reset(self : AlarmEngine) -> Unit

    AlarmEngine::rule_count

    fn AlarmEngine::rule_count(self : AlarmEngine) -> Int

    AlarmEngine::shelve

    fn AlarmEngine::shelve(self : AlarmEngine, rule_id : String, timestamp : Int) -> Result[AlarmEvent, ModbusError]

    AlarmEngine::summary

    fn AlarmEngine::summary(self : AlarmEngine) -> String

    AlarmEngine::unshelve

    fn AlarmEngine::unshelve(self : AlarmEngine, rule_id : String, timestamp : Int) -> Result[AlarmEvent, ModbusError]

    AlarmEvent

    pub(all) struct AlarmEvent {
    sequence : Int
    rule_id : String
    point_id : String
    state : AlarmState
    value : Int
    timestamp : Int
    severity : AlarmSeverity
    message : String
    } derive(
    Debug
    )

    An event emitted when an alarm lifecycle changes.

    AlarmEvent::message

    fn AlarmEvent::message(self : AlarmEvent) -> String

    AlarmEvent::point_id

    fn AlarmEvent::point_id(self : AlarmEvent) -> String

    AlarmEvent::rule_id

    fn AlarmEvent::rule_id(self : AlarmEvent) -> String

    AlarmEvent::sequence

    fn AlarmEvent::sequence(self : AlarmEvent) -> Int

    AlarmEvent::severity

    fn AlarmEvent::severity(self : AlarmEvent) -> AlarmSeverity

    AlarmEvent::state

    fn AlarmEvent::state(self : AlarmEvent) -> AlarmState

    AlarmEvent::summary

    fn AlarmEvent::summary(self : AlarmEvent) -> String

    AlarmEvent::timestamp

    fn AlarmEvent::timestamp(self : AlarmEvent) -> Int

    AlarmEvent::value

    fn AlarmEvent::value(self : AlarmEvent) -> Int

    AlarmInstance

    pub(all) struct AlarmInstance {
    rule : AlarmRule
    state : AlarmState
    pending_since : Int?
    clearing_since : Int?
    last_value : Int
    last_timestamp : Int
    transitions : Int
    acknowledger : String?
    }

    Internal state retained for one rule.

    AlarmInstance::acknowledge

    fn AlarmInstance::acknowledge(self : AlarmInstance, operator : String) -> Result[Unit, ModbusError]

    AlarmInstance::acknowledger

    fn AlarmInstance::acknowledger(self : AlarmInstance) -> String?

    AlarmInstance::evaluate

    fn AlarmInstance::evaluate(self : AlarmInstance, value : Int, timestamp : Int, sequence : Int) -> AlarmTransition

    Evaluate one new sample and update the instance lifecycle.

    AlarmInstance::id

    fn AlarmInstance::id(self : AlarmInstance) -> String

    AlarmInstance::is_active

    fn AlarmInstance::is_active(self : AlarmInstance) -> Bool

    AlarmInstance::last_timestamp

    fn AlarmInstance::last_timestamp(self : AlarmInstance) -> Int

    AlarmInstance::last_value

    fn AlarmInstance::last_value(self : AlarmInstance) -> Int

    AlarmInstance::new

    AlarmInstance::point_id

    fn AlarmInstance::point_id(self : AlarmInstance) -> String

    AlarmInstance::rule

    AlarmInstance::shelve

    fn AlarmInstance::shelve(self : AlarmInstance) -> Result[Unit, ModbusError]

    AlarmInstance::state

    AlarmInstance::transitions

    fn AlarmInstance::transitions(self : AlarmInstance) -> Int

    AlarmInstance::unshelve

    fn AlarmInstance::unshelve(self : AlarmInstance) -> Unit

    AlarmMonitor

    pub(all) struct AlarmMonitor {
    threshold : Threshold
    state : ThresholdState
    transitions : Int
    last_value : Int?
    }

    Stateful threshold monitor that counts state transitions.

    AlarmMonitor::last_value

    fn AlarmMonitor::last_value(self : AlarmMonitor) -> Int?

    AlarmMonitor::new

    fn AlarmMonitor::new(threshold : Threshold) -> AlarmMonitor

    AlarmMonitor::observe

    fn AlarmMonitor::observe(self : AlarmMonitor, value : Int) -> ThresholdState

    AlarmMonitor::reset

    fn AlarmMonitor::reset(self : AlarmMonitor) -> Unit

    AlarmMonitor::state

    AlarmMonitor::threshold

    fn AlarmMonitor::threshold(self : AlarmMonitor) -> Threshold

    AlarmMonitor::transitions

    fn AlarmMonitor::transitions(self : AlarmMonitor) -> Int

    AlarmRule

    pub(all) struct AlarmRule {
    id : String
    point_id : String
    condition : AlarmCondition
    low : Int
    high : Int
    severity : AlarmSeverity
    activation_delay : Int
    clear_delay : Int
    hysteresis : Int
    enabled : Bool
    }

    A declarative threshold rule attached to a profile point.

    AlarmRule::activation_delay

    fn AlarmRule::activation_delay(self : AlarmRule) -> Int

    AlarmRule::clear_delay

    fn AlarmRule::clear_delay(self : AlarmRule) -> Int

    AlarmRule::clear_matches

    fn AlarmRule::clear_matches(self : AlarmRule, value : Int) -> Bool

    AlarmRule::condition

    fn AlarmRule::condition(self : AlarmRule) -> AlarmCondition

    AlarmRule::enabled

    fn AlarmRule::enabled(self : AlarmRule) -> Bool

    AlarmRule::high

    fn AlarmRule::high(self : AlarmRule) -> Int

    AlarmRule::hysteresis

    fn AlarmRule::hysteresis(self : AlarmRule) -> Int

    AlarmRule::id

    fn AlarmRule::id(self : AlarmRule) -> String

    AlarmRule::low

    fn AlarmRule::low(self : AlarmRule) -> Int

    AlarmRule::matches

    fn AlarmRule::matches(self : AlarmRule, value : Int) -> Bool

    AlarmRule::new

    fn AlarmRule::new(id : String, point_id : String, condition : AlarmCondition, low : Int, high : Int, severity : AlarmSeverity, activation_delay? : Int, clear_delay? : Int, hysteresis? : Int) -> Result[AlarmRule, ModbusError]

    AlarmRule::point_id

    fn AlarmRule::point_id(self : AlarmRule) -> String

    AlarmRule::set_enabled

    fn AlarmRule::set_enabled(self : AlarmRule, enabled : Bool) -> Unit

    AlarmRule::severity

    fn AlarmRule::severity(self : AlarmRule) -> AlarmSeverity

    AlarmRule::summary

    fn AlarmRule::summary(self : AlarmRule) -> String

    AlarmSeverity

    pub(all) enum AlarmSeverity {
    Informational
    Warning
    Critical
    } derive(Eq,
    Debug
    )

    Severity assigned to an operational alarm.

    AlarmState

    pub(all) enum AlarmState {
    Normal
    Pending
    Active
    Acknowledged
    Clearing
    Shelved
    } derive(Eq,
    Debug
    )

    Lifecycle state of an alarm instance.

    AlarmTransition

    pub(all) enum AlarmTransition {
    Unchanged(AlarmState)
    Changed(AlarmEvent)
    } derive(
    Debug
    )

    A deterministic transition result used by polling and UI layers.

    AnalyticsReport

    pub(all) struct AnalyticsReport {
    direction : TrendDirection
    average : Int
    minimum : Int
    maximum : Int
    slope : Int
    anomalies : Int
    p95 : Int
    }

    Combined trend and distribution report.

    AnalyticsReport::anomalies

    fn AnalyticsReport::anomalies(self : AnalyticsReport) -> Int

    AnalyticsReport::average

    fn AnalyticsReport::average(self : AnalyticsReport) -> Int

    AnalyticsReport::direction

    AnalyticsReport::maximum

    fn AnalyticsReport::maximum(self : AnalyticsReport) -> Int

    AnalyticsReport::minimum

    fn AnalyticsReport::minimum(self : AnalyticsReport) -> Int

    AnalyticsReport::p95

    fn AnalyticsReport::p95(self : AnalyticsReport) -> Int

    AnalyticsReport::slope

    fn AnalyticsReport::slope(self : AnalyticsReport) -> Int

    AnalyticsRule

    pub(all) struct AnalyticsRule {
    id : String
    lower : Int?
    upper : Int?
    spike_delta : Int
    flatline_delta : Int
    flatline_count : Int
    }

    A limit and deviation rule applied to a series.

    AnalyticsRule::evaluate

    fn AnalyticsRule::evaluate(self : AnalyticsRule, window : AnalyticsWindow) -> Array[ValueAnomaly]

    AnalyticsRule::flatline_count

    fn AnalyticsRule::flatline_count(self : AnalyticsRule) -> Int

    AnalyticsRule::flatline_delta

    fn AnalyticsRule::flatline_delta(self : AnalyticsRule) -> Int

    AnalyticsRule::id

    fn AnalyticsRule::id(self : AnalyticsRule) -> String

    AnalyticsRule::lower

    fn AnalyticsRule::lower(self : AnalyticsRule) -> Int?

    AnalyticsRule::new

    fn AnalyticsRule::new(id : String, lower? : Int, upper? : Int, spike_delta? : Int, flatline_delta? : Int, flatline_count? : Int) -> Result[AnalyticsRule, ModbusError]

    AnalyticsRule::spike_delta

    fn AnalyticsRule::spike_delta(self : AnalyticsRule) -> Int

    AnalyticsRule::upper

    fn AnalyticsRule::upper(self : AnalyticsRule) -> Int?

    AnalyticsSample

    pub(all) struct AnalyticsSample {
    timestamp : Int
    value : Int
    quality : ReadingQuality
    }

    A timestamped value used by trend and anomaly calculations.

    AnalyticsSample::new

    fn AnalyticsSample::new(timestamp : Int, value : Int, quality? : ReadingQuality) -> Result[AnalyticsSample, ModbusError]

    AnalyticsSample::quality

    AnalyticsSample::timestamp

    fn AnalyticsSample::timestamp(self : AnalyticsSample) -> Int

    AnalyticsSample::usable

    fn AnalyticsSample::usable(self : AnalyticsSample) -> Bool

    AnalyticsSample::value

    fn AnalyticsSample::value(self : AnalyticsSample) -> Int

    AnalyticsWindow

    pub(all) struct AnalyticsWindow {
    id : String
    capacity : Int
    samples : Array[AnalyticsSample]
    dropped : Int
    }

    A bounded time series with deterministic order guarantees.

    AnalyticsWindow::append

    fn AnalyticsWindow::append(self : AnalyticsWindow, sample : AnalyticsSample) -> Result[Unit, ModbusError]

    AnalyticsWindow::at

    fn AnalyticsWindow::at(self : AnalyticsWindow, index : Int) -> Result[AnalyticsSample, ModbusError]

    AnalyticsWindow::average

    fn AnalyticsWindow::average(self : AnalyticsWindow) -> Result[Int, ModbusError]

    AnalyticsWindow::capacity

    fn AnalyticsWindow::capacity(self : AnalyticsWindow) -> Int

    AnalyticsWindow::direction

    fn AnalyticsWindow::direction(self : AnalyticsWindow, threshold : Int) -> Result[TrendDirection, ModbusError]

    AnalyticsWindow::dropped

    fn AnalyticsWindow::dropped(self : AnalyticsWindow) -> Int

    AnalyticsWindow::first

    AnalyticsWindow::id

    fn AnalyticsWindow::id(self : AnalyticsWindow) -> String

    AnalyticsWindow::last

    AnalyticsWindow::length

    fn AnalyticsWindow::length(self : AnalyticsWindow) -> Int

    AnalyticsWindow::maximum

    fn AnalyticsWindow::maximum(self : AnalyticsWindow) -> Result[Int, ModbusError]

    AnalyticsWindow::minimum

    fn AnalyticsWindow::minimum(self : AnalyticsWindow) -> Result[Int, ModbusError]

    AnalyticsWindow::new

    fn AnalyticsWindow::new(id : String, capacity? : Int) -> Result[AnalyticsWindow, ModbusError]

    AnalyticsWindow::range

    fn AnalyticsWindow::range(self : AnalyticsWindow) -> Result[Int, ModbusError]

    AnalyticsWindow::slope

    fn AnalyticsWindow::slope(self : AnalyticsWindow) -> Result[Int, ModbusError]

    AnalyticsWindow::usable_values

    fn AnalyticsWindow::usable_values(self : AnalyticsWindow) -> Array[Int]

    AnomalyKind

    pub(all) enum AnomalyKind {
    UpperLimitAnomaly
    LowerLimitAnomaly
    SpikeAnomaly
    FlatlineAnomaly
    RateAnomaly
    } derive(Eq,
    Debug
    )

    Reason a sample was flagged by an analytics rule.

    AuditEntry

    pub(all) struct AuditEntry {
    sequence : Int
    direction : String
    mode : Mode
    transaction_id : UInt16
    summary : FrameSummary
    outcome : String
    }

    A trace record suitable for debugging a gateway or device exchange.

    AuditLog

    pub struct AuditLog {
    entries : Array[AuditEntry]
    max_entries : Int
    next_sequence : Int
    }

    AuditLog::clear

    fn AuditLog::clear(self : AuditLog) -> Unit

    AuditLog::length

    fn AuditLog::length(self : AuditLog) -> Int

    AuditLog::new

    fn AuditLog::new(max_entries? : Int) -> Result[AuditLog, ModbusError]

    AuditLog::record

    fn AuditLog::record(self : AuditLog, direction : String, mode : Mode, transaction_id : UInt16, frame : Frame, outcome : String) -> Unit

    AuditLog::snapshot

    fn AuditLog::snapshot(self : AuditLog) -> Array[AuditEntry]

    BatchItem

    pub(all) struct BatchItem {
    id : Int
    request : Frame
    }

    A named request in a batch operation.

    BatchItem::new

    fn BatchItem::new(id : Int, request : Frame) -> Result[BatchItem, ModbusError]

    BatchPlan

    pub struct BatchPlan {
    items : Array[BatchItem]
    max_items : Int
    }

    An ordered batch plan used to pipeline independent requests.

    BatchPlan::add

    fn BatchPlan::add(self : BatchPlan, item : BatchItem) -> Result[Unit, ModbusError]

    BatchPlan::execute

    fn BatchPlan::execute(self : BatchPlan, device : Device) -> Array[BatchResult]

    Execute an ordered plan against a deterministic device.

    BatchPlan::item

    fn BatchPlan::item(self : BatchPlan, index : Int) -> Result[BatchItem, ModbusError]

    BatchPlan::length

    fn BatchPlan::length(self : BatchPlan) -> Int

    BatchPlan::new

    fn BatchPlan::new(max_items? : Int) -> Result[BatchPlan, ModbusError]

    BatchPlan::snapshot

    fn BatchPlan::snapshot(self : BatchPlan) -> Array[BatchItem]

    BatchResult

    pub(all) enum BatchResult {
    Completed(Int, Frame)
    Failed(Int, ModbusError)
    }

    The result of executing one batch item.

    BenchmarkResult

    pub(all) struct BenchmarkResult {
    name : String
    iterations : Int
    successful : Int
    failed : Int
    bytes : Int
    }

    Deterministic benchmark counters emitted by the command-line benchmark.

    BenchmarkResult::operations

    fn BenchmarkResult::operations(self : BenchmarkResult) -> Int

    BenchmarkResult::success_rate

    fn BenchmarkResult::success_rate(self : BenchmarkResult) -> Float

    BenchmarkResult::summary

    fn BenchmarkResult::summary(self : BenchmarkResult) -> String

    BitVector

    pub(all) struct BitVector {
    length : Int
    storage : Array[Byte]
    }

    A mutable bounded bit vector for coils and discrete inputs.

    BitVector::bit_and

    fn BitVector::bit_and(self : BitVector, other : BitVector) -> Result[BitVector, ModbusError]

    Apply a bitwise AND to two equally sized vectors.

    BitVector::byte_length

    fn BitVector::byte_length(self : BitVector) -> Int

    BitVector::copy

    fn BitVector::copy(self : BitVector) -> BitVector

    Copy a bit vector and keep its logical length.

    BitVector::count

    fn BitVector::count(self : BitVector) -> Int

    BitVector::equal

    fn BitVector::equal(self : BitVector, other : BitVector) -> Bool

    Compare two bit vectors including their logical lengths.

    BitVector::fill

    fn BitVector::fill(self : BitVector, value : Bool) -> Unit

    BitVector::from_bits

    fn BitVector::from_bits(values : Array[Bool]) -> BitVector

    BitVector::get

    fn BitVector::get(self : BitVector, index : Int) -> Result[Bool, ModbusError]

    BitVector::length

    fn BitVector::length(self : BitVector) -> Int

    BitVector::new

    fn BitVector::new(length : Int) -> Result[BitVector, ModbusError]

    Create a zero-filled bit vector.

    BitVector::not

    fn BitVector::not(self : BitVector) -> BitVector

    Invert all logical bits, keeping padding bits clear.

    BitVector::or

    fn BitVector::or(self : BitVector, other : BitVector) -> Result[BitVector, ModbusError]

    Apply a bitwise OR to two equally sized vectors.

    BitVector::pack_range

    fn BitVector::pack_range(self : BitVector, start : Int, quantity : Int) -> Result[Array[Byte], ModbusError]

    Pack a range of bits from a vector for a Modbus response.

    BitVector::set

    fn BitVector::set(self : BitVector, index : Int, value : Bool) -> Result[Unit, ModbusError]

    BitVector::shift_left

    fn BitVector::shift_left(self : BitVector, distance : Int) -> Result[BitVector, ModbusError]

    Shift logical bits left, dropping values that fall outside the vector.

    BitVector::shift_right

    fn BitVector::shift_right(self : BitVector, distance : Int) -> Result[BitVector, ModbusError]

    Shift logical bits right, dropping values that fall outside the vector.

    BitVector::to_bits

    fn BitVector::to_bits(self : BitVector) -> Array[Bool]

    BitVector::to_bytes

    fn BitVector::to_bytes(self : BitVector) -> Array[Byte]

    BitVector::unpack_into

    fn BitVector::unpack_into(self : BitVector, start : Int, quantity : Int, bytes : Array[Byte]) -> Result[Unit, ModbusError]

    Replace a range of bits from packed input bytes.

    BridgeAction

    pub(all) enum BridgeAction {
    ForwardBridge
    RewriteBridge
    DenyBridge
    AuditBridge
    RateLimitBridge
    } derive(Eq,
    Debug
    )

    Action taken when a frame matches a gateway policy rule.

    BridgeDecision

    pub(all) struct BridgeDecision {
    rule_id : String?
    action : BridgeAction
    frame : Frame?
    reason : String
    matched : Bool
    }

    Result of applying one gateway rule to a frame.

    BridgeDecision::action

    BridgeDecision::frame

    fn BridgeDecision::frame(self : BridgeDecision) -> Frame?

    BridgeDecision::matched

    fn BridgeDecision::matched(rule : ServiceBridgeRule, action : BridgeAction, frame : Frame?, reason : String) -> BridgeDecision

    BridgeDecision::matched_rule

    fn BridgeDecision::matched_rule(self : BridgeDecision) -> Bool

    BridgeDecision::new

    fn BridgeDecision::new(action : BridgeAction, reason : String) -> BridgeDecision

    BridgeDecision::reason

    fn BridgeDecision::reason(self : BridgeDecision) -> String

    BridgeDecision::rule_id

    fn BridgeDecision::rule_id(self : BridgeDecision) -> String?

    ByteQueue

    pub struct ByteQueue {
    data : Array[Byte]
    max_length : Int
    }

    A bounded byte queue for adapters that receive arbitrary chunk sizes.

    ByteQueue::clear

    fn ByteQueue::clear(self : ByteQueue) -> Unit

    ByteQueue::contains_sequence

    fn ByteQueue::contains_sequence(self : ByteQueue, pattern : Array[Byte]) -> Bool

    ByteQueue::find

    fn ByteQueue::find(self : ByteQueue, value : Byte) -> Int?

    ByteQueue::is_empty

    fn ByteQueue::is_empty(self : ByteQueue) -> Bool

    ByteQueue::length

    fn ByteQueue::length(self : ByteQueue) -> Int

    ByteQueue::new

    fn ByteQueue::new(max_length? : Int) -> Result[ByteQueue, ModbusError]

    ByteQueue::peek

    fn ByteQueue::peek(self : ByteQueue, index : Int) -> Result[Byte, ModbusError]

    ByteQueue::push

    fn ByteQueue::push(self : ByteQueue, bytes : Array[Byte]) -> Result[Unit, ModbusError]

    ByteQueue::push_byte

    fn ByteQueue::push_byte(self : ByteQueue, byte : Byte) -> Result[Unit, ModbusError]

    ByteQueue::remaining

    fn ByteQueue::remaining(self : ByteQueue) -> Int

    ByteQueue::snapshot

    fn ByteQueue::snapshot(self : ByteQueue) -> Array[Byte]

    ByteQueue::take

    fn ByteQueue::take(self : ByteQueue, count : Int) -> Result[Array[Byte], ModbusError]

    ByteQueue::take_all

    fn ByteQueue::take_all(self : ByteQueue) -> Array[Byte]

    CalibrationCurve

    pub(all) struct CalibrationCurve {
    samples : Array[CalibrationSample]
    max_samples : Int
    clamp : Bool
    }

    A monotonic calibration curve for sensors with non-linear error.

    CalibrationCurve::add

    fn CalibrationCurve::add(self : CalibrationCurve, sample : CalibrationSample) -> Result[Unit, ModbusError]

    CalibrationCurve::convert

    fn CalibrationCurve::convert(self : CalibrationCurve, raw : Int) -> Result[Int, ModbusError]

    CalibrationCurve::convert_many

    fn CalibrationCurve::convert_many(self : CalibrationCurve, values : Array[Int]) -> Result[Array[Int], ModbusError]

    CalibrationCurve::length

    fn CalibrationCurve::length(self : CalibrationCurve) -> Int

    CalibrationCurve::new

    fn CalibrationCurve::new(max_samples? : Int, clamp? : Bool) -> Result[CalibrationCurve, ModbusError]

    CalibrationCurve::raw_max

    fn CalibrationCurve::raw_max(self : CalibrationCurve) -> Result[Int, ModbusError]

    CalibrationCurve::raw_min

    fn CalibrationCurve::raw_min(self : CalibrationCurve) -> Result[Int, ModbusError]

    CalibrationCurve::sample

    fn CalibrationCurve::sample(self : CalibrationCurve, index : Int) -> Result[CalibrationSample, ModbusError]

    CalibrationCurve::snapshot

    CalibrationSample

    pub(all) struct CalibrationSample {
    raw : Int
    engineering : Int
    }

    A calibration sample used to build a piecewise-linear curve.

    CalibrationSample::engineering

    fn CalibrationSample::engineering(self : CalibrationSample) -> Int

    CalibrationSample::new

    fn CalibrationSample::new(raw : Int, engineering : Int) -> CalibrationSample

    CalibrationSample::raw

    fn CalibrationSample::raw(self : CalibrationSample) -> Int

    CapabilitySet

    pub(all) struct CapabilitySet {
    functions : Array[Byte]
    modes : Array[Mode]
    max_pdu : Int
    broadcasts : Bool
    }

    A set of capabilities expected from a server or gateway.

    CapabilitySet::add_function

    fn CapabilitySet::add_function(self : CapabilitySet, function : Byte) -> Result[Unit, ModbusError]

    CapabilitySet::add_mode

    fn CapabilitySet::add_mode(self : CapabilitySet, mode : Mode) -> Unit

    CapabilitySet::broadcasts

    fn CapabilitySet::broadcasts(self : CapabilitySet) -> Bool

    CapabilitySet::coverage

    fn CapabilitySet::coverage(self : CapabilitySet, expected : Array[Byte]) -> Int

    CapabilitySet::functions

    fn CapabilitySet::functions(self : CapabilitySet) -> Array[Byte]

    CapabilitySet::max_pdu

    fn CapabilitySet::max_pdu(self : CapabilitySet) -> Int

    CapabilitySet::modes

    fn CapabilitySet::modes(self : CapabilitySet) -> Array[Mode]

    CapabilitySet::new

    fn CapabilitySet::new(max_pdu? : Int, broadcasts? : Bool) -> Result[CapabilitySet, ModbusError]

    CapabilitySet::supports_function

    fn CapabilitySet::supports_function(self : CapabilitySet, function : Byte) -> Bool

    CapabilitySet::supports_mode

    fn CapabilitySet::supports_mode(self : CapabilitySet, mode : Mode) -> Bool

    CapabilitySet::validate_frame

    fn CapabilitySet::validate_frame(self : CapabilitySet, frame : Frame) -> Result[Unit, ModbusError]

    CapacityLedger

    pub(all) struct CapacityLedger {
    limits : Array[CapacityLimit]
    reservations : Array[CapacityReservation]
    max_reservations : Int
    sequence : Int
    }

    Multi-resource ledger for admission control.

    CapacityLedger::add_limit

    fn CapacityLedger::add_limit(self : CapacityLedger, limit : CapacityLimit) -> Result[Unit, ModbusError]

    CapacityLedger::expire

    fn CapacityLedger::expire(self : CapacityLedger, now : Int, age : Int) -> Result[Int, ModbusError]

    Expire all reservations older than a caller-supplied age.

    CapacityLedger::export_lines

    fn CapacityLedger::export_lines(self : CapacityLedger) -> Array[String]

    Human-readable capacity table for health endpoints.

    CapacityLedger::limit

    CapacityLedger::limit_count

    fn CapacityLedger::limit_count(self : CapacityLedger) -> Int

    CapacityLedger::new

    fn CapacityLedger::new(max_reservations? : Int) -> Result[CapacityLedger, ModbusError]

    CapacityLedger::pressure

    Return resources currently above their soft limit.

    CapacityLedger::release

    fn CapacityLedger::release(self : CapacityLedger, reservation_id : String) -> Result[Unit, ModbusError]

    Release a previously issued reservation exactly once.

    CapacityLedger::reservation_count

    fn CapacityLedger::reservation_count(self : CapacityLedger) -> Int

    CapacityLedger::reserve

    fn CapacityLedger::reserve(self : CapacityLedger, resource : CapacityResource, amount : Int, now : Int) -> Result[CapacityReservation, ModbusError]

    Reserve one resource atomically and create an expirable token.

    CapacityLedger::reset

    fn CapacityLedger::reset(self : CapacityLedger) -> Unit

    Reset all limits and reservation tokens after a controlled restart.

    CapacityLimit

    pub(all) struct CapacityLimit {
    resource : CapacityResource
    name : String
    soft_limit : Int
    hard_limit : Int
    used : Int
    }

    A named resource limit with soft and hard thresholds.

    CapacityLimit::available

    fn CapacityLimit::available(self : CapacityLimit) -> Int

    CapacityLimit::hard_limit

    fn CapacityLimit::hard_limit(self : CapacityLimit) -> Int

    CapacityLimit::name

    fn CapacityLimit::name(self : CapacityLimit) -> String

    CapacityLimit::new

    fn CapacityLimit::new(resource : CapacityResource, name : String, soft_limit : Int, hard_limit : Int) -> Result[CapacityLimit, ModbusError]

    CapacityLimit::over_hard

    fn CapacityLimit::over_hard(self : CapacityLimit) -> Bool

    CapacityLimit::over_soft

    fn CapacityLimit::over_soft(self : CapacityLimit) -> Bool

    CapacityLimit::release

    fn CapacityLimit::release(self : CapacityLimit, amount : Int) -> Result[Unit, ModbusError]

    CapacityLimit::reserve

    fn CapacityLimit::reserve(self : CapacityLimit, amount : Int) -> Result[Unit, ModbusError]

    CapacityLimit::reset

    fn CapacityLimit::reset(self : CapacityLimit) -> Unit

    CapacityLimit::resource

    CapacityLimit::soft_limit

    fn CapacityLimit::soft_limit(self : CapacityLimit) -> Int

    CapacityLimit::used

    fn CapacityLimit::used(self : CapacityLimit) -> Int

    CapacityReservation

    pub(all) struct CapacityReservation {
    id : String
    resource : CapacityResource
    amount : Int
    created_at : Int
    released : Bool
    }

    A reservation returned to a caller so releases can be audited.

    CapacityReservation::amount

    fn CapacityReservation::amount(self : CapacityReservation) -> Int

    CapacityReservation::created_at

    fn CapacityReservation::created_at(self : CapacityReservation) -> Int

    CapacityReservation::id

    fn CapacityReservation::id(self : CapacityReservation) -> String

    CapacityReservation::mark_released

    fn CapacityReservation::mark_released(self : CapacityReservation) -> Result[Unit, ModbusError]

    CapacityReservation::new

    fn CapacityReservation::new(id : String, resource : CapacityResource, amount : Int, created_at : Int) -> Result[CapacityReservation, ModbusError]

    CapacityReservation::released

    fn CapacityReservation::released(self : CapacityReservation) -> Bool

    CapacityReservation::resource

    CapacityResource

    pub(all) enum CapacityResource {
    InFlightRequests
    PollRegisters
    CaptureBytes
    CommandQueue
    HistorianSamples
    AlarmEvents
    } derive(Eq,
    Debug
    )

    Resource tracked by a gateway or device service budget.

    CaptureDirection

    pub(all) enum CaptureDirection {
    Received
    Transmitted
    Internal
    } derive(Eq,
    Debug
    )

    Direction of a frame in a transport capture.

    CaptureFilter

    pub(all) struct CaptureFilter {
    mode : Mode?
    unit_id : Byte?
    function : Byte?
    direction : CaptureDirection?
    status : CaptureStatus?
    start_time : Int?
    end_time : Int?
    }

    Filter used to query a capture ring without decoding records again.

    CaptureFilter::between

    fn CaptureFilter::between(self : CaptureFilter, start : Int, end : Int) -> Result[CaptureFilter, ModbusError]

    CaptureFilter::matches

    fn CaptureFilter::matches(self : CaptureFilter, record : CaptureRecord) -> Bool

    CaptureFilter::new

    CaptureFilter::with_direction

    fn CaptureFilter::with_direction(self : CaptureFilter, direction : CaptureDirection) -> CaptureFilter

    CaptureFilter::with_function

    fn CaptureFilter::with_function(self : CaptureFilter, function : Byte) -> CaptureFilter

    CaptureFilter::with_mode

    fn CaptureFilter::with_mode(self : CaptureFilter, mode : Mode) -> CaptureFilter

    CaptureFilter::with_status

    fn CaptureFilter::with_status(self : CaptureFilter, status : CaptureStatus) -> CaptureFilter

    CaptureFilter::with_unit

    fn CaptureFilter::with_unit(self : CaptureFilter, unit_id : Byte) -> CaptureFilter

    CaptureRecord

    pub(all) struct CaptureRecord {
    id : Int
    timestamp : Int
    mode : Mode
    transaction_id : UInt16
    direction : CaptureDirection
    bytes : Array[Byte]
    frame : Frame?
    status : CaptureStatus
    note : String
    }

    A single timestamped wire record.

    CaptureRecord::bytes

    fn CaptureRecord::bytes(self : CaptureRecord) -> Array[Byte]

    CaptureRecord::direction

    CaptureRecord::frame

    fn CaptureRecord::frame(self : CaptureRecord) -> Frame?

    CaptureRecord::from_frame

    fn CaptureRecord::from_frame(id : Int, timestamp : Int, mode : Mode, transaction_id : UInt16, direction : CaptureDirection, frame : Frame, note? : String) -> Result[CaptureRecord, ModbusError]

    CaptureRecord::function

    fn CaptureRecord::function(self : CaptureRecord) -> Byte?

    CaptureRecord::id

    fn CaptureRecord::id(self : CaptureRecord) -> Int

    CaptureRecord::is_valid

    fn CaptureRecord::is_valid(self : CaptureRecord) -> Bool

    CaptureRecord::mode

    fn CaptureRecord::mode(self : CaptureRecord) -> Mode

    CaptureRecord::new

    fn CaptureRecord::new(id : Int, timestamp : Int, mode : Mode, transaction_id : UInt16, direction : CaptureDirection, bytes : Array[Byte], note? : String) -> Result[CaptureRecord, ModbusError]

    CaptureRecord::note

    fn CaptureRecord::note(self : CaptureRecord) -> String

    CaptureRecord::status

    CaptureRecord::summary

    fn CaptureRecord::summary(self : CaptureRecord) -> String

    CaptureRecord::timestamp

    fn CaptureRecord::timestamp(self : CaptureRecord) -> Int

    CaptureRecord::transaction_id

    fn CaptureRecord::transaction_id(self : CaptureRecord) -> UInt16

    CaptureRecord::unit_id

    fn CaptureRecord::unit_id(self : CaptureRecord) -> Byte?

    CaptureRing

    pub(all) struct CaptureRing {
    records : Array[CaptureRecord]
    max_records : Int
    next_id : Int
    lost : Int
    }

    A bounded rolling store for protocol captures.

    CaptureRing::byte_count

    fn CaptureRing::byte_count(self : CaptureRing) -> Int

    CaptureRing::capacity

    fn CaptureRing::capacity(self : CaptureRing) -> Int

    CaptureRing::clear

    fn CaptureRing::clear(self : CaptureRing) -> Unit

    CaptureRing::corrupt_count

    fn CaptureRing::corrupt_count(self : CaptureRing) -> Int

    CaptureRing::decoded_count

    fn CaptureRing::decoded_count(self : CaptureRing) -> Int

    CaptureRing::get

    fn CaptureRing::get(self : CaptureRing, index : Int) -> Result[CaptureRecord, ModbusError]

    CaptureRing::latest

    fn CaptureRing::latest(self : CaptureRing) -> CaptureRecord?

    CaptureRing::length

    fn CaptureRing::length(self : CaptureRing) -> Int

    CaptureRing::lost

    fn CaptureRing::lost(self : CaptureRing) -> Int

    CaptureRing::new

    fn CaptureRing::new(max_records? : Int) -> Result[CaptureRing, ModbusError]

    CaptureRing::push

    fn CaptureRing::push(self : CaptureRing, timestamp : Int, mode : Mode, transaction_id : UInt16, direction : CaptureDirection, bytes : Array[Byte], note? : String) -> Result[CaptureRecord, ModbusError]

    CaptureRing::push_frame

    fn CaptureRing::push_frame(self : CaptureRing, timestamp : Int, mode : Mode, transaction_id : UInt16, direction : CaptureDirection, frame : Frame, note? : String) -> Result[CaptureRecord, ModbusError]

    CaptureRing::query

    fn CaptureRing::query(self : CaptureRing, filter : CaptureFilter) -> Array[CaptureRecord]

    CaptureRing::snapshot

    fn CaptureRing::snapshot(self : CaptureRing) -> Array[CaptureRecord]

    CaptureRing::summary

    fn CaptureRing::summary(self : CaptureRing) -> String

    CaptureStatus

    pub(all) enum CaptureStatus {
    Decoded
    Undecoded
    Corrupt
    Truncated
    } derive(Eq,
    Debug
    )

    Integrity state retained with a captured byte sequence.

    CircuitGuard

    pub(all) struct CircuitGuard {
    name : String
    failure_threshold : Int
    recovery_after : Int
    probe_limit : Int
    state : CircuitGuardState
    consecutive_failures : Int
    opened_at : Int?
    probes : Int
    }

    A circuit breaker with failure threshold and recovery probes.

    CircuitGuard::allow

    fn CircuitGuard::allow(self : CircuitGuard, now : Int) -> Result[Bool, ModbusError]

    CircuitGuard::consecutive_failures

    fn CircuitGuard::consecutive_failures(self : CircuitGuard) -> Int

    CircuitGuard::failure_threshold

    fn CircuitGuard::failure_threshold(self : CircuitGuard) -> Int

    CircuitGuard::force_close

    fn CircuitGuard::force_close(self : CircuitGuard) -> Unit

    CircuitGuard::force_open

    fn CircuitGuard::force_open(self : CircuitGuard, now : Int) -> Result[Unit, ModbusError]

    CircuitGuard::name

    fn CircuitGuard::name(self : CircuitGuard) -> String

    CircuitGuard::new

    fn CircuitGuard::new(name : String, failure_threshold : Int, recovery_after : Int, probe_limit? : Int) -> Result[CircuitGuard, ModbusError]

    CircuitGuard::opened_at

    fn CircuitGuard::opened_at(self : CircuitGuard) -> Int?

    CircuitGuard::record_failure

    fn CircuitGuard::record_failure(self : CircuitGuard, now : Int) -> Result[Unit, ModbusError]

    CircuitGuard::record_success

    fn CircuitGuard::record_success(self : CircuitGuard) -> Unit

    CircuitGuard::recovery_after

    fn CircuitGuard::recovery_after(self : CircuitGuard) -> Int

    CircuitGuard::state

    CircuitGuardState

    pub(all) enum CircuitGuardState {
    ClosedCircuit
    OpenCircuit
    HalfOpenCircuit
    } derive(Eq,
    Debug
    )

    State of a circuit guard protecting a device or route.

    Client

    pub struct Client {
    mode : Mode
    config : ClientConfig
    next_transaction : UInt16
    pending : Array[PendingExchange]
    }

    A stateful protocol client that does not assume a particular socket runtime.

    Client::accept

    fn Client::accept(self : Client, request : ClientRequest, bytes : Array[Byte]) -> Result[Frame, ModbusError]

    Accept bytes from the transport and correlate them with a pending request.

    Client::accept_frame

    fn Client::accept_frame(self : Client, request : ClientRequest, transaction_id : UInt16, response : Frame) -> Result[Frame, ModbusError]

    Accept an already decoded response frame.

    Client::allocate_transaction

    fn Client::allocate_transaction(self : Client) -> UInt16

    Allocate a non-zero transaction id for TCP and a stable zero id for serial modes.

    Client::attempts

    fn Client::attempts(self : Client, transaction_id : UInt16) -> Int

    Return a request's retry count, or zero when it is not tracked.

    Client::begin

    fn Client::begin(self : Client, frame : Frame) -> Result[ClientRequest, ModbusError]

    Begin an exchange at logical tick zero.

    Client::begin_at

    fn Client::begin_at(self : Client, frame : Frame, now : Int) -> Result[ClientRequest, ModbusError]

    Begin an exchange at a caller-supplied logical tick.

    Client::cancel

    fn Client::cancel(self : Client, transaction_id : UInt16) -> Result[Unit, ModbusError]

    Client::completed_count

    fn Client::completed_count(self : Client) -> Int

    Client::config

    fn Client::config(self : Client) -> ClientConfig

    Client::expire

    fn Client::expire(self : Client, now : Int) -> Array[UInt16]

    Mark all timed-out exchanges as failed and return their transaction ids.

    Client::failed_count

    fn Client::failed_count(self : Client) -> Int

    Client::mode

    fn Client::mode(self : Client) -> Mode

    Client::new

    fn Client::new(mode : Mode, config? : ClientConfig) -> Client

    Client::next_transaction

    fn Client::next_transaction(self : Client) -> UInt16

    Client::pending_active

    fn Client::pending_active(self : Client) -> Int

    Client::pending_request

    fn Client::pending_request(self : Client, transaction_id : UInt16) -> PendingExchange?

    Find a pending request by transaction id.

    Client::pending_snapshot

    fn Client::pending_snapshot(self : Client) -> Array[PendingExchange]

    Return a copy of all pending records for an external scheduler.

    Client::retry_due

    fn Client::retry_due(self : Client, now : Int) -> Array[UInt16]

    Return pending exchanges that can be retried at a logical tick.

    ClientConfig

    pub(all) struct ClientConfig {
    timeout_ticks : Int
    retries : Int
    max_pending : Int
    strict_unit : Bool
    }

    Client retry and framing policy.

    ClientRequest

    pub(all) struct ClientRequest {
    transaction_id : UInt16
    frame : Frame
    bytes : Array[Byte]
    }

    A request prepared for a transport adapter.

    ClientRequest::encoded_length

    fn ClientRequest::encoded_length(self : ClientRequest) -> Int

    ClientResult

    pub(all) enum ClientResult {
    Success(Frame)
    Exception(ExceptionCode)
    }

    A decoded client result with a typed success/exception branch.

    CoilBank

    pub(all) struct CoilBank {
    start : UInt16
    bits : BitVector
    writable : Bool
    }

    A bounded coil/discrete-input bank backed by a bit vector.

    CoilBank::clear

    fn CoilBank::clear(self : CoilBank) -> Unit

    CoilBank::contains

    fn CoilBank::contains(self : CoilBank, address : UInt16, quantity : Int) -> Bool

    CoilBank::fill

    fn CoilBank::fill(self : CoilBank, value : Bool) -> Unit

    CoilBank::get

    fn CoilBank::get(self : CoilBank, address : UInt16) -> Result[Bool, ModbusError]

    CoilBank::is_writable

    fn CoilBank::is_writable(self : CoilBank) -> Bool

    CoilBank::length

    fn CoilBank::length(self : CoilBank) -> Int

    CoilBank::new

    fn CoilBank::new(start : UInt16, length : Int, writable? : Bool) -> Result[CoilBank, ModbusError]

    CoilBank::read

    fn CoilBank::read(self : CoilBank, address : UInt16, quantity : Int) -> Result[Array[Bool], ModbusError]

    CoilBank::set

    fn CoilBank::set(self : CoilBank, address : UInt16, value : Bool) -> Result[Unit, ModbusError]

    CoilBank::snapshot

    fn CoilBank::snapshot(self : CoilBank) -> Array[Bool]

    CoilBank::snapshot_bytes

    fn CoilBank::snapshot_bytes(self : CoilBank) -> Array[Byte]

    CoilBank::start

    fn CoilBank::start(self : CoilBank) -> UInt16

    CoilBank::write

    fn CoilBank::write(self : CoilBank, address : UInt16, values : Array[Bool]) -> Result[Unit, ModbusError]

    CommandArgument

    pub(all) struct CommandArgument {
    key : String
    value : String
    }

    A typed key/value argument supplied by a UI, rule, or automation.

    CommandArgument::as_bool

    fn CommandArgument::as_bool(self : CommandArgument) -> Result[Bool, ModbusError]

    CommandArgument::as_int

    fn CommandArgument::as_int(self : CommandArgument) -> Result[Int, ModbusError]

    CommandArgument::key

    fn CommandArgument::key(self : CommandArgument) -> String

    CommandArgument::new

    fn CommandArgument::new(key : String, value : String) -> Result[CommandArgument, ModbusError]

    CommandArgument::value

    fn CommandArgument::value(self : CommandArgument) -> String

    CommandAuditEntry

    pub(all) struct CommandAuditEntry {
    sequence : Int
    command_id : String
    principal : String
    device_id : String
    operation : String
    state : DeviceCommandState
    timestamp : Int
    detail : String
    }

    Immutable audit event for compliance exports.

    CommandAuditEntry::command_id

    fn CommandAuditEntry::command_id(self : CommandAuditEntry) -> String

    CommandAuditEntry::detail

    fn CommandAuditEntry::detail(self : CommandAuditEntry) -> String

    CommandAuditEntry::device_id

    fn CommandAuditEntry::device_id(self : CommandAuditEntry) -> String

    CommandAuditEntry::new

    fn CommandAuditEntry::new(sequence : Int, command : DeviceCommand, state : DeviceCommandState, timestamp : Int, detail? : String) -> Result[CommandAuditEntry, ModbusError]

    CommandAuditEntry::operation

    fn CommandAuditEntry::operation(self : CommandAuditEntry) -> String

    CommandAuditEntry::principal

    fn CommandAuditEntry::principal(self : CommandAuditEntry) -> String

    CommandAuditEntry::sequence

    fn CommandAuditEntry::sequence(self : CommandAuditEntry) -> Int

    CommandAuditEntry::state

    CommandAuditEntry::timestamp

    fn CommandAuditEntry::timestamp(self : CommandAuditEntry) -> Int

    CommandCenter

    pub(all) struct CommandCenter {
    queue : Array[DeviceCommand]
    completed : Array[CommandExecution]
    audit : Array[CommandAuditEntry]
    max_queue : Int
    max_audit : Int
    sequence : Int
    }

    Central queue and audit log used by a control-plane service.

    CommandCenter::audit_count

    fn CommandCenter::audit_count(self : CommandCenter) -> Int

    CommandCenter::cancel

    fn CommandCenter::cancel(self : CommandCenter, command_id : String, timestamp : Int) -> Result[Unit, ModbusError]

    CommandCenter::completed_count

    fn CommandCenter::completed_count(self : CommandCenter) -> Int

    CommandCenter::find_audit

    fn CommandCenter::find_audit(self : CommandCenter, command_id : String) -> Array[CommandAuditEntry]

    CommandCenter::finish

    fn CommandCenter::finish(self : CommandCenter, command : DeviceCommand, execution : CommandExecution) -> Result[Unit, ModbusError]

    Complete a dispatched command and retain its result for inspection.

    CommandCenter::new

    fn CommandCenter::new(max_queue? : Int, max_audit? : Int) -> Result[CommandCenter, ModbusError]

    CommandCenter::next

    fn CommandCenter::next(self : CommandCenter, timestamp : Int) -> Result[DeviceCommand, ModbusError]

    CommandCenter::queue_count

    fn CommandCenter::queue_count(self : CommandCenter) -> Int

    CommandCenter::recent

    fn CommandCenter::recent(self : CommandCenter, limit : Int) -> Result[Array[CommandAuditEntry], ModbusError]

    CommandCenter::state_counts

    fn CommandCenter::state_counts(self : CommandCenter) -> Array[Int]

    CommandCenter::submit

    fn CommandCenter::submit(self : CommandCenter, command : DeviceCommand, timestamp : Int) -> Result[Unit, ModbusError]

    CommandExecution

    pub(all) struct CommandExecution {
    command_id : String
    state : DeviceCommandState
    started_at : Int
    finished_at : Int
    response : Frame?
    error : ModbusError?
    message : String
    }

    Result returned by a transport or a simulated execution backend.

    CommandExecution::command_id

    fn CommandExecution::command_id(self : CommandExecution) -> String

    CommandExecution::duration

    fn CommandExecution::duration(self : CommandExecution) -> Int

    CommandExecution::error

    CommandExecution::finished_at

    fn CommandExecution::finished_at(self : CommandExecution) -> Int

    CommandExecution::message

    fn CommandExecution::message(self : CommandExecution) -> String

    CommandExecution::new

    fn CommandExecution::new(command_id : String, state : DeviceCommandState, started_at : Int, finished_at : Int, response? : Frame, error? : ModbusError, message? : String) -> Result[CommandExecution, ModbusError]

    CommandExecution::response

    fn CommandExecution::response(self : CommandExecution) -> Frame?

    CommandExecution::started_at

    fn CommandExecution::started_at(self : CommandExecution) -> Int

    CommandExecution::state

    ConfigEntry

    pub(all) struct ConfigEntry {
    key : String
    value : ConfigValue
    source : String
    revision : Int
    }

    A key/value pair in a runtime configuration snapshot.

    ConfigEntry::display

    fn ConfigEntry::display(self : ConfigEntry, redact? : Bool) -> String

    ConfigEntry::key

    fn ConfigEntry::key(self : ConfigEntry) -> String

    ConfigEntry::new

    fn ConfigEntry::new(key : String, value : ConfigValue, source? : String, revision? : Int) -> Result[ConfigEntry, ModbusError]

    ConfigEntry::revision

    fn ConfigEntry::revision(self : ConfigEntry) -> Int

    ConfigEntry::source

    fn ConfigEntry::source(self : ConfigEntry) -> String

    ConfigEntry::value

    fn ConfigEntry::value(self : ConfigEntry) -> ConfigValue

    ConfigKind

    pub(all) enum ConfigKind {
    Text
    Integer
    Boolean
    ModeValue
    ByteSequence
    } derive(Eq,
    Debug
    )

    Type constraint for a runtime configuration key.

    ConfigOperation

    pub(all) enum ConfigOperation {
    SetValue(String, ConfigValue)
    RemoveValue(String)
    } derive(
    Debug
    )

    A change applied to a runtime configuration.

    ConfigSchema

    pub(all) struct ConfigSchema {
    specs : Array[ConfigSpec]
    max_specs : Int
    }

    A collection of configuration specifications.

    ConfigSchema::add

    fn ConfigSchema::add(self : ConfigSchema, spec : ConfigSpec) -> Result[Unit, ModbusError]

    ConfigSchema::find

    fn ConfigSchema::find(self : ConfigSchema, key : String) -> ConfigSpec?

    ConfigSchema::get

    fn ConfigSchema::get(self : ConfigSchema, index : Int) -> Result[ConfigSpec, ModbusError]

    ConfigSchema::length

    fn ConfigSchema::length(self : ConfigSchema) -> Int

    ConfigSchema::new

    fn ConfigSchema::new(max_specs? : Int) -> Result[ConfigSchema, ModbusError]

    ConfigSchema::snapshot

    fn ConfigSchema::snapshot(self : ConfigSchema) -> Array[ConfigSpec]

    ConfigSchema::validate_values

    fn ConfigSchema::validate_values(self : ConfigSchema, values : Array[ConfigEntry]) -> Result[Unit, ModbusError]

    ConfigSpec

    pub(all) struct ConfigSpec {
    key : String
    kind : ConfigKind
    required : Bool
    default_value : ConfigValue?
    min_integer : Int?
    max_integer : Int?
    min_length : Int
    max_length : Int
    secret : Bool
    description : String
    }

    A schema entry describing a single configurable field.

    ConfigSpec::default_value

    fn ConfigSpec::default_value(self : ConfigSpec) -> ConfigValue?

    ConfigSpec::description

    fn ConfigSpec::description(self : ConfigSpec) -> String

    ConfigSpec::key

    fn ConfigSpec::key(self : ConfigSpec) -> String

    ConfigSpec::kind

    fn ConfigSpec::kind(self : ConfigSpec) -> ConfigKind

    ConfigSpec::new

    fn ConfigSpec::new(key : String, kind : ConfigKind, required? : Bool, default_value? : ConfigValue, min_integer? : Int, max_integer? : Int, min_length? : Int, max_length? : Int, secret? : Bool, description? : String) -> Result[ConfigSpec, ModbusError]

    ConfigSpec::required

    fn ConfigSpec::required(self : ConfigSpec) -> Bool

    ConfigSpec::secret

    fn ConfigSpec::secret(self : ConfigSpec) -> Bool

    ConfigSpec::summary

    fn ConfigSpec::summary(self : ConfigSpec) -> String

    ConfigSpec::validate

    fn ConfigSpec::validate(self : ConfigSpec, value : ConfigValue) -> Result[Unit, ModbusError]

    ConfigValue

    pub(all) enum ConfigValue {
    TextValue(String)
    IntegerValue(Int)
    BooleanValue(Bool)
    ModeValue(Mode)
    ByteSequenceValue(Array[Byte])
    } derive(
    Debug
    )

    A configuration value represented without a dynamic runtime dependency.

    ConfigValue::as_boolean

    fn ConfigValue::as_boolean(self : ConfigValue) -> Result[Bool, ModbusError]

    ConfigValue::as_bytes

    fn ConfigValue::as_bytes(self : ConfigValue) -> Result[Array[Byte], ModbusError]

    ConfigValue::as_integer

    fn ConfigValue::as_integer(self : ConfigValue) -> Result[Int, ModbusError]

    ConfigValue::as_mode

    fn ConfigValue::as_mode(self : ConfigValue) -> Result[Mode, ModbusError]

    ConfigValue::as_text

    fn ConfigValue::as_text(self : ConfigValue) -> Result[String, ModbusError]

    ConfigValue::display

    fn ConfigValue::display(self : ConfigValue, redact? : Bool) -> String

    ConfigValue::kind

    fn ConfigValue::kind(self : ConfigValue) -> ConfigKind

    ConformanceResult

    pub(all) struct ConformanceResult {
    name : String
    passed : Bool
    detail : String
    }

    A vector execution result.

    ConformanceSuite

    pub struct ConformanceSuite {
    vectors : Array[ConformanceVector]
    }

    A reusable conformance suite.

    ConformanceSuite::add

    fn ConformanceSuite::add(self : ConformanceSuite, vector : ConformanceVector) -> Unit

    ConformanceSuite::length

    fn ConformanceSuite::length(self : ConformanceSuite) -> Int

    ConformanceSuite::new

    ConformanceSuite::run

    ConformanceVector

    pub(all) struct ConformanceVector {
    name : String
    mode : Mode
    bytes : Array[Byte]
    expected_function : Byte?
    expected_error : ModbusError?
    }

    A portable conformance vector for transport and frame decoders.

    ConformanceVector::invalid

    fn ConformanceVector::invalid(name : String, mode : Mode, bytes : Array[Byte], expected_error : ModbusError) -> ConformanceVector

    ConformanceVector::valid

    fn ConformanceVector::valid(name : String, mode : Mode, bytes : Array[Byte], expected_function : Byte) -> ConformanceVector

    ContractResult

    pub(all) enum ContractResult {
    ContractPass
    ContractUnitMismatch
    ContractFunctionMismatch
    ContractLengthMismatch
    ContractDataMismatch
    ContractException
    } derive(Eq,
    Debug
    )

    Contract check result for a request/response pair.

    Counter

    pub(all) struct Counter {
    name : String
    value : Int
    }

    A small integer counter used for protocol telemetry.

    Counter::add

    fn Counter::add(self : Counter, amount : Int) -> Result[Unit, ModbusError]

    Counter::inc

    fn Counter::inc(self : Counter) -> Unit

    Counter::name

    fn Counter::name(self : Counter) -> String

    Counter::new

    fn Counter::new(name : String) -> Counter

    Counter::reset

    fn Counter::reset(self : Counter) -> Unit

    Counter::value

    fn Counter::value(self : Counter) -> Int

    Crc16State

    pub(all) struct Crc16State {
    value : UInt16
    }

    Incremental CRC16 accumulator for serial readers.

    Crc16State::finalize

    fn Crc16State::finalize(self : Crc16State) -> UInt16

    Crc16State::finalize_bytes

    fn Crc16State::finalize_bytes(self : Crc16State) -> Array[Byte]

    Crc16State::new

    fn Crc16State::new() -> Crc16State

    Crc16State::update

    fn Crc16State::update(self : Crc16State, bytes : Array[Byte]) -> Unit

    Crc16State::update_byte

    fn Crc16State::update_byte(self : Crc16State, byte : Byte) -> Unit

    Device

    pub struct Device {
    unit_id : Byte
    memory : DeviceMemory
    file_store : FileRecordStore
    server_id : Array[Byte]
    event_count : UInt16
    busy : Bool
    exception_count : Int
    }

    A protocol-level Modbus device backed by four bounded data tables.

    Device::event_count

    fn Device::event_count(self : Device) -> UInt16

    Device::exception_count

    fn Device::exception_count(self : Device) -> Int

    Device::file_store

    fn Device::file_store(self : Device) -> FileRecordStore

    Device::handle

    fn Device::handle(self : Device, request : Frame) -> Result[Frame, ModbusError]

    Handle a request and return a normal or exception response.

    Device::health

    fn Device::health(self : Device) -> DeviceHealth

    Device::is_busy

    fn Device::is_busy(self : Device) -> Bool

    Device::memory

    fn Device::memory(self : Device) -> DeviceMemory

    Device::new

    fn Device::new(unit_id : Byte, coil_capacity? : Int, register_capacity? : Int) -> Result[Device, ModbusError]

    Create a device with configurable table capacities.

    Device::serve

    fn Device::serve(self : Device, request : Frame) -> Result[DeviceResponse, ModbusError]

    Handle a request while making broadcast no-response semantics explicit.

    Device::server_id

    fn Device::server_id(self : Device) -> Array[Byte]

    Device::set_busy

    fn Device::set_busy(self : Device, busy : Bool) -> Unit

    Device::set_server_id

    fn Device::set_server_id(self : Device, values : Array[Byte]) -> Result[Unit, ModbusError]

    Device::unit_id

    fn Device::unit_id(self : Device) -> Byte

    DeviceCommand

    pub(all) struct DeviceCommand {
    id : String
    device_id : String
    unit_id : Byte
    kind : DeviceCommandKind
    function : Byte
    address : UInt16
    quantity : Int
    arguments : Array[CommandArgument]
    principal : String
    reason : String
    timeout : Int
    state : DeviceCommandState
    created_at : Int
    }

    Definition and authorization context for one device operation.

    DeviceCommand::add_argument

    fn DeviceCommand::add_argument(self : DeviceCommand, argument : CommandArgument) -> Result[Unit, ModbusError]

    DeviceCommand::address

    fn DeviceCommand::address(self : DeviceCommand) -> UInt16

    DeviceCommand::argument

    fn DeviceCommand::argument(self : DeviceCommand, key : String) -> CommandArgument?

    DeviceCommand::argument_count

    fn DeviceCommand::argument_count(self : DeviceCommand) -> Int

    DeviceCommand::created_at

    fn DeviceCommand::created_at(self : DeviceCommand) -> Int

    DeviceCommand::device_id

    fn DeviceCommand::device_id(self : DeviceCommand) -> String

    DeviceCommand::function

    fn DeviceCommand::function(self : DeviceCommand) -> Byte

    DeviceCommand::id

    fn DeviceCommand::id(self : DeviceCommand) -> String

    DeviceCommand::is_terminal

    fn DeviceCommand::is_terminal(self : DeviceCommand) -> Bool

    DeviceCommand::is_write

    fn DeviceCommand::is_write(self : DeviceCommand) -> Bool

    DeviceCommand::kind

    DeviceCommand::new

    fn DeviceCommand::new(id : String, device_id : String, unit_id : Byte, kind : DeviceCommandKind, function : Byte, address : UInt16, quantity : Int, principal : String, reason : String, created_at : Int, timeout? : Int) -> Result[DeviceCommand, ModbusError]

    DeviceCommand::principal

    fn DeviceCommand::principal(self : DeviceCommand) -> String

    DeviceCommand::quantity

    fn DeviceCommand::quantity(self : DeviceCommand) -> Int

    DeviceCommand::reason

    fn DeviceCommand::reason(self : DeviceCommand) -> String

    DeviceCommand::request

    fn DeviceCommand::request(self : DeviceCommand) -> Result[Frame, ModbusError]

    Build a PDU for commands represented directly by standard Modbus writes.

    DeviceCommand::set_state

    fn DeviceCommand::set_state(self : DeviceCommand, state : DeviceCommandState) -> Result[Unit, ModbusError]

    DeviceCommand::state

    DeviceCommand::timeout

    fn DeviceCommand::timeout(self : DeviceCommand) -> Int

    DeviceCommand::unit_id

    fn DeviceCommand::unit_id(self : DeviceCommand) -> Byte

    DeviceCommand::verify_address

    fn DeviceCommand::verify_address(self : DeviceCommand) -> Bool

    DeviceCommandKind

    pub(all) enum DeviceCommandKind {
    WriteCoilCommand
    WriteRegisterCommand
    WriteCoilsCommand
    WriteRegistersCommand
    ReadVerificationCommand
    ClearAlarmCommand
    RestartDeviceCommand
    CustomCommand
    } derive(Eq,
    Debug
    )

    Kind of operator command accepted by the control plane.

    DeviceCommandState

    pub(all) enum DeviceCommandState {
    Queued
    Validating
    Dispatched
    Acknowledged
    Rejected
    TimedOut
    FailedCommand
    CancelledCommand
    } derive(Eq,
    Debug
    )

    Lifecycle of a command from admission to audit completion.

    DeviceHealth

    pub(all) struct DeviceHealth {
    unit_id : Byte
    event_count : UInt16
    exception_count : Int
    busy : Bool
    }

    A compact device health snapshot for dashboards and polling logs.

    DeviceIdCategory

    pub(all) enum DeviceIdCategory {
    Basic
    Regular
    Extended
    Individual(Byte)
    } derive(Eq,
    Debug
    )

    Device-identification access category used by MEI type 0x0E.

    DeviceIdCategory::to_byte

    fn DeviceIdCategory::to_byte(category : DeviceIdCategory) -> Byte

    DeviceIdObject

    pub(all) struct DeviceIdObject {
    object_id : Byte
    value : String
    }

    One TLV object returned by a device-identification response.

    DeviceIdObject::new

    fn DeviceIdObject::new(object_id : Byte, value : String) -> Result[DeviceIdObject, ModbusError]

    DeviceIdentification

    pub(all) struct DeviceIdentification {
    category : DeviceIdCategory
    conformity : Byte
    more_follows : Bool
    next_object_id : Byte
    objects : Array[DeviceIdObject]
    }

    Parsed MEI device-identification response metadata.

    DeviceIdentityCatalog

    pub struct DeviceIdentityCatalog {
    category : DeviceIdCategory
    objects : Array[DeviceIdObject]
    conformity : Byte
    }

    A reusable identity catalogue for virtual devices.

    DeviceIdentityCatalog::add

    fn DeviceIdentityCatalog::add(self : DeviceIdentityCatalog, object : DeviceIdObject) -> Result[Unit, ModbusError]

    DeviceIdentityCatalog::length

    DeviceIdentityCatalog::new

    DeviceIdentityCatalog::objects

    DeviceIdentityCatalog::response

    fn DeviceIdentityCatalog::response(self : DeviceIdentityCatalog, request : Frame) -> Result[Frame, ModbusError]

    DeviceIdentityCatalog::set_conformity

    fn DeviceIdentityCatalog::set_conformity(self : DeviceIdentityCatalog, conformity : Byte) -> Unit

    DeviceInventory

    pub(all) struct DeviceInventory {
    devices : Array[InventoryDevice]
    max_devices : Int
    revision : Int
    }

    A fleet inventory with lookup and stale-device reporting.

    DeviceInventory::add

    fn DeviceInventory::add(self : DeviceInventory, device : InventoryDevice) -> Result[Unit, ModbusError]

    DeviceInventory::by_state

    fn DeviceInventory::by_state(self : DeviceInventory, state : InventoryState) -> Array[String]

    Return devices by lifecycle state.

    DeviceInventory::by_tag

    fn DeviceInventory::by_tag(self : DeviceInventory, tag : String) -> Array[String]

    DeviceInventory::by_vendor

    fn DeviceInventory::by_vendor(self : DeviceInventory, vendor : String) -> Array[String]

    DeviceInventory::count

    fn DeviceInventory::count(self : DeviceInventory) -> Int

    DeviceInventory::export_lines

    fn DeviceInventory::export_lines(self : DeviceInventory) -> Array[String]

    Stable tabular export for provisioning and support tools.

    DeviceInventory::get

    fn DeviceInventory::get(self : DeviceInventory, id : String) -> InventoryDevice?

    DeviceInventory::mark_stale

    fn DeviceInventory::mark_stale(self : DeviceInventory, now : Int, timeout : Int) -> Result[Int, ModbusError]

    Mark devices stale or offline using one common fleet timestamp.

    DeviceInventory::new

    fn DeviceInventory::new(max_devices? : Int) -> Result[DeviceInventory, ModbusError]

    DeviceInventory::remove

    fn DeviceInventory::remove(self : DeviceInventory, id : String) -> Result[InventoryDevice, ModbusError]

    DeviceInventory::revision

    fn DeviceInventory::revision(self : DeviceInventory) -> Int

    DeviceMemory

    pub(all) struct DeviceMemory {
    coils : CoilBank
    discrete_inputs : CoilBank
    input_registers : RegisterBank
    holding_registers : RegisterBank
    }

    The four standard Modbus data tables exposed by a device.

    DeviceMemory::clear

    fn DeviceMemory::clear(self : DeviceMemory) -> Unit

    DeviceMemory::coils

    fn DeviceMemory::coils(self : DeviceMemory) -> CoilBank

    DeviceMemory::discrete_inputs

    fn DeviceMemory::discrete_inputs(self : DeviceMemory) -> CoilBank

    DeviceMemory::holding_registers

    fn DeviceMemory::holding_registers(self : DeviceMemory) -> RegisterBank

    DeviceMemory::input_registers

    fn DeviceMemory::input_registers(self : DeviceMemory) -> RegisterBank

    DeviceMemory::load_discrete

    fn DeviceMemory::load_discrete(self : DeviceMemory, address : UInt16, values : Array[Bool]) -> Result[Unit, ModbusError]

    DeviceMemory::load_holding

    fn DeviceMemory::load_holding(self : DeviceMemory, address : UInt16, values : Array[UInt16]) -> Result[Unit, ModbusError]

    DeviceMemory::load_input

    fn DeviceMemory::load_input(self : DeviceMemory, address : UInt16, values : Array[UInt16]) -> Result[Unit, ModbusError]

    DeviceMemory::new

    fn DeviceMemory::new(coil_capacity? : Int, register_capacity? : Int) -> Result[DeviceMemory, ModbusError]

    Create a device memory map with all tables starting at address zero.

    DeviceProfile

    pub(all) struct DeviceProfile {
    name : String
    model : String
    unit_id : Byte
    revision : String
    points : Array[ProfilePoint]
    max_points : Int
    }

    A named set of points belonging to one device model.

    DeviceProfile::add_point

    fn DeviceProfile::add_point(self : DeviceProfile, point : ProfilePoint) -> Result[Unit, ModbusError]

    DeviceProfile::find

    fn DeviceProfile::find(self : DeviceProfile, id : String) -> ProfilePoint?

    DeviceProfile::model

    fn DeviceProfile::model(self : DeviceProfile) -> String

    DeviceProfile::name

    fn DeviceProfile::name(self : DeviceProfile) -> String

    DeviceProfile::new

    fn DeviceProfile::new(name : String, model : String, unit_id : Byte, revision? : String, max_points? : Int) -> Result[DeviceProfile, ModbusError]

    DeviceProfile::point

    fn DeviceProfile::point(self : DeviceProfile, index : Int) -> Result[ProfilePoint, ModbusError]

    DeviceProfile::point_count

    fn DeviceProfile::point_count(self : DeviceProfile) -> Int

    DeviceProfile::points

    DeviceProfile::points_in_area

    fn DeviceProfile::points_in_area(self : DeviceProfile, area : ProfileArea) -> Array[ProfilePoint]

    DeviceProfile::read_requests

    fn DeviceProfile::read_requests(self : DeviceProfile) -> Result[Array[Frame], ModbusError]

    DeviceProfile::remove_point

    fn DeviceProfile::remove_point(self : DeviceProfile, id : String) -> Result[ProfilePoint, ModbusError]

    DeviceProfile::revision

    fn DeviceProfile::revision(self : DeviceProfile) -> String

    DeviceProfile::summary

    fn DeviceProfile::summary(self : DeviceProfile) -> String

    DeviceProfile::unit_id

    fn DeviceProfile::unit_id(self : DeviceProfile) -> Byte

    DeviceProfile::validate

    fn DeviceProfile::validate(self : DeviceProfile) -> Result[Unit, ModbusError]

    DeviceProfile::writable_points

    fn DeviceProfile::writable_points(self : DeviceProfile) -> Array[ProfilePoint]

    DeviceReliability

    pub(all) struct DeviceReliability {
    device_id : String
    window : ReliabilityWindow
    circuit : CircuitGuard
    last_seen : Int?
    total_requests : Int
    total_successes : Int
    }

    Current availability and latency indicators for a device.

    DeviceReliability::allow_request

    fn DeviceReliability::allow_request(self : DeviceReliability, now : Int) -> Result[Bool, ModbusError]

    DeviceReliability::average_latency

    fn DeviceReliability::average_latency(self : DeviceReliability) -> Int

    DeviceReliability::device_id

    fn DeviceReliability::device_id(self : DeviceReliability) -> String

    DeviceReliability::failure_breakdown

    fn DeviceReliability::failure_breakdown(self : DeviceReliability) -> Array[Int]

    DeviceReliability::health_score

    fn DeviceReliability::health_score(self : DeviceReliability, now : Int) -> Result[Int, ModbusError]

    Return a health score from 0 (offline) to 100 (healthy).

    DeviceReliability::last_seen

    fn DeviceReliability::last_seen(self : DeviceReliability) -> Int?

    DeviceReliability::new

    fn DeviceReliability::new(device_id : String, window_width : Int, failure_threshold : Int, recovery_after : Int) -> Result[DeviceReliability, ModbusError]

    DeviceReliability::record

    fn DeviceReliability::record(self : DeviceReliability, sample : ReliabilitySample) -> Result[Unit, ModbusError]

    Record one outcome and update breaker state atomically from the caller's view.

    DeviceReliability::state

    DeviceReliability::success_rate

    fn DeviceReliability::success_rate(self : DeviceReliability) -> Int

    DeviceReliability::total_requests

    fn DeviceReliability::total_requests(self : DeviceReliability) -> Int

    DeviceReliability::total_successes

    fn DeviceReliability::total_successes(self : DeviceReliability) -> Int

    DeviceResponse

    pub(all) enum DeviceResponse {
    Reply(Frame)
    NoReply
    }

    A response returned by a virtual or embedded device service.

    DeviceService

    pub(all) struct DeviceService {
    id : String
    device_id : String
    kind : DeviceServiceKind
    endpoint : String
    state : DeviceServiceState
    started_at : Int?
    stopped_at : Int?
    restart_count : Int
    tags : Array[String]
    }

    Registration record for a long-lived device-facing service.

    DeviceService::add_tag

    fn DeviceService::add_tag(self : DeviceService, tag : String) -> Result[Unit, ModbusError]

    DeviceService::device_id

    fn DeviceService::device_id(self : DeviceService) -> String

    DeviceService::drain

    fn DeviceService::drain(self : DeviceService) -> Result[Unit, ModbusError]

    DeviceService::endpoint

    fn DeviceService::endpoint(self : DeviceService) -> String

    DeviceService::fail

    fn DeviceService::fail(self : DeviceService, timestamp : Int) -> Result[Unit, ModbusError]

    DeviceService::id

    fn DeviceService::id(self : DeviceService) -> String

    DeviceService::kind

    DeviceService::new

    fn DeviceService::new(id : String, device_id : String, kind : DeviceServiceKind, endpoint : String) -> Result[DeviceService, ModbusError]

    DeviceService::restart

    fn DeviceService::restart(self : DeviceService, timestamp : Int) -> Result[Unit, ModbusError]

    DeviceService::restart_count

    fn DeviceService::restart_count(self : DeviceService) -> Int

    DeviceService::start

    fn DeviceService::start(self : DeviceService, timestamp : Int) -> Result[Unit, ModbusError]

    DeviceService::started_at

    fn DeviceService::started_at(self : DeviceService) -> Int?

    DeviceService::state

    DeviceService::stop

    fn DeviceService::stop(self : DeviceService, timestamp : Int) -> Result[Unit, ModbusError]

    DeviceService::stopped_at

    fn DeviceService::stopped_at(self : DeviceService) -> Int?

    DeviceService::tag_count

    fn DeviceService::tag_count(self : DeviceService) -> Int

    DeviceServiceKind

    pub(all) enum DeviceServiceKind {
    PollingService
    CommandService
    AlarmService
    HistorianService
    GatewayService
    DiagnosticsService
    } derive(Eq,
    Debug
    )

    Kind of service hosted by the integration layer.

    DeviceServiceRegistry

    pub(all) struct DeviceServiceRegistry {
    services : Array[DeviceService]
    snapshots : Array[DeviceSnapshot]
    max_services : Int
    max_snapshots : Int
    }

    Registry for services and latest snapshots.

    DeviceServiceRegistry::export_summary

    fn DeviceServiceRegistry::export_summary(self : DeviceServiceRegistry) -> Array[String]

    Return a stable line-oriented snapshot for diagnostics and support bundles.

    DeviceServiceRegistry::failed

    fn DeviceServiceRegistry::failed(self : DeviceServiceRegistry) -> Array[String]

    DeviceServiceRegistry::for_device

    fn DeviceServiceRegistry::for_device(self : DeviceServiceRegistry, device_id : String) -> Array[DeviceService]

    DeviceServiceRegistry::new

    fn DeviceServiceRegistry::new(max_services? : Int, max_snapshots? : Int) -> Result[DeviceServiceRegistry, ModbusError]

    DeviceServiceRegistry::put_snapshot

    fn DeviceServiceRegistry::put_snapshot(self : DeviceServiceRegistry, snapshot : DeviceSnapshot) -> Result[Unit, ModbusError]

    DeviceServiceRegistry::register

    fn DeviceServiceRegistry::register(self : DeviceServiceRegistry, service : DeviceService) -> Result[Unit, ModbusError]

    DeviceServiceRegistry::running

    fn DeviceServiceRegistry::running(self : DeviceServiceRegistry) -> Array[String]

    DeviceServiceRegistry::service

    fn DeviceServiceRegistry::service(self : DeviceServiceRegistry, id : String) -> DeviceService?

    DeviceServiceRegistry::service_count

    fn DeviceServiceRegistry::service_count(self : DeviceServiceRegistry) -> Int

    DeviceServiceRegistry::snapshot

    fn DeviceServiceRegistry::snapshot(self : DeviceServiceRegistry, device_id : String) -> DeviceSnapshot?

    DeviceServiceRegistry::snapshot_count

    fn DeviceServiceRegistry::snapshot_count(self : DeviceServiceRegistry) -> Int

    DeviceServiceState

    pub(all) enum DeviceServiceState {
    ServiceCreated
    ServiceStarting
    ServiceRunning
    ServiceDraining
    ServiceStopped
    ServiceFailed
    } derive(Eq,
    Debug
    )

    Lifecycle of an application service attached to a device.

    DeviceSnapshot

    pub(all) struct DeviceSnapshot {
    device_id : String
    captured_at : Int
    values : Array[SnapshotValue]
    sequence : Int
    complete : Bool
    }

    A consistent set of point values from one acquisition cycle.

    DeviceSnapshot::add

    fn DeviceSnapshot::add(self : DeviceSnapshot, value : SnapshotValue) -> Result[Unit, ModbusError]

    DeviceSnapshot::captured_at

    fn DeviceSnapshot::captured_at(self : DeviceSnapshot) -> Int

    DeviceSnapshot::complete

    fn DeviceSnapshot::complete(self : DeviceSnapshot) -> Bool

    DeviceSnapshot::device_id

    fn DeviceSnapshot::device_id(self : DeviceSnapshot) -> String

    DeviceSnapshot::diff

    fn DeviceSnapshot::diff(self : DeviceSnapshot, previous : DeviceSnapshot) -> Array[String]

    DeviceSnapshot::finish

    fn DeviceSnapshot::finish(self : DeviceSnapshot, expected : Int) -> Result[Unit, ModbusError]

    DeviceSnapshot::get

    fn DeviceSnapshot::get(self : DeviceSnapshot, point_id : String) -> SnapshotValue?

    DeviceSnapshot::good_count

    fn DeviceSnapshot::good_count(self : DeviceSnapshot) -> Int

    DeviceSnapshot::new

    fn DeviceSnapshot::new(device_id : String, captured_at : Int, sequence : Int) -> Result[DeviceSnapshot, ModbusError]

    DeviceSnapshot::quality

    DeviceSnapshot::sequence

    fn DeviceSnapshot::sequence(self : DeviceSnapshot) -> Int

    DeviceSnapshot::value_count

    fn DeviceSnapshot::value_count(self : DeviceSnapshot) -> Int

    DiagnosticCategory

    pub(all) enum DiagnosticCategory {
    Framing
    Addressing
    FunctionSupport
    Payload
    Timing
    Capacity
    Configuration
    Interoperability
    } derive(Eq,
    Debug
    )

    Category assigned to a diagnostic finding.

    DiagnosticIssue

    pub(all) struct DiagnosticIssue {
    code : String
    category : DiagnosticCategory
    severity : DiagnosticSeverity
    message : String
    context : String
    suggestion : String
    }

    One actionable finding from a diagnostic pass.

    DiagnosticIssue::category

    DiagnosticIssue::code

    fn DiagnosticIssue::code(self : DiagnosticIssue) -> String

    DiagnosticIssue::context

    fn DiagnosticIssue::context(self : DiagnosticIssue) -> String

    DiagnosticIssue::message

    fn DiagnosticIssue::message(self : DiagnosticIssue) -> String

    DiagnosticIssue::new

    fn DiagnosticIssue::new(code : String, category : DiagnosticCategory, severity : DiagnosticSeverity, message : String, context? : String, suggestion? : String) -> Result[DiagnosticIssue, ModbusError]

    DiagnosticIssue::severity

    DiagnosticIssue::suggestion

    fn DiagnosticIssue::suggestion(self : DiagnosticIssue) -> String

    DiagnosticIssue::summary

    fn DiagnosticIssue::summary(self : DiagnosticIssue) -> String

    DiagnosticReport

    pub(all) struct DiagnosticReport {
    name : String
    issues : Array[DiagnosticIssue]
    max_issues : Int
    inspected : Int
    }

    A report collected from one or more protocol checks.

    DiagnosticReport::add

    fn DiagnosticReport::add(self : DiagnosticReport, issue : DiagnosticIssue) -> Result[Unit, ModbusError]

    DiagnosticReport::clear

    fn DiagnosticReport::clear(self : DiagnosticReport) -> Unit

    DiagnosticReport::count_category

    fn DiagnosticReport::count_category(self : DiagnosticReport, category : DiagnosticCategory) -> Int

    DiagnosticReport::count_severity

    fn DiagnosticReport::count_severity(self : DiagnosticReport, severity : DiagnosticSeverity) -> Int

    DiagnosticReport::has_errors

    fn DiagnosticReport::has_errors(self : DiagnosticReport) -> Bool

    DiagnosticReport::has_warnings

    fn DiagnosticReport::has_warnings(self : DiagnosticReport) -> Bool

    DiagnosticReport::inspect_one

    fn DiagnosticReport::inspect_one(self : DiagnosticReport, frame : Frame) -> Result[Unit, ModbusError]

    DiagnosticReport::inspect_wire

    fn DiagnosticReport::inspect_wire(self : DiagnosticReport, mode : Mode, bytes : Array[Byte]) -> Unit

    DiagnosticReport::inspected

    fn DiagnosticReport::inspected(self : DiagnosticReport) -> Int

    DiagnosticReport::issues

    DiagnosticReport::length

    fn DiagnosticReport::length(self : DiagnosticReport) -> Int

    DiagnosticReport::name

    fn DiagnosticReport::name(self : DiagnosticReport) -> String

    DiagnosticReport::new

    fn DiagnosticReport::new(name? : String, max_issues? : Int) -> Result[DiagnosticReport, ModbusError]

    DiagnosticReport::ok

    fn DiagnosticReport::ok(self : DiagnosticReport) -> Bool

    DiagnosticReport::summary

    fn DiagnosticReport::summary(self : DiagnosticReport) -> String

    DiagnosticSeverity

    pub(all) enum DiagnosticSeverity {
    Note
    WarningFinding
    ErrorFinding
    } derive(Eq,
    Debug
    )

    Severity of a diagnostic finding.

    EncodedAdu

    pub(all) struct EncodedAdu {
    mode : Mode
    transaction_id : UInt16
    bytes : Array[Byte]
    }

    An encoded ADU that can be handed to a socket or serial adapter.

    EncodedAdu::bytes

    fn EncodedAdu::bytes(self : EncodedAdu) -> Array[Byte]

    EncodedAdu::decode

    fn EncodedAdu::decode(self : EncodedAdu) -> Result[Frame, ModbusError]

    EncodedAdu::mode

    fn EncodedAdu::mode(self : EncodedAdu) -> Mode

    EncodedAdu::new

    fn EncodedAdu::new(mode : Mode, transaction_id : UInt16, frame : Frame) -> Result[EncodedAdu, ModbusError]

    EncodedAdu::transaction_id

    fn EncodedAdu::transaction_id(self : EncodedAdu) -> UInt16

    EndpointConfig

    pub(all) enum EndpointConfig {
    Serial(SerialConfig)
    Tcp(TcpConfig)
    }

    A transport endpoint configuration.

    EndpointConfig::mode

    fn EndpointConfig::mode(config : EndpointConfig) -> Mode

    EndpointConfig::name

    fn EndpointConfig::name(config : EndpointConfig) -> String

    EndpointHealth

    pub(all) struct EndpointHealth {
    unit_id : Byte
    ready : Bool
    event_count : UInt16
    exceptions : Int
    requests : Int
    responses : Int
    errors : Int
    }

    Aggregated endpoint health used by operations dashboards.

    EndpointRuntime

    pub(all) struct EndpointRuntime {
    config : EndpointConfig
    state : EndpointState
    opened_at : Int
    last_error : ModbusError?
    reconnects : Int
    frames_in : Int
    frames_out : Int
    }

    Runtime state tracked independently from operating-system handles.

    EndpointRuntime::backoff

    fn EndpointRuntime::backoff(self : EndpointRuntime) -> Unit

    EndpointRuntime::close

    fn EndpointRuntime::close(self : EndpointRuntime) -> Unit

    EndpointRuntime::config

    EndpointRuntime::fail

    fn EndpointRuntime::fail(self : EndpointRuntime, error : ModbusError) -> Unit

    EndpointRuntime::frames_in

    fn EndpointRuntime::frames_in(self : EndpointRuntime) -> Int

    EndpointRuntime::frames_out

    fn EndpointRuntime::frames_out(self : EndpointRuntime) -> Int

    EndpointRuntime::last_error

    fn EndpointRuntime::last_error(self : EndpointRuntime) -> ModbusError?

    EndpointRuntime::new

    EndpointRuntime::open

    fn EndpointRuntime::open(self : EndpointRuntime, now : Int) -> Result[Unit, ModbusError]

    EndpointRuntime::reconnects

    fn EndpointRuntime::reconnects(self : EndpointRuntime) -> Int

    EndpointRuntime::record_in

    fn EndpointRuntime::record_in(self : EndpointRuntime) -> Result[Unit, ModbusError]

    EndpointRuntime::record_out

    fn EndpointRuntime::record_out(self : EndpointRuntime) -> Result[Unit, ModbusError]

    EndpointRuntime::state

    EndpointRuntime::uptime

    fn EndpointRuntime::uptime(self : EndpointRuntime, now : Int) -> Int

    EndpointState

    pub(all) enum EndpointState {
    Closed
    Connecting
    Ready
    Backoff
    Faulted
    } derive(Eq,
    Debug
    )

    Lifecycle state of a transport endpoint.

    EngineeringUnit

    pub(all) enum EngineeringUnit {
    Unitless
    Percent
    Celsius
    Fahrenheit
    Pascal
    Kilopascal
    Volt
    Ampere
    Hertz
    Rpm
    Meter
    Millimeter
    LiterPerMinute
    } derive(Eq,
    Debug
    )

    Physical unit associated with an engineering value.

    EventDelivery

    pub(all) enum EventDelivery {
    EventPending
    EventDelivered
    EventFailed
    EventDeadLetter
    } derive(Eq,
    Debug
    )

    Delivery state used by durable event consumers.

    EventSubscription

    pub(all) struct EventSubscription {
    id : String
    source : String?
    kind : ServiceEventKind?
    enabled : Bool
    }

    Subscription filter for one consumer.

    EventSubscription::enabled

    fn EventSubscription::enabled(self : EventSubscription) -> Bool

    EventSubscription::id

    fn EventSubscription::id(self : EventSubscription) -> String

    EventSubscription::matches

    fn EventSubscription::matches(self : EventSubscription, event : ServiceEvent) -> Bool

    EventSubscription::new

    fn EventSubscription::new(id : String, source? : String, kind? : ServiceEventKind) -> Result[EventSubscription, ModbusError]

    EventSubscription::set_enabled

    fn EventSubscription::set_enabled(self : EventSubscription, enabled : Bool) -> Unit

    ExceptionCode

    pub(all) enum ExceptionCode {
    IllegalFunction
    IllegalDataAddress
    IllegalDataValue
    ServerDeviceFailure
    Acknowledge
    ServerDeviceBusy
    NegativeAcknowledge
    MemoryParityError
    GatewayPathUnavailable
    GatewayTargetFailedToRespond
    UnknownException(Byte)
    } derive(Eq,
    Debug
    )

    Standard exception codes returned by a Modbus server.

    ExceptionCode::to_byte

    fn ExceptionCode::to_byte(code : ExceptionCode) -> Byte

    ExchangeEnvelope

    pub(all) struct ExchangeEnvelope {
    source : String
    destination : String
    adu : EncodedAdu
    }

    A transport-neutral request envelope.

    ExchangeEnvelope::new

    fn ExchangeEnvelope::new(source : String, destination : String, adu : EncodedAdu) -> ExchangeEnvelope

    ExchangeEnvelope::size

    fn ExchangeEnvelope::size(self : ExchangeEnvelope) -> Int

    ExchangeState

    pub(all) enum ExchangeState {
    Pending
    Completed
    Failed
    Cancelled
    } derive(Eq,
    Debug
    )

    Lifecycle of a client-side exchange.

    FaultMode

    pub(all) enum FaultMode {
    NoFault
    DropResponse
    CorruptCrc
    CorruptLrc
    WrongTransaction
    BusyDevice
    InvalidFunction
    } derive(Eq,
    Debug
    )

    Deterministic fault modes for protocol integration tests.

    FileRecordReference

    pub(all) struct FileRecordReference {
    reference_type : Byte
    file_number : UInt16
    record_number : UInt16
    record_length : UInt16
    }

    A Modbus file-record selector.

    FileRecordReference::encoded_length

    fn FileRecordReference::encoded_length(_self : FileRecordReference) -> Int

    FileRecordReference::new

    fn FileRecordReference::new(file_number : UInt16, record_number : UInt16, record_length : UInt16, reference_type? : Byte) -> Result[FileRecordReference, ModbusError]

    FileRecordStore

    pub(all) struct FileRecordStore {
    records : Array[FileRecordWrite]
    max_records : Int
    }

    A bounded in-memory store for file records used by simulators.

    FileRecordStore::clear

    fn FileRecordStore::clear(self : FileRecordStore) -> Unit

    FileRecordStore::get

    fn FileRecordStore::get(self : FileRecordStore, reference : FileRecordReference) -> Result[Array[UInt16], ModbusError]

    FileRecordStore::length

    fn FileRecordStore::length(self : FileRecordStore) -> Int

    FileRecordStore::new

    fn FileRecordStore::new(max_records? : Int) -> Result[FileRecordStore, ModbusError]

    FileRecordStore::put

    fn FileRecordStore::put(self : FileRecordStore, record : FileRecordWrite) -> Result[Unit, ModbusError]

    FileRecordWrite

    pub(all) struct FileRecordWrite {
    reference : FileRecordReference
    values : Array[UInt16]
    }

    A file-record write item combines a selector and its register payload.

    FileRecordWrite::new

    fn FileRecordWrite::new(reference : FileRecordReference, values : Array[UInt16]) -> Result[FileRecordWrite, ModbusError]

    FirmwareConstraint

    pub(all) struct FirmwareConstraint {
    vendor : String
    model : String
    minimum : String
    recommended : String
    }

    A small firmware compatibility constraint.

    FirmwareConstraint::matches

    fn FirmwareConstraint::matches(self : FirmwareConstraint, device : InventoryDevice) -> Bool

    FirmwareConstraint::minimum

    fn FirmwareConstraint::minimum(self : FirmwareConstraint) -> String

    FirmwareConstraint::new

    fn FirmwareConstraint::new(vendor : String, model : String, minimum : String, recommended : String) -> Result[FirmwareConstraint, ModbusError]

    FirmwareConstraint::recommended

    fn FirmwareConstraint::recommended(self : FirmwareConstraint) -> String

    FleetHealthRollup

    pub(all) struct FleetHealthRollup {
    contributions : Array[HealthContribution]
    score : Int
    state : FleetHealthState
    timestamp : Int
    }

    Weighted score calculation used by operator dashboards.

    FleetHealthRollup::add

    fn FleetHealthRollup::add(self : FleetHealthRollup, contribution : HealthContribution) -> Result[Unit, ModbusError]

    FleetHealthRollup::contribution

    fn FleetHealthRollup::contribution(self : FleetHealthRollup, source : String) -> HealthContribution?

    FleetHealthRollup::contribution_count

    fn FleetHealthRollup::contribution_count(self : FleetHealthRollup) -> Int

    FleetHealthRollup::contributions

    FleetHealthRollup::export_lines

    fn FleetHealthRollup::export_lines(self : FleetHealthRollup) -> Array[String]

    A serializable health line for logs and support bundles.

    FleetHealthRollup::new

    fn FleetHealthRollup::new(timestamp : Int) -> Result[FleetHealthRollup, ModbusError]

    FleetHealthRollup::recalculate

    fn FleetHealthRollup::recalculate(self : FleetHealthRollup) -> Unit

    FleetHealthRollup::remove

    fn FleetHealthRollup::remove(self : FleetHealthRollup, source : String) -> Result[HealthContribution, ModbusError]

    FleetHealthRollup::score

    fn FleetHealthRollup::score(self : FleetHealthRollup) -> Int

    FleetHealthRollup::state

    FleetHealthRollup::timestamp

    fn FleetHealthRollup::timestamp(self : FleetHealthRollup) -> Int

    FleetHealthState

    pub(all) enum FleetHealthState {
    FleetHealthy
    FleetDegraded
    FleetCritical
    FleetEmpty
    } derive(Eq,
    Debug
    )

    Fleet-level state derived from reliability, services, and inventory.

    Frame

    pub(all) struct Frame {
    unit_id : Byte
    pdu : Pdu
    }

    A decoded frame, including the unit identifier.

    Frame::data_length

    fn Frame::data_length(self : Frame) -> Int

    Frame::function_code

    fn Frame::function_code(self : Frame) -> FunctionCode

    Frame::is_exception

    fn Frame::is_exception(self : Frame) -> Bool

    Frame::new

    fn Frame::new(unit_id : Byte, function : Byte, data : Array[Byte]) -> Frame

    FrameContract

    pub(all) struct FrameContract {
    id : String
    function : Byte
    request_min : Int
    request_max : Int
    response_min : Int
    response_max : Int
    require_echo : Bool
    }

    Expected shape of one application data unit.

    FrameContract::check

    fn FrameContract::check(self : FrameContract, request : Frame, response : Frame) -> ContractResult

    Validate a response against this function-level contract.

    FrameContract::function

    fn FrameContract::function(self : FrameContract) -> Byte

    FrameContract::id

    fn FrameContract::id(self : FrameContract) -> String

    FrameContract::new

    fn FrameContract::new(id : String, function : Byte, request_min : Int, request_max : Int, response_min : Int, response_max : Int, require_echo? : Bool) -> Result[FrameContract, ModbusError]

    FrameContract::request_max

    fn FrameContract::request_max(self : FrameContract) -> Int

    FrameContract::request_min

    fn FrameContract::request_min(self : FrameContract) -> Int

    FrameContract::require_echo

    fn FrameContract::require_echo(self : FrameContract) -> Bool

    FrameContract::response_max

    fn FrameContract::response_max(self : FrameContract) -> Int

    FrameContract::response_min

    fn FrameContract::response_min(self : FrameContract) -> Int

    FrameContractCatalog

    pub(all) struct FrameContractCatalog {
    contracts : Array[FrameContract]
    max_contracts : Int
    }

    A catalog of frame contracts used by server and gateway adapters.

    FrameContractCatalog::add

    fn FrameContractCatalog::add(self : FrameContractCatalog, contract : FrameContract) -> Result[Unit, ModbusError]

    FrameContractCatalog::check

    fn FrameContractCatalog::check(self : FrameContractCatalog, request : Frame, response : Frame) -> Result[ContractResult, ModbusError]

    FrameContractCatalog::check_all

    Check all known standard functions and return the first failure.

    FrameContractCatalog::count

    FrameContractCatalog::find

    fn FrameContractCatalog::find(self : FrameContractCatalog, function : Byte) -> FrameContract?

    FrameContractCatalog::new

    fn FrameContractCatalog::new(max_contracts? : Int) -> Result[FrameContractCatalog, ModbusError]

    FrameFingerprint

    pub(all) struct FrameFingerprint {
    unit_id : Byte
    function : Byte
    data_length : Int
    checksum : Int
    }

    Immutable frame fingerprint for duplicate detection.

    FrameFingerprint::checksum

    fn FrameFingerprint::checksum(self : FrameFingerprint) -> Int

    FrameFingerprint::data_length

    fn FrameFingerprint::data_length(self : FrameFingerprint) -> Int

    FrameFingerprint::from_frame

    fn FrameFingerprint::from_frame(frame : Frame) -> FrameFingerprint

    FrameFingerprint::function

    fn FrameFingerprint::function(self : FrameFingerprint) -> Byte

    FrameFingerprint::same

    fn FrameFingerprint::same(self : FrameFingerprint, other : FrameFingerprint) -> Bool

    FrameFingerprint::unit_id

    fn FrameFingerprint::unit_id(self : FrameFingerprint) -> Byte

    FrameSequence

    pub struct FrameSequence {
    frames : Array[Frame]
    max_frames : Int
    }

    A bounded ordered collection of frames for gateways and batch adapters.

    FrameSequence::encoded_bytes

    fn FrameSequence::encoded_bytes(self : FrameSequence, mode : Mode) -> Int

    FrameSequence::filter_function

    fn FrameSequence::filter_function(self : FrameSequence, function : Byte) -> Array[Frame]

    FrameSequence::filter_unit

    fn FrameSequence::filter_unit(self : FrameSequence, unit_id : Byte) -> Array[Frame]

    FrameSequence::get

    fn FrameSequence::get(self : FrameSequence, index : Int) -> Result[Frame, ModbusError]

    FrameSequence::length

    fn FrameSequence::length(self : FrameSequence) -> Int

    FrameSequence::new

    fn FrameSequence::new(max_frames? : Int) -> Result[FrameSequence, ModbusError]

    FrameSequence::push

    fn FrameSequence::push(self : FrameSequence, frame : Frame) -> Result[Unit, ModbusError]

    FrameSequence::snapshot

    fn FrameSequence::snapshot(self : FrameSequence) -> Array[Frame]

    FrameSequence::validate

    fn FrameSequence::validate(self : FrameSequence, allow_broadcast : Bool) -> Result[Unit, ModbusError]

    FrameStream

    pub struct FrameStream {
    mode : Mode
    parser : IncrementalParser
    queue : ByteQueue
    chunks : Int
    frames : Int
    }

    A frame stream combines a byte queue with the protocol parser.

    FrameStream::chunks

    fn FrameStream::chunks(self : FrameStream) -> Int

    FrameStream::finish

    fn FrameStream::finish(self : FrameStream) -> Result[Frame, ModbusError]

    FrameStream::frames

    fn FrameStream::frames(self : FrameStream) -> Int

    FrameStream::mode

    fn FrameStream::mode(self : FrameStream) -> Mode

    FrameStream::new

    fn FrameStream::new(mode : Mode, role? : ParserRole, max_buffer? : Int, max_frame? : Int) -> Result[FrameStream, ModbusError]

    FrameStream::push

    fn FrameStream::push(self : FrameStream, bytes : Array[Byte]) -> Result[Array[Frame], ModbusError]

    FrameStream::reset

    fn FrameStream::reset(self : FrameStream) -> Unit

    FrameSummary

    pub(all) struct FrameSummary {
    unit_id : Byte
    function : Byte
    data_length : Int
    exception : Bool
    }

    A compact description useful for logs and metrics.

    FrameTextLog

    pub struct FrameTextLog {
    entries : Array[String]
    max_entries : Int
    }

    A bounded text trace used by CLI tools and embedded diagnostics.

    FrameTextLog::clear

    fn FrameTextLog::clear(self : FrameTextLog) -> Unit

    FrameTextLog::length

    fn FrameTextLog::length(self : FrameTextLog) -> Int

    FrameTextLog::lines

    fn FrameTextLog::lines(self : FrameTextLog) -> Array[String]

    FrameTextLog::new

    fn FrameTextLog::new(max_entries? : Int) -> Result[FrameTextLog, ModbusError]

    FrameTextLog::push

    fn FrameTextLog::push(self : FrameTextLog, line : String) -> Unit

    FrameTextLog::record

    fn FrameTextLog::record(self : FrameTextLog, direction : String, frame : Frame) -> Unit

    FrameTextLog::record_wire

    fn FrameTextLog::record_wire(self : FrameTextLog, direction : String, mode : Mode, transaction_id : UInt16, frame : Frame) -> Unit

    FunctionCode

    pub(all) enum FunctionCode {
    ReadCoils
    ReadDiscreteInputs
    ReadHoldingRegisters
    ReadInputRegisters
    WriteSingleCoil
    WriteSingleRegister
    ReadExceptionStatus
    Diagnostics
    GetCommEventCounter
    GetCommEventLog
    ReportServerId
    WriteMultipleCoils
    WriteMultipleRegisters
    ReportServerIdExtended
    ReadFileRecord
    WriteFileRecord
    MaskWriteRegister
    ReadWriteMultipleRegisters
    ReadFifoQueue
    EncapsulatedInterface
    Unknown(Byte)
    } derive(Eq,
    Debug
    )

    The function codes defined by the Modbus application protocol.

    FunctionCode::to_byte

    fn FunctionCode::to_byte(code : FunctionCode) -> Byte

    Return the numeric representation of a typed function code.

    FunctionDescriptor

    pub(all) struct FunctionDescriptor {
    function : Byte
    name : String
    request_min : Int
    request_max : Int
    response_variable : Bool
    writable : Bool
    description : String
    }

    Metadata used by configuration UIs and validation tools.

    FunctionDescriptor::description

    fn FunctionDescriptor::description(self : FunctionDescriptor) -> String

    FunctionDescriptor::function

    fn FunctionDescriptor::function(self : FunctionDescriptor) -> Byte

    FunctionDescriptor::is_write

    fn FunctionDescriptor::is_write(self : FunctionDescriptor) -> Bool

    FunctionDescriptor::name

    fn FunctionDescriptor::name(self : FunctionDescriptor) -> String

    FunctionDescriptor::supports_request

    fn FunctionDescriptor::supports_request(self : FunctionDescriptor, length : Int) -> Bool

    Gateway

    pub struct Gateway {
    rules : Array[GatewayRule]
    forwarded : Int
    rejected : Int
    translated : Int
    }

    A deterministic frame gateway that rewrites unit ids and register/coil addresses.

    Gateway::add_rule

    fn Gateway::add_rule(self : Gateway, rule : GatewayRule) -> Result[Unit, ModbusError]

    Gateway::forwarded_count

    fn Gateway::forwarded_count(self : Gateway) -> Int

    Gateway::new

    fn Gateway::new() -> Gateway

    Gateway::rejected_count

    fn Gateway::rejected_count(self : Gateway) -> Int

    Gateway::reset_metrics

    fn Gateway::reset_metrics(self : Gateway) -> Unit

    Gateway::reverse

    fn Gateway::reverse(self : Gateway, request : Frame, response : Frame) -> Result[Frame, ModbusError]

    Translate a response back to the source address space.

    Gateway::rule_count

    fn Gateway::rule_count(self : Gateway) -> Int

    Gateway::rules

    fn Gateway::rules(self : Gateway) -> Array[GatewayRule]

    Gateway::translate

    fn Gateway::translate(self : Gateway, frame : Frame) -> Result[Frame, ModbusError]

    Translate one request according to the first matching rule.

    Gateway::translated_count

    fn Gateway::translated_count(self : Gateway) -> Int

    GatewayPolicyTable

    pub(all) struct GatewayPolicyTable {
    policies : Array[ServiceGatewayPolicy]
    max_policies : Int
    }

    Fleet-level route table for selecting one policy by endpoint pair.

    GatewayPolicyTable::add

    fn GatewayPolicyTable::add(self : GatewayPolicyTable, policy : ServiceGatewayPolicy) -> Result[Unit, ModbusError]

    GatewayPolicyTable::count

    fn GatewayPolicyTable::count(self : GatewayPolicyTable) -> Int

    GatewayPolicyTable::evaluate

    fn GatewayPolicyTable::evaluate(self : GatewayPolicyTable, source : String, destination : String, frame : Frame) -> Result[BridgeDecision, ModbusError]

    GatewayPolicyTable::find

    fn GatewayPolicyTable::find(self : GatewayPolicyTable, source : String, destination : String) -> ServiceGatewayPolicy?

    GatewayPolicyTable::new

    fn GatewayPolicyTable::new(max_policies? : Int) -> Result[GatewayPolicyTable, ModbusError]

    GatewayPolicyTable::routes

    fn GatewayPolicyTable::routes(self : GatewayPolicyTable) -> Array[String]

    GatewayRoute

    pub(all) struct GatewayRoute {
    name : String
    gateway : Gateway
    device : Device
    client : Client
    }

    A gateway route that combines a rule set, client, and virtual device.

    GatewayRoute::add_rule

    fn GatewayRoute::add_rule(self : GatewayRoute, rule : GatewayRule) -> Result[Unit, ModbusError]

    GatewayRoute::exchange

    fn GatewayRoute::exchange(self : GatewayRoute, request : Frame) -> Result[Frame, ModbusError]

    GatewayRoute::metrics

    fn GatewayRoute::metrics(self : GatewayRoute) -> (Int, Int, Int)

    GatewayRoute::name

    fn GatewayRoute::name(self : GatewayRoute) -> String

    GatewayRoute::new

    fn GatewayRoute::new(name : String, mode : Mode, device : Device) -> GatewayRoute

    GatewayRule

    pub(all) struct GatewayRule {
    source_unit : Byte
    target_unit : Byte
    function : Byte
    source_start : UInt16
    target_start : UInt16
    span : Int
    enabled : Bool
    }

    Address mapping rule for a protocol gateway.

    GatewayRule::enable

    fn GatewayRule::enable(self : GatewayRule, enabled : Bool) -> Unit

    GatewayRule::matches

    fn GatewayRule::matches(self : GatewayRule, frame : Frame) -> Bool

    GatewayRule::new

    fn GatewayRule::new(source_unit : Byte, target_unit : Byte, function : Byte, source_start : UInt16, target_start : UInt16, span : Int) -> Result[GatewayRule, ModbusError]

    GuardDecision

    pub(all) enum GuardDecision {
    AdmitFrame
    RejectFrame
    DeferFrame
    DuplicateFrame
    QuotaFrame
    OversizeFrame
    } derive(Eq,
    Debug
    )

    Decision made before a frame enters a server or gateway pipeline.

    GuardEvent

    pub(all) struct GuardEvent {
    sequence : Int
    timestamp : Int
    peer : String
    decision : GuardDecision
    reason : GuardReason
    unit_id : Byte
    function : Byte
    frame_bytes : Int
    fingerprint : FrameFingerprint
    }

    Admission event retained for metrics and support diagnostics.

    GuardEvent::decision

    fn GuardEvent::decision(self : GuardEvent) -> GuardDecision

    GuardEvent::fingerprint

    fn GuardEvent::fingerprint(self : GuardEvent) -> FrameFingerprint

    GuardEvent::frame_bytes

    fn GuardEvent::frame_bytes(self : GuardEvent) -> Int

    GuardEvent::function

    fn GuardEvent::function(self : GuardEvent) -> Byte

    GuardEvent::new

    fn GuardEvent::new(sequence : Int, timestamp : Int, peer : String, decision : GuardDecision, reason : GuardReason, frame : Frame) -> Result[GuardEvent, ModbusError]

    GuardEvent::peer

    fn GuardEvent::peer(self : GuardEvent) -> String

    GuardEvent::reason

    fn GuardEvent::reason(self : GuardEvent) -> GuardReason

    GuardEvent::sequence

    fn GuardEvent::sequence(self : GuardEvent) -> Int

    GuardEvent::timestamp

    fn GuardEvent::timestamp(self : GuardEvent) -> Int

    GuardEvent::unit_id

    fn GuardEvent::unit_id(self : GuardEvent) -> Byte

    GuardReason

    pub(all) enum GuardReason {
    GuardAccepted
    GuardBadUnit
    GuardBadFunction
    GuardBadLength
    GuardDuplicate
    GuardRateLimited
    GuardTooLarge
    GuardUnknownPeer
    } derive(Eq,
    Debug
    )

    Reason included in a protocol admission record.

    HealthContribution

    pub(all) struct HealthContribution {
    source : String
    score : Int
    weight : Int
    detail : String
    }

    A weighted health contribution from one subsystem.

    HealthContribution::detail

    fn HealthContribution::detail(self : HealthContribution) -> String

    HealthContribution::new

    fn HealthContribution::new(source : String, score : Int, weight : Int, detail : String) -> Result[HealthContribution, ModbusError]

    HealthContribution::score

    fn HealthContribution::score(self : HealthContribution) -> Int

    HealthContribution::source

    fn HealthContribution::source(self : HealthContribution) -> String

    HealthContribution::weight

    fn HealthContribution::weight(self : HealthContribution) -> Int

    Historian

    pub(all) struct Historian {
    series : Array[TagSeries]
    max_points : Int
    per_point_capacity : Int
    }

    A bounded multi-point historian.

    Historian::aggregate

    fn Historian::aggregate(self : Historian, point_id : String, start : Int, end : Int, aggregation : Aggregation) -> Result[Int, ModbusError]

    Historian::append

    fn Historian::append(self : Historian, sample : TagSample) -> Result[Unit, ModbusError]

    Historian::clear

    fn Historian::clear(self : Historian) -> Unit

    Historian::ensure_point

    fn Historian::ensure_point(self : Historian, point_id : String) -> Result[Unit, ModbusError]

    Historian::get

    fn Historian::get(self : Historian, point_id : String) -> TagSeries?

    Historian::new

    fn Historian::new(max_points? : Int, per_point_capacity? : Int) -> Result[Historian, ModbusError]

    Historian::point_count

    fn Historian::point_count(self : Historian) -> Int

    Historian::query

    fn Historian::query(self : Historian, point_id : String, start : Int, end : Int) -> Result[Array[TagSample], ModbusError]

    Historian::remove

    fn Historian::remove(self : Historian, point_id : String) -> Result[TagSeries, ModbusError]

    Historian::series_snapshot

    fn Historian::series_snapshot(self : Historian) -> Array[TagSeries]

    Historian::summary

    fn Historian::summary(self : Historian) -> String

    Historian::total_samples

    fn Historian::total_samples(self : Historian) -> Int

    HistoryBucket

    pub(all) struct HistoryBucket {
    start : Int
    end : Int
    count : Int
    minimum : Int
    maximum : Int
    sum : Int
    }

    A fixed interval bucket for downsampled exports.

    HistoryBucket::add

    fn HistoryBucket::add(self : HistoryBucket, value : Int) -> Unit

    HistoryBucket::average

    fn HistoryBucket::average(self : HistoryBucket) -> Int

    HistoryBucket::contains

    fn HistoryBucket::contains(self : HistoryBucket, timestamp : Int) -> Bool

    HistoryBucket::count

    fn HistoryBucket::count(self : HistoryBucket) -> Int

    HistoryBucket::end

    fn HistoryBucket::end(self : HistoryBucket) -> Int

    HistoryBucket::maximum

    fn HistoryBucket::maximum(self : HistoryBucket) -> Int

    HistoryBucket::minimum

    fn HistoryBucket::minimum(self : HistoryBucket) -> Int

    HistoryBucket::new

    fn HistoryBucket::new(start : Int, width : Int, first : Int) -> Result[HistoryBucket, ModbusError]

    HistoryBucket::start

    fn HistoryBucket::start(self : HistoryBucket) -> Int

    IncrementalParser

    pub struct IncrementalParser {
    mode : Mode
    role : ParserRole
    buffer : Array[Byte]
    max_frame : Int
    frames_seen : Int
    errors_seen : Int
    }

    A bounded incremental parser for stream transports.

    IncrementalParser::buffered

    fn IncrementalParser::buffered(self : IncrementalParser) -> Int

    Return the number of bytes waiting in the parser.

    IncrementalParser::errors_seen

    fn IncrementalParser::errors_seen(self : IncrementalParser) -> Int

    IncrementalParser::feed

    fn IncrementalParser::feed(self : IncrementalParser, input : Array[Byte]) -> Result[Array[Frame], ModbusError]

    Feed bytes and return every complete frame currently available.

    IncrementalParser::feed_byte

    fn IncrementalParser::feed_byte(self : IncrementalParser, byte : Byte) -> Result[Array[Frame], ModbusError]

    Feed a single byte without allocating an input array at the call site.

    IncrementalParser::finish

    fn IncrementalParser::finish(self : IncrementalParser) -> Result[Frame, ModbusError]

    Finish a serial frame at an externally supplied RTU silent interval.

    IncrementalParser::frames_seen

    fn IncrementalParser::frames_seen(self : IncrementalParser) -> Int

    IncrementalParser::max_frame

    fn IncrementalParser::max_frame(self : IncrementalParser) -> Int

    IncrementalParser::mode

    IncrementalParser::new

    fn IncrementalParser::new(mode : Mode, max_frame? : Int, role? : ParserRole) -> IncrementalParser

    Create a stream parser. max_frame prevents unbounded input growth.

    IncrementalParser::reset

    fn IncrementalParser::reset(self : IncrementalParser) -> Unit

    Discard buffered bytes after a transport reset.

    IncrementalParser::role

    IncrementalParser::set_max_frame

    fn IncrementalParser::set_max_frame(self : IncrementalParser, max_frame : Int) -> Result[Unit, ModbusError]

    Change the maximum frame size for a parser that is already in use.

    IncrementalParser::take_buffer

    fn IncrementalParser::take_buffer(self : IncrementalParser) -> Array[Byte]

    Take the current buffered bytes and reset the parser.

    InventoryDevice

    pub(all) struct InventoryDevice {
    id : String
    label : String
    vendor : String
    model : String
    serial : String
    firmware : String
    unit_id : Byte
    transport : String
    state : InventoryState
    last_seen : Int?
    tags : Array[String]
    }

    Firmware and identity metadata used by fleet operations.

    InventoryDevice::add_tag

    fn InventoryDevice::add_tag(self : InventoryDevice, tag : String) -> Result[Unit, ModbusError]

    InventoryDevice::firmware

    fn InventoryDevice::firmware(self : InventoryDevice) -> String

    InventoryDevice::has_tag

    fn InventoryDevice::has_tag(self : InventoryDevice, tag : String) -> Bool

    InventoryDevice::id

    fn InventoryDevice::id(self : InventoryDevice) -> String

    InventoryDevice::label

    fn InventoryDevice::label(self : InventoryDevice) -> String

    InventoryDevice::last_seen

    fn InventoryDevice::last_seen(self : InventoryDevice) -> Int?

    InventoryDevice::mark_seen

    fn InventoryDevice::mark_seen(self : InventoryDevice, timestamp : Int) -> Result[Unit, ModbusError]

    InventoryDevice::model

    fn InventoryDevice::model(self : InventoryDevice) -> String

    InventoryDevice::new

    fn InventoryDevice::new(id : String, label : String, vendor : String, model : String, serial : String, firmware : String, unit_id : Byte, transport : String) -> Result[InventoryDevice, ModbusError]

    InventoryDevice::serial

    fn InventoryDevice::serial(self : InventoryDevice) -> String

    InventoryDevice::set_state

    fn InventoryDevice::set_state(self : InventoryDevice, state : InventoryState) -> Unit

    InventoryDevice::stale

    fn InventoryDevice::stale(self : InventoryDevice, now : Int, timeout : Int) -> Result[Bool, ModbusError]

    InventoryDevice::state

    InventoryDevice::transport

    fn InventoryDevice::transport(self : InventoryDevice) -> String

    InventoryDevice::unit_id

    fn InventoryDevice::unit_id(self : InventoryDevice) -> Byte

    InventoryDevice::vendor

    fn InventoryDevice::vendor(self : InventoryDevice) -> String

    InventoryState

    pub(all) enum InventoryState {
    InventoryDiscovered
    InventoryProvisioned
    InventoryOnline
    InventoryOffline
    InventoryRetired
    } derive(Eq,
    Debug
    )

    Lifecycle state of an enrolled industrial device.

    JobPriority

    pub(all) enum JobPriority {
    Background
    NormalPriority
    HighPriority
    Emergency
    } derive(Eq,
    Debug
    )

    Priority used by the application-level request scheduler.

    JobScheduler

    pub(all) struct JobScheduler {
    jobs : Array[ScheduledJob]
    max_jobs : Int
    now : Int
    dispatched : Int
    completed : Int
    failed : Int
    cancelled : Int
    }

    A bounded scheduler with priority-aware due-job selection.

    JobScheduler::add

    fn JobScheduler::add(self : JobScheduler, job : ScheduledJob) -> Result[Unit, ModbusError]

    JobScheduler::cancel

    fn JobScheduler::cancel(self : JobScheduler, id : String) -> Result[Unit, ModbusError]

    JobScheduler::cancelled

    fn JobScheduler::cancelled(self : JobScheduler) -> Int

    JobScheduler::complete

    fn JobScheduler::complete(self : JobScheduler, id : String, now : Int) -> Result[Unit, ModbusError]

    JobScheduler::completed

    fn JobScheduler::completed(self : JobScheduler) -> Int

    JobScheduler::dispatch

    fn JobScheduler::dispatch(self : JobScheduler, now : Int) -> Result[ScheduledJob, ModbusError]

    JobScheduler::dispatched

    fn JobScheduler::dispatched(self : JobScheduler) -> Int

    JobScheduler::due_count

    fn JobScheduler::due_count(self : JobScheduler, now : Int) -> Int

    JobScheduler::fail

    fn JobScheduler::fail(self : JobScheduler, id : String, error : ModbusError, now : Int) -> Result[Bool, ModbusError]

    JobScheduler::failed

    fn JobScheduler::failed(self : JobScheduler) -> Int

    JobScheduler::find

    fn JobScheduler::find(self : JobScheduler, id : String) -> ScheduledJob?

    JobScheduler::get

    fn JobScheduler::get(self : JobScheduler, index : Int) -> Result[ScheduledJob, ModbusError]

    JobScheduler::length

    fn JobScheduler::length(self : JobScheduler) -> Int

    JobScheduler::new

    fn JobScheduler::new(max_jobs? : Int) -> Result[JobScheduler, ModbusError]

    JobScheduler::next_due

    fn JobScheduler::next_due(self : JobScheduler, now : Int) -> ScheduledJob?

    JobScheduler::now

    fn JobScheduler::now(self : JobScheduler) -> Int

    JobScheduler::remove

    fn JobScheduler::remove(self : JobScheduler, id : String) -> Result[ScheduledJob, ModbusError]

    JobScheduler::reschedule

    fn JobScheduler::reschedule(self : JobScheduler, id : String, due_at : Int) -> Result[Unit, ModbusError]

    JobScheduler::reset_metrics

    fn JobScheduler::reset_metrics(self : JobScheduler) -> Unit

    JobScheduler::snapshot

    fn JobScheduler::snapshot(self : JobScheduler) -> Array[ScheduledJob]

    JobScheduler::snapshot_metrics

    fn JobScheduler::snapshot_metrics(self : JobScheduler) -> SchedulerSnapshot

    JobScheduler::state_count

    fn JobScheduler::state_count(self : JobScheduler, state : JobState) -> Int

    JobScheduler::summary

    fn JobScheduler::summary(self : JobScheduler) -> String

    JobState

    pub(all) enum JobState {
    Ready
    InFlight
    Waiting
    Completed
    Failed
    Cancelled
    } derive(Eq,
    Debug
    )

    Lifecycle state of a scheduled request.

    LatencyHistogram

    pub(all) struct LatencyHistogram {
    bounds : Array[Int]
    counts : Array[Int]
    total : Int
    sum : Int
    }

    Fixed latency buckets, expressed in logical ticks.

    LatencyHistogram::bucket_counts

    fn LatencyHistogram::bucket_counts(self : LatencyHistogram) -> Array[Int]

    LatencyHistogram::mean

    fn LatencyHistogram::mean(self : LatencyHistogram) -> Float

    LatencyHistogram::new

    fn LatencyHistogram::new(bounds : Array[Int]) -> Result[LatencyHistogram, ModbusError]

    LatencyHistogram::observe

    fn LatencyHistogram::observe(self : LatencyHistogram, ticks : Int) -> Result[Unit, ModbusError]

    LatencyHistogram::sum

    fn LatencyHistogram::sum(self : LatencyHistogram) -> Int

    LatencyHistogram::total

    fn LatencyHistogram::total(self : LatencyHistogram) -> Int

    LeaseManager

    pub(all) struct LeaseManager {
    leases : Array[ResourceLease]
    max_leases : Int
    default_duration : Int
    sequence : Int
    }

    Manages exclusive resource ownership across client workers.

    LeaseManager::acquire

    fn LeaseManager::acquire(self : LeaseManager, resource : String, owner : String, now : Int, priority? : Int) -> Result[ResourceLease, ModbusError]

    Acquire a resource if no active lease has a higher or equal priority.

    LeaseManager::active_resources

    fn LeaseManager::active_resources(self : LeaseManager, now : Int) -> Result[Array[String], ModbusError]

    Return resource names with an active owner.

    LeaseManager::compact

    fn LeaseManager::compact(self : LeaseManager, before : Int) -> Result[Int, ModbusError]

    Clean up old terminal leases while retaining recent history.

    LeaseManager::count

    fn LeaseManager::count(self : LeaseManager) -> Int

    LeaseManager::default_duration

    fn LeaseManager::default_duration(self : LeaseManager) -> Int

    LeaseManager::expire

    fn LeaseManager::expire(self : LeaseManager, now : Int) -> Result[Int, ModbusError]

    Expire inactive leases and return their count.

    LeaseManager::find

    fn LeaseManager::find(self : LeaseManager, resource : String) -> ResourceLease?

    LeaseManager::new

    fn LeaseManager::new(max_leases? : Int, default_duration? : Int) -> Result[LeaseManager, ModbusError]

    LeaseManager::owned_by

    fn LeaseManager::owned_by(self : LeaseManager, owner : String, now : Int) -> Result[Array[String], ModbusError]

    Return active leases for a given owner.

    LeaseManager::release

    fn LeaseManager::release(self : LeaseManager, lease_id : String, owner : String) -> Result[Unit, ModbusError]

    Release a lease at the end of a request or connection.

    LeaseManager::renew

    fn LeaseManager::renew(self : LeaseManager, lease_id : String, owner : String, now : Int, duration? : Int) -> Result[Unit, ModbusError]

    Renew a lease only for its current owner.

    LeaseState

    pub(all) enum LeaseState {
    LeaseAvailable
    LeaseHeld
    LeaseExpired
    LeaseRevoked
    } derive(Eq,
    Debug
    )

    Ownership state for a serial line, TCP endpoint, or device command lane.

    MaintenanceKind

    pub(all) enum MaintenanceKind {
    Inspection
    Calibration
    Cleaning
    FirmwareUpdate
    CableReplacement
    PreventiveService
    CorrectiveRepair
    } derive(Eq,
    Debug
    )

    Type of maintenance activity tracked for a field device.

    MaintenancePlanner

    pub(all) struct MaintenancePlanner {
    plans : Array[ServicePlan]
    records : Array[ServiceRecord]
    work_orders : Array[MaintenanceWorkOrder]
    max_records : Int
    max_orders : Int
    }

    Plan and audit maintenance across multiple devices.

    MaintenancePlanner::add_plan

    fn MaintenancePlanner::add_plan(self : MaintenancePlanner, plan : ServicePlan) -> Result[Unit, ModbusError]

    MaintenancePlanner::add_record

    fn MaintenancePlanner::add_record(self : MaintenancePlanner, record : ServiceRecord) -> Result[Unit, ModbusError]

    MaintenancePlanner::add_work_order

    fn MaintenancePlanner::add_work_order(self : MaintenancePlanner, order : MaintenanceWorkOrder) -> Result[Unit, ModbusError]

    MaintenancePlanner::complete_order

    fn MaintenancePlanner::complete_order(self : MaintenancePlanner, order_id : String, timestamp : Int, note? : String) -> Result[Unit, ModbusError]

    Complete a linked order and update the corresponding service plan.

    MaintenancePlanner::due_plans

    fn MaintenancePlanner::due_plans(self : MaintenancePlanner, now : Int) -> Result[Array[String], ModbusError]

    Return plans due or overdue at a timestamp.

    MaintenancePlanner::generate_due

    fn MaintenancePlanner::generate_due(self : MaintenancePlanner, now : Int) -> Result[Int, ModbusError]

    Generate due work orders for plans that have not been scheduled at now.

    MaintenancePlanner::history_count

    fn MaintenancePlanner::history_count(self : MaintenancePlanner, asset_id : String, start : Int, end : Int) -> Result[Int, ModbusError]

    Count service records for an asset within a time range.

    MaintenancePlanner::new

    fn MaintenancePlanner::new(max_records? : Int, max_orders? : Int) -> Result[MaintenancePlanner, ModbusError]

    MaintenancePlanner::open_orders

    fn MaintenancePlanner::open_orders(self : MaintenancePlanner, now : Int, overdue_only? : Bool) -> Result[Array[String], ModbusError]

    Return the IDs of open work orders, optionally limited to overdue work.

    MaintenancePlanner::plan

    fn MaintenancePlanner::plan(self : MaintenancePlanner, id : String) -> ServicePlan?

    MaintenancePlanner::plan_count

    fn MaintenancePlanner::plan_count(self : MaintenancePlanner) -> Int

    MaintenancePlanner::record_count

    fn MaintenancePlanner::record_count(self : MaintenancePlanner) -> Int

    MaintenancePlanner::summary

    fn MaintenancePlanner::summary(self : MaintenancePlanner, now : Int) -> Result[MaintenanceSummary, ModbusError]

    MaintenancePlanner::work_order

    fn MaintenancePlanner::work_order(self : MaintenancePlanner, id : String) -> MaintenanceWorkOrder?

    MaintenancePlanner::work_order_count

    fn MaintenancePlanner::work_order_count(self : MaintenancePlanner) -> Int

    MaintenancePriority

    pub(all) enum MaintenancePriority {
    Routine
    Important
    Urgent
    Critical
    } derive(Eq,
    Debug
    )

    Priority assigned by an operator or by an automated due-date rule.

    MaintenanceSummary

    pub(all) struct MaintenanceSummary {
    plans : Int
    due : Int
    overdue : Int
    completed : Int
    open : Int
    records : Int
    }

    Summary for maintenance dashboards and export jobs.

    MaintenanceSummary::completed

    fn MaintenanceSummary::completed(self : MaintenanceSummary) -> Int

    MaintenanceSummary::due

    fn MaintenanceSummary::due(self : MaintenanceSummary) -> Int

    MaintenanceSummary::open

    fn MaintenanceSummary::open(self : MaintenanceSummary) -> Int

    MaintenanceSummary::overdue

    fn MaintenanceSummary::overdue(self : MaintenanceSummary) -> Int

    MaintenanceSummary::plans

    fn MaintenanceSummary::plans(self : MaintenanceSummary) -> Int

    MaintenanceSummary::records

    fn MaintenanceSummary::records(self : MaintenanceSummary) -> Int

    MaintenanceSummary::summary

    fn MaintenanceSummary::summary(self : MaintenanceSummary) -> String

    MaintenanceWorkOrder

    pub(all) struct MaintenanceWorkOrder {
    id : String
    asset_id : String
    plan_id : String?
    title : String
    priority : MaintenancePriority
    state : WorkOrderState
    created_at : Int
    due_at : Int
    assigned_to : String?
    started_at : Int?
    finished_at : Int?
    note : String
    }

    An actionable unit of work generated from a service plan or alarm.

    MaintenanceWorkOrder::asset_id

    fn MaintenanceWorkOrder::asset_id(self : MaintenanceWorkOrder) -> String

    MaintenanceWorkOrder::assign

    fn MaintenanceWorkOrder::assign(self : MaintenanceWorkOrder, technician : String) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::assigned_to

    fn MaintenanceWorkOrder::assigned_to(self : MaintenanceWorkOrder) -> String?

    MaintenanceWorkOrder::block

    fn MaintenanceWorkOrder::block(self : MaintenanceWorkOrder, note : String) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::cancel

    fn MaintenanceWorkOrder::cancel(self : MaintenanceWorkOrder, reason : String) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::complete

    fn MaintenanceWorkOrder::complete(self : MaintenanceWorkOrder, timestamp : Int, note? : String) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::continue_work

    fn MaintenanceWorkOrder::continue_work(self : MaintenanceWorkOrder) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::created_at

    fn MaintenanceWorkOrder::created_at(self : MaintenanceWorkOrder) -> Int

    MaintenanceWorkOrder::due_at

    fn MaintenanceWorkOrder::due_at(self : MaintenanceWorkOrder) -> Int

    MaintenanceWorkOrder::duration

    fn MaintenanceWorkOrder::duration(self : MaintenanceWorkOrder) -> Int?

    MaintenanceWorkOrder::id

    MaintenanceWorkOrder::is_due

    fn MaintenanceWorkOrder::is_due(self : MaintenanceWorkOrder, now : Int) -> Bool

    MaintenanceWorkOrder::is_overdue

    fn MaintenanceWorkOrder::is_overdue(self : MaintenanceWorkOrder, now : Int) -> Bool

    MaintenanceWorkOrder::new

    fn MaintenanceWorkOrder::new(id : String, asset_id : String, title : String, priority : MaintenancePriority, created_at : Int, due_at : Int, plan_id? : String) -> Result[MaintenanceWorkOrder, ModbusError]

    MaintenanceWorkOrder::note

    fn MaintenanceWorkOrder::note(self : MaintenanceWorkOrder) -> String

    MaintenanceWorkOrder::plan_id

    fn MaintenanceWorkOrder::plan_id(self : MaintenanceWorkOrder) -> String?

    MaintenanceWorkOrder::priority

    MaintenanceWorkOrder::start

    fn MaintenanceWorkOrder::start(self : MaintenanceWorkOrder, timestamp : Int) -> Result[Unit, ModbusError]

    MaintenanceWorkOrder::state

    MaintenanceWorkOrder::title

    fn MaintenanceWorkOrder::title(self : MaintenanceWorkOrder) -> String

    MetricKind

    pub(all) enum MetricKind {
    CounterMetric
    GaugeMetric
    DurationMetric
    RatioMetric
    EventMetric
    } derive(Eq,
    Debug
    )

    Storage type of a metric emitted by a Modbus service.

    MetricRegistry

    pub(all) struct MetricRegistry {
    series : Array[MetricSeries]
    max_series : Int
    max_samples : Int
    }

    A registry used by transports, schedulers, and HTTP adapters.

    MetricRegistry::digest

    MetricRegistry::export_lines

    fn MetricRegistry::export_lines(self : MetricRegistry) -> Array[String]

    Export a compact Prometheus-like line representation without external dependencies.

    MetricRegistry::has

    fn MetricRegistry::has(self : MetricRegistry, name : String) -> Bool

    MetricRegistry::latest

    fn MetricRegistry::latest(self : MetricRegistry, name : String) -> ServiceMetric?

    MetricRegistry::names

    fn MetricRegistry::names(self : MetricRegistry) -> Array[String]

    MetricRegistry::new

    fn MetricRegistry::new(max_series? : Int, max_samples? : Int) -> Result[MetricRegistry, ModbusError]

    MetricRegistry::range

    fn MetricRegistry::range(self : MetricRegistry, start : Int, end : Int) -> Result[Array[ServiceMetric], ModbusError]

    Collect a time range from every registered series.

    MetricRegistry::record

    fn MetricRegistry::record(self : MetricRegistry, metric : ServiceMetric) -> Result[Unit, ModbusError]

    MetricRegistry::register

    fn MetricRegistry::register(self : MetricRegistry, name : String, kind : MetricKind) -> Result[Unit, ModbusError]

    MetricRegistry::series

    fn MetricRegistry::series(self : MetricRegistry, name : String) -> MetricSeries?

    MetricRegistry::series_count

    fn MetricRegistry::series_count(self : MetricRegistry) -> Int

    MetricSeries

    pub(all) struct MetricSeries {
    name : String
    kind : MetricKind
    capacity : Int
    samples : Array[ServiceMetric]
    dropped : Int
    }

    Bounded history for one named metric.

    MetricSeries::append

    fn MetricSeries::append(self : MetricSeries, metric : ServiceMetric) -> Result[Unit, ModbusError]

    MetricSeries::average

    fn MetricSeries::average(self : MetricSeries) -> Int?

    MetricSeries::between

    fn MetricSeries::between(self : MetricSeries, start : Int, end : Int) -> Result[Array[ServiceMetric], ModbusError]

    MetricSeries::dropped

    fn MetricSeries::dropped(self : MetricSeries) -> Int

    MetricSeries::kind

    MetricSeries::latest

    fn MetricSeries::latest(self : MetricSeries) -> ServiceMetric?

    MetricSeries::length

    fn MetricSeries::length(self : MetricSeries) -> Int

    MetricSeries::maximum

    fn MetricSeries::maximum(self : MetricSeries) -> Int?

    MetricSeries::minimum

    fn MetricSeries::minimum(self : MetricSeries) -> Int?

    MetricSeries::name

    fn MetricSeries::name(self : MetricSeries) -> String

    MetricSeries::new

    fn MetricSeries::new(name : String, kind : MetricKind, capacity? : Int) -> Result[MetricSeries, ModbusError]

    MetricSeries::sum

    fn MetricSeries::sum(self : MetricSeries) -> Int

    MetricsTransport

    pub(all) enum MetricsTransport {
    MetricsRtu
    MetricsAscii
    MetricsTcp
    MetricsTls
    MetricsVirtual
    } derive(Eq,
    Debug
    )

    Transport mode used for operational metrics.

    MigrationOperation

    pub(all) enum MigrationOperation {
    AddSetting
    RemoveSetting
    RenameSetting
    ReplaceSetting
    ValidateSetting
    } derive(Eq,
    Debug
    )

    Operation used by a migration step.

    MigrationPlan

    pub(all) struct MigrationPlan {
    id : String
    from_version : Int
    to_version : Int
    steps : Array[MigrationStep]
    max_steps : Int
    state : MigrationState
    }

    Ordered migration plan with transactional execution state.

    MigrationPlan::add_step

    fn MigrationPlan::add_step(self : MigrationPlan, step : MigrationStep) -> Result[Unit, ModbusError]

    MigrationPlan::apply

    Apply each step and return the changed snapshot.

    MigrationPlan::export_lines

    fn MigrationPlan::export_lines(self : MigrationPlan) -> Array[String]

    MigrationPlan::from_version

    fn MigrationPlan::from_version(self : MigrationPlan) -> Int

    MigrationPlan::id

    fn MigrationPlan::id(self : MigrationPlan) -> String

    MigrationPlan::new

    fn MigrationPlan::new(id : String, from_version : Int, to_version : Int, max_steps? : Int) -> Result[MigrationPlan, ModbusError]

    MigrationPlan::rollback

    fn MigrationPlan::rollback(self : MigrationPlan, snapshot : MigrationSnapshot) -> Result[MigrationSnapshot, ModbusError]

    Roll back applied steps in reverse order where rollback values exist.

    MigrationPlan::state

    MigrationPlan::step_count

    fn MigrationPlan::step_count(self : MigrationPlan) -> Int

    MigrationPlan::to_version

    fn MigrationPlan::to_version(self : MigrationPlan) -> Int

    MigrationSnapshot

    pub(all) struct MigrationSnapshot {
    version : Int
    entries : Array[(String, String)]
    timestamp : Int
    }

    A copy-on-write key/value configuration snapshot.

    MigrationSnapshot::get

    fn MigrationSnapshot::get(self : MigrationSnapshot, key : String) -> String?

    MigrationSnapshot::keys

    fn MigrationSnapshot::keys(self : MigrationSnapshot) -> Array[String]

    MigrationSnapshot::length

    fn MigrationSnapshot::length(self : MigrationSnapshot) -> Int

    MigrationSnapshot::new

    fn MigrationSnapshot::new(version : Int, timestamp : Int) -> Result[MigrationSnapshot, ModbusError]

    MigrationSnapshot::put

    fn MigrationSnapshot::put(self : MigrationSnapshot, key : String, value : String) -> Result[Unit, ModbusError]

    MigrationSnapshot::remove

    fn MigrationSnapshot::remove(self : MigrationSnapshot, key : String) -> Result[String, ModbusError]

    MigrationSnapshot::timestamp

    fn MigrationSnapshot::timestamp(self : MigrationSnapshot) -> Int

    MigrationSnapshot::version

    fn MigrationSnapshot::version(self : MigrationSnapshot) -> Int

    MigrationState

    pub(all) enum MigrationState {
    MigrationPlanned
    MigrationRunning
    MigrationApplied
    MigrationRolledBack
    MigrationFailed
    } derive(Eq,
    Debug
    )

    Lifecycle state of a configuration migration.

    MigrationStep

    pub(all) struct MigrationStep {
    id : String
    operation : MigrationOperation
    key : String
    value : String
    rollback_value : String?
    order : Int
    applied : Bool
    }

    One deterministic configuration change with a rollback value.

    MigrationStep::applied

    fn MigrationStep::applied(self : MigrationStep) -> Bool

    MigrationStep::id

    fn MigrationStep::id(self : MigrationStep) -> String

    MigrationStep::key

    fn MigrationStep::key(self : MigrationStep) -> String

    MigrationStep::mark_applied

    fn MigrationStep::mark_applied(self : MigrationStep) -> Unit

    MigrationStep::mark_pending

    fn MigrationStep::mark_pending(self : MigrationStep) -> Unit

    MigrationStep::new

    fn MigrationStep::new(id : String, operation : MigrationOperation, key : String, value : String, order : Int, rollback_value? : String) -> Result[MigrationStep, ModbusError]

    MigrationStep::operation

    MigrationStep::order

    fn MigrationStep::order(self : MigrationStep) -> Int

    MigrationStep::rollback_value

    fn MigrationStep::rollback_value(self : MigrationStep) -> String?

    MigrationStep::value

    fn MigrationStep::value(self : MigrationStep) -> String

    ModbusError

    pub(all) enum ModbusError {
    Incomplete
    InvalidLength
    InvalidChecksum
    InvalidAscii
    InvalidMbap
    InvalidUnitId
    InvalidFunction
    InvalidAddress
    InvalidQuantity
    InvalidByteCount
    InvalidData
    InvalidTransaction
    Unsupported
    UnitMismatch
    CapacityExceeded
    NoResponse
    Busy
    } derive(Eq,
    Debug
    )

    Errors produced by the protocol core and its in-memory services.

    ModbusScenario

    pub(all) struct ModbusScenario {
    id : String
    description : String
    steps : Array[ScenarioStep]
    max_steps : Int
    revision : Int
    }

    Scenario definition containing steps and shared test variables.

    ModbusScenario::add

    fn ModbusScenario::add(self : ModbusScenario, step : ScenarioStep) -> Result[Unit, ModbusError]

    ModbusScenario::at

    fn ModbusScenario::at(self : ModbusScenario, index : Int) -> Result[ScenarioStep, ModbusError]

    ModbusScenario::description

    fn ModbusScenario::description(self : ModbusScenario) -> String

    ModbusScenario::faults

    fn ModbusScenario::faults(self : ModbusScenario) -> Int

    ModbusScenario::id

    fn ModbusScenario::id(self : ModbusScenario) -> String

    ModbusScenario::new

    fn ModbusScenario::new(id : String, description : String, max_steps? : Int) -> Result[ModbusScenario, ModbusError]

    ModbusScenario::revision

    fn ModbusScenario::revision(self : ModbusScenario) -> Int

    ModbusScenario::step

    fn ModbusScenario::step(self : ModbusScenario, id : String) -> ScenarioStep?

    ModbusScenario::step_count

    fn ModbusScenario::step_count(self : ModbusScenario) -> Int

    ModbusScenario::steps

    ModbusTransaction

    pub(all) struct ModbusTransaction {
    id : String
    unit_id : Byte
    items : Array[TransactionItem]
    outcomes : Array[TransactionOutcome]
    max_items : Int
    state : TransactionState
    next_order : Int
    }

    Ordered transaction coordinator for write-and-verify workflows.

    ModbusTransaction::acknowledge

    fn ModbusTransaction::acknowledge(self : ModbusTransaction, item_id : String, response : Frame, timestamp : Int) -> Result[Unit, ModbusError]

    Record a successful response for the next prepared item.

    ModbusTransaction::add

    fn ModbusTransaction::add(self : ModbusTransaction, request : Frame, compensation? : Frame) -> Result[String, ModbusError]

    ModbusTransaction::commit

    fn ModbusTransaction::commit(self : ModbusTransaction) -> Result[Unit, ModbusError]

    Commit only when every prepared item has acknowledged successfully.

    ModbusTransaction::fail

    fn ModbusTransaction::fail(self : ModbusTransaction, item_id : String, error : ModbusError, timestamp : Int) -> Result[Unit, ModbusError]

    Mark an item failed and retain the protocol error.

    ModbusTransaction::id

    fn ModbusTransaction::id(self : ModbusTransaction) -> String

    ModbusTransaction::is_successful

    fn ModbusTransaction::is_successful(self : ModbusTransaction) -> Bool

    ModbusTransaction::item_count

    fn ModbusTransaction::item_count(self : ModbusTransaction) -> Int

    ModbusTransaction::new

    fn ModbusTransaction::new(id : String, unit_id : Byte, max_items? : Int) -> Result[ModbusTransaction, ModbusError]

    ModbusTransaction::next_prepared

    ModbusTransaction::outcome_count

    fn ModbusTransaction::outcome_count(self : ModbusTransaction) -> Int

    ModbusTransaction::outcomes

    ModbusTransaction::prepare

    fn ModbusTransaction::prepare(self : ModbusTransaction) -> Result[Unit, ModbusError]

    Prepare all requests, rejecting malformed frames before transport I/O.

    ModbusTransaction::rollback

    fn ModbusTransaction::rollback(self : ModbusTransaction, timestamp : Int) -> Result[Array[Frame], ModbusError]

    Roll back a prepared or partially committed transaction.

    ModbusTransaction::state

    ModbusTransaction::unit_id

    fn ModbusTransaction::unit_id(self : ModbusTransaction) -> Byte

    Mode

    pub(all) enum Mode {
    Rtu
    Ascii
    Tcp
    } derive(Eq,
    Debug
    )

    A Modbus wire mode.

    MovingAverage

    pub(all) struct MovingAverage {
    values : Array[Int]
    max_values : Int
    }

    Fixed-size moving average with integer arithmetic.

    MovingAverage::average

    fn MovingAverage::average(self : MovingAverage) -> Result[Int, ModbusError]

    MovingAverage::clear

    fn MovingAverage::clear(self : MovingAverage) -> Unit

    MovingAverage::length

    fn MovingAverage::length(self : MovingAverage) -> Int

    MovingAverage::new

    fn MovingAverage::new(max_values : Int) -> Result[MovingAverage, ModbusError]

    MovingAverage::push

    fn MovingAverage::push(self : MovingAverage, value : Int) -> Unit

    MovingAverage::snapshot

    fn MovingAverage::snapshot(self : MovingAverage) -> Array[Int]

    NetworkTopology

    pub(all) struct NetworkTopology {
    nodes : Array[TopologyNode]
    links : Array[TopologyLink]
    max_nodes : Int
    max_links : Int
    }

    A mutable topology graph used by gateway routing and deployment tools.
    fn NetworkTopology::add_link(self : NetworkTopology, link : TopologyLink) -> Result[Unit, ModbusError]

    NetworkTopology::add_node

    fn NetworkTopology::add_node(self : NetworkTopology, node : TopologyNode) -> Result[Unit, ModbusError]

    fn NetworkTopology::busy_links(self : NetworkTopology, threshold : Int) -> Result[Array[String], ModbusError]

    Return links at or above a utilization threshold.

    NetworkTopology::has_node

    fn NetworkTopology::has_node(self : NetworkTopology, id : String) -> Bool

    fn NetworkTopology::link(self : NetworkTopology, id : String) -> TopologyLink?

    fn NetworkTopology::link_count(self : NetworkTopology) -> Int

    fn NetworkTopology::max_links(self : NetworkTopology) -> Int

    NetworkTopology::max_nodes

    fn NetworkTopology::max_nodes(self : NetworkTopology) -> Int

    NetworkTopology::new

    fn NetworkTopology::new(max_nodes? : Int, max_links? : Int) -> Result[NetworkTopology, ModbusError]

    NetworkTopology::node

    fn NetworkTopology::node(self : NetworkTopology, id : String) -> TopologyNode?

    NetworkTopology::node_count

    fn NetworkTopology::node_count(self : NetworkTopology) -> Int

    NetworkTopology::remove_node

    fn NetworkTopology::remove_node(self : NetworkTopology, id : String) -> Result[TopologyNode, ModbusError]

    NetworkTopology::route

    fn NetworkTopology::route(self : NetworkTopology, source : String, destination : String) -> Result[TopologyRoute, ModbusError]

    Find a low-cost path with a bounded Bellman-Ford relaxation.
    fn NetworkTopology::set_link_utilization(self : NetworkTopology, id : String, utilization : Int) -> Result[Unit, ModbusError]

    NetworkTopology::set_node_health

    fn NetworkTopology::set_node_health(self : NetworkTopology, id : String, health : TopologyHealth) -> Result[Unit, ModbusError]

    NetworkTopology::unhealthy_nodes

    fn NetworkTopology::unhealthy_nodes(self : NetworkTopology) -> Array[String]

    Return all nodes whose health is not currently healthy.

    NetworkTopology::validate

    Validate graph references, duplicate identifiers, and unit assignments.

    ObservabilityDigest

    pub(all) struct ObservabilityDigest {
    metric_series : Int
    samples : Int
    counters : Int
    gauges : Int
    latest_timestamp : Int
    }

    Snapshot counts for a service status endpoint.

    ObservabilityDigest::counters

    fn ObservabilityDigest::counters(self : ObservabilityDigest) -> Int

    ObservabilityDigest::gauges

    fn ObservabilityDigest::gauges(self : ObservabilityDigest) -> Int

    ObservabilityDigest::latest_timestamp

    fn ObservabilityDigest::latest_timestamp(self : ObservabilityDigest) -> Int

    ObservabilityDigest::metric_series

    fn ObservabilityDigest::metric_series(self : ObservabilityDigest) -> Int

    ObservabilityDigest::samples

    fn ObservabilityDigest::samples(self : ObservabilityDigest) -> Int

    ParserRole

    pub(all) enum ParserRole {
    Request
    Response
    Either
    } derive(Eq,
    Debug
    )

    The side of a stream that an incremental parser is consuming.

    Pdu

    pub(all) struct Pdu {
    function : Byte
    data : Array[Byte]
    }

    A Modbus application data unit without transport framing.

    Pdu::data_length

    fn Pdu::data_length(self : Pdu) -> Int

    Pdu::function_code

    fn Pdu::function_code(self : Pdu) -> FunctionCode

    Pdu::is_exception

    fn Pdu::is_exception(self : Pdu) -> Bool

    Pdu::new

    fn Pdu::new(function : Byte, data : Array[Byte]) -> Pdu

    PeerGuardState

    pub(all) struct PeerGuardState {
    peer : String
    timestamps : Array[Int]
    fingerprints : Array[(FrameFingerprint, Int)]
    accepted : Int
    rejected : Int
    }

    Per-peer admission state.

    PeerGuardState::accepted

    fn PeerGuardState::accepted(self : PeerGuardState) -> Int

    PeerGuardState::duplicate

    fn PeerGuardState::duplicate(self : PeerGuardState, fingerprint : FrameFingerprint, now : Int, policy : ProtocolGuardPolicy) -> Bool

    PeerGuardState::frame_count

    fn PeerGuardState::frame_count(self : PeerGuardState) -> Int

    PeerGuardState::new

    fn PeerGuardState::new(peer : String) -> Result[PeerGuardState, ModbusError]

    PeerGuardState::peer

    fn PeerGuardState::peer(self : PeerGuardState) -> String

    PeerGuardState::prune

    fn PeerGuardState::prune(self : PeerGuardState, now : Int, policy : ProtocolGuardPolicy) -> Result[Unit, ModbusError]

    PeerGuardState::record

    fn PeerGuardState::record(self : PeerGuardState, fingerprint : FrameFingerprint, now : Int, accepted : Bool) -> Unit

    PeerGuardState::rejected

    fn PeerGuardState::rejected(self : PeerGuardState) -> Int

    PendingExchange

    pub(all) struct PendingExchange {
    transaction_id : UInt16
    frame : Frame
    attempts : Int
    created_at : Int
    last_sent_at : Int
    state : ExchangeState
    }

    A pending exchange retained for correlation and retry accounting.

    PlanSummary

    pub(all) struct PlanSummary {
    requests : Int
    total_registers : Int
    total_coils : Int
    total_bytes : Int
    }

    A request plan summary used to size queues before dispatch.

    PlannedRequest

    pub(all) struct PlannedRequest {
    id : Int
    frame : Frame
    address : AddressRange
    }

    A range request planner that splits large logical reads into legal PDUs.

    PollArea

    pub(all) enum PollArea {
    PollCoils
    PollDiscreteInputs
    PollHoldingRegisters
    PollInputRegisters
    } derive(Eq,
    Debug
    )

    Address space selected by a polling point.

    PollBudget

    pub(all) struct PollBudget {
    max_requests : Int
    max_registers : Int
    requests : Int
    registers : Int
    rejected : Int
    }

    A budget for limiting requests emitted in one scheduler cycle.

    PollBudget::accept

    fn PollBudget::accept(self : PollBudget, group : PollRequestGroup) -> Bool

    PollBudget::max_registers

    fn PollBudget::max_registers(self : PollBudget) -> Int

    PollBudget::max_requests

    fn PollBudget::max_requests(self : PollBudget) -> Int

    PollBudget::new

    fn PollBudget::new(max_requests : Int, max_registers : Int) -> Result[PollBudget, ModbusError]

    PollBudget::registers

    fn PollBudget::registers(self : PollBudget) -> Int

    PollBudget::rejected

    fn PollBudget::rejected(self : PollBudget) -> Int

    PollBudget::remaining_registers

    fn PollBudget::remaining_registers(self : PollBudget) -> Int

    PollBudget::remaining_requests

    fn PollBudget::remaining_requests(self : PollBudget) -> Int

    PollBudget::requests

    fn PollBudget::requests(self : PollBudget) -> Int

    PollBudget::reset

    fn PollBudget::reset(self : PollBudget) -> Unit

    PollGroupPlan

    pub(all) struct PollGroupPlan {
    points : Array[PollPoint]
    groups : Array[PollRequestGroup]
    max_groups : Int
    merge_gap : Int
    revision : Int
    }

    A complete plan generated from point definitions.

    PollGroupPlan::add_point

    fn PollGroupPlan::add_point(self : PollGroupPlan, point : PollPoint) -> Result[Unit, ModbusError]

    PollGroupPlan::budgeted

    fn PollGroupPlan::budgeted(self : PollGroupPlan, budget : PollBudget) -> Array[PollRequestGroup]

    Produce a budgeted batch while preserving group priority order.

    PollGroupPlan::due_groups

    fn PollGroupPlan::due_groups(self : PollGroupPlan, now : Int, last_run : Array[(String, Int)]) -> Result[Array[String], ModbusError]

    PollGroupPlan::group_count

    fn PollGroupPlan::group_count(self : PollGroupPlan) -> Int

    PollGroupPlan::groups

    PollGroupPlan::groups_for

    fn PollGroupPlan::groups_for(self : PollGroupPlan, device_id : String) -> Array[PollRequestGroup]

    PollGroupPlan::new

    fn PollGroupPlan::new(max_groups? : Int, merge_gap? : Int) -> Result[PollGroupPlan, ModbusError]

    PollGroupPlan::point_count

    fn PollGroupPlan::point_count(self : PollGroupPlan) -> Int

    PollGroupPlan::points

    PollGroupPlan::rebuild

    fn PollGroupPlan::rebuild(self : PollGroupPlan) -> Unit

    Rebuild groups using a stable address order and contiguous coalescing.

    PollGroupPlan::remove_point

    fn PollGroupPlan::remove_point(self : PollGroupPlan, id : String) -> Result[PollPoint, ModbusError]

    PollGroupPlan::request_for

    fn PollGroupPlan::request_for(self : PollGroupPlan, group_id : String) -> Result[Frame, ModbusError]

    PollGroupPlan::revision

    fn PollGroupPlan::revision(self : PollGroupPlan) -> Int

    PollGroupPlan::stats

    PollGroupPlan::validate

    fn PollGroupPlan::validate(self : PollGroupPlan) -> Array[ModbusError]

    PollJob

    pub(all) struct PollJob {
    id : Int
    name : String
    request : Frame
    interval : Int
    timeout : Int
    retries : Int
    next_due : Int
    attempts : Int
    runs : Int
    failures : Int
    last_response : Frame?
    }

    A polling job with a deterministic logical-clock schedule.

    PollJob::is_due

    fn PollJob::is_due(self : PollJob, now : Int) -> Bool

    PollJob::mark_failure

    fn PollJob::mark_failure(self : PollJob, now : Int) -> Unit

    PollJob::mark_success

    fn PollJob::mark_success(self : PollJob, now : Int, response : Frame) -> Unit

    PollJob::new

    fn PollJob::new(id : Int, name : String, request : Frame, interval? : Int, timeout? : Int, retries? : Int) -> Result[PollJob, ModbusError]

    PollJob::success_rate

    fn PollJob::success_rate(self : PollJob) -> Float

    PollPlan

    pub struct PollPlan {
    jobs : Array[PollJob]
    max_jobs : Int
    }

    A polling plan keeps jobs ordered and addresses them by stable ids.

    PollPlan::add

    fn PollPlan::add(self : PollPlan, job : PollJob) -> Result[Unit, ModbusError]

    PollPlan::due

    fn PollPlan::due(self : PollPlan, now : Int) -> Array[PollJob]

    PollPlan::job

    fn PollPlan::job(self : PollPlan, id : Int) -> PollJob?

    PollPlan::length

    fn PollPlan::length(self : PollPlan) -> Int

    PollPlan::mark_failure

    fn PollPlan::mark_failure(self : PollPlan, id : Int, now : Int) -> Result[Unit, ModbusError]

    PollPlan::mark_success

    fn PollPlan::mark_success(self : PollPlan, id : Int, now : Int, response : Frame) -> Result[Unit, ModbusError]

    PollPlan::new

    fn PollPlan::new(max_jobs? : Int) -> Result[PollPlan, ModbusError]

    PollPlan::remove

    fn PollPlan::remove(self : PollPlan, id : Int) -> Result[Unit, ModbusError]

    PollPlan::run_once

    fn PollPlan::run_once(self : PollPlan, device : Device, now : Int) -> PollReport

    Execute due jobs against a deterministic device.

    PollPlan::snapshot

    fn PollPlan::snapshot(self : PollPlan) -> Array[PollJob]

    PollPlanStats

    pub(all) struct PollPlanStats {
    points : Int
    enabled_points : Int
    groups : Int
    merged_points : Int
    estimated_registers : Int
    highest_priority : Int
    }

    A plan statistic used to tune address maps and transport budgets.

    PollPlanStats::enabled_points

    fn PollPlanStats::enabled_points(self : PollPlanStats) -> Int

    PollPlanStats::estimated_registers

    fn PollPlanStats::estimated_registers(self : PollPlanStats) -> Int

    PollPlanStats::groups

    fn PollPlanStats::groups(self : PollPlanStats) -> Int

    PollPlanStats::highest_priority

    fn PollPlanStats::highest_priority(self : PollPlanStats) -> Int

    PollPlanStats::merged_points

    fn PollPlanStats::merged_points(self : PollPlanStats) -> Int

    PollPlanStats::points

    fn PollPlanStats::points(self : PollPlanStats) -> Int

    PollPoint

    pub(all) struct PollPoint {
    id : String
    device_id : String
    unit_id : Byte
    area : PollArea
    address : UInt16
    quantity : Int
    period : Int
    priority : Int
    enabled : Bool
    }

    A point requested by a periodic acquisition job.

    PollPoint::address

    fn PollPoint::address(self : PollPoint) -> UInt16

    PollPoint::area

    fn PollPoint::area(self : PollPoint) -> PollArea

    PollPoint::device_id

    fn PollPoint::device_id(self : PollPoint) -> String

    PollPoint::enabled

    fn PollPoint::enabled(self : PollPoint) -> Bool

    PollPoint::end_exclusive

    fn PollPoint::end_exclusive(self : PollPoint) -> Int

    PollPoint::id

    fn PollPoint::id(self : PollPoint) -> String

    PollPoint::new

    fn PollPoint::new(id : String, device_id : String, unit_id : Byte, area : PollArea, address : UInt16, quantity : Int, period : Int, priority? : Int) -> Result[PollPoint, ModbusError]

    PollPoint::overlaps

    fn PollPoint::overlaps(self : PollPoint, other : PollPoint) -> Bool

    PollPoint::period

    fn PollPoint::period(self : PollPoint) -> Int

    PollPoint::priority

    fn PollPoint::priority(self : PollPoint) -> Int

    PollPoint::quantity

    fn PollPoint::quantity(self : PollPoint) -> Int

    PollPoint::set_enabled

    fn PollPoint::set_enabled(self : PollPoint, enabled : Bool) -> Unit

    PollPoint::unit_id

    fn PollPoint::unit_id(self : PollPoint) -> Byte

    PollReport

    pub(all) struct PollReport {
    now : Int
    attempted : Int
    succeeded : Int
    failed : Int
    responses : Array[Frame]
    }

    One scheduler run result.

    PollRequestGroup

    pub(all) struct PollRequestGroup {
    id : String
    device_id : String
    unit_id : Byte
    area : PollArea
    address : UInt16
    quantity : Int
    points : Array[String]
    period : Int
    priority : Int
    }

    A contiguous request made from one or more polling points.

    PollRequestGroup::address

    fn PollRequestGroup::address(self : PollRequestGroup) -> UInt16

    PollRequestGroup::area

    PollRequestGroup::can_merge

    fn PollRequestGroup::can_merge(self : PollRequestGroup, point : PollPoint, gap : Int) -> Bool

    PollRequestGroup::device_id

    fn PollRequestGroup::device_id(self : PollRequestGroup) -> String

    PollRequestGroup::end_exclusive

    fn PollRequestGroup::end_exclusive(self : PollRequestGroup) -> Int

    PollRequestGroup::id

    fn PollRequestGroup::id(self : PollRequestGroup) -> String

    PollRequestGroup::merge

    fn PollRequestGroup::merge(self : PollRequestGroup, point : PollPoint) -> Result[Unit, ModbusError]

    PollRequestGroup::new

    fn PollRequestGroup::new(id : String, first : PollPoint) -> PollRequestGroup

    PollRequestGroup::period

    fn PollRequestGroup::period(self : PollRequestGroup) -> Int

    PollRequestGroup::point_count

    fn PollRequestGroup::point_count(self : PollRequestGroup) -> Int

    PollRequestGroup::points

    fn PollRequestGroup::points(self : PollRequestGroup) -> Array[String]

    PollRequestGroup::priority

    fn PollRequestGroup::priority(self : PollRequestGroup) -> Int

    PollRequestGroup::quantity

    fn PollRequestGroup::quantity(self : PollRequestGroup) -> Int

    PollRequestGroup::request

    fn PollRequestGroup::request(self : PollRequestGroup) -> Result[Frame, ModbusError]

    Build the request frame for a contiguous poll group.

    PollRequestGroup::summary

    fn PollRequestGroup::summary(self : PollRequestGroup) -> String

    PollRequestGroup::unit_id

    fn PollRequestGroup::unit_id(self : PollRequestGroup) -> Byte

    PollScheduler

    pub struct PollScheduler {
    plan : PollPlan
    device : Device
    mode : Mode
    last_report : PollReport?
    }

    A scheduler that records the last report and applies a transport mode.

    PollScheduler::last_report

    fn PollScheduler::last_report(self : PollScheduler) -> PollReport?

    PollScheduler::mode

    fn PollScheduler::mode(self : PollScheduler) -> Mode

    PollScheduler::new

    fn PollScheduler::new(plan : PollPlan, device : Device, mode : Mode) -> PollScheduler

    PollScheduler::plan

    PollScheduler::tick

    fn PollScheduler::tick(self : PollScheduler, now : Int) -> PollReport

    PreflightReport

    pub(all) struct PreflightReport {
    errors : Array[String]
    warnings : Array[String]
    checked_frames : Int
    checked_devices : Int
    }

    A structured preflight report for deployment and CI diagnostics.

    PreflightReport::error_count

    fn PreflightReport::error_count(self : PreflightReport) -> Int

    PreflightReport::errors

    fn PreflightReport::errors(self : PreflightReport) -> Array[String]

    PreflightReport::new

    PreflightReport::ok

    fn PreflightReport::ok(self : PreflightReport) -> Bool

    PreflightReport::warning_count

    fn PreflightReport::warning_count(self : PreflightReport) -> Int

    PreflightReport::warnings

    fn PreflightReport::warnings(self : PreflightReport) -> Array[String]

    ProfileArea

    pub(all) enum ProfileArea {
    Coils
    DiscreteInputs
    HoldingRegisters
    InputRegisters
    } derive(Eq,
    Debug
    )

    A logical address area used by a device profile.

    ProfileEncoding

    pub(all) enum ProfileEncoding {
    Bit
    Unsigned16
    Signed16
    Unsigned32
    Signed32
    Unsigned64
    RawWords
    } derive(Eq,
    Debug
    )

    Encoding used when a profile point is mapped to registers.

    ProfilePoint

    pub(all) struct ProfilePoint {
    id : String
    label : String
    area : ProfileArea
    address : UInt16
    quantity : Int
    encoding : ProfileEncoding
    writable : Bool
    scale_numerator : Int
    scale_denominator : Int
    offset : Int
    }

    A single named data point exposed by an industrial device.

    ProfilePoint::address

    fn ProfilePoint::address(self : ProfilePoint) -> UInt16

    ProfilePoint::area

    ProfilePoint::contains

    fn ProfilePoint::contains(self : ProfilePoint, address : UInt16) -> Bool

    ProfilePoint::contains_range

    fn ProfilePoint::contains_range(self : ProfilePoint, address : UInt16, length : Int) -> Bool

    ProfilePoint::encoding

    fn ProfilePoint::encoding(self : ProfilePoint) -> ProfileEncoding

    ProfilePoint::end_exclusive

    fn ProfilePoint::end_exclusive(self : ProfilePoint) -> Int

    ProfilePoint::engineering_to_raw

    fn ProfilePoint::engineering_to_raw(self : ProfilePoint, value : Int) -> Result[Int, ModbusError]

    ProfilePoint::function_code

    fn ProfilePoint::function_code(self : ProfilePoint) -> Byte

    ProfilePoint::id

    fn ProfilePoint::id(self : ProfilePoint) -> String

    ProfilePoint::label

    fn ProfilePoint::label(self : ProfilePoint) -> String

    ProfilePoint::new

    fn ProfilePoint::new(id : String, label : String, area : ProfileArea, address : UInt16, quantity : Int, encoding : ProfileEncoding, writable? : Bool, scale_numerator? : Int, scale_denominator? : Int, offset? : Int) -> Result[ProfilePoint, ModbusError]

    ProfilePoint::offset

    fn ProfilePoint::offset(self : ProfilePoint) -> Int

    ProfilePoint::quantity

    fn ProfilePoint::quantity(self : ProfilePoint) -> Int

    ProfilePoint::raw_to_engineering

    fn ProfilePoint::raw_to_engineering(self : ProfilePoint, raw : Int) -> Int

    ProfilePoint::read_request

    fn ProfilePoint::read_request(self : ProfilePoint, unit_id : Byte) -> Result[Frame, ModbusError]

    ProfilePoint::register_count

    fn ProfilePoint::register_count(self : ProfilePoint) -> Int

    ProfilePoint::scale_denominator

    fn ProfilePoint::scale_denominator(self : ProfilePoint) -> Int

    ProfilePoint::scale_numerator

    fn ProfilePoint::scale_numerator(self : ProfilePoint) -> Int

    ProfilePoint::summary

    fn ProfilePoint::summary(self : ProfilePoint) -> String

    ProfilePoint::writable

    fn ProfilePoint::writable(self : ProfilePoint) -> Bool

    ProfilePoint::write_request

    fn ProfilePoint::write_request(self : ProfilePoint, unit_id : Byte, value : Int) -> Result[Frame, ModbusError]

    ProfileRegistry

    pub(all) struct ProfileRegistry {
    profiles : Array[DeviceProfile]
    max_profiles : Int
    }

    Registry for profiles loaded from an application configuration.

    ProfileRegistry::add

    fn ProfileRegistry::add(self : ProfileRegistry, profile : DeviceProfile) -> Result[Unit, ModbusError]

    ProfileRegistry::by_name

    fn ProfileRegistry::by_name(self : ProfileRegistry, name : String) -> DeviceProfile?

    ProfileRegistry::by_unit

    fn ProfileRegistry::by_unit(self : ProfileRegistry, unit_id : Byte) -> DeviceProfile?

    ProfileRegistry::count

    fn ProfileRegistry::count(self : ProfileRegistry) -> Int

    ProfileRegistry::new

    fn ProfileRegistry::new(max_profiles? : Int) -> Result[ProfileRegistry, ModbusError]

    ProfileRegistry::remove_by_name

    fn ProfileRegistry::remove_by_name(self : ProfileRegistry, name : String) -> Result[DeviceProfile, ModbusError]

    ProfileRegistry::replace

    fn ProfileRegistry::replace(self : ProfileRegistry, profile : DeviceProfile) -> Result[Unit, ModbusError]

    ProfileRegistry::snapshot

    ProfileValue

    pub(all) enum ProfileValue {
    BitValue(Bool)
    U16(UInt16)
    I16(Int)
    U32(UInt)
    I32(Int)
    U64(UInt64)
    Words(Array[UInt16])
    } derive(
    Debug
    )

    A typed value returned by a profile point decoder.

    ProfileValue::as_int

    fn ProfileValue::as_int(self : ProfileValue) -> Result[Int, ModbusError]

    ProfileValue::summary

    fn ProfileValue::summary(self : ProfileValue) -> String

    ProfileValue::word_count

    fn ProfileValue::word_count(self : ProfileValue) -> Int

    ProtocolGuard

    pub(all) struct ProtocolGuard {
    policy : ProtocolGuardPolicy
    peers : Array[PeerGuardState]
    events : Array[GuardEvent]
    max_peers : Int
    max_events : Int
    sequence : Int
    }

    A protocol admission guard safe to use before decoding application data.

    ProtocolGuard::admit

    fn ProtocolGuard::admit(self : ProtocolGuard, peer_name : String, frame : Frame, now : Int) -> Result[GuardDecision, ModbusError]

    Validate and record a frame before transport-specific decoding.

    ProtocolGuard::clear_events

    fn ProtocolGuard::clear_events(self : ProtocolGuard) -> Unit

    Flush historical events while retaining peer counters.

    ProtocolGuard::decision_counts

    fn ProtocolGuard::decision_counts(self : ProtocolGuard) -> Array[Int]

    ProtocolGuard::event_count

    fn ProtocolGuard::event_count(self : ProtocolGuard) -> Int

    ProtocolGuard::new

    fn ProtocolGuard::new(policy : ProtocolGuardPolicy, max_peers? : Int, max_events? : Int) -> Result[ProtocolGuard, ModbusError]

    ProtocolGuard::peer_count

    fn ProtocolGuard::peer_count(self : ProtocolGuard) -> Int

    ProtocolGuard::peer_stats

    fn ProtocolGuard::peer_stats(self : ProtocolGuard, name : String) -> Result[(Int, Int), ModbusError]

    ProtocolGuard::policy

    ProtocolGuard::recent_events

    fn ProtocolGuard::recent_events(self : ProtocolGuard, limit : Int) -> Result[Array[GuardEvent], ModbusError]

    ProtocolGuardPolicy

    pub(all) struct ProtocolGuardPolicy {
    max_frame_bytes : Int
    max_frames : Int
    window : Int
    duplicate_window : Int
    allow_broadcast : Bool
    functions : Array[Byte]
    }

    Per-peer frame quota and size policy.

    ProtocolGuardPolicy::add_function

    fn ProtocolGuardPolicy::add_function(self : ProtocolGuardPolicy, function : Byte) -> Result[Unit, ModbusError]

    ProtocolGuardPolicy::allow_broadcast

    fn ProtocolGuardPolicy::allow_broadcast(self : ProtocolGuardPolicy) -> Bool

    ProtocolGuardPolicy::duplicate_window

    fn ProtocolGuardPolicy::duplicate_window(self : ProtocolGuardPolicy) -> Int

    ProtocolGuardPolicy::function_allowed

    fn ProtocolGuardPolicy::function_allowed(self : ProtocolGuardPolicy, function : Byte) -> Bool

    ProtocolGuardPolicy::max_frame_bytes

    fn ProtocolGuardPolicy::max_frame_bytes(self : ProtocolGuardPolicy) -> Int

    ProtocolGuardPolicy::max_frames

    fn ProtocolGuardPolicy::max_frames(self : ProtocolGuardPolicy) -> Int

    ProtocolGuardPolicy::new

    fn ProtocolGuardPolicy::new(max_frame_bytes? : Int, max_frames? : Int, window? : Int, duplicate_window? : Int, allow_broadcast? : Bool) -> Result[ProtocolGuardPolicy, ModbusError]

    ProtocolGuardPolicy::window

    fn ProtocolGuardPolicy::window(self : ProtocolGuardPolicy) -> Int

    ProtocolLimits

    pub(all) struct ProtocolLimits {
    max_adu : Int
    max_pdu : Int
    max_registers : Int
    max_coils : Int
    max_buffer : Int
    }

    A small immutable configuration snapshot used by clients and servers.

    ProtocolMetrics

    pub(all) struct ProtocolMetrics {
    requests : Int
    responses : Int
    exceptions : Int
    errors : Int
    bytes_in : Int
    bytes_out : Int
    active : Int
    latency : LatencyHistogram
    }

    A snapshot-friendly metrics set for a protocol endpoint.

    ProtocolMetrics::active

    fn ProtocolMetrics::active(self : ProtocolMetrics) -> Int

    ProtocolMetrics::errors

    fn ProtocolMetrics::errors(self : ProtocolMetrics) -> Int

    ProtocolMetrics::exceptions

    fn ProtocolMetrics::exceptions(self : ProtocolMetrics) -> Int

    ProtocolMetrics::new

    ProtocolMetrics::record_error

    fn ProtocolMetrics::record_error(self : ProtocolMetrics) -> Unit

    ProtocolMetrics::record_request

    fn ProtocolMetrics::record_request(self : ProtocolMetrics, bytes : Int) -> Result[Unit, ModbusError]

    ProtocolMetrics::record_response

    fn ProtocolMetrics::record_response(self : ProtocolMetrics, bytes : Int, latency : Int, exception : Bool) -> Result[Unit, ModbusError]

    ProtocolMetrics::requests

    fn ProtocolMetrics::requests(self : ProtocolMetrics) -> Int

    ProtocolMetrics::responses

    fn ProtocolMetrics::responses(self : ProtocolMetrics) -> Int

    ProtocolMetrics::throughput

    fn ProtocolMetrics::throughput(self : ProtocolMetrics, ticks : Int) -> Float

    QualityDecision

    pub(all) enum QualityDecision {
    QualityAccepted
    QualitySubstituted
    QualityRejected
    QualityDeferred
    } derive(Eq,
    Debug
    )

    Decision produced by a quality pipeline.

    QualityFinding

    pub(all) struct QualityFinding {
    rule_id : String
    point_id : String
    check_kind : QualityTest
    decision : QualityDecision
    value : Int
    timestamp : Int
    message : String
    }

    One quality evaluation with stable evidence for the operator.

    QualityFinding::check_kind

    fn QualityFinding::check_kind(self : QualityFinding) -> QualityTest

    QualityFinding::decision

    QualityFinding::message

    fn QualityFinding::message(self : QualityFinding) -> String

    QualityFinding::new

    fn QualityFinding::new(rule : QualityRule, decision : QualityDecision, value : Int, timestamp : Int, message : String) -> Result[QualityFinding, ModbusError]

    QualityFinding::point_id

    fn QualityFinding::point_id(self : QualityFinding) -> String

    QualityFinding::rule_id

    fn QualityFinding::rule_id(self : QualityFinding) -> String

    QualityFinding::timestamp

    fn QualityFinding::timestamp(self : QualityFinding) -> Int

    QualityFinding::value

    fn QualityFinding::value(self : QualityFinding) -> Int

    QualityPipeline

    pub(all) struct QualityPipeline {
    rules : Array[QualityRule]
    findings : Array[QualityFinding]
    max_findings : Int
    }

    Ordered rules and recent findings for a point pipeline.

    QualityPipeline::add_rule

    fn QualityPipeline::add_rule(self : QualityPipeline, rule : QualityRule) -> Result[Unit, ModbusError]

    QualityPipeline::evaluate

    fn QualityPipeline::evaluate(self : QualityPipeline, point_id : String, value : Int, timestamp : Int, previous? : Int?, previous_timestamp? : Int?) -> Result[QualityDecision, ModbusError]

    Evaluate all rules for a point and retain every finding.

    QualityPipeline::finding_count

    fn QualityPipeline::finding_count(self : QualityPipeline) -> Int

    QualityPipeline::findings_for

    fn QualityPipeline::findings_for(self : QualityPipeline, point_id : String) -> Array[QualityFinding]

    QualityPipeline::new

    fn QualityPipeline::new(max_findings? : Int) -> Result[QualityPipeline, ModbusError]

    QualityPipeline::rejected

    fn QualityPipeline::rejected(self : QualityPipeline) -> Int

    QualityPipeline::rule

    fn QualityPipeline::rule(self : QualityPipeline, id : String) -> QualityRule?

    QualityPipeline::rule_count

    fn QualityPipeline::rule_count(self : QualityPipeline) -> Int

    QualityPipeline::substituted

    fn QualityPipeline::substituted(self : QualityPipeline) -> Int

    QualityPipeline::summary

    fn QualityPipeline::summary(self : QualityPipeline, point_id : String) -> QualitySummary

    QualityRule

    pub(all) struct QualityRule {
    id : String
    point_id : String
    check_kind : QualityTest
    lower : Int?
    upper : Int?
    limit : Int
    allowed : Array[Int]
    enabled : Bool
    }

    A field-level quality rule.

    QualityRule::allow_value

    fn QualityRule::allow_value(self : QualityRule, value : Int) -> Result[Unit, ModbusError]

    QualityRule::check_kind

    fn QualityRule::check_kind(self : QualityRule) -> QualityTest

    QualityRule::enabled

    fn QualityRule::enabled(self : QualityRule) -> Bool

    QualityRule::evaluate

    fn QualityRule::evaluate(self : QualityRule, value : Int, timestamp : Int, previous : Int?, previous_timestamp : Int?) -> Result[QualityFinding, ModbusError]

    Evaluate a rule against current and previous observations.

    QualityRule::id

    fn QualityRule::id(self : QualityRule) -> String

    QualityRule::limit

    fn QualityRule::limit(self : QualityRule) -> Int

    QualityRule::lower

    fn QualityRule::lower(self : QualityRule) -> Int?

    QualityRule::new

    fn QualityRule::new(id : String, point_id : String, check_kind : QualityTest, lower? : Int, upper? : Int, limit? : Int) -> Result[QualityRule, ModbusError]

    QualityRule::point_id

    fn QualityRule::point_id(self : QualityRule) -> String

    QualityRule::set_enabled

    fn QualityRule::set_enabled(self : QualityRule, enabled : Bool) -> Unit

    QualityRule::upper

    fn QualityRule::upper(self : QualityRule) -> Int?

    QualitySummary

    pub(all) struct QualitySummary {
    accepted : Int
    substituted : Int
    rejected : Int
    deferred : Int
    }

    A compact quality summary for one point.

    QualitySummary::accepted

    fn QualitySummary::accepted(self : QualitySummary) -> Int

    QualitySummary::deferred

    fn QualitySummary::deferred(self : QualitySummary) -> Int

    QualitySummary::rejected

    fn QualitySummary::rejected(self : QualitySummary) -> Int

    QualitySummary::substituted

    fn QualitySummary::substituted(self : QualitySummary) -> Int

    QualityTest

    pub(all) enum QualityTest {
    RangeTest
    FreshnessTest
    StepTest
    DuplicateTest
    EnumTest
    RequiredTest
    } derive(Eq,
    Debug
    )

    Quality test applied to a decoded point value.

    RateLimiter

    pub(all) struct RateLimiter {
    max_delta : Int
    previous : Int?
    }

    Simple rate limiter for noisy integer signals.

    RateLimiter::apply

    fn RateLimiter::apply(self : RateLimiter, value : Int) -> Int

    RateLimiter::max_delta

    fn RateLimiter::max_delta(self : RateLimiter) -> Int

    RateLimiter::new

    fn RateLimiter::new(max_delta : Int) -> Result[RateLimiter, ModbusError]

    RateLimiter::reset

    fn RateLimiter::reset(self : RateLimiter) -> Unit

    RateWindow

    pub(all) struct RateWindow {
    width : Int
    limit : Int
    timestamps : Array[Int]
    }

    A fixed-size request window for rate limiting a transport or unit.

    RateWindow::allow

    fn RateWindow::allow(self : RateWindow, now : Int) -> Bool

    RateWindow::count

    fn RateWindow::count(self : RateWindow, now : Int) -> Int

    RateWindow::limit

    fn RateWindow::limit(self : RateWindow) -> Int

    RateWindow::new

    fn RateWindow::new(width : Int, limit : Int) -> Result[RateWindow, ModbusError]

    RateWindow::prune

    fn RateWindow::prune(self : RateWindow, now : Int) -> Unit

    RateWindow::remaining

    fn RateWindow::remaining(self : RateWindow, now : Int) -> Int

    RateWindow::reset

    fn RateWindow::reset(self : RateWindow) -> Unit

    RateWindow::width

    fn RateWindow::width(self : RateWindow) -> Int

    ReadingQuality

    pub(all) enum ReadingQuality {
    Good
    OutOfRange
    Stale
    Disconnected
    BadFormat
    Substituted
    } derive(Eq,
    Debug
    )

    Quality assigned to a value after conversion and filtering.

    ReconciliationDiff

    pub(all) struct ReconciliationDiff {
    point_id : String
    kind : ReconciliationKind
    expected : Int?
    observed : Int?
    detail : String
    }

    One difference between an expected and observed snapshot.

    ReconciliationDiff::detail

    fn ReconciliationDiff::detail(self : ReconciliationDiff) -> String

    ReconciliationDiff::expected

    fn ReconciliationDiff::expected(self : ReconciliationDiff) -> Int?

    ReconciliationDiff::kind

    ReconciliationDiff::new

    fn ReconciliationDiff::new(point_id : String, kind : ReconciliationKind, expected? : Int, observed? : Int, detail? : String) -> Result[ReconciliationDiff, ModbusError]

    ReconciliationDiff::observed

    fn ReconciliationDiff::observed(self : ReconciliationDiff) -> Int?

    ReconciliationDiff::point_id

    fn ReconciliationDiff::point_id(self : ReconciliationDiff) -> String

    ReconciliationKind

    pub(all) enum ReconciliationKind {
    MissingPoint
    AddedPoint
    ValueChanged
    QualityChanged
    TimestampRegressed
    SnapshotComplete
    } derive(Eq,
    Debug
    )

    Difference class produced when comparing two device observations.

    ReconciliationReport

    pub(all) struct ReconciliationReport {
    device_id : String
    compared : Int
    differences : Int
    missing : Int
    added : Int
    changed : Int
    equivalent : Bool
    }

    Accumulated reconciliation result for a device fleet.

    ReconciliationReport::added

    ReconciliationReport::changed

    fn ReconciliationReport::changed(self : ReconciliationReport) -> Int

    ReconciliationReport::compared

    fn ReconciliationReport::compared(self : ReconciliationReport) -> Int

    ReconciliationReport::device_id

    fn ReconciliationReport::device_id(self : ReconciliationReport) -> String

    ReconciliationReport::differences

    fn ReconciliationReport::differences(self : ReconciliationReport) -> Int

    ReconciliationReport::equivalent

    fn ReconciliationReport::equivalent(self : ReconciliationReport) -> Bool

    ReconciliationReport::missing

    fn ReconciliationReport::missing(self : ReconciliationReport) -> Int

    RegisterBank

    pub(all) struct RegisterBank {
    start : UInt16
    values : Array[UInt16]
    writable : Bool
    }

    A contiguous, bounds-checked register bank.

    RegisterBank::clear

    fn RegisterBank::clear(self : RegisterBank) -> Unit

    RegisterBank::contains

    fn RegisterBank::contains(self : RegisterBank, address : UInt16, quantity : Int) -> Bool

    RegisterBank::end_exclusive

    fn RegisterBank::end_exclusive(self : RegisterBank) -> Int

    RegisterBank::fill

    fn RegisterBank::fill(self : RegisterBank, value : UInt16) -> Unit

    RegisterBank::get

    fn RegisterBank::get(self : RegisterBank, address : UInt16) -> Result[UInt16, ModbusError]

    RegisterBank::is_writable

    fn RegisterBank::is_writable(self : RegisterBank) -> Bool

    RegisterBank::length

    fn RegisterBank::length(self : RegisterBank) -> Int

    RegisterBank::new

    fn RegisterBank::new(start : UInt16, length : Int, writable? : Bool) -> Result[RegisterBank, ModbusError]

    Create a register bank in the 16-bit address space.

    RegisterBank::read

    fn RegisterBank::read(self : RegisterBank, address : UInt16, quantity : Int) -> Result[Array[UInt16], ModbusError]

    RegisterBank::set

    fn RegisterBank::set(self : RegisterBank, address : UInt16, value : UInt16) -> Result[Unit, ModbusError]

    RegisterBank::snapshot

    fn RegisterBank::snapshot(self : RegisterBank) -> Array[UInt16]

    RegisterBank::start

    fn RegisterBank::start(self : RegisterBank) -> UInt16

    RegisterBank::write

    fn RegisterBank::write(self : RegisterBank, address : UInt16, values : Array[UInt16]) -> Result[Unit, ModbusError]

    RegisterBank::write_mask

    fn RegisterBank::write_mask(self : RegisterBank, address : UInt16, and_mask : UInt16, or_mask : UInt16) -> Result[UInt16, ModbusError]

    RegisterByteOrder

    pub(all) enum RegisterByteOrder {
    BigEndian
    LittleEndian
    } derive(Eq,
    Debug
    )

    Register byte order used when mapping multi-register values.

    RegisterCursor

    pub(all) struct RegisterCursor {
    values : Array[UInt16]
    position : Int
    }

    A bounds-checked cursor over an owned register array.

    RegisterCursor::at_end

    fn RegisterCursor::at_end(self : RegisterCursor) -> Bool

    RegisterCursor::new

    fn RegisterCursor::new(values : Array[UInt16]) -> RegisterCursor

    RegisterCursor::position

    fn RegisterCursor::position(self : RegisterCursor) -> Int

    RegisterCursor::read_f32

    fn RegisterCursor::read_f32(self : RegisterCursor, order : RegisterWordOrder) -> Result[Float, ModbusError]

    RegisterCursor::read_i16

    fn RegisterCursor::read_i16(self : RegisterCursor) -> Result[Int, ModbusError]

    RegisterCursor::read_i32

    fn RegisterCursor::read_i32(self : RegisterCursor, order : RegisterWordOrder) -> Result[Int, ModbusError]

    RegisterCursor::read_u16

    fn RegisterCursor::read_u16(self : RegisterCursor) -> Result[UInt16, ModbusError]

    RegisterCursor::read_u32

    fn RegisterCursor::read_u32(self : RegisterCursor, order : RegisterWordOrder) -> Result[UInt, ModbusError]

    RegisterCursor::read_u64

    fn RegisterCursor::read_u64(self : RegisterCursor, order : RegisterWordOrder) -> Result[UInt64, ModbusError]

    RegisterCursor::remaining

    fn RegisterCursor::remaining(self : RegisterCursor) -> Int

    RegisterCursor::seek

    fn RegisterCursor::seek(self : RegisterCursor, position : Int) -> Result[Unit, ModbusError]

    RegisterCursor::skip

    fn RegisterCursor::skip(self : RegisterCursor, count : Int) -> Result[Unit, ModbusError]

    RegisterField

    pub(all) struct RegisterField {
    name : String
    address : UInt16
    kind : RegisterFieldKind
    writable : Bool
    scale : Float
    }

    A named register field with an explicit wire representation.

    RegisterField::address

    fn RegisterField::address(self : RegisterField) -> UInt16

    RegisterField::is_writable

    fn RegisterField::is_writable(self : RegisterField) -> Bool

    RegisterField::kind

    RegisterField::name

    fn RegisterField::name(self : RegisterField) -> String

    RegisterField::new

    fn RegisterField::new(name : String, address : UInt16, kind : RegisterFieldKind, writable? : Bool, scale? : Float) -> Result[RegisterField, ModbusError]

    RegisterField::scale

    fn RegisterField::scale(self : RegisterField) -> Float

    RegisterField::width

    fn RegisterField::width(self : RegisterField) -> Int

    RegisterFieldKind

    pub(all) enum RegisterFieldKind {
    Unsigned16
    Signed16
    Unsigned32
    Signed32
    Float32
    Unsigned64
    BitField(Int)
    } derive(Eq,
    Debug
    )

    Typed interpretation for a register-backed device schema.

    RegisterFieldKind::name

    fn RegisterFieldKind::name(self : RegisterFieldKind) -> String

    RegisterFieldKind::width

    fn RegisterFieldKind::width(self : RegisterFieldKind) -> Int

    RegisterSchema

    pub struct RegisterSchema {
    fields : Array[RegisterField]
    max_fields : Int
    }

    A schema with unique named fields and no overlapping wire ranges.

    RegisterSchema::add

    fn RegisterSchema::add(self : RegisterSchema, field : RegisterField) -> Result[Unit, ModbusError]

    RegisterSchema::field

    fn RegisterSchema::field(self : RegisterSchema, name : String) -> RegisterField?

    RegisterSchema::fields

    RegisterSchema::length

    fn RegisterSchema::length(self : RegisterSchema) -> Int

    RegisterSchema::new

    fn RegisterSchema::new(max_fields? : Int) -> Result[RegisterSchema, ModbusError]

    RegisterSchema::read

    fn RegisterSchema::read(self : RegisterSchema, name : String, bank : RegisterBank) -> Result[RegisterValue, ModbusError]

    Decode one schema field from a register bank.

    RegisterSchema::read_all

    fn RegisterSchema::read_all(self : RegisterSchema, bank : RegisterBank) -> Result[Array[(String, RegisterValue)], ModbusError]

    Return the values of every field that fits in a bank snapshot.

    RegisterSchema::validate_against

    fn RegisterSchema::validate_against(self : RegisterSchema, bank : RegisterBank) -> Result[Unit, ModbusError]

    Validate a schema against a register bank before starting a service.

    RegisterSchema::write

    fn RegisterSchema::write(self : RegisterSchema, name : String, value : RegisterValue, bank : RegisterBank) -> Result[Unit, ModbusError]

    Encode a typed value and write it to a schema field.

    RegisterValue

    pub(all) enum RegisterValue {
    U16(UInt16)
    I16(Int)
    U32(UInt)
    I32(Int)
    F32(Float)
    U64(UInt64)
    Bits(Array[Bool])
    }

    A value returned by schema-aware reads.

    RegisterWordOrder

    pub(all) enum RegisterWordOrder {
    HighWordFirst
    LowWordFirst
    } derive(Eq,
    Debug
    )

    Word order used for values wider than one register.

    RegisterWriter

    pub(all) struct RegisterWriter {
    values : Array[UInt16]
    capacity : Int
    }

    A register writer that grows only up to a configured capacity.

    RegisterWriter::length

    fn RegisterWriter::length(self : RegisterWriter) -> Int

    RegisterWriter::new

    fn RegisterWriter::new(capacity : Int) -> Result[RegisterWriter, ModbusError]

    RegisterWriter::push

    fn RegisterWriter::push(self : RegisterWriter, value : UInt16) -> Result[Unit, ModbusError]

    RegisterWriter::push_f32

    fn RegisterWriter::push_f32(self : RegisterWriter, value : Float, order : RegisterWordOrder) -> Result[Unit, ModbusError]

    RegisterWriter::push_i16

    fn RegisterWriter::push_i16(self : RegisterWriter, value : Int) -> Result[Unit, ModbusError]

    RegisterWriter::push_u32

    fn RegisterWriter::push_u32(self : RegisterWriter, value : UInt, order : RegisterWordOrder) -> Result[Unit, ModbusError]

    RegisterWriter::push_u64

    fn RegisterWriter::push_u64(self : RegisterWriter, value : UInt64, order : RegisterWordOrder) -> Result[Unit, ModbusError]

    RegisterWriter::remaining

    fn RegisterWriter::remaining(self : RegisterWriter) -> Int

    RegisterWriter::to_array

    fn RegisterWriter::to_array(self : RegisterWriter) -> Array[UInt16]

    ReliabilityFailure

    pub(all) enum ReliabilityFailure {
    TimeoutFailure
    ChecksumFailure
    ProtocolFailure
    TransportFailure
    DeviceException
    ValidationFailure
    } derive(Eq,
    Debug
    )

    Classification used by reliability counters and incident reports.

    ReliabilityFleetSummary

    pub(all) struct ReliabilityFleetSummary {
    devices : Int
    healthy : Int
    degraded : Int
    open_circuits : Int
    average_success_rate : Int
    average_latency : Int
    }

    A fleet-level reliability snapshot for dashboards and alert rules.

    ReliabilityFleetSummary::average_latency

    fn ReliabilityFleetSummary::average_latency(self : ReliabilityFleetSummary) -> Int

    ReliabilityFleetSummary::average_success_rate

    fn ReliabilityFleetSummary::average_success_rate(self : ReliabilityFleetSummary) -> Int

    ReliabilityFleetSummary::degraded

    ReliabilityFleetSummary::devices

    ReliabilityFleetSummary::healthy

    ReliabilityFleetSummary::open_circuits

    fn ReliabilityFleetSummary::open_circuits(self : ReliabilityFleetSummary) -> Int

    ReliabilitySample

    pub(all) struct ReliabilitySample {
    timestamp : Int
    latency : Int
    success : Bool
    failure : ReliabilityFailure?
    operation : String
    }

    One outcome recorded by a transport or polling worker.

    ReliabilitySample::failure

    ReliabilitySample::latency

    fn ReliabilitySample::latency(self : ReliabilitySample) -> Int

    ReliabilitySample::new

    fn ReliabilitySample::new(timestamp : Int, latency : Int, success : Bool, operation : String, failure? : ReliabilityFailure) -> Result[ReliabilitySample, ModbusError]

    ReliabilitySample::operation

    fn ReliabilitySample::operation(self : ReliabilitySample) -> String

    ReliabilitySample::success

    fn ReliabilitySample::success(self : ReliabilitySample) -> Bool

    ReliabilitySample::timestamp

    fn ReliabilitySample::timestamp(self : ReliabilitySample) -> Int

    ReliabilityWindow

    pub(all) struct ReliabilityWindow {
    width : Int
    max_samples : Int
    samples : Array[ReliabilitySample]
    evicted : Int
    }

    A bounded sliding window of request outcomes.

    ReliabilityWindow::append

    fn ReliabilityWindow::append(self : ReliabilityWindow, sample : ReliabilitySample) -> Result[Unit, ModbusError]

    ReliabilityWindow::average_latency

    fn ReliabilityWindow::average_latency(self : ReliabilityWindow) -> Int

    ReliabilityWindow::clear

    fn ReliabilityWindow::clear(self : ReliabilityWindow) -> Unit

    ReliabilityWindow::evicted

    fn ReliabilityWindow::evicted(self : ReliabilityWindow) -> Int

    ReliabilityWindow::failure_count

    fn ReliabilityWindow::failure_count(self : ReliabilityWindow, failure : ReliabilityFailure) -> Int

    ReliabilityWindow::failures

    fn ReliabilityWindow::failures(self : ReliabilityWindow) -> Int

    ReliabilityWindow::latest

    ReliabilityWindow::length

    fn ReliabilityWindow::length(self : ReliabilityWindow) -> Int

    ReliabilityWindow::new

    fn ReliabilityWindow::new(width : Int, max_samples? : Int) -> Result[ReliabilityWindow, ModbusError]

    ReliabilityWindow::prune

    fn ReliabilityWindow::prune(self : ReliabilityWindow, now : Int) -> Result[Int, ModbusError]

    ReliabilityWindow::success_rate

    fn ReliabilityWindow::success_rate(self : ReliabilityWindow) -> Int

    ReliabilityWindow::successes

    fn ReliabilityWindow::successes(self : ReliabilityWindow) -> Int

    ReliabilityWindow::width

    fn ReliabilityWindow::width(self : ReliabilityWindow) -> Int

    ReplayItem

    pub(all) struct ReplayItem {
    record_id : Int
    due_at : Int
    bytes : Array[Byte]
    attempts : Int
    sent : Bool
    }

    A deterministic replay item generated from a capture record.

    ReplayItem::attempts

    fn ReplayItem::attempts(self : ReplayItem) -> Int

    ReplayItem::bytes

    fn ReplayItem::bytes(self : ReplayItem) -> Array[Byte]

    ReplayItem::due_at

    fn ReplayItem::due_at(self : ReplayItem) -> Int

    ReplayItem::is_due

    fn ReplayItem::is_due(self : ReplayItem, now : Int) -> Bool

    ReplayItem::mark_sent

    fn ReplayItem::mark_sent(self : ReplayItem) -> Result[Unit, ModbusError]

    ReplayItem::new

    fn ReplayItem::new(record : CaptureRecord, due_at : Int) -> Result[ReplayItem, ModbusError]

    ReplayItem::record_id

    fn ReplayItem::record_id(self : ReplayItem) -> Int

    ReplayItem::reset

    fn ReplayItem::reset(self : ReplayItem, due_at : Int) -> Result[Unit, ModbusError]

    ReplayItem::sent

    fn ReplayItem::sent(self : ReplayItem) -> Bool

    ReplayPlan

    pub(all) struct ReplayPlan {
    items : Array[ReplayItem]
    max_items : Int
    started_at : Int?
    }

    A replay plan for deterministic integration tests and diagnostics.

    ReplayPlan::add

    fn ReplayPlan::add(self : ReplayPlan, record : CaptureRecord, delay : Int) -> Result[Unit, ModbusError]

    ReplayPlan::completed

    fn ReplayPlan::completed(self : ReplayPlan) -> Int

    ReplayPlan::length

    fn ReplayPlan::length(self : ReplayPlan) -> Int

    ReplayPlan::mark_sent

    fn ReplayPlan::mark_sent(self : ReplayPlan, record_id : Int) -> Result[Unit, ModbusError]

    ReplayPlan::new

    fn ReplayPlan::new(max_items? : Int) -> Result[ReplayPlan, ModbusError]

    ReplayPlan::next_due

    fn ReplayPlan::next_due(self : ReplayPlan, now : Int) -> ReplayItem?

    ReplayPlan::pending

    fn ReplayPlan::pending(self : ReplayPlan) -> Int

    ReplayPlan::reset

    fn ReplayPlan::reset(self : ReplayPlan, timestamp : Int) -> Result[Unit, ModbusError]

    ReplayPlan::snapshot

    fn ReplayPlan::snapshot(self : ReplayPlan) -> Array[ReplayItem]

    ReplayPlan::start

    fn ReplayPlan::start(self : ReplayPlan, timestamp : Int) -> Result[Unit, ModbusError]

    ResourceLease

    pub(all) struct ResourceLease {
    id : String
    resource : String
    owner : String
    acquired_at : Int
    expires_at : Int
    state : LeaseState
    renewals : Int
    priority : Int
    }

    A time-bounded exclusive lease with renewal history.

    ResourceLease::acquired_at

    fn ResourceLease::acquired_at(self : ResourceLease) -> Int

    ResourceLease::active

    fn ResourceLease::active(self : ResourceLease, now : Int) -> Bool

    ResourceLease::expire

    fn ResourceLease::expire(self : ResourceLease, now : Int) -> Result[Unit, ModbusError]

    ResourceLease::expires_at

    fn ResourceLease::expires_at(self : ResourceLease) -> Int

    ResourceLease::id

    fn ResourceLease::id(self : ResourceLease) -> String

    ResourceLease::new

    fn ResourceLease::new(id : String, resource : String, owner : String, acquired_at : Int, duration : Int, priority? : Int) -> Result[ResourceLease, ModbusError]

    ResourceLease::owner

    fn ResourceLease::owner(self : ResourceLease) -> String

    ResourceLease::priority

    fn ResourceLease::priority(self : ResourceLease) -> Int

    ResourceLease::renew

    fn ResourceLease::renew(self : ResourceLease, now : Int, duration : Int) -> Result[Unit, ModbusError]

    ResourceLease::renewals

    fn ResourceLease::renewals(self : ResourceLease) -> Int

    ResourceLease::resource

    fn ResourceLease::resource(self : ResourceLease) -> String

    ResourceLease::revoke

    fn ResourceLease::revoke(self : ResourceLease) -> Result[Unit, ModbusError]

    ResourceLease::state

    ResponseValue

    pub(all) enum ResponseValue {
    Normal(Frame)
    Exception(Frame, ExceptionCode)
    }

    A raw PDU result that retains whether a response was an exception.

    RetryPolicy

    pub(all) struct RetryPolicy {
    max_attempts : Int
    initial_backoff : Int
    max_backoff : Int
    multiplier : Int
    }

    Policy controlling retry count and backoff growth.

    RetryPolicy::backoff

    fn RetryPolicy::backoff(self : RetryPolicy, attempt : Int) -> Result[Int, ModbusError]

    RetryPolicy::can_retry

    fn RetryPolicy::can_retry(self : RetryPolicy, attempt : Int) -> Bool

    RetryPolicy::initial_backoff

    fn RetryPolicy::initial_backoff(self : RetryPolicy) -> Int

    RetryPolicy::max_attempts

    fn RetryPolicy::max_attempts(self : RetryPolicy) -> Int

    RetryPolicy::max_backoff

    fn RetryPolicy::max_backoff(self : RetryPolicy) -> Int

    RetryPolicy::multiplier

    fn RetryPolicy::multiplier(self : RetryPolicy) -> Int

    RetryPolicy::new

    fn RetryPolicy::new(max_attempts : Int, initial_backoff : Int, max_backoff : Int, multiplier? : Int) -> Result[RetryPolicy, ModbusError]

    RetryPolicy::summary

    fn RetryPolicy::summary(self : RetryPolicy) -> String

    RuntimeConfig

    pub(all) struct RuntimeConfig {
    schema : ConfigSchema
    entries : Array[ConfigEntry]
    revision : Int
    }

    Mutable configuration store with atomic-style patch application.

    RuntimeConfig::apply

    fn RuntimeConfig::apply(self : RuntimeConfig, operations : Array[ConfigOperation], source? : String) -> Result[Int, ModbusError]

    RuntimeConfig::entry

    fn RuntimeConfig::entry(self : RuntimeConfig, key : String) -> ConfigEntry?

    RuntimeConfig::export_lines

    fn RuntimeConfig::export_lines(self : RuntimeConfig, redact? : Bool) -> Array[String]

    RuntimeConfig::get

    fn RuntimeConfig::get(self : RuntimeConfig, key : String) -> ConfigValue?

    RuntimeConfig::length

    fn RuntimeConfig::length(self : RuntimeConfig) -> Int

    RuntimeConfig::new

    RuntimeConfig::remove

    fn RuntimeConfig::remove(self : RuntimeConfig, key : String) -> Result[Unit, ModbusError]

    RuntimeConfig::revision

    fn RuntimeConfig::revision(self : RuntimeConfig) -> Int

    RuntimeConfig::schema

    RuntimeConfig::set

    fn RuntimeConfig::set(self : RuntimeConfig, key : String, value : ConfigValue, source? : String) -> Result[Unit, ModbusError]

    RuntimeConfig::snapshot

    fn RuntimeConfig::snapshot(self : RuntimeConfig) -> Array[ConfigEntry]

    RuntimeConfig::validate

    fn RuntimeConfig::validate(self : RuntimeConfig) -> Result[Unit, ModbusError]

    ScaleTransform

    pub(all) struct ScaleTransform {
    raw_min : Int
    raw_max : Int
    engineering_min : Int
    engineering_max : Int
    unit : EngineeringUnit
    deadband : Int
    clamp : Bool
    precision : Int
    }

    A deterministic integer scaling transform for register data.

    ScaleTransform::apply_deadband

    fn ScaleTransform::apply_deadband(self : ScaleTransform, previous : Int, current : Int) -> Int

    ScaleTransform::clamp_engineering

    fn ScaleTransform::clamp_engineering(self : ScaleTransform, value : Int) -> Int

    ScaleTransform::clamp_raw

    fn ScaleTransform::clamp_raw(self : ScaleTransform, raw : Int) -> Int

    ScaleTransform::deadband

    fn ScaleTransform::deadband(self : ScaleTransform) -> Int

    ScaleTransform::engineering_in_range

    fn ScaleTransform::engineering_in_range(self : ScaleTransform, value : Int) -> Bool

    ScaleTransform::engineering_max

    fn ScaleTransform::engineering_max(self : ScaleTransform) -> Int

    ScaleTransform::engineering_min

    fn ScaleTransform::engineering_min(self : ScaleTransform) -> Int

    ScaleTransform::engineering_to_raw

    fn ScaleTransform::engineering_to_raw(self : ScaleTransform, value : Int) -> Result[Int, ModbusError]

    ScaleTransform::format

    fn ScaleTransform::format(self : ScaleTransform, value : Int) -> String

    ScaleTransform::new

    fn ScaleTransform::new(raw_min : Int, raw_max : Int, engineering_min : Int, engineering_max : Int, unit? : EngineeringUnit, deadband? : Int, clamp? : Bool, precision? : Int) -> Result[ScaleTransform, ModbusError]

    ScaleTransform::normalize

    fn ScaleTransform::normalize(self : ScaleTransform, raw : Int) -> Result[Int, ModbusError]

    ScaleTransform::precision

    fn ScaleTransform::precision(self : ScaleTransform) -> Int

    ScaleTransform::raw_in_range

    fn ScaleTransform::raw_in_range(self : ScaleTransform, raw : Int) -> Bool

    ScaleTransform::raw_max

    fn ScaleTransform::raw_max(self : ScaleTransform) -> Int

    ScaleTransform::raw_min

    fn ScaleTransform::raw_min(self : ScaleTransform) -> Int

    ScaleTransform::raw_to_engineering

    fn ScaleTransform::raw_to_engineering(self : ScaleTransform, raw : Int) -> Result[Int, ModbusError]

    ScaleTransform::summary

    fn ScaleTransform::summary(self : ScaleTransform) -> String

    ScaleTransform::unit

    ScaledReading

    pub(all) struct ScaledReading {
    point_id : String
    raw : Int
    value : Int
    unit : EngineeringUnit
    quality : ReadingQuality
    timestamp : Int
    }

    A timestamped reading after scaling and quality assessment.

    ScaledReading::new

    fn ScaledReading::new(point_id : String, raw : Int, transform : ScaleTransform, timestamp : Int) -> Result[ScaledReading, ModbusError]

    ScaledReading::point_id

    fn ScaledReading::point_id(self : ScaledReading) -> String

    ScaledReading::quality

    ScaledReading::raw

    fn ScaledReading::raw(self : ScaledReading) -> Int

    ScaledReading::summary

    fn ScaledReading::summary(self : ScaledReading) -> String

    ScaledReading::timestamp

    fn ScaledReading::timestamp(self : ScaledReading) -> Int

    ScaledReading::unit

    ScaledReading::value

    fn ScaledReading::value(self : ScaledReading) -> Int

    ScaledReading::with_quality

    fn ScaledReading::with_quality(self : ScaledReading, quality : ReadingQuality) -> ScaledReading

    Scenario

    pub(all) struct Scenario {
    name : String
    requests : Array[Frame]
    mode : Mode
    }

    A deterministic multi-request scenario.

    Scenario::add

    fn Scenario::add(self : Scenario, request : Frame) -> Result[Unit, ModbusError]

    Scenario::length

    fn Scenario::length(self : Scenario) -> Int

    Scenario::mode

    fn Scenario::mode(self : Scenario) -> Mode

    Scenario::name

    fn Scenario::name(self : Scenario) -> String

    Scenario::new

    fn Scenario::new(name : String, mode : Mode) -> Scenario

    Scenario::run

    fn Scenario::run(self : Scenario, simulation : Simulation) -> Array[SimulationResult]

    ScenarioFault

    pub(all) enum ScenarioFault {
    NoFault
    DropNext
    DelayNext(Int)
    CorruptByte(Int)
    ForceException(Byte)
    Repeat(Int)
    } derive(Eq,
    Debug
    )

    Fault applied to a selected step in a reproducible test scenario.

    ScenarioOutcome

    pub(all) enum ScenarioOutcome {
    ScenarioSuccess
    ScenarioTimeout
    ScenarioException
    ScenarioCorrupt
    ScenarioDropped
    ScenarioDelayed
    } derive(Eq,
    Debug
    )

    Deterministic outcome injected into a protocol simulation.

    ScenarioResult

    pub(all) struct ScenarioResult {
    step_id : String
    outcome : ScenarioOutcome
    started_at : Int
    finished_at : Int
    response : Frame?
    error : ModbusError?
    detail : String
    }

    A single result emitted by the deterministic runner.

    ScenarioResult::detail

    fn ScenarioResult::detail(self : ScenarioResult) -> String

    ScenarioResult::duration

    fn ScenarioResult::duration(self : ScenarioResult) -> Int

    ScenarioResult::error

    ScenarioResult::finished_at

    fn ScenarioResult::finished_at(self : ScenarioResult) -> Int

    ScenarioResult::new

    fn ScenarioResult::new(step_id : String, outcome : ScenarioOutcome, started_at : Int, finished_at : Int, response? : Frame, error? : ModbusError, detail? : String) -> Result[ScenarioResult, ModbusError]

    ScenarioResult::outcome

    ScenarioResult::response

    fn ScenarioResult::response(self : ScenarioResult) -> Frame?

    ScenarioResult::started_at

    fn ScenarioResult::started_at(self : ScenarioResult) -> Int

    ScenarioResult::step_id

    fn ScenarioResult::step_id(self : ScenarioResult) -> String

    ScenarioRunner

    pub(all) struct ScenarioRunner {
    scenario : ModbusScenario
    results : Array[ScenarioResult]
    cursor : Int
    now : Int
    }

    Deterministic runner with no wall-clock or random dependencies.

    ScenarioRunner::cursor

    fn ScenarioRunner::cursor(self : ScenarioRunner) -> Int

    ScenarioRunner::new

    fn ScenarioRunner::new(scenario : ModbusScenario, start_at? : Int) -> Result[ScenarioRunner, ModbusError]

    ScenarioRunner::now

    fn ScenarioRunner::now(self : ScenarioRunner) -> Int

    ScenarioRunner::outcome_counts

    fn ScenarioRunner::outcome_counts(self : ScenarioRunner) -> Array[Int]

    Count each deterministic outcome in runner results.

    ScenarioRunner::passed

    fn ScenarioRunner::passed(self : ScenarioRunner) -> Bool

    Verify that all outcomes match the scenario's declared expectations.

    ScenarioRunner::result_count

    fn ScenarioRunner::result_count(self : ScenarioRunner) -> Int

    ScenarioRunner::results

    ScenarioRunner::run_all

    Run all remaining steps, stopping at the first execution error.

    ScenarioRunner::run_next

    fn ScenarioRunner::run_next(self : ScenarioRunner) -> Result[ScenarioResult, ModbusError]

    Execute the next step and return its deterministic result.

    ScenarioStep

    pub(all) struct ScenarioStep {
    id : String
    timestamp : Int
    request : Frame
    expected_function : Byte
    expected_outcome : ScenarioOutcome
    fault : ScenarioFault
    note : String
    }

    One input/output expectation used by integration and boundary tests.

    ScenarioStep::expected_function

    fn ScenarioStep::expected_function(self : ScenarioStep) -> Byte

    ScenarioStep::expected_outcome

    fn ScenarioStep::expected_outcome(self : ScenarioStep) -> ScenarioOutcome

    ScenarioStep::fault

    ScenarioStep::id

    fn ScenarioStep::id(self : ScenarioStep) -> String

    ScenarioStep::new

    fn ScenarioStep::new(id : String, timestamp : Int, request : Frame, expected_outcome : ScenarioOutcome, note? : String) -> Result[ScenarioStep, ModbusError]

    ScenarioStep::note

    fn ScenarioStep::note(self : ScenarioStep) -> String

    ScenarioStep::request

    fn ScenarioStep::request(self : ScenarioStep) -> Frame

    ScenarioStep::timestamp

    fn ScenarioStep::timestamp(self : ScenarioStep) -> Int

    ScenarioStep::with_fault

    fn ScenarioStep::with_fault(self : ScenarioStep, fault : ScenarioFault) -> Unit

    ScheduledJob

    pub(all) struct ScheduledJob {
    id : String
    request : Frame
    priority : JobPriority
    period : Int
    deadline : Int
    policy : RetryPolicy
    due_at : Int
    attempts : Int
    state : JobState
    last_error : ModbusError?
    last_started : Int?
    last_finished : Int?
    tag : String
    }

    A request retained by the scheduler until it is dispatched or expires.

    ScheduledJob::age

    fn ScheduledJob::age(self : ScheduledJob, now : Int) -> Int

    ScheduledJob::attempts

    fn ScheduledJob::attempts(self : ScheduledJob) -> Int

    ScheduledJob::cancel

    fn ScheduledJob::cancel(self : ScheduledJob) -> Result[Unit, ModbusError]

    ScheduledJob::complete

    fn ScheduledJob::complete(self : ScheduledJob, now : Int) -> Result[Unit, ModbusError]

    ScheduledJob::deadline

    fn ScheduledJob::deadline(self : ScheduledJob) -> Int

    ScheduledJob::due_at

    fn ScheduledJob::due_at(self : ScheduledJob) -> Int

    ScheduledJob::fail

    fn ScheduledJob::fail(self : ScheduledJob, error : ModbusError, now : Int) -> Result[Bool, ModbusError]

    ScheduledJob::id

    fn ScheduledJob::id(self : ScheduledJob) -> String

    ScheduledJob::is_due

    fn ScheduledJob::is_due(self : ScheduledJob, now : Int) -> Bool

    ScheduledJob::is_expired

    fn ScheduledJob::is_expired(self : ScheduledJob, now : Int) -> Bool

    ScheduledJob::is_periodic

    fn ScheduledJob::is_periodic(self : ScheduledJob) -> Bool

    ScheduledJob::last_error

    fn ScheduledJob::last_error(self : ScheduledJob) -> ModbusError?

    ScheduledJob::latency

    fn ScheduledJob::latency(self : ScheduledJob) -> Int?

    ScheduledJob::new

    fn ScheduledJob::new(id : String, request : Frame, due_at : Int, period? : Int, priority? : JobPriority, deadline? : Int, policy? : RetryPolicy, tag? : String) -> Result[ScheduledJob, ModbusError]

    ScheduledJob::period

    fn ScheduledJob::period(self : ScheduledJob) -> Int

    ScheduledJob::priority

    fn ScheduledJob::priority(self : ScheduledJob) -> JobPriority

    ScheduledJob::request

    fn ScheduledJob::request(self : ScheduledJob) -> Frame

    ScheduledJob::reset

    fn ScheduledJob::reset(self : ScheduledJob, due_at : Int) -> Result[Unit, ModbusError]

    ScheduledJob::start

    fn ScheduledJob::start(self : ScheduledJob, now : Int) -> Result[Unit, ModbusError]

    ScheduledJob::state

    fn ScheduledJob::state(self : ScheduledJob) -> JobState

    ScheduledJob::tag

    fn ScheduledJob::tag(self : ScheduledJob) -> String

    SchedulerSnapshot

    pub(all) struct SchedulerSnapshot {
    total : Int
    ready : Int
    in_flight : Int
    waiting : Int
    completed : Int
    failed : Int
    cancelled : Int
    }

    A compact schedule snapshot for metrics export.

    SchedulerSnapshot::healthy

    fn SchedulerSnapshot::healthy(self : SchedulerSnapshot) -> Bool

    SchedulerSnapshot::summary

    fn SchedulerSnapshot::summary(self : SchedulerSnapshot) -> String

    SecurityAudit

    pub(all) struct SecurityAudit {
    sequence : Int
    timestamp : Int
    principal : String
    role : AccessRole
    operation : AccessOperation
    unit_id : Byte
    function : Byte
    allowed : Bool
    reason : String
    }

    Security audit record generated by a policy decision.

    SecurityAudit::allowed

    fn SecurityAudit::allowed(self : SecurityAudit) -> Bool

    SecurityAudit::new

    fn SecurityAudit::new(sequence : Int, timestamp : Int, principal : String, role : AccessRole, operation : AccessOperation, frame : Frame, allowed : Bool, reason : String) -> Result[SecurityAudit, ModbusError]

    SecurityAudit::sequence

    fn SecurityAudit::sequence(self : SecurityAudit) -> Int

    SecurityAudit::summary

    fn SecurityAudit::summary(self : SecurityAudit) -> String

    SerialConfig

    pub(all) struct SerialConfig {
    path : String
    baud : Int
    data_bits : Int
    stop_bits : Int
    parity : Byte
    mode : Mode
    }

    Serial-line parameters independent of any concrete serial-port library.

    SerialConfig::new

    fn SerialConfig::new(path : String, baud : Int, mode : Mode, data_bits? : Int, stop_bits? : Int, parity? : Byte) -> Result[SerialConfig, ModbusError]

    SerialConfig::parity_name

    fn SerialConfig::parity_name(self : SerialConfig) -> String

    Server

    pub struct Server {
    config : ServerConfig
    devices : Array[Device]
    parser : IncrementalParser
    metrics : ProtocolMetrics
    audit : AuditLog
    }

    A multi-unit server that owns device instances and performs transport framing.

    Server::add_device

    fn Server::add_device(self : Server, device : Device) -> Result[Unit, ModbusError]

    Server::audit

    fn Server::audit(self : Server) -> AuditLog

    Server::broadcast

    fn Server::broadcast(self : Server, request : Frame) -> Array[Frame]

    Run a request against every configured unit and return normal replies.

    Server::config

    fn Server::config(self : Server) -> ServerConfig

    Server::device

    fn Server::device(self : Server, unit_id : Byte) -> Device?

    Server::device_count

    fn Server::device_count(self : Server) -> Int

    Server::handle

    fn Server::handle(self : Server, request : Frame) -> Result[Frame, ModbusError]

    Handle a decoded request and return a decoded reply.

    Server::handle_adu

    fn Server::handle_adu(self : Server, bytes : Array[Byte]) -> Result[Array[Byte], ModbusError]

    Decode an ADU, dispatch it, and encode the reply.

    Server::metrics

    fn Server::metrics(self : Server) -> ProtocolMetrics

    Server::mode

    fn Server::mode(self : Server) -> Mode

    Server::new

    fn Server::new(config : ServerConfig) -> Result[Server, ModbusError]

    Server::parser

    fn Server::parser(self : Server) -> IncrementalParser

    Server::remove_device

    fn Server::remove_device(self : Server, unit_id : Byte) -> Result[Unit, ModbusError]

    ServerConfig

    pub(all) struct ServerConfig {
    mode : Mode
    max_devices : Int
    max_frame : Int
    allow_broadcast : Bool
    max_pending_bytes : Int
    }

    Configuration for an in-process Modbus server.

    ServiceBridgeRule

    pub(all) struct ServiceBridgeRule {
    id : String
    source_unit : Byte
    target_unit : Byte
    function : Byte
    source_start : UInt16
    span : Int
    target_start : UInt16
    action : BridgeAction
    priority : Int
    enabled : Bool
    tag : String
    }

    Rule matching a source request and selecting a target route.

    ServiceBridgeRule::action

    ServiceBridgeRule::enabled

    fn ServiceBridgeRule::enabled(self : ServiceBridgeRule) -> Bool

    ServiceBridgeRule::function

    fn ServiceBridgeRule::function(self : ServiceBridgeRule) -> Byte

    ServiceBridgeRule::id

    fn ServiceBridgeRule::id(self : ServiceBridgeRule) -> String

    ServiceBridgeRule::matches

    fn ServiceBridgeRule::matches(self : ServiceBridgeRule, frame : Frame) -> Bool

    ServiceBridgeRule::new

    fn ServiceBridgeRule::new(id : String, source_unit : Byte, target_unit : Byte, function : Byte, source_start : UInt16, span : Int, target_start : UInt16, action : BridgeAction, priority? : Int, tag? : String) -> Result[ServiceBridgeRule, ModbusError]

    ServiceBridgeRule::priority

    fn ServiceBridgeRule::priority(self : ServiceBridgeRule) -> Int

    ServiceBridgeRule::rewrite

    fn ServiceBridgeRule::rewrite(self : ServiceBridgeRule, frame : Frame) -> Result[Frame, ModbusError]

    ServiceBridgeRule::set_enabled

    fn ServiceBridgeRule::set_enabled(self : ServiceBridgeRule, enabled : Bool) -> Unit

    ServiceBridgeRule::source_start

    fn ServiceBridgeRule::source_start(self : ServiceBridgeRule) -> UInt16

    ServiceBridgeRule::source_unit

    fn ServiceBridgeRule::source_unit(self : ServiceBridgeRule) -> Byte

    ServiceBridgeRule::span

    fn ServiceBridgeRule::span(self : ServiceBridgeRule) -> Int

    ServiceBridgeRule::tag

    fn ServiceBridgeRule::tag(self : ServiceBridgeRule) -> String

    ServiceBridgeRule::target_start

    fn ServiceBridgeRule::target_start(self : ServiceBridgeRule) -> UInt16

    ServiceBridgeRule::target_unit

    fn ServiceBridgeRule::target_unit(self : ServiceBridgeRule) -> Byte

    ServiceEvent

    pub(all) struct ServiceEvent {
    id : String
    kind : ServiceEventKind
    source : String
    timestamp : Int
    payload : Array[Byte]
    delivery : EventDelivery
    attempts : Int
    }

    Small immutable event envelope suitable for an in-memory or file queue.

    ServiceEvent::attempts

    fn ServiceEvent::attempts(self : ServiceEvent) -> Int

    ServiceEvent::delivery

    fn ServiceEvent::delivery(self : ServiceEvent) -> EventDelivery

    ServiceEvent::id

    fn ServiceEvent::id(self : ServiceEvent) -> String

    ServiceEvent::kind

    ServiceEvent::mark_delivered

    fn ServiceEvent::mark_delivered(self : ServiceEvent) -> Unit

    ServiceEvent::mark_failed

    fn ServiceEvent::mark_failed(self : ServiceEvent, dead_letter_after : Int) -> Result[Unit, ModbusError]

    ServiceEvent::new

    fn ServiceEvent::new(id : String, kind : ServiceEventKind, source : String, timestamp : Int, payload : Array[Byte]) -> Result[ServiceEvent, ModbusError]

    ServiceEvent::payload

    fn ServiceEvent::payload(self : ServiceEvent) -> Array[Byte]

    ServiceEvent::source

    fn ServiceEvent::source(self : ServiceEvent) -> String

    ServiceEvent::timestamp

    fn ServiceEvent::timestamp(self : ServiceEvent) -> Int

    ServiceEventBus

    pub(all) struct ServiceEventBus {
    queue : Array[ServiceEvent]
    dead_letters : Array[ServiceEvent]
    subscriptions : Array[EventSubscription]
    max_queue : Int
    max_dead_letters : Int
    max_subscriptions : Int
    }

    Event queue with bounded pending and dead-letter retention.

    ServiceEventBus::ack

    fn ServiceEventBus::ack(self : ServiceEventBus, event : ServiceEvent, success : Bool, dead_letter_after? : Int) -> Result[Unit, ModbusError]

    Acknowledge an event or return it to the queue after a failed attempt.

    ServiceEventBus::claim

    fn ServiceEventBus::claim(self : ServiceEventBus, subscription_id : String) -> Result[ServiceEvent, ModbusError]

    Claim the next event matching a subscription.

    ServiceEventBus::clear_dead_letters

    fn ServiceEventBus::clear_dead_letters(self : ServiceEventBus) -> Unit

    ServiceEventBus::dead_letter_count

    fn ServiceEventBus::dead_letter_count(self : ServiceEventBus) -> Int

    ServiceEventBus::new

    fn ServiceEventBus::new(max_queue? : Int, max_dead_letters? : Int, max_subscriptions? : Int) -> Result[ServiceEventBus, ModbusError]

    ServiceEventBus::peek_kind

    Return events filtered by kind without claiming them.

    ServiceEventBus::publish

    fn ServiceEventBus::publish(self : ServiceEventBus, event : ServiceEvent) -> Result[Unit, ModbusError]

    Publish an event and enforce the queue capacity.

    ServiceEventBus::queue_count

    fn ServiceEventBus::queue_count(self : ServiceEventBus) -> Int

    ServiceEventBus::subscribe

    fn ServiceEventBus::subscribe(self : ServiceEventBus, subscription : EventSubscription) -> Result[Unit, ModbusError]

    ServiceEventBus::subscription_count

    fn ServiceEventBus::subscription_count(self : ServiceEventBus) -> Int

    ServiceEventBus::unsubscribe

    fn ServiceEventBus::unsubscribe(self : ServiceEventBus, id : String) -> Result[EventSubscription, ModbusError]

    ServiceEventKind

    pub(all) enum ServiceEventKind {
    FrameReceivedEvent
    FrameSentEvent
    AlarmRaisedEvent
    AlarmClearedEvent
    CommandUpdatedEvent
    DeviceHealthEvent
    MaintenanceDueEvent
    GatewayDeniedEvent
    } derive(Eq,
    Debug
    )

    Application event categories emitted by the protocol services.

    ServiceGatewayPolicy

    pub(all) struct ServiceGatewayPolicy {
    id : String
    source : String
    destination : String
    rules : Array[ServiceBridgeRule]
    default_action : BridgeAction
    max_rules : Int
    revision : Int
    }

    An ordered policy set for one gateway route.

    ServiceGatewayPolicy::add_rule

    fn ServiceGatewayPolicy::add_rule(self : ServiceGatewayPolicy, rule : ServiceBridgeRule) -> Result[Unit, ModbusError]

    ServiceGatewayPolicy::default_action

    ServiceGatewayPolicy::destination

    fn ServiceGatewayPolicy::destination(self : ServiceGatewayPolicy) -> String

    ServiceGatewayPolicy::evaluate

    Find the highest priority matching rule and execute its action.

    ServiceGatewayPolicy::export_rules

    fn ServiceGatewayPolicy::export_rules(self : ServiceGatewayPolicy) -> Array[String]

    Produce the stable rule table used in support bundles.

    ServiceGatewayPolicy::id

    ServiceGatewayPolicy::new

    fn ServiceGatewayPolicy::new(id : String, source : String, destination : String, default_action? : BridgeAction, max_rules? : Int) -> Result[ServiceGatewayPolicy, ModbusError]

    ServiceGatewayPolicy::remove_rule

    fn ServiceGatewayPolicy::remove_rule(self : ServiceGatewayPolicy, id : String) -> Result[ServiceBridgeRule, ModbusError]

    ServiceGatewayPolicy::revision

    fn ServiceGatewayPolicy::revision(self : ServiceGatewayPolicy) -> Int

    ServiceGatewayPolicy::rule

    ServiceGatewayPolicy::rule_count

    fn ServiceGatewayPolicy::rule_count(self : ServiceGatewayPolicy) -> Int

    ServiceGatewayPolicy::source

    fn ServiceGatewayPolicy::source(self : ServiceGatewayPolicy) -> String

    ServiceGatewayPolicy::validate

    Validate rule ordering and overlapping address windows.

    ServiceMetric

    pub(all) struct ServiceMetric {
    name : String
    kind : MetricKind
    value : Int
    timestamp : Int
    labels : Array[(String, String)]
    }

    A metric sample with a small, allocation-friendly label set.

    ServiceMetric::kind

    ServiceMetric::label

    fn ServiceMetric::label(self : ServiceMetric, key : String) -> String?

    ServiceMetric::label_count

    fn ServiceMetric::label_count(self : ServiceMetric) -> Int

    ServiceMetric::name

    fn ServiceMetric::name(self : ServiceMetric) -> String

    ServiceMetric::new

    fn ServiceMetric::new(name : String, kind : MetricKind, value : Int, timestamp : Int) -> Result[ServiceMetric, ModbusError]

    ServiceMetric::timestamp

    fn ServiceMetric::timestamp(self : ServiceMetric) -> Int

    ServiceMetric::value

    fn ServiceMetric::value(self : ServiceMetric) -> Int

    ServiceMetric::with_label

    fn ServiceMetric::with_label(self : ServiceMetric, key : String, value : String) -> Result[Unit, ModbusError]

    ServicePlan

    pub(all) struct ServicePlan {
    id : String
    asset_id : String
    title : String
    kind : MaintenanceKind
    interval : Int
    grace : Int
    estimated_minutes : Int
    enabled : Bool
    last_completed : Int?
    owner : String
    }

    A repeatable service plan for one device or profile point.

    ServicePlan::asset_id

    fn ServicePlan::asset_id(self : ServicePlan) -> String

    ServicePlan::due_at

    fn ServicePlan::due_at(self : ServicePlan) -> Int?

    ServicePlan::enabled

    fn ServicePlan::enabled(self : ServicePlan) -> Bool

    ServicePlan::estimated_minutes

    fn ServicePlan::estimated_minutes(self : ServicePlan) -> Int

    ServicePlan::grace

    fn ServicePlan::grace(self : ServicePlan) -> Int

    ServicePlan::id

    fn ServicePlan::id(self : ServicePlan) -> String

    ServicePlan::interval

    fn ServicePlan::interval(self : ServicePlan) -> Int

    ServicePlan::is_due

    fn ServicePlan::is_due(self : ServicePlan, now : Int) -> Result[Bool, ModbusError]

    ServicePlan::is_overdue

    fn ServicePlan::is_overdue(self : ServicePlan, now : Int) -> Result[Bool, ModbusError]

    ServicePlan::kind

    ServicePlan::last_completed

    fn ServicePlan::last_completed(self : ServicePlan) -> Int?

    ServicePlan::mark_completed

    fn ServicePlan::mark_completed(self : ServicePlan, timestamp : Int) -> Result[Unit, ModbusError]

    ServicePlan::new

    fn ServicePlan::new(id : String, asset_id : String, title : String, kind : MaintenanceKind, interval : Int, grace? : Int, estimated_minutes? : Int, owner? : String) -> Result[ServicePlan, ModbusError]

    ServicePlan::owner

    fn ServicePlan::owner(self : ServicePlan) -> String

    ServicePlan::priority

    fn ServicePlan::priority(self : ServicePlan, now : Int) -> Result[MaintenancePriority, ModbusError]

    ServicePlan::set_enabled

    fn ServicePlan::set_enabled(self : ServicePlan, enabled : Bool) -> Unit

    ServicePlan::title

    fn ServicePlan::title(self : ServicePlan) -> String

    ServiceRecord

    pub(all) struct ServiceRecord {
    id : String
    plan_id : String
    asset_id : String
    started_at : Int
    finished_at : Int
    technician : String
    result : String
    readings : Array[Int]
    parts : Array[String]
    }

    A historical service record including measurements and the operator note.

    ServiceRecord::add_part

    fn ServiceRecord::add_part(self : ServiceRecord, part : String) -> Result[Unit, ModbusError]

    ServiceRecord::add_reading

    fn ServiceRecord::add_reading(self : ServiceRecord, reading : Int) -> Unit

    ServiceRecord::asset_id

    fn ServiceRecord::asset_id(self : ServiceRecord) -> String

    ServiceRecord::average_reading

    fn ServiceRecord::average_reading(self : ServiceRecord) -> Result[Int, ModbusError]

    ServiceRecord::duration

    fn ServiceRecord::duration(self : ServiceRecord) -> Int

    ServiceRecord::finished_at

    fn ServiceRecord::finished_at(self : ServiceRecord) -> Int

    ServiceRecord::id

    fn ServiceRecord::id(self : ServiceRecord) -> String

    ServiceRecord::new

    fn ServiceRecord::new(id : String, plan_id : String, asset_id : String, started_at : Int, finished_at : Int, technician : String, result : String) -> Result[ServiceRecord, ModbusError]

    ServiceRecord::part_count

    fn ServiceRecord::part_count(self : ServiceRecord) -> Int

    ServiceRecord::plan_id

    fn ServiceRecord::plan_id(self : ServiceRecord) -> String

    ServiceRecord::reading_count

    fn ServiceRecord::reading_count(self : ServiceRecord) -> Int

    ServiceRecord::result

    fn ServiceRecord::result(self : ServiceRecord) -> String

    ServiceRecord::started_at

    fn ServiceRecord::started_at(self : ServiceRecord) -> Int

    ServiceRecord::technician

    fn ServiceRecord::technician(self : ServiceRecord) -> String

    Simulation

    pub struct Simulation {
    device : Device
    mode : Mode
    fault : FaultMode
    clock : Int
    metrics : ProtocolMetrics
    audit : AuditLog
    }

    A portable protocol simulation with no operating-system I/O.

    Simulation::advance

    fn Simulation::advance(self : Simulation, ticks : Int) -> Result[Unit, ModbusError]

    Simulation::audit

    fn Simulation::audit(self : Simulation) -> AuditLog

    Simulation::clock

    fn Simulation::clock(self : Simulation) -> Int

    Simulation::device

    fn Simulation::device(self : Simulation) -> Device

    Simulation::fault

    fn Simulation::fault(self : Simulation) -> FaultMode

    Simulation::metrics

    fn Simulation::metrics(self : Simulation) -> ProtocolMetrics

    Simulation::mode

    fn Simulation::mode(self : Simulation) -> Mode

    Simulation::new

    fn Simulation::new(device : Device, mode : Mode) -> Result[Simulation, ModbusError]

    Simulation::request

    fn Simulation::request(self : Simulation, transaction_id : UInt16, request : Frame) -> SimulationResult

    Send one request through the selected fault model.

    Simulation::reset

    fn Simulation::reset(self : Simulation) -> Unit

    Simulation::set_fault

    fn Simulation::set_fault(self : Simulation, fault : FaultMode) -> Unit

    SimulationResult

    pub(all) enum SimulationResult {
    Delivered(Frame)
    Dropped
    Rejected(ModbusError)
    }

    Result of one deterministic simulation step.

    SnapshotValue

    pub(all) struct SnapshotValue {
    point_id : String
    value : Int
    quality : ReadingQuality
    timestamp : Int
    }

    A point/value pair captured from a device snapshot.

    SnapshotValue::is_good

    fn SnapshotValue::is_good(self : SnapshotValue) -> Bool

    SnapshotValue::new

    fn SnapshotValue::new(point_id : String, value : Int, timestamp : Int, quality? : ReadingQuality) -> Result[SnapshotValue, ModbusError]

    SnapshotValue::point_id

    fn SnapshotValue::point_id(self : SnapshotValue) -> String

    SnapshotValue::quality

    SnapshotValue::timestamp

    fn SnapshotValue::timestamp(self : SnapshotValue) -> Int

    SnapshotValue::value

    fn SnapshotValue::value(self : SnapshotValue) -> Int

    TagSample

    pub(all) struct TagSample {
    point_id : String
    timestamp : Int
    value : Int
    quality : ReadingQuality
    }

    One immutable historian sample.

    TagSample::is_good

    fn TagSample::is_good(self : TagSample) -> Bool

    TagSample::new

    fn TagSample::new(point_id : String, timestamp : Int, value : Int, quality? : ReadingQuality) -> Result[TagSample, ModbusError]

    TagSample::point_id

    fn TagSample::point_id(self : TagSample) -> String

    TagSample::quality

    fn TagSample::quality(self : TagSample) -> ReadingQuality

    TagSample::summary

    fn TagSample::summary(self : TagSample) -> String

    TagSample::timestamp

    fn TagSample::timestamp(self : TagSample) -> Int

    TagSample::value

    fn TagSample::value(self : TagSample) -> Int

    TagSeries

    pub(all) struct TagSeries {
    point_id : String
    samples : Array[TagSample]
    max_samples : Int
    dropped : Int
    }

    A time range with samples belonging to one point.

    TagSeries::aggregate

    fn TagSeries::aggregate(self : TagSeries, start : Int, end : Int, aggregation : Aggregation) -> Result[Int, ModbusError]

    TagSeries::append

    fn TagSeries::append(self : TagSeries, sample : TagSample) -> Result[Unit, ModbusError]

    TagSeries::at

    fn TagSeries::at(self : TagSeries, index : Int) -> Result[TagSample, ModbusError]

    TagSeries::average

    fn TagSeries::average(self : TagSeries, start : Int, end : Int) -> Result[Int, ModbusError]

    TagSeries::between

    fn TagSeries::between(self : TagSeries, start : Int, end : Int) -> Result[Array[TagSample], ModbusError]

    TagSeries::clear

    fn TagSeries::clear(self : TagSeries) -> Unit

    TagSeries::dropped

    fn TagSeries::dropped(self : TagSeries) -> Int

    TagSeries::first

    fn TagSeries::first(self : TagSeries) -> TagSample?

    TagSeries::good_count

    fn TagSeries::good_count(self : TagSeries) -> Int

    TagSeries::last

    fn TagSeries::last(self : TagSeries) -> TagSample?

    TagSeries::length

    fn TagSeries::length(self : TagSeries) -> Int

    TagSeries::new

    fn TagSeries::new(point_id : String, max_samples? : Int) -> Result[TagSeries, ModbusError]

    TagSeries::point_id

    fn TagSeries::point_id(self : TagSeries) -> String

    TagSeries::snapshot

    fn TagSeries::snapshot(self : TagSeries) -> Array[TagSample]

    TagSeries::summary

    fn TagSeries::summary(self : TagSeries) -> String

    TcpConfig

    pub(all) struct TcpConfig {
    host : String
    port : Int
    connect_timeout : Int
    keep_alive : Bool
    }

    TCP endpoint settings.

    TcpConfig::address

    fn TcpConfig::address(self : TcpConfig) -> String

    TcpConfig::new

    fn TcpConfig::new(host : String, port : Int, connect_timeout? : Int, keep_alive? : Bool) -> Result[TcpConfig, ModbusError]

    TelemetryRing

    pub(all) struct TelemetryRing {
    values : Array[Int]
    capacity : Int
    cursor : Int
    count : Int
    }

    A bounded ring of integer telemetry samples for device dashboards.

    TelemetryRing::at

    fn TelemetryRing::at(self : TelemetryRing, logical : Int) -> Result[Int, ModbusError]

    Read a sample from oldest to newest order.

    TelemetryRing::average

    fn TelemetryRing::average(self : TelemetryRing) -> Float

    TelemetryRing::capacity

    fn TelemetryRing::capacity(self : TelemetryRing) -> Int

    TelemetryRing::clear

    fn TelemetryRing::clear(self : TelemetryRing) -> Unit

    TelemetryRing::delta

    fn TelemetryRing::delta(self : TelemetryRing) -> Result[Int, ModbusError]

    TelemetryRing::is_full

    fn TelemetryRing::is_full(self : TelemetryRing) -> Bool

    TelemetryRing::latest

    fn TelemetryRing::latest(self : TelemetryRing) -> Result[Int, ModbusError]

    TelemetryRing::length

    fn TelemetryRing::length(self : TelemetryRing) -> Int

    TelemetryRing::maximum

    fn TelemetryRing::maximum(self : TelemetryRing) -> Result[Int, ModbusError]

    TelemetryRing::minimum

    fn TelemetryRing::minimum(self : TelemetryRing) -> Result[Int, ModbusError]

    TelemetryRing::new

    fn TelemetryRing::new(capacity : Int) -> Result[TelemetryRing, ModbusError]

    TelemetryRing::previous

    fn TelemetryRing::previous(self : TelemetryRing) -> Result[Int, ModbusError]

    TelemetryRing::record

    fn TelemetryRing::record(self : TelemetryRing, value : Int) -> Unit

    Add a sample and overwrite the oldest sample when the ring is full.

    TelemetryRing::snapshot

    fn TelemetryRing::snapshot(self : TelemetryRing) -> Array[Int]

    TelemetryRing::sum

    fn TelemetryRing::sum(self : TelemetryRing) -> Int

    Threshold

    pub(all) struct Threshold {
    low : Int
    high : Int
    }

    A closed interval used for a device alarm threshold.

    Threshold::classify

    fn Threshold::classify(self : Threshold, value : Int) -> ThresholdState

    Threshold::high

    fn Threshold::high(self : Threshold) -> Int

    Threshold::low

    fn Threshold::low(self : Threshold) -> Int

    Threshold::new

    fn Threshold::new(low : Int, high : Int) -> Result[Threshold, ModbusError]

    ThresholdState

    pub(all) enum ThresholdState {
    Below
    Within
    Above
    } derive(Eq,
    Debug
    )

    TokenBucket

    pub(all) struct TokenBucket {
    capacity : Int
    refill_interval : Int
    tokens : Int
    last_refill : Int
    }

    A token bucket with integer tokens, suitable for frame-level quotas.

    TokenBucket::capacity

    fn TokenBucket::capacity(self : TokenBucket) -> Int

    TokenBucket::new

    fn TokenBucket::new(capacity : Int, refill_interval : Int, now : Int) -> Result[TokenBucket, ModbusError]

    TokenBucket::refill

    fn TokenBucket::refill(self : TokenBucket, now : Int) -> Unit

    TokenBucket::reset

    fn TokenBucket::reset(self : TokenBucket, now : Int) -> Result[Unit, ModbusError]

    TokenBucket::take

    fn TokenBucket::take(self : TokenBucket, amount : Int, now : Int) -> Bool

    TokenBucket::tokens

    fn TokenBucket::tokens(self : TokenBucket, now : Int) -> Int

    TopologyHealth

    pub(all) enum TopologyHealth {
    Healthy
    Degraded
    Unreachable
    Maintenance
    UnknownHealth
    } derive(Eq,
    Debug
    )

    Operational health used by route selection and dashboards.

    TopologyHealthReport

    pub(all) struct TopologyHealthReport {
    node_count : Int
    link_count : Int
    healthy : Int
    degraded : Int
    unavailable : Int
    average_load : Int
    invalid_edges : Int
    }

    A compact health report suitable for a gateway status endpoint.

    TopologyHealthReport::average_load

    fn TopologyHealthReport::average_load(self : TopologyHealthReport) -> Int

    TopologyHealthReport::degraded

    fn TopologyHealthReport::degraded(self : TopologyHealthReport) -> Int

    TopologyHealthReport::healthy

    fn TopologyHealthReport::healthy(self : TopologyHealthReport) -> Int

    TopologyHealthReport::invalid_edges

    fn TopologyHealthReport::invalid_edges(self : TopologyHealthReport) -> Int

    fn TopologyHealthReport::link_count(self : TopologyHealthReport) -> Int

    TopologyHealthReport::new

    TopologyHealthReport::node_count

    fn TopologyHealthReport::node_count(self : TopologyHealthReport) -> Int

    TopologyHealthReport::summary

    fn TopologyHealthReport::summary(self : TopologyHealthReport) -> String

    TopologyHealthReport::unavailable

    fn TopologyHealthReport::unavailable(self : TopologyHealthReport) -> Int

    pub(all) struct TopologyLink {
    id : String
    from : String
    to : String
    latency : Int
    capacity : Int
    utilization : Int
    bidirectional : Bool
    transport : String
    }

    A directed or bidirectional connection between topology nodes.

    TopologyLink::available

    fn TopologyLink::available(self : TopologyLink) -> Bool

    TopologyLink::capacity

    fn TopologyLink::capacity(self : TopologyLink) -> Int

    TopologyLink::connects

    fn TopologyLink::connects(self : TopologyLink, node_id : String) -> Bool

    TopologyLink::cost

    fn TopologyLink::cost(self : TopologyLink) -> Int

    TopologyLink::from

    fn TopologyLink::from(self : TopologyLink) -> String

    TopologyLink::id

    fn TopologyLink::id(self : TopologyLink) -> String

    TopologyLink::is_bidirectional

    fn TopologyLink::is_bidirectional(self : TopologyLink) -> Bool

    TopologyLink::latency

    fn TopologyLink::latency(self : TopologyLink) -> Int

    TopologyLink::new

    fn TopologyLink::new(id : String, from : String, to : String, latency : Int, capacity : Int, bidirectional? : Bool, transport? : String) -> Result[TopologyLink, ModbusError]

    TopologyLink::other

    fn TopologyLink::other(self : TopologyLink, node_id : String) -> String?

    TopologyLink::set_utilization

    fn TopologyLink::set_utilization(self : TopologyLink, value : Int) -> Result[Unit, ModbusError]

    TopologyLink::to

    fn TopologyLink::to(self : TopologyLink) -> String

    TopologyLink::transport

    fn TopologyLink::transport(self : TopologyLink) -> String

    TopologyLink::utilization

    fn TopologyLink::utilization(self : TopologyLink) -> Int

    TopologyNode

    pub(all) struct TopologyNode {
    id : String
    label : String
    kind : TopologyNodeKind
    unit_id : Byte?
    health : TopologyHealth
    load : Int
    zone : String
    tags : Array[String]
    }

    A graph node representing a site, device, gateway, or consumer.

    TopologyNode::add_tag

    fn TopologyNode::add_tag(self : TopologyNode, tag : String) -> Result[Unit, ModbusError]

    TopologyNode::has_tag

    fn TopologyNode::has_tag(self : TopologyNode, tag : String) -> Bool

    TopologyNode::health

    TopologyNode::id

    fn TopologyNode::id(self : TopologyNode) -> String

    TopologyNode::is_available

    fn TopologyNode::is_available(self : TopologyNode) -> Bool

    TopologyNode::kind

    TopologyNode::label

    fn TopologyNode::label(self : TopologyNode) -> String

    TopologyNode::load

    fn TopologyNode::load(self : TopologyNode) -> Int

    TopologyNode::new

    fn TopologyNode::new(id : String, label : String, kind : TopologyNodeKind, unit_id? : Byte, zone? : String) -> Result[TopologyNode, ModbusError]

    TopologyNode::set_health

    fn TopologyNode::set_health(self : TopologyNode, health : TopologyHealth) -> Unit

    TopologyNode::set_load

    fn TopologyNode::set_load(self : TopologyNode, load : Int) -> Result[Unit, ModbusError]

    TopologyNode::tag_count

    fn TopologyNode::tag_count(self : TopologyNode) -> Int

    TopologyNode::unit_id

    fn TopologyNode::unit_id(self : TopologyNode) -> Byte?

    TopologyNode::zone

    fn TopologyNode::zone(self : TopologyNode) -> String

    TopologyNodeKind

    pub(all) enum TopologyNodeKind {
    SiteNode
    DeviceNode
    GatewayNode
    ServiceNode
    } derive(Eq,
    Debug
    )

    The role of a node in a Modbus deployment topology.

    TopologyRoute

    pub(all) struct TopologyRoute {
    source : String
    destination : String
    nodes : Array[String]
    links : Array[String]
    cost : Int
    reachable : Bool
    }

    A selected path with aggregate latency and link identifiers.

    TopologyRoute::cost

    fn TopologyRoute::cost(self : TopologyRoute) -> Int

    TopologyRoute::destination

    fn TopologyRoute::destination(self : TopologyRoute) -> String

    TopologyRoute::hops

    fn TopologyRoute::hops(self : TopologyRoute) -> Int

    fn TopologyRoute::links(self : TopologyRoute) -> Array[String]

    TopologyRoute::new

    fn TopologyRoute::new(source : String, destination : String, nodes : Array[String], links : Array[String], cost : Int) -> TopologyRoute

    TopologyRoute::nodes

    fn TopologyRoute::nodes(self : TopologyRoute) -> Array[String]

    TopologyRoute::not_reachable

    fn TopologyRoute::not_reachable(source : String, destination : String) -> TopologyRoute

    TopologyRoute::reachable

    fn TopologyRoute::reachable(self : TopologyRoute) -> Bool

    TopologyRoute::source

    fn TopologyRoute::source(self : TopologyRoute) -> String

    TopologyRoute::summary

    fn TopologyRoute::summary(self : TopologyRoute) -> String

    TransactionBatch

    pub(all) struct TransactionBatch {
    transactions : Array[ModbusTransaction]
    max_transactions : Int
    }

    A transaction batch containing several independent units.

    TransactionBatch::add

    fn TransactionBatch::add(self : TransactionBatch, transaction : ModbusTransaction) -> Result[Unit, ModbusError]

    TransactionBatch::count

    fn TransactionBatch::count(self : TransactionBatch) -> Int

    TransactionBatch::failed

    fn TransactionBatch::failed(self : TransactionBatch) -> Int

    TransactionBatch::new

    fn TransactionBatch::new(max_transactions? : Int) -> Result[TransactionBatch, ModbusError]

    TransactionBatch::successful

    fn TransactionBatch::successful(self : TransactionBatch) -> Int

    TransactionFrame

    pub(all) struct TransactionFrame {
    transaction_id : UInt16
    request : Frame
    response : Frame?
    }

    A request/response pair associated with a TCP transaction identifier.

    TransactionFrame::complete

    fn TransactionFrame::complete(self : TransactionFrame, response : Frame) -> TransactionFrame

    TransactionFrame::is_complete

    fn TransactionFrame::is_complete(self : TransactionFrame) -> Bool

    TransactionFrame::new

    fn TransactionFrame::new(transaction_id : UInt16, request : Frame) -> TransactionFrame

    TransactionItem

    pub(all) struct TransactionItem {
    id : String
    request : Frame
    compensation : Frame?
    state : TransactionState
    order : Int
    }

    A request in a transaction with an optional compensation frame.

    TransactionItem::compensation

    fn TransactionItem::compensation(self : TransactionItem) -> Frame?

    TransactionItem::id

    fn TransactionItem::id(self : TransactionItem) -> String

    TransactionItem::mark

    fn TransactionItem::mark(self : TransactionItem, state : TransactionState) -> Unit

    TransactionItem::new

    fn TransactionItem::new(id : String, request : Frame, order : Int, compensation? : Frame) -> Result[TransactionItem, ModbusError]

    TransactionItem::order

    fn TransactionItem::order(self : TransactionItem) -> Int

    TransactionItem::request

    fn TransactionItem::request(self : TransactionItem) -> Frame

    TransactionItem::state

    TransactionOutcome

    pub(all) struct TransactionOutcome {
    item_id : String
    state : TransactionState
    response : Frame?
    error : ModbusError?
    timestamp : Int
    }

    A transaction result with response and error context.

    TransactionOutcome::error

    TransactionOutcome::item_id

    fn TransactionOutcome::item_id(self : TransactionOutcome) -> String

    TransactionOutcome::new

    fn TransactionOutcome::new(item_id : String, state : TransactionState, timestamp : Int, response? : Frame, error? : ModbusError) -> Result[TransactionOutcome, ModbusError]

    TransactionOutcome::response

    TransactionOutcome::state

    TransactionOutcome::timestamp

    fn TransactionOutcome::timestamp(self : TransactionOutcome) -> Int

    TransactionState

    pub(all) enum TransactionState {
    TransactionOpen
    TransactionPrepared
    TransactionCommitted
    TransactionRolledBack
    TransactionFailed
    } derive(Eq,
    Debug
    )

    Lifecycle state for a multi-request transaction.

    TransportCapabilities

    pub(all) struct TransportCapabilities {
    mode : Mode
    max_adu : Int
    supports_broadcast : Bool
    preserves_transaction_id : Bool
    }

    A transport capability report for startup diagnostics.

    TransportKind

    pub(all) enum TransportKind {
    SerialRtu
    SerialAscii
    ModbusTcp
    } derive(Eq,
    Debug
    )

    Named transport choices used by adapters.

    TransportMetricWindow

    pub(all) struct TransportMetricWindow {
    transport : MetricsTransport
    window : Int
    requests : Int
    successes : Int
    failures : Int
    bytes_sent : Int
    bytes_received : Int
    latency_total : Int
    latency_max : Int
    last_timestamp : Int
    }

    Request outcome accumulated by a transport lane.

    TransportMetricWindow::average_latency

    fn TransportMetricWindow::average_latency(self : TransportMetricWindow) -> Int

    TransportMetricWindow::bytes_received

    fn TransportMetricWindow::bytes_received(self : TransportMetricWindow) -> Int

    TransportMetricWindow::bytes_sent

    fn TransportMetricWindow::bytes_sent(self : TransportMetricWindow) -> Int

    TransportMetricWindow::failures

    fn TransportMetricWindow::failures(self : TransportMetricWindow) -> Int

    TransportMetricWindow::maximum_latency

    fn TransportMetricWindow::maximum_latency(self : TransportMetricWindow) -> Int

    TransportMetricWindow::new

    fn TransportMetricWindow::new(transport : MetricsTransport, window : Int) -> Result[TransportMetricWindow, ModbusError]

    TransportMetricWindow::record

    fn TransportMetricWindow::record(self : TransportMetricWindow, timestamp : Int, success : Bool, latency : Int, sent : Int, received : Int) -> Result[Unit, ModbusError]

    TransportMetricWindow::requests

    fn TransportMetricWindow::requests(self : TransportMetricWindow) -> Int

    TransportMetricWindow::reset

    TransportMetricWindow::success_rate

    fn TransportMetricWindow::success_rate(self : TransportMetricWindow) -> Int

    TransportMetricWindow::successes

    fn TransportMetricWindow::successes(self : TransportMetricWindow) -> Int

    TransportMetricWindow::transport

    TransportMetricWindow::window

    TransportMetricsRegistry

    pub(all) struct TransportMetricsRegistry {
    windows : Array[TransportMetricWindow]
    max_windows : Int
    }

    Fleet transport metrics registry.

    TransportMetricsRegistry::count

    TransportMetricsRegistry::export_lines

    fn TransportMetricsRegistry::export_lines(self : TransportMetricsRegistry) -> Array[String]

    TransportMetricsRegistry::new

    fn TransportMetricsRegistry::new(max_windows? : Int, window? : Int) -> Result[TransportMetricsRegistry, ModbusError]

    TransportMetricsRegistry::record

    fn TransportMetricsRegistry::record(self : TransportMetricsRegistry, transport : MetricsTransport, timestamp : Int, success : Bool, latency : Int, sent : Int, received : Int) -> Result[Unit, ModbusError]

    TransportMetricsRegistry::total_failures

    fn TransportMetricsRegistry::total_failures(self : TransportMetricsRegistry) -> Int

    TransportMetricsRegistry::total_requests

    fn TransportMetricsRegistry::total_requests(self : TransportMetricsRegistry) -> Int

    TransportMetricsRegistry::window

    TrendDirection

    pub(all) enum TrendDirection {
    RisingTrend
    FallingTrend
    StableTrend
    InsufficientTrend
    } derive(Eq,
    Debug
    )

    Direction of a value series over a configured observation window.

    ValueAnomaly

    pub(all) struct ValueAnomaly {
    rule_id : String
    timestamp : Int
    value : Int
    kind : AnomalyKind
    severity : Int
    detail : String
    }

    A detected deviation with enough context for an incident message.

    ValueAnomaly::detail

    fn ValueAnomaly::detail(self : ValueAnomaly) -> String

    ValueAnomaly::kind

    ValueAnomaly::new

    fn ValueAnomaly::new(rule_id : String, timestamp : Int, value : Int, kind : AnomalyKind, severity : Int, detail : String) -> Result[ValueAnomaly, ModbusError]

    ValueAnomaly::rule_id

    fn ValueAnomaly::rule_id(self : ValueAnomaly) -> String

    ValueAnomaly::severity

    fn ValueAnomaly::severity(self : ValueAnomaly) -> Int

    ValueAnomaly::timestamp

    fn ValueAnomaly::timestamp(self : ValueAnomaly) -> Int

    ValueAnomaly::value

    fn ValueAnomaly::value(self : ValueAnomaly) -> Int

    ValueHistogram

    pub(all) struct ValueHistogram {
    lower : Int
    upper : Int
    width : Int
    bins : Array[Int]
    outside : Int
    }

    Fixed-width histogram used for distribution and percentile approximations.

    ValueHistogram::add

    fn ValueHistogram::add(self : ValueHistogram, value : Int) -> Unit

    ValueHistogram::bins

    fn ValueHistogram::bins(self : ValueHistogram) -> Array[Int]

    ValueHistogram::new

    fn ValueHistogram::new(lower : Int, upper : Int, bin_count : Int) -> Result[ValueHistogram, ModbusError]

    ValueHistogram::outside

    fn ValueHistogram::outside(self : ValueHistogram) -> Int

    ValueHistogram::percentile

    fn ValueHistogram::percentile(self : ValueHistogram, percent : Int) -> Result[Int, ModbusError]

    ValueHistogram::total

    fn ValueHistogram::total(self : ValueHistogram) -> Int

    pub struct VirtualLink {
    mode : Mode
    max_queue : Int
    master_to_device : Array[Array[Byte]]
    device_to_master : Array[Array[Byte]]
    sent : Int
    received : Int
    dropped : Int
    }

    A deterministic in-memory transport used by tests, demos, and simulators.

    VirtualLink::clear

    fn VirtualLink::clear(self : VirtualLink) -> Unit

    VirtualLink::dropped_count

    fn VirtualLink::dropped_count(self : VirtualLink) -> Int

    VirtualLink::mode

    fn VirtualLink::mode(self : VirtualLink) -> Mode

    VirtualLink::new

    fn VirtualLink::new(mode : Mode, max_queue? : Int) -> Result[VirtualLink, ModbusError]

    VirtualLink::queued_requests

    fn VirtualLink::queued_requests(self : VirtualLink) -> Int

    VirtualLink::queued_responses

    fn VirtualLink::queued_responses(self : VirtualLink) -> Int

    VirtualLink::receive_request

    fn VirtualLink::receive_request(self : VirtualLink) -> Result[Frame, ModbusError]

    VirtualLink::receive_response

    fn VirtualLink::receive_response(self : VirtualLink) -> Result[Array[Byte], ModbusError]

    VirtualLink::received_count

    fn VirtualLink::received_count(self : VirtualLink) -> Int

    VirtualLink::round_trip

    fn VirtualLink::round_trip(self : VirtualLink, device : Device, transaction_id : UInt16, request : Frame) -> Result[DeviceResponse, ModbusError]

    Execute one request against a device and enqueue its response.

    VirtualLink::send_request

    fn VirtualLink::send_request(self : VirtualLink, transaction_id : UInt16, frame : Frame) -> Result[Unit, ModbusError]

    VirtualLink::send_response

    fn VirtualLink::send_response(self : VirtualLink, transaction_id : UInt16, frame : Frame) -> Result[Unit, ModbusError]

    VirtualLink::sent_count

    fn VirtualLink::sent_count(self : VirtualLink) -> Int

    WorkOrderState

    pub(all) enum WorkOrderState {
    Planned
    Assigned
    InProgress
    Blocked
    Completed
    Cancelled
    } derive(Eq,
    Debug
    )

    State of a maintenance work order.

    accepts_broadcast

    fn accepts_broadcast(mode : Mode) -> Bool

    access_operation_name

    fn access_operation_name(value : AccessOperation) -> String

    access_role_rank

    fn access_role_rank(value : AccessRole) -> Int

    address_bytes

    fn address_bytes(address : UInt16) -> Array[Byte]

    Make the two-byte address representation used by request builders.

    aggregation_name

    fn aggregation_name(value : Aggregation) -> String

    alarm_condition_name

    fn alarm_condition_name(value : AlarmCondition) -> String

    alarm_severity_name

    fn alarm_severity_name(value : AlarmSeverity) -> String

    alarm_state_name

    fn alarm_state_name(value : AlarmState) -> String

    analytics_report

    fn analytics_report(window : AnalyticsWindow, rule : AnalyticsRule, histogram : ValueHistogram) -> Result[AnalyticsReport, ModbusError]

    anomaly_kind_name

    fn anomaly_kind_name(kind : AnomalyKind) -> String

    append_u16_be

    fn append_u16_be(out : Array[Byte], value : UInt16) -> Unit

    Append a big-endian unsigned 16-bit value.

    append_u32_be

    fn append_u32_be(out : Array[Byte], value : UInt) -> Unit

    Append a big-endian unsigned 32-bit value.

    ascii_boundary

    fn ascii_boundary(bytes : Array[Byte]) -> Int?

    Return a complete ASCII frame boundary if CRLF is present.

    ascii_mode

    fn ascii_mode() -> Mode

    base_function

    fn base_function(frame : Frame) -> Byte

    Return the function number without the exception bit.

    batch_completed

    fn batch_completed(results : Array[BatchResult]) -> Int

    batch_failed

    fn batch_failed(results : Array[BatchResult]) -> Int

    batch_register_values

    fn batch_register_values(results : Array[BatchResult]) -> Result[Array[UInt16], ModbusError]

    Merge successful register responses from a batch into one ordered array.

    benchmark_crc

    fn benchmark_crc(iterations : Int) -> Result[BenchmarkResult, ModbusError]

    Run repeated CRC work over a representative RTU payload.

    benchmark_device_reads

    fn benchmark_device_reads(iterations : Int) -> Result[BenchmarkResult, ModbusError]

    Run a device read workload over the in-memory server path.

    benchmark_rtu_round_trip

    fn benchmark_rtu_round_trip(iterations : Int) -> Result[BenchmarkResult, ModbusError]

    Run encode/decode round trips for the RTU transport.

    benchmark_suite

    fn benchmark_suite(iterations : Int) -> Result[Array[BenchmarkResult], ModbusError]

    Run the standard local benchmark suite.

    benchmark_tcp_round_trip

    fn benchmark_tcp_round_trip(iterations : Int) -> Result[BenchmarkResult, ModbusError]

    Run encode/decode round trips for the TCP transport.

    boundary_vectors

    fn boundary_vectors(frame : Frame) -> Array[ConformanceVector]

    Generate boundary vectors for empty, short, and corrupt inputs.

    bridge_action_name

    fn bridge_action_name(action : BridgeAction) -> String

    bucket_samples

    fn bucket_samples(samples : Array[TagSample], start : Int, width : Int) -> Result[Array[HistoryBucket], ModbusError]

    byte_sum

    fn byte_sum(bytes : Array[Byte]) -> Byte

    byte_xor

    fn byte_xor(bytes : Array[Byte]) -> Byte

    bytes_equal

    fn bytes_equal(left : Array[Byte], right : Array[Byte]) -> Bool

    bytes_to_hex_string

    fn bytes_to_hex_string(bytes : Array[Byte]) -> String

    Convert a byte array to a printable uppercase hexadecimal string.

    bytes_to_register

    fn bytes_to_register(bytes : Array[Byte], offset : Int, order : RegisterByteOrder) -> Result[UInt16, ModbusError]

    Decode two bytes as one register.

    bytes_to_registers

    fn bytes_to_registers(bytes : Array[Byte], order : RegisterByteOrder) -> Result[Array[UInt16], ModbusError]

    Convert an even-length byte array to registers.

    capabilities

    fn capabilities(mode : Mode) -> TransportCapabilities

    capacity_resource_name

    fn capacity_resource_name(resource : CapacityResource) -> String

    capture_direction_name

    fn capture_direction_name(direction : CaptureDirection) -> String

    capture_status_name

    fn capture_status_name(status : CaptureStatus) -> String

    chunk_bytes

    fn chunk_bytes(bytes : Array[Byte], chunk_size : Int) -> Result[Array[Array[Byte]], ModbusError]

    Split a byte array into bounded chunks for transport fuzzing and tests.

    clamp_int

    fn clamp_int(value : Int, minimum : Int, maximum : Int) -> Result[Int, ModbusError]

    client_result

    fn client_result(response : Frame) -> ClientResult

    config_diff

    fn config_diff(before : Array[ConfigEntry], after : Array[ConfigEntry]) -> Array[ConfigOperation]

    config_kind_name

    fn config_kind_name(kind : ConfigKind) -> String

    config_schema_summary

    fn config_schema_summary(schema : ConfigSchema) -> String

    config_values_equal

    fn config_values_equal(left : ConfigValue, right : ConfigValue) -> Bool

    conformance_failed

    fn conformance_failed(results : Array[ConformanceResult]) -> Int

    conformance_passed

    fn conformance_passed(results : Array[ConformanceResult]) -> Int

    contract_result_name

    fn contract_result_name(result : ContractResult) -> String

    copy_bytes

    fn copy_bytes(bytes : Array[Byte]) -> Array[Byte]

    Make an owned byte-array copy. Protocol parsers use this to avoid retaining views.

    copy_range

    fn copy_range(bytes : Array[Byte], start : Int, end : Int) -> Result[Array[Byte], ModbusError]

    Copy a half-open range and return a protocol error when the range is invalid.

    count_bits

    fn count_bits(bytes : Array[Byte]) -> Int

    Count the set bits in a packed byte array.

    crc16

    fn crc16(bytes : Array[Byte]) -> UInt16

    Modbus polynomial CRC16, low byte first on the wire.

    crc16_range

    fn crc16_range(bytes : Array[Byte], start : Int, end : Int) -> Result[UInt16, ModbusError]

    Compute CRC16 for a half-open range without allocating a slice.

    crc16_update

    fn crc16_update(crc : UInt16, byte : Byte) -> UInt16

    Update a CRC16 accumulator with one byte.

    crc_bytes

    fn crc_bytes(bytes : Array[Byte]) -> Array[Byte]

    Return CRC bytes in Modbus RTU order.

    decode_ascii

    fn decode_ascii(bytes : Array[Byte]) -> Result[Frame, ModbusError]

    Decode one complete Modbus ASCII frame.

    decode_bits_response

    fn decode_bits_response(request : Frame, response : Frame) -> Result[Array[Bool], ModbusError]

    Decode a read-coils or read-discrete-inputs response.

    decode_comm_event_counter

    fn decode_comm_event_counter(request : Frame, response : Frame) -> Result[(UInt16, UInt16), ModbusError]

    Decode the communication event counter response.

    decode_device_identification

    fn decode_device_identification(request : Frame, response : Frame) -> Result[DeviceIdentification, ModbusError]

    Decode a Read Device Identification response into TLV objects.

    decode_diagnostics

    fn decode_diagnostics(request : Frame, response : Frame) -> Result[(UInt16, Array[Byte]), ModbusError]

    Decode the two-byte diagnostics subfunction and its data.

    decode_exception_status

    fn decode_exception_status(request : Frame, response : Frame) -> Result[Byte, ModbusError]

    Decode an exception-status response.

    decode_fifo_queue

    fn decode_fifo_queue(request : Frame, response : Frame) -> Result[Array[UInt16], ModbusError]

    Decode a FIFO response into the queue values.

    decode_file_record_response

    fn decode_file_record_response(request : Frame, response : Frame) -> Result[Array[Array[UInt16]], ModbusError]

    Decode the values returned for a Read File Record response.

    decode_file_record_write_response

    fn decode_file_record_write_response(request : Frame, response : Frame) -> Result[Unit, ModbusError]

    Decode the echo of a Write File Record response.

    decode_hex

    fn decode_hex(bytes : Array[Byte]) -> Result[Array[Byte], ModbusError]

    Decode an even-length hexadecimal ASCII array.

    decode_mask_write

    fn decode_mask_write(request : Frame, response : Frame) -> Result[(UInt16, UInt16), ModbusError]

    Decode a mask-write response and return (and_mask, or_mask).

    decode_mode

    fn decode_mode(mode : Mode, bytes : Array[Byte]) -> Result[Frame, ModbusError]

    Decode a complete frame when the transport does not carry a TCP transaction id.

    decode_multiple_write

    fn decode_multiple_write(request : Frame, response : Frame) -> Result[(UInt16, UInt16), ModbusError]

    Decode a multiple-write echo and return (address, quantity).

    decode_read_write_response

    fn decode_read_write_response(request : Frame, response : Frame) -> Result[Array[UInt16], ModbusError]

    Decode the register payload of a combined read/write response.

    decode_register_response

    fn decode_register_response(request : Frame, response : Frame) -> Result[Array[UInt16], ModbusError]

    Decode a function 03 or 04 register response.

    decode_response

    fn decode_response(request : Frame, response : Frame) -> Result[ResponseValue, ModbusError]

    Decode any response while preserving exception information.

    decode_rtu

    fn decode_rtu(bytes : Array[Byte]) -> Result[Frame, ModbusError]

    Decode one complete Modbus RTU frame.

    decode_server_id

    fn decode_server_id(request : Frame, response : Frame) -> Result[Array[Byte], ModbusError]

    Decode a Report Server ID response into its raw payload.

    decode_tcp

    fn decode_tcp(bytes : Array[Byte]) -> Result[(UInt16, Frame), ModbusError]

    Decode one complete Modbus TCP ADU and return its transaction id.

    decode_transaction

    fn decode_transaction(mode : Mode, bytes : Array[Byte]) -> Result[(UInt16, Frame), ModbusError]

    Decode an encoded frame and preserve a TCP transaction identifier when present.

    decode_write_single_coil

    fn decode_write_single_coil(request : Frame, response : Frame) -> Result[Bool, ModbusError]

    Decode a single-coil echo and return its logical value.

    decode_write_single_register

    fn decode_write_single_register(request : Frame, response : Frame) -> Result[UInt16, ModbusError]

    Decode a single-register write echo.

    default_client_config

    fn default_client_config() -> ClientConfig

    default_frame_limit

    fn default_frame_limit(mode : Mode) -> Int

    default_limits

    fn default_limits() -> ProtocolLimits

    default_queue_limit

    fn default_queue_limit(mode : Mode) -> Int

    default_retry_policy

    fn default_retry_policy() -> RetryPolicy

    default_server_capabilities

    fn default_server_capabilities() -> CapabilitySet

    default_server_config

    fn default_server_config(mode : Mode) -> ServerConfig

    device_command_kind_name

    fn device_command_kind_name(kind : DeviceCommandKind) -> String

    device_command_state_name

    fn device_command_state_name(state : DeviceCommandState) -> String

    device_id_category

    fn device_id_category(value : Byte) -> DeviceIdCategory

    device_service_kind_name

    fn device_service_kind_name(kind : DeviceServiceKind) -> String

    device_service_state_name

    fn device_service_state_name(state : DeviceServiceState) -> String

    diagnose_capability_gap

    fn diagnose_capability_gap(capabilities : CapabilitySet, expected_functions : Array[Byte]) -> DiagnosticReport

    diagnose_frames

    fn diagnose_frames(frames : Array[Frame]) -> DiagnosticReport

    diagnostic_category_name

    fn diagnostic_category_name(value : DiagnosticCategory) -> String

    diagnostic_severity_name

    fn diagnostic_severity_name(value : DiagnosticSeverity) -> String

    diagnostics

    fn diagnostics(unit_id : Byte, subfunction : UInt16, data : Array[Byte]) -> Result[Frame, ModbusError]

    Build a diagnostics request (function 08).

    diagnostics_return_query_data

    fn diagnostics_return_query_data(unit_id : Byte, data : Array[Byte]) -> Result[Frame, ModbusError]

    Build the common Return Query Data diagnostics request.

    encapsulated_interface

    fn encapsulated_interface(unit_id : Byte, mei_type : Byte, payload : Array[Byte]) -> Result[Frame, ModbusError]

    Build a generic encapsulated-interface request (function 43).

    encode_ascii

    fn encode_ascii(frame : Frame) -> Array[Byte]

    Encode a frame as Modbus ASCII, including : prefix and CRLF suffix.

    encode_device_identification

    fn encode_device_identification(unit_id : Byte, category : DeviceIdCategory, conformity : Byte, more_follows : Bool, next_object_id : Byte, objects : Array[DeviceIdObject]) -> Result[Frame, ModbusError]

    Encode an identification response from typed objects.

    encode_hex

    fn encode_hex(bytes : Array[Byte]) -> Array[Byte]

    Encode an owned byte array as uppercase hexadecimal ASCII.

    encode_mode

    fn encode_mode(mode : Mode, frame : Frame) -> Array[Byte]

    Encode a frame for a mode; TCP uses transaction id zero for this convenience API.

    encode_rtu

    fn encode_rtu(frame : Frame) -> Array[Byte]

    Encode a frame as Modbus RTU.

    encode_tcp

    fn encode_tcp(transaction_id : UInt16, frame : Frame) -> Array[Byte]

    Encode a frame as Modbus TCP, using a caller-provided transaction id.

    encoded_length

    fn encoded_length(mode : Mode, frame : Frame) -> Int

    Return the encoded size of a frame on a transport.

    endpoint_health

    fn endpoint_health(device : Device, metrics : ProtocolMetrics) -> EndpointHealth

    endpoint_health_summary

    fn endpoint_health_summary(health : EndpointHealth) -> String

    Summarize health in stable key/value form for a CLI or metrics exporter.

    endpoint_score

    fn endpoint_score(health : EndpointHealth) -> Int

    Return a score in [0, 100] suitable for a small status indicator.

    engineering_unit_name

    fn engineering_unit_name(unit : EngineeringUnit) -> String

    error_name

    fn error_name(error : ModbusError) -> String

    Convert a protocol error to a stable diagnostic name.

    error_or_unit

    fn error_or_unit(result : Result[Unit, ModbusError]) -> String

    error_response

    fn error_response(request : Frame, error : ModbusError) -> Frame

    Construct an exception from a protocol error.

    evaluate_access

    fn evaluate_access(policy : AccessPolicy, role : AccessRole, operation : AccessOperation, principal : String, frame : Frame, timestamp : Int, sequence : Int) -> Result[SecurityAudit, ModbusError]

    exception_code

    fn exception_code(value : Byte) -> ExceptionCode

    exception_for_error

    fn exception_for_error(error : ModbusError) -> ExceptionCode

    exception_from_frame

    fn exception_from_frame(frame : Frame) -> Result[ExceptionCode, ModbusError]

    Decode the exception code from a standard exception response.

    exception_response

    fn exception_response(unit_id : Byte, function : Byte, code : Byte) -> Frame

    Build a standard Modbus exception response.

    expected_response_function

    fn expected_response_function(request : Frame) -> Byte

    Return the expected response function byte for a request.

    expected_tcp_length

    fn expected_tcp_length(bytes : Array[Byte]) -> Result[Int, ModbusError]

    Return the expected TCP ADU size from a partial header.

    f32_to_registers

    fn f32_to_registers(value : Float, word_order : RegisterWordOrder) -> Array[UInt16]

    Encode a Float in IEEE-754 binary32 form as two registers.

    fault_mode_name

    fn fault_mode_name(mode : FaultMode) -> String

    fits_mode_limit

    fn fits_mode_limit(mode : Mode, frame : Frame) -> Bool

    Return whether a frame can be represented by a mode's ADU limit.

    fits_queue_budget

    fn fits_queue_budget(frames : Array[Frame], mode : Mode, budget : Int) -> Bool

    Check that an entire sequence stays below a caller's queue budget.

    fleet_health_from_inventory

    fn fleet_health_from_inventory(rollup : FleetHealthRollup, inventory : DeviceInventory, now : Int, timeout : Int) -> Result[Unit, ModbusError]

    Generate a contribution from inventory reachability.

    fleet_health_from_reliability

    fn fleet_health_from_reliability(timestamp : Int, summary : ReliabilityFleetSummary) -> Result[FleetHealthRollup, ModbusError]

    Generate contributions from a reliability fleet summary.

    fleet_health_from_services

    fn fleet_health_from_services(rollup : FleetHealthRollup, registry : DeviceServiceRegistry) -> Result[Unit, ModbusError]

    Generate contributions from a service registry.

    fleet_health_state_name

    fn fleet_health_state_name(state : FleetHealthState) -> String

    fleet_score

    fn fleet_score(health : Array[EndpointHealth]) -> Int

    Compute an overall score for a fleet of devices.

    float_words

    fn float_words(high : UInt16, low : UInt16) -> UInt64

    Decode two registers as the raw IEEE-754 single precision words.

    format_error

    fn format_error(error : ModbusError) -> String

    Produce a one-line protocol error for a CLI diagnostic.

    format_frame

    fn format_frame(frame : Frame) -> String

    Format a complete frame for logs without exposing transport framing.

    format_wire_frame

    fn format_wire_frame(mode : Mode, transaction_id : UInt16, frame : Frame) -> String

    Format a frame with its RTU, ASCII, or TCP wire representation.

    frame_budget_available

    fn frame_budget_available(mode : Mode, frame : Frame, budget : Int) -> Bool

    frame_count_for_coils

    fn frame_count_for_coils(quantity : Int) -> Result[Int, ModbusError]

    Calculate the number of frames needed for a logical coil read.

    frame_count_for_registers

    fn frame_count_for_registers(quantity : Int) -> Result[Int, ModbusError]

    Calculate the number of frames needed for a logical register read.

    frame_data_copy

    fn frame_data_copy(frame : Frame) -> Array[Byte]

    frame_is_empty

    fn frame_is_empty(frame : Frame) -> Bool

    frame_is_valid

    fn frame_is_valid(frame : Frame) -> Bool

    frame_with_data_copy

    fn frame_with_data_copy(frame : Frame, data : Array[Byte]) -> Frame

    frames_equal

    fn frames_equal(left : Frame, right : Frame) -> Bool

    Compare frames at the logical PDU level.

    function_catalog

    fn function_catalog() -> Array[FunctionDescriptor]

    Return every descriptor in numeric order.

    function_code

    fn function_code(value : Byte) -> FunctionCode

    Convert a function code byte into the typed function-code vocabulary.

    function_descriptor

    fn function_descriptor(function : Byte) -> FunctionDescriptor?

    function_name

    fn function_name(function : Byte) -> String

    Human-readable function-code name used by diagnostic output.

    gateway_function_supported

    fn gateway_function_supported(function : Byte) -> Bool

    Return whether a gateway rule can safely carry a function code.

    get_bit

    fn get_bit(bytes : Array[Byte], index : Int) -> Result[Bool, ModbusError]

    Read a single bit from a packed byte array.

    get_comm_event_counter

    fn get_comm_event_counter(unit_id : Byte) -> Result[Frame, ModbusError]

    Build a request for the communication event counter (function 11).

    get_comm_event_log

    fn get_comm_event_log(unit_id : Byte) -> Result[Frame, ModbusError]

    Build a request for the communication event log (function 12).

    guard_decision_name

    fn guard_decision_name(value : GuardDecision) -> String

    guard_reason_name

    fn guard_reason_name(value : GuardReason) -> String

    hex_string_to_bytes

    fn hex_string_to_bytes(text : String) -> Result[Array[Byte], ModbusError]

    Convert a string containing hexadecimal digits and optional whitespace to bytes.

    i32_to_registers

    fn i32_to_registers(value : Int, word_order : RegisterWordOrder) -> Array[UInt16]

    Encode a signed 32-bit value using two's-complement bits.

    inventory_state_name

    fn inventory_state_name(state : InventoryState) -> String

    is_broadcast

    fn is_broadcast(unit_id : Byte) -> Bool

    True when the frame uses the serial-line broadcast address.

    is_client_input_error

    fn is_client_input_error(error : ModbusError) -> Bool

    is_exception

    fn is_exception(frame : Frame) -> Bool

    Whether a PDU is an exception response.

    is_read_function

    fn is_read_function(function : Byte) -> Bool

    is_retryable

    fn is_retryable(error : ModbusError) -> Bool

    Return whether an error is recoverable by a retry policy.

    is_supported_mode

    fn is_supported_mode(mode : Mode) -> Bool

    is_transport_error

    fn is_transport_error(error : ModbusError) -> Bool

    is_valid_unit_id

    fn is_valid_unit_id(unit_id : Byte, broadcast? : Bool) -> Bool

    True for a legal serial-line unit identifier, including broadcast.

    is_write_echo

    fn is_write_echo(request : Frame, response : Frame) -> Bool

    Check an ordinary write response without decoding its fields.

    is_write_function

    fn is_write_function(function : Byte) -> Bool

    job_priority_rank

    fn job_priority_rank(priority : JobPriority) -> Int

    job_state_name

    fn job_state_name(state : JobState) -> String

    join_chunks

    fn join_chunks(chunks : Array[Array[Byte]], max_length : Int) -> Result[Array[Byte], ModbusError]

    Reassemble byte chunks and check their total size.

    lease_state_name

    fn lease_state_name(state : LeaseState) -> String

    least_healthy

    fn least_healthy(health : Array[EndpointHealth]) -> EndpointHealth?

    Return the least healthy endpoint, if any.

    limits_for

    fn limits_for(mode : Mode) -> ProtocolLimits

    lrc

    fn lrc(bytes : Array[Byte]) -> Byte

    LRC used by Modbus ASCII.

    lrc_from_sum

    fn lrc_from_sum(sum : Byte) -> Byte

    Compute the LRC from a running sum, using the Modbus two's-complement rule.

    lrc_with_sum

    fn lrc_with_sum(bytes : Array[Byte]) -> (Byte, Byte)

    Return both the LRC and the modulo-256 sum for diagnostics.

    maintenance_kind_name

    fn maintenance_kind_name(kind : MaintenanceKind) -> String

    maintenance_priority_name

    fn maintenance_priority_name(priority : MaintenancePriority) -> String

    mask_write_register

    fn mask_write_register(unit_id : Byte, address : UInt16, and_mask : UInt16, or_mask : UInt16) -> Result[Frame, ModbusError]

    Build a mask-write-register request (function 22).

    max_request_adu

    fn max_request_adu(mode : Mode, function : Byte) -> Int

    Return a conservative maximum request size for a function and mode.

    metric_kind_name

    fn metric_kind_name(kind : MetricKind) -> String

    metrics_transport_name

    fn metrics_transport_name(transport : MetricsTransport) -> String

    migration_operation_name

    fn migration_operation_name(operation : MigrationOperation) -> String

    migration_state_name

    fn migration_state_name(state : MigrationState) -> String

    minimum_frame_length

    fn minimum_frame_length(mode : Mode) -> Int

    Calculate how many bytes are needed for the shortest frame of a mode.

    mode_description

    fn mode_description(mode : Mode) -> String

    mode_name

    fn mode_name(mode : Mode) -> String

    Return the stable display name of a transport mode.

    mode_payload_capacity

    fn mode_payload_capacity(mode : Mode) -> Int

    Return the number of data bytes available after transport framing.

    offset_frame_address

    fn offset_frame_address(frame : Frame, delta : Int) -> Result[Frame, ModbusError]

    Add a signed address offset while preserving 16-bit bounds.

    ordinary_function

    fn ordinary_function(function : Byte) -> Byte

    Return the ordinary function code for an exception response.

    pack_bits

    fn pack_bits(values : Array[Bool]) -> Array[Byte]

    Pack boolean values into Modbus LSB-first coil bytes.

    parse_hex_byte

    fn parse_hex_byte(high : Byte, low : Byte) -> Result[Byte, ModbusError]

    Convert one ASCII hex byte into a binary byte.

    parse_wire_frame

    fn parse_wire_frame(mode : Mode, text : String) -> Result[(UInt16, Frame), ModbusError]

    Parse a wire representation in the selected mode.

    parser_load

    fn parser_load(parser : IncrementalParser) -> Int

    Return the number of bytes currently held across parser metrics.

    payload_is_bounded

    fn payload_is_bounded(mode : Mode, size : Int) -> Bool

    pdu_bytes

    fn pdu_bytes(frame : Frame) -> Array[Byte]

    Return the PDU bytes following the unit identifier.

    pdus_equal

    fn pdus_equal(left : Pdu, right : Pdu) -> Bool

    plan_read_coils

    fn plan_read_coils(unit_id : Byte, address : UInt16, quantity : Int, discrete? : Bool) -> Result[Array[PlannedRequest], ModbusError]

    plan_read_registers

    fn plan_read_registers(unit_id : Byte, address : UInt16, quantity : Int, function? : Byte) -> Result[Array[PlannedRequest], ModbusError]

    plan_write_registers

    fn plan_write_registers(unit_id : Byte, address : UInt16, values : Array[UInt16]) -> Result[Array[PlannedRequest], ModbusError]

    Plan a write block, respecting the protocol's maximum register quantity.

    poll_area_function

    fn poll_area_function(area : PollArea) -> Byte

    poll_area_name

    fn poll_area_name(area : PollArea) -> String

    preflight_device

    fn preflight_device(report : PreflightReport, device : Device) -> Unit

    Check a device's table capacities and unit id.

    preflight_frame

    fn preflight_frame(report : PreflightReport, mode : Mode, frame : Frame) -> Unit

    Check a frame's unit, PDU shape, and transport envelope constraints.

    preflight_plan

    fn preflight_plan(report : PreflightReport, plan : PollPlan, mode : Mode) -> Unit

    Check every job in a polling plan.

    preflight_server

    fn preflight_server(server : Server) -> PreflightReport

    Validate a complete server configuration and its registered devices.

    preflight_summary

    fn preflight_summary(report : PreflightReport) -> String

    Return a compact result line for CI logs.

    profile_area_name

    fn profile_area_name(area : ProfileArea) -> String

    profile_contiguous_points

    fn profile_contiguous_points(points : Array[ProfilePoint], area : ProfileArea) -> Array[ProfilePoint]

    Return all points that are safe to poll in one contiguous register range.

    profile_encoding_name

    fn profile_encoding_name(encoding : ProfileEncoding) -> String

    profile_point_value_from_registers

    fn profile_point_value_from_registers(point : ProfilePoint, registers : Array[UInt16]) -> Result[ProfileValue, ModbusError]

    quality_decision_name

    fn quality_decision_name(decision : QualityDecision) -> String

    quality_test_name

    fn quality_test_name(kind : QualityTest) -> String

    quantity_bytes_checked

    fn quantity_bytes_checked(quantity : UInt16) -> Array[Byte]

    Make a quantity representation used by request builders.

    read_coils

    fn read_coils(unit_id : Byte, address : UInt16, quantity : UInt16) -> Result[Frame, ModbusError]

    Build a read-coils request (function 01).

    read_device_identification

    fn read_device_identification(unit_id : Byte, category : DeviceIdCategory, object_id : Byte) -> Result[Frame, ModbusError]

    Build a Read Device Identification request.

    read_discrete_inputs

    fn read_discrete_inputs(unit_id : Byte, address : UInt16, quantity : UInt16) -> Result[Frame, ModbusError]

    Build a read-discrete-inputs request (function 02).

    read_exception_status

    fn read_exception_status(unit_id : Byte) -> Result[Frame, ModbusError]

    Build a request for the exception status byte (function 07).

    read_fifo_queue

    fn read_fifo_queue(unit_id : Byte, address : UInt16) -> Result[Frame, ModbusError]

    Build a Read FIFO Queue request (function 24).

    read_file_record

    fn read_file_record(unit_id : Byte, references : Array[FileRecordReference]) -> Result[Frame, ModbusError]

    Build a Read File Record request (function 20).

    read_holding

    fn read_holding(unit_id : Byte, address : UInt16, quantity : UInt16) -> Frame

    A request for reading holding registers (function 03).

    read_holding_checked

    fn read_holding_checked(unit_id : Byte, address : UInt16, quantity : UInt16) -> Result[Frame, ModbusError]

    Checked variant of read_holding for application code.

    read_holding_registers

    fn read_holding_registers(unit_id : Byte, address : UInt16, quantity : UInt16) -> Result[Frame, ModbusError]

    Build a read-holding-registers request (function 03).

    read_input_registers

    fn read_input_registers(unit_id : Byte, address : UInt16, quantity : UInt16) -> Result[Frame, ModbusError]

    Build a read-input-registers request (function 04).

    read_quantity_limit

    fn read_quantity_limit(function : Byte) -> Int

    Return the maximum legal request quantity for a read function.

    read_u16_be

    fn read_u16_be(bytes : Array[Byte], offset : Int) -> Result[UInt16, ModbusError]

    Read a big-endian unsigned 16-bit value from a byte array.

    read_u32_be

    fn read_u32_be(bytes : Array[Byte], offset : Int) -> Result[UInt, ModbusError]

    Read a big-endian unsigned 32-bit value using MoonBit's platform unsigned type.

    read_write_multiple_registers

    fn read_write_multiple_registers(unit_id : Byte, read_address : UInt16, read_quantity : UInt16, write_address : UInt16, write_values : Array[UInt16]) -> Result[Frame, ModbusError]

    Build a combined read/write-multiple-registers request (function 23).

    reading_quality_name

    fn reading_quality_name(value : ReadingQuality) -> String

    fn recommended_parser_role(function : Byte) -> ParserRole

    Return the recommended parser role for a function family.

    reconcile_snapshots

    fn reconcile_snapshots(expected : DeviceSnapshot, observed : DeviceSnapshot) -> Result[Array[ReconciliationDiff], ModbusError]

    Compare point values and qualities in two snapshots.

    reconciliation_kind_name

    fn reconciliation_kind_name(kind : ReconciliationKind) -> String

    reconciliation_report

    fn reconciliation_report(device_id : String, diffs : Array[ReconciliationDiff], compared : Int) -> Result[ReconciliationReport, ModbusError]

    register_byte_order_name

    fn register_byte_order_name(order : RegisterByteOrder) -> String

    register_to_bytes

    fn register_to_bytes(value : UInt16, order : RegisterByteOrder) -> Array[Byte]

    Convert one register to two bytes in the requested byte order.

    register_value_name

    fn register_value_name(value : RegisterValue) -> String

    Render a typed value as a compact diagnostic string.

    register_word_order_name

    fn register_word_order_name(order : RegisterWordOrder) -> String

    registers

    fn registers(frame : Frame) -> Result[Array[UInt16], ModbusError]

    Decode the data portion of a register-oriented frame without a byte count.

    registers_to_bytes

    fn registers_to_bytes(values : Array[UInt16], order : RegisterByteOrder) -> Array[Byte]

    Convert an array of registers to bytes with a selected byte order.

    registers_to_f32

    fn registers_to_f32(values : Array[UInt16], word_order : RegisterWordOrder) -> Result[Float, ModbusError]

    Decode two registers as an IEEE-754 binary32 Float.

    registers_to_i32

    fn registers_to_i32(values : Array[UInt16], word_order : RegisterWordOrder) -> Result[Int, ModbusError]

    Decode a signed 32-bit value from two registers.

    registers_to_u32

    fn registers_to_u32(values : Array[UInt16], word_order : RegisterWordOrder) -> Result[UInt, ModbusError]

    Decode two registers as an unsigned 32-bit value.

    registers_to_u64

    fn registers_to_u64(values : Array[UInt16], word_order : RegisterWordOrder) -> Result[UInt64, ModbusError]

    Decode four registers as a 64-bit value.

    reliability_failure_name

    fn reliability_failure_name(failure : ReliabilityFailure) -> String

    reliability_fleet_summary

    fn reliability_fleet_summary(devices : Array[DeviceReliability]) -> ReliabilityFleetSummary

    replace_frame_unit

    fn replace_frame_unit(frame : Frame, unit_id : Byte) -> Result[Frame, ModbusError]

    report_server_id

    fn report_server_id(unit_id : Byte) -> Result[Frame, ModbusError]

    Build a Report Server ID request (function 17).

    response_frame

    fn response_frame(request : Frame, data : Array[Byte]) -> Frame

    Construct a response with an explicit function and owned data array.

    response_payload_length

    fn response_payload_length(frame : Frame) -> Int

    response_quality

    fn response_quality(request : Frame, response : Frame) -> String

    Return a short response quality classification for metrics.

    response_timeout_hint

    fn response_timeout_hint(mode : Mode) -> Int

    response_value

    fn response_value(frame : Frame) -> ResponseValue

    retry_limit_for

    fn retry_limit_for(mode : Mode) -> Int

    reverse_registers

    fn reverse_registers(values : Array[UInt16]) -> Array[UInt16]

    Reverse register order in a copied array.

    round_trip_all_modes

    fn round_trip_all_modes(frame : Frame) -> Result[Array[Frame], ModbusError]

    Run the same frame through every transport codec.

    round_trip_vectors

    fn round_trip_vectors(frame : Frame) -> Array[ConformanceVector]

    Build protocol vectors from a known request in all three transports.

    rtu_mode

    fn rtu_mode() -> Mode

    Standard constructors kept as named entry points for configuration files.

    rtu_payload

    fn rtu_payload(frame : Frame) -> Array[Byte]

    Return the RTU payload before its two-byte CRC.

    safe_address

    fn safe_address(value : UInt16, quantity : Int) -> Result[Unit, ModbusError]

    safe_byte_at

    fn safe_byte_at(bytes : Array[Byte], index : Int) -> Result[Byte, ModbusError]

    safe_quantity

    fn safe_quantity(value : UInt16, limit : Int) -> Result[Int, ModbusError]

    scenario_boundary_suite

    fn scenario_boundary_suite(unit_id : Byte, function : Byte) -> Result[ModbusScenario, ModbusError]

    Build a common boundary scenario for a unit and function pair.

    scenario_fault_name

    fn scenario_fault_name(fault : ScenarioFault) -> String

    scenario_outcome_name

    fn scenario_outcome_name(outcome : ScenarioOutcome) -> String

    service_event_kind_name

    fn service_event_kind_name(kind : ServiceEventKind) -> String

    set_bit

    fn set_bit(bytes : Array[Byte], index : Int, value : Bool) -> Result[Unit, ModbusError]

    Set a single bit in a packed byte array.

    should_retry

    fn should_retry(mode : Mode, error : ModbusError) -> Bool

    signed_register

    fn signed_register(value : UInt16) -> Int

    Decode a signed 16-bit register using two's-complement representation.

    simulation_failures

    fn simulation_failures(results : Array[SimulationResult]) -> Int

    simulation_successes

    fn simulation_successes(results : Array[SimulationResult]) -> Int

    Count successful deliveries in a scenario result.

    standard_frame_contracts

    fn standard_frame_contracts() -> FrameContractCatalog

    Build a conservative catalog for the common Modbus function codes.

    summarize

    fn summarize(frame : Frame) -> FrameSummary

    summarize_plan

    fn summarize_plan(items : Array[PlannedRequest]) -> PlanSummary

    supported_function

    fn supported_function(function : Byte) -> Bool

    Check that a function code is in the supported public subset.

    swap_register_bytes

    fn swap_register_bytes(values : Array[UInt16]) -> Array[UInt16]

    Rotate bytes inside every register, useful for devices with byte-swapped words.

    tcp_mode

    fn tcp_mode() -> Mode

    topology_health_name

    fn topology_health_name(health : TopologyHealth) -> String

    topology_node_kind_name

    fn topology_node_kind_name(kind : TopologyNodeKind) -> String

    transaction_state_name

    fn transaction_state_name(state : TransactionState) -> String

    transport_is_network

    fn transport_is_network(mode : Mode) -> Bool

    transport_is_serial

    fn transport_is_serial(mode : Mode) -> Bool

    transport_kind_mode

    fn transport_kind_mode(kind : TransportKind) -> Mode

    transport_kind_name

    fn transport_kind_name(kind : TransportKind) -> String

    trend_direction_name

    fn trend_direction_name(direction : TrendDirection) -> String

    try_encode_ascii

    fn try_encode_ascii(frame : Frame) -> Result[Array[Byte], ModbusError]

    Checked ASCII encoder.

    try_encode_mode

    fn try_encode_mode(mode : Mode, transaction_id : UInt16, frame : Frame) -> Result[Array[Byte], ModbusError]

    Checked transport encoder with an explicit TCP transaction id.

    try_encode_rtu

    fn try_encode_rtu(frame : Frame) -> Result[Array[Byte], ModbusError]

    Checked RTU encoder for code that wants validation errors instead of a raw frame.

    try_encode_tcp

    fn try_encode_tcp(transaction_id : UInt16, frame : Frame) -> Result[Array[Byte], ModbusError]

    Checked TCP encoder.

    typed_exception_response

    fn typed_exception_response(unit_id : Byte, function : Byte, code : ExceptionCode) -> Frame

    Build a typed exception response.

    u32_to_registers

    fn u32_to_registers(value : UInt, word_order : RegisterWordOrder) -> Array[UInt16]

    Encode an unsigned 32-bit value into two registers.

    u64_to_registers

    fn u64_to_registers(value : UInt64, word_order : RegisterWordOrder) -> Array[UInt16]

    Encode a 64-bit value into four registers.

    unpack_bits

    fn unpack_bits(bytes : Array[Byte], quantity : Int) -> Result[Array[Bool], ModbusError]

    Unpack exactly quantity coil values from LSB-first bytes.

    valid_address_range

    fn valid_address_range(address : UInt16, quantity : Int) -> Bool

    Check whether an address/count pair fits in the 16-bit Modbus address space.

    validate_catalog_request

    fn validate_catalog_request(frame : Frame) -> Result[Unit, ModbusError]

    Validate a request against the catalog before invoking a builder.

    validate_endpoint

    fn validate_endpoint(config : EndpointConfig) -> Result[Unit, ModbusError]

    validate_endpoint_health

    fn validate_endpoint_health(health : EndpointHealth) -> Result[Unit, ModbusError]

    Validate that endpoint counters are internally consistent.

    validate_frame

    fn validate_frame(frame : Frame, allow_broadcast : Bool) -> Result[Unit, ModbusError]

    Validate a complete logical frame before encoding it on any transport.

    validate_mode_payload

    fn validate_mode_payload(mode : Mode, data_length : Int) -> Result[Unit, ModbusError]

    validate_pdu

    fn validate_pdu(pdu : Pdu) -> Result[Unit, ModbusError]

    Validate a request PDU's byte-level shape and protocol limits.

    validate_plan_order

    fn validate_plan_order(items : Array[PlannedRequest]) -> Result[Unit, ModbusError]

    Validate that planned ranges are ordered and non-overlapping.

    validate_poll_plan

    fn validate_poll_plan(plan : PollPlan) -> Result[Unit, ModbusError]

    Validate plan timing invariants before deployment.

    validate_response_header

    fn validate_response_header(request : Frame, response : Frame) -> Result[Unit, ModbusError]

    Validate the common unit/function relationship of a response.

    validate_server_config

    fn validate_server_config(config : ServerConfig) -> Result[Unit, ModbusError]

    validate_unit

    fn validate_unit(unit_id : Byte, allow_broadcast : Bool) -> Result[Unit, ModbusError]

    Validate a unit identifier for a request.

    validate_wire_frame

    fn validate_wire_frame(frame : Frame, allow_broadcast : Bool) -> Result[Unit, ModbusError]

    Validate a frame for wire encoding without assuming request-only payload shapes.

    validate_write_shape

    fn validate_write_shape(function : Byte, quantity : Int) -> Result[Unit, ModbusError]

    Check whether a write payload is legal before allocating its data array.

    variable_response_function_names

    fn variable_response_function_names() -> Array[String]

    Return the names of all functions whose response contains a byte count.

    verify_crc16

    fn verify_crc16(bytes : Array[Byte]) -> Result[Unit, ModbusError]

    Verify a CRC16 trailer in low-byte-first wire order.

    verify_lrc

    fn verify_lrc(bytes : Array[Byte]) -> Result[Unit, ModbusError]

    Verify an LRC trailer at the end of a byte array.

    with_data

    fn with_data(frame : Frame, data : Array[Byte]) -> Frame

    Return a copy of a frame with a different data payload.

    with_function

    fn with_function(frame : Frame, function : Byte) -> Frame

    Return a copy of a frame with a different function code.

    with_unit

    fn with_unit(frame : Frame, unit_id : Byte) -> Frame

    Return a copy of a frame with a different unit identifier.

    work_order_state_name

    fn work_order_state_name(state : WorkOrderState) -> String

    writable_function_names

    fn writable_function_names() -> Array[String]

    Return the names of all writable functions.

    write_file_record

    fn write_file_record(unit_id : Byte, records : Array[FileRecordWrite]) -> Result[Frame, ModbusError]

    Build a Write File Record request (function 21).

    write_multiple_coils

    fn write_multiple_coils(unit_id : Byte, address : UInt16, values : Array[Bool]) -> Result[Frame, ModbusError]

    Build a write-multiple-coils request (function 15).

    write_multiple_registers

    fn write_multiple_registers(unit_id : Byte, address : UInt16, values : Array[UInt16]) -> Result[Frame, ModbusError]

    Build a write-multiple-registers request (function 16).

    write_quantity_limit

    fn write_quantity_limit(function : Byte) -> Int

    Return the maximum legal write quantity for a write-multiple function.

    write_single_coil

    fn write_single_coil(unit_id : Byte, address : UInt16, value : Bool) -> Result[Frame, ModbusError]

    Build a write-single-coil request (function 05).

    write_single_register

    fn write_single_register(unit_id : Byte, address : UInt16, value : UInt16) -> Frame

    A request for writing one holding register (function 06).

    write_single_register_checked

    fn write_single_register_checked(unit_id : Byte, address : UInt16, value : UInt16) -> Result[Frame, ModbusError]

    Build a write-single-register request (function 06) with validation.