A deterministic, dependency-free CAN 2.0 and CAN-FD toolkit for MoonBit.
moon check --target all --deny-warn
moon test --target all --deny-warnlet frame = @moonbit_canbus.data_frame(0x120, [0x2A]) catch {
_ => panic()
}
let wire = @moonbit_canbus.encode_frame(frame)
let restored = @moonbit_canbus.decode_frame(wire) catch {
_ => panic()
}
assert_true(@moonbit_canbus.frame_equal(frame, restored))moon run src/cmd/canctl -- demo
moon run src/cmd/canctl -- decode 01000000012303102030moon run src/cmd/bench| 层次 | 主要模块 | 责任 |
|---|---|---|
| Frame / wire | frame.mbt, frame_codec.mbt, wire.mbt, wire_codec.mbt | 帧不变量、DLC、CRC、bit stuffing 和可移植编码 |
| Transport | transport.mbt, isotp_engine.mbt, isotp_session.mbt, j1939_transport.mbt, transport_queue.mbt | ISO-TP、J1939、队列、时序与边界处理 |
| Database | dbc.mbt, dbc_extended.mbt, dbc_runtime.mbt, dbc_workspace.mbt, dbc_codegen.mbt, dbc_serializer.mbt | DBC 解析、信号运行时、schema 工具和代码生成 |
| Diagnostics | diagnostic.mbt, uds_stack.mbt, diagnostic_session.mbt, diagnostic_catalog.mbt, diagnostic_workflow.mbt, diagnostic_codec.mbt, ecu_simulator.mbt | UDS 服务、会话状态、DTC、ECU 仿真和诊断工作流 |
| Network | filter.mbt, can_network.mbt, hardware_adapter.mbt, canopen_device.mbt, routing.mbt, gateway_policy_advanced.mbt, simulation.mbt, simulation_profile.mbt | 过滤、适配器抽象、CANopen、网关、多节点网络和确定性仿真 |
| Analysis | trace.mbt, trace_query.mbt, trace_export.mbt, bus_analysis_advanced.mbt, network_health_advanced.mbt, compatibility_matrix.mbt, metrics.mbt, latency.mbt | 日志查询、导出、总线利用率、网络健康和部署兼容性分析 |
moon fmt
moon check --target all --deny-warn
moon test --target all --deny-warn
moon infopub suberror AdmissionError {
InvalidRule
NoMatchingRule
ProtocolNotAllowed
PayloadTooLarge
RemoteNotAllowed
RateExceeded
TimestampReversed
} derive(Debug)pub suberror CanAdapterError {
CanAdapterNotOpen
CanAdapterAlreadyOpen
CanAdapterBusOffError
CanAdapterQueueFull
CanAdapterUnsupported
CanAdapterInvalidConfiguration
CanAdapterRejectedFrame
}pub suberror CanOpenError {
InvalidNodeId
InvalidCobId
InvalidIndex
InvalidSdoPayload
InvalidDataLength
} derive(Debug)pub suberror CanTextError {
InvalidHeader
InvalidFieldCount
InvalidTimestamp
InvalidPayload
} derive(Debug)pub suberror CanTimingError {
InvalidClock
InvalidBitrate
InvalidSamplePoint
NoTimingCandidate
} derive(Debug)pub suberror DbcError {
InvalidMessageLine(String)
InvalidSignalLine(String)
InvalidNumber(String)
}pub suberror DbcExtendedError {
InvalidMessage
InvalidSignal
InvalidNumber
MissingMessage
InvalidRange
} derive(Debug)pub suberror DbcRuntimeError {
InvalidSignalLayout
PayloadTooShort
PayloadTooLong
DuplicateSignal
MissingSignalValue
ValueOutOfRange
} derive(Debug)pub suberror DbcSchemaError {
DuplicateMessageId
InvalidIdentifier
EmptyMessageName
InvalidDlc
InvalidSignalLayout
OverlappingSignals
} derive(Debug)pub suberror DtcCodecError {
InvalidCode
InvalidPayload
InvalidRecordLength
CapacityExceeded
} derive(Debug)pub suberror EcuMemoryError {
EcuMemoryOutOfRange
EcuMemoryPermissionDenied
EcuMemoryInvalidLength
EcuMemoryOverlappingRegion
}pub suberror FrameCodecError {
UnsupportedVersion
Truncated
InvalidFlags
InvalidPayloadLength
InvalidHex
} derive(Debug)pub suberror FramePipelineError {
FramePipelineInvalidPayload
FramePipelineRuleExists
FramePipelineRuleMissing
FramePipelineCapacity
}pub suberror GatewayPolicyError {
GatewayPolicyInvalidPayload
GatewayPolicyDuplicateRule
GatewayPolicyRuleNotFound
GatewayPolicyInvalidInterval
}pub suberror IsoTpError {
InvalidFrameSize
PayloadTooLarge
TruncatedPacket
InvalidFirstFrame
UnexpectedConsecutive
SequenceMismatch
LengthMismatch
UnsupportedFlowStatus
} derive(Debug)pub suberror J1939Error {
InvalidPriority
InvalidPgn
InvalidAddress
InvalidPayloadLength
InvalidSequence
TransferTooLarge
} derive(Debug)pub suberror NetworkError {
InvalidNodeId
DuplicateNode
UnknownNode
InvalidTimestamp
QueueFull
} derive(Debug)pub suberror SchedulerError {
InvalidPeriod
InvalidDeadline
DuplicateTask
UnknownTask
} derive(Debug)pub suberror TraceError {
NonMonotonicTimestamp
InvalidLine
InvalidTimestamp
InvalidFrame
} derive(Debug)pub suberror UdsError {
InvalidIdentifier
InvalidAddressFormat
EmptyPayload
InvalidBlockCounter
InvalidLength
} derive(Debug)pub suberror UdsSessionError {
InvalidTransition
SecurityRequired
ResponseTimeout
UnexpectedResponse
} derive(Debug)pub suberror WireCodecError {
InvalidEof
InvalidCrc
InvalidControl
InvalidDlc
InvalidFrameBits
} derive(Debug)pub suberror WireError {
InvalidStuffedBit
}pub struct AdmissionDecision {
accepted : Bool
rule_name : String
reason : String
}pub struct AdmissionPolicy {
rules : Array[AdmissionRule]
accepted_count : Int
rejected_count : Int
last_timestamp_us : UInt64?
}fn AdmissionPolicy::evaluate(self : AdmissionPolicy, frame : Frame, timestamp_us : UInt64) -> AdmissionDecision raise AdmissionErrorpub struct AdmissionRule {
name : String
filter : Filter
max_payload : Int
allow_fd : Bool
allow_remote : Bool
min_interval_us : UInt64
last_seen_us : UInt64?
}pub enum BusAnalysisAnomaly {
BusAnomalyBurst(UInt, Int)
BusAnomalyJitter(UInt, UInt64)
BusAnomalyPayloadGrowth(UInt, Int, Int)
BusAnomalyIdentifierChange(UInt)
BusAnomalyTimestampRegression(UInt64)
BusAnomalySequenceGap(UInt, UInt)
BusAnomalyOverload(Double)
}pub enum BusAnalysisMode {
BusAnalysisLive
BusAnalysisOffline
BusAnalysisReplay
BusAnalysisCompliance
}pub struct BusAnalysisReport {
mode : BusAnalysisMode
channel : String
start_us : UInt64?
end_us : UInt64?
total_frames : Int
payload_bytes : Int
wire_bits : Int
profiles : Array[BusIdentifierProfile]
anomalies : Array[BusAnalysisAnomaly]
utilization : Double
}pub struct BusAnalyzer {
mode : BusAnalysisMode
channel : String
bitrate_kbps : UInt
burst_window_us : UInt64
jitter_limit_us : UInt64
observations : Array[BusObservation]
last_timestamp_us : UInt64?
last_sequence : UInt?
}pub struct BusHealth {
state : BusHealthState
utilization : Double
drop_rate : Double
error_rate : Double
recommendations : Array[String]
}pub struct BusIdentifierProfile {
identifier : UInt
frames : Int
first_seen_us : UInt64
last_seen_us : UInt64
min_payload : Int
max_payload : Int
wire_bits : Int
extended : Bool
intervals : Array[UInt64]
}pub(all) enum ByteOrder {
BigEndian
LittleEndian
}pub struct CanAdapterCapabilities {
classic : Bool
can_fd : Bool
bitrate_switch : Bool
listen_only : Bool
loopback : Bool
timestamping : Bool
max_rx_queue : Int
max_tx_queue : Int
}pub struct CanAdapterConfig {
nominal_bitrate_kbps : UInt
data_bitrate_kbps : UInt
listen_only : Bool
loopback : Bool
receive_own : Bool
filter : Filter?
}fn CanAdapterHub::broadcast(self : CanAdapterHub, source : String, timestamp_us : UInt64, frame : Frame) -> Intpub enum CanAdapterLifecycle {
CanAdapterCreated
CanAdapterConfigured
CanAdapterOpen
CanAdapterBusOff
CanAdapterClosed
}pub struct CanAdapterMessage {
timestamp_us : UInt64
frame : Frame
direction_tx : Bool
sequence : UInt
}pub struct CanAdapterStats {
transmitted : Int
received : Int
dropped_rx : Int
rejected_tx : Int
bus_off : Int
error_frames : Int
bytes_tx : Int
bytes_rx : Int
}pub struct CanBitTiming {
clock_hz : UInt
bitrate : UInt
prescaler : UInt
time_quanta : UInt
propagation_segment : UInt
phase_segment_1 : UInt
phase_segment_2 : UInt
sample_point_percent : Double
}pub struct CanNetwork {
timeout_us : UInt64
now_us : UInt64
nodes : Array[NetworkNode]
queue : FrameQueue
delivered : Int
}fn CanNetwork::add_node(self : CanNetwork, node_id : Byte, name : String, timestamp_us : UInt64) -> Unit raise NetworkErrorfn CanNetwork::heartbeat(self : CanNetwork, node_id : Byte, timestamp_us : UInt64) -> Unit raise NetworkErrorfn CanNetwork::offline_nodes(self : CanNetwork, timestamp_us : UInt64) -> Array[String] raise NetworkErrorfn CanNetwork::poll(self : CanNetwork, timestamp_us : UInt64) -> Array[NetworkDelivery] raise NetworkErrorfn CanNetwork::send(self : CanNetwork, sender : Byte, frame : Frame, timestamp_us : UInt64) -> UInt raise NetworkErrorpub(all) enum CanOpenCobType {
Nmt
Sync
Emergency
Pdo1Transmit
Pdo1Receive
Pdo2Transmit
Pdo2Receive
Pdo3Transmit
Pdo3Receive
Pdo4Transmit
Pdo4Receive
SdoTransmit
SdoReceive
Heartbeat
} derive(Debug)pub struct CanOpenDevice {
node_id : Byte
name : String
state : CanOpenDeviceState
dictionary : CanOpenObjectDictionary
heartbeat : CanOpenHeartbeatMonitor
nmt_commands : Int
sdo_uploads : Int
sdo_downloads : Int
}fn CanOpenDevice::heartbeat_receive(self : CanOpenDevice, state_byte : Byte, timestamp_us : UInt64) -> Unitfn CanOpenDevice::heartbeat_tick(self : CanOpenDevice, timestamp_us : UInt64) -> CanOpenHeartbeatStatefn CanOpenDevice::sdo_download(self : CanOpenDevice, index : UInt, sub_index : Byte, data : Array[Byte]) -> CanOpenDeviceSdoResultfn CanOpenDevice::sdo_upload(self : CanOpenDevice, index : UInt, sub_index : Byte) -> CanOpenDeviceSdoResultpub struct CanOpenDeviceNetwork {
devices : Array[CanOpenDevice]
commands : Int
unknown_nodes : Int
}fn CanOpenDeviceNetwork::broadcast_nmt(self : CanOpenDeviceNetwork, command : CanOpenNmtCommand) -> Intfn CanOpenDeviceNetwork::sdo_upload(self : CanOpenDeviceNetwork, node_id : Byte, index : UInt, sub_index : Byte) -> CanOpenDeviceSdoResultpub enum CanOpenDeviceSdoResult {
CanOpenDeviceSdoUploaded(Array[Byte])
CanOpenDeviceSdoDownloaded
CanOpenDeviceSdoAbort(UInt)
}pub struct CanOpenDeviceSdoSession {
index : UInt
sub_index : Byte
upload : Bool
data : Array[Byte]
offset : Int
toggle : Bool
block_size : Int
}pub enum CanOpenDeviceState {
CanOpenDeviceInitializing
CanOpenDevicePreOperational
CanOpenDeviceOperational
CanOpenDeviceStopped
CanOpenDeviceResetting
}pub struct CanOpenHeartbeatMonitor {
node_id : Byte
timeout_us : UInt64
state : CanOpenHeartbeatState
last_seen_us : UInt64
heartbeats : Int
transitions : Int
}fn CanOpenHeartbeatMonitor::observe(self : CanOpenHeartbeatMonitor, state_byte : Byte, timestamp_us : UInt64) -> Unitfn CanOpenHeartbeatMonitor::poll(self : CanOpenHeartbeatMonitor, timestamp_us : UInt64) -> CanOpenHeartbeatStatepub enum CanOpenHeartbeatState {
CanOpenHeartbeatUnknown
CanOpenHeartbeatAlive
CanOpenHeartbeatTimeout
CanOpenHeartbeatStopped
}pub(all) enum CanOpenNmtCommand {
Start
Stop
EnterPreOperational
ResetNode
ResetCommunication
}pub enum CanOpenObjectAccess {
CanOpenObjectReadOnly
CanOpenObjectWriteOnly
CanOpenObjectReadWrite
CanOpenObjectConstant
}pub struct CanOpenObjectDictionary {
entries : Array[CanOpenObjectEntry]
revision : UInt
capacity : Int
}fn CanOpenObjectDictionary::find(self : CanOpenObjectDictionary, index : UInt, sub_index : Byte) -> CanOpenObjectEntry?fn CanOpenObjectDictionary::read(self : CanOpenObjectDictionary, index : UInt, sub_index : Byte) -> Array[Byte]?fn CanOpenObjectDictionary::replace(self : CanOpenObjectDictionary, entry : CanOpenObjectEntry) -> Boolfn CanOpenObjectDictionary::write(self : CanOpenObjectDictionary, index : UInt, sub_index : Byte, data : Array[Byte]) -> Boolpub struct CanOpenObjectEntry {
index : UInt
sub_index : Byte
name : String
access : CanOpenObjectAccess
data : Array[Byte]
max_length : Int
revision : UInt
}pub enum CanOpenSdoCommand {
DownloadInitiate(index~ : UInt, sub_index~ : Byte, data~ : Array[Byte])
UploadInitiate(index~ : UInt, sub_index~ : Byte)
DownloadSegment(toggle~ : Bool, data~ : Array[Byte], last~ : Bool)
UploadSegment(toggle~ : Bool)
Abort(index~ : UInt, sub_index~ : Byte, code~ : UInt)
}pub struct CanPort {
name : String
capabilities : CanAdapterCapabilities
config : CanAdapterConfig
lifecycle : CanAdapterLifecycle
rx_queue : Array[CanAdapterMessage]
tx_queue : Array[CanAdapterMessage]
sequence : UInt
stats : CanAdapterStats
}fn CanPort::transmit(self : CanPort, timestamp_us : UInt64, frame : Frame) -> Unit raise CanAdapterErrorfn CanScheduler::add(self : CanScheduler, name : String, frame : Frame, first_due_us : UInt64, period_us : UInt64, deadline_us : UInt64, count : Int) -> Unit raise SchedulerErrorfn CanScheduler::tick(self : CanScheduler, timestamp_us : UInt64) -> Array[SchedulerTick] raise SchedulerErrorpub struct CanTask {
name : String
frame : Frame
next_due_us : UInt64
period_us : UInt64
deadline_us : UInt64
remaining : Int
priority : Int
}pub struct CompatibilityCandidate {
target : CompatibilityTarget
evaluation : CompatibilityEvaluation
rank : Int
}pub struct CompatibilityDelta {
source : String
destination : String
bitrate_loss : Int
data_bitrate_loss : Int
payload_loss : Int
identifier_loss : Int
node_capacity_loss : Int
lost_features : Array[String]
}pub struct CompatibilityEvaluation {
target : CompatibilityTarget
issues : Array[CompatibilityIssue]
passed : Int
warnings : Int
failures : Int
score : Int
}pub struct CompatibilityFleetSummary {
target_count : Int
compatible_count : Int
warning_count : Int
failure_count : Int
average_score : Int
lowest_score : Int
highest_score : Int
}pub struct CompatibilityIssue {
target : String
code : String
severity : CompatibilitySeverity
passed : Bool
message : String
observed : String
expected : String
}pub struct CompatibilityMatrix {
name : String
strict : Bool
targets : Array[CompatibilityTarget]
requirements : Array[CompatibilityRequirement]
}fn CompatibilityMatrix::add_requirement(self : CompatibilityMatrix, requirement : CompatibilityRequirement) -> Unitfn CompatibilityMatrix::add_target(self : CompatibilityMatrix, target : CompatibilityTarget) -> Unitfn CompatibilityMatrix::compatible_targets(self : CompatibilityMatrix) -> Array[CompatibilityTarget]fn CompatibilityMatrix::evaluate(self : CompatibilityMatrix, target : CompatibilityTarget) -> CompatibilityEvaluationfn CompatibilityMatrix::ranked_candidates(self : CompatibilityMatrix) -> Array[CompatibilityCandidate]fn CompatibilityMatrix::requirements_by_severity(self : CompatibilityMatrix, severity : CompatibilitySeverity) -> Array[CompatibilityRequirement]pub(all) enum CompatibilityProtocol {
CompatibilityClassicCan
CompatibilityCanFd
CompatibilityIsoTp
CompatibilityUds
CompatibilityCanOpen
CompatibilityJ1939
CompatibilityGateway
CompatibilityCustom
}pub struct CompatibilityReleaseGate {
name : String
matrices : Array[CompatibilityMatrix]
minimum_score : Int
require_all_targets : Bool
}fn CompatibilityReleaseGate::add_matrix(self : CompatibilityReleaseGate, matrix : CompatibilityMatrix) -> Unitpub struct CompatibilityRequirement {
code : String
description : String
kind : CompatibilityRequirementKind
numeric_value : Int
protocol_value : CompatibilityProtocol?
feature_value : String?
severity : CompatibilitySeverity
}fn CompatibilityRequirement::protocol_value(self : CompatibilityRequirement) -> CompatibilityProtocol?pub(all) enum CompatibilityRequirementKind {
CompatibilityMinimumBitrate
CompatibilityMinimumDataBitrate
CompatibilityMinimumPayload
CompatibilityMinimumIdentifierBits
CompatibilityMinimumNodeCapacity
CompatibilityProtocolIs
CompatibilityRequiresFeature
CompatibilityForbidsFeature
CompatibilityRequiresFd
CompatibilityRequiresClassic
CompatibilityRequiresIsoTp
CompatibilityRequiresDiagnostics
}pub struct CompatibilityRoute {
source : CompatibilityTarget
destination : CompatibilityTarget
transport : CompatibilityProtocol
max_payload : Int
uses_segmentation : Bool
valid : Bool
reason : String
}fn CompatibilityRouteTable::invalid_routes(self : CompatibilityRouteTable) -> Array[CompatibilityRoute]fn CompatibilityRouteTable::valid_routes(self : CompatibilityRouteTable) -> Array[CompatibilityRoute]pub(all) enum CompatibilitySeverity {
CompatibilityInfo
CompatibilityWarning
CompatibilityError
}pub struct CompatibilityTarget {
name : String
protocol : CompatibilityProtocol
nominal_bitrate : Int
data_bitrate : Int
max_payload : Int
identifier_bits : Int
node_capacity : Int
features : Array[String]
notes : String
}pub struct DbcCodegenOptions {
target : DbcCodegenTarget
module_name : String
include_comments : Bool
include_validation : Bool
line_ending : String
}pub enum DbcCodegenTarget {
DbcCodegenMoonBit
DbcCodegenCHeader
DbcCodegenJsonSchema
DbcCodegenMarkdown
}fn DbcDatabase::decode_frame(self : DbcDatabase, frame : Frame) -> DecodedMessage? raise DbcRuntimeErrorpub struct DbcGeneratedArtifact {
path : String
target : DbcCodegenTarget
content : String
line_count : Int
message_count : Int
signal_count : Int
warnings : Array[String]
}pub struct DbcSchemaChange {
id : UInt
kind : String
before : String?
after : String?
}pub struct DbcSchemaReport {
message_count : Int
signal_count : Int
unique_identifier_count : Int
maximum_required_bytes : Int
}pub struct DbcWorkspace {
messages : Array[Message]
groups : Array[DbcWorkspaceSignalGroup]
bindings : Array[DbcWorkspaceBinding]
revision : UInt
encoded_frames : Int
decoded_frames : Int
}fn DbcWorkspace::decode(self : DbcWorkspace, frame : Frame) -> DecodedMessage? raise DbcRuntimeErrorfn DbcWorkspace::encode(self : DbcWorkspace, name : String, values : DbcWorkspaceValueSet) -> Frame raise DbcRuntimeErrorpub struct DbcWorkspaceBinding {
name : String
message : Message
selector : DbcWorkspaceMuxSelector
extended : Bool
default_values : DbcWorkspaceValueSet
encoded : Int
decoded : Int
}fn DbcWorkspaceBinding::decode(self : DbcWorkspaceBinding, frame : Frame) -> DecodedMessage raise DbcRuntimeErrorfn DbcWorkspaceBinding::encode(self : DbcWorkspaceBinding, values : DbcWorkspaceValueSet) -> Frame raise DbcRuntimeErrorfn DbcWorkspaceBinding::set_default(self : DbcWorkspaceBinding, values : DbcWorkspaceValueSet) -> Unitpub enum DbcWorkspaceIssue {
DbcWorkspaceDuplicateId(UInt)
DbcWorkspaceDuplicateName(String)
DbcWorkspaceInvalidMessage(String)
DbcWorkspaceMissingBinding(UInt)
DbcWorkspaceEmptyGroup(String)
DbcWorkspaceMuxConflict(String)
}pub enum DbcWorkspaceMuxSelector {
DbcWorkspaceMuxNone
DbcWorkspaceMuxValue(UInt)
DbcWorkspaceMuxRange(UInt, UInt)
}pub struct DbcWorkspaceValue {
name : String
value : Double
}fn DbcWorkspaceValueSet::put_number(self : DbcWorkspaceValueSet, name : String, value : Double) -> Unitpub struct DecodedSignal {
name : String
raw : UInt
physical : Double
unit : String
}pub enum DiagnosticAddressingMode {
NormalAddressing
ExtendedAddressing
MixedAddressing(Byte)
}pub struct DiagnosticDataIdentifier {
identifier : UInt
name : String
length : Int
readable : Bool
writable : Bool
value : Array[Byte]
}fn DiagnosticDataIdentifier::set_value(self : DiagnosticDataIdentifier, value : Array[Byte]) -> Boolfn DiagnosticDataTable::find(self : DiagnosticDataTable, identifier : UInt) -> DiagnosticDataIdentifier?fn DiagnosticDataTable::replace(self : DiagnosticDataTable, entry : DiagnosticDataIdentifier) -> Boolfn DiagnosticDataTable::write(self : DiagnosticDataTable, identifier : UInt, value : Array[Byte]) -> Boolpub struct DiagnosticEvent {
timestamp_us : UInt64
request : DiagnosticRequest
response : Array[Byte]
positive : Bool
duration_us : UInt64
}pub struct DiagnosticExchangeLog {
events : Array[DiagnosticEvent]
positive_count : Int
negative_count : Int
}pub struct DiagnosticReadiness {
session_ok : Bool
security_ok : Bool
voltage_ok : Bool
temperature_ok : Bool
dtc_ok : Bool
reasons : Array[String]
}pub struct DiagnosticRetryPolicy {
max_attempts : Int
backoff_us : UInt64
retry_negative : Bool
attempts : Int
}pub enum DiagnosticSessionKind {
DefaultSession
ProgrammingSession
ExtendedSession
SafetySystemSession
SupplierSession(Byte)
}pub struct DiagnosticSessionProfile {
kind : DiagnosticSessionKind
p2_server_us : UInt64
p2_star_server_us : UInt64
s3_server_us : UInt64
addressing : DiagnosticAddressingMode
security_level : Byte
}fn DiagnosticSessionProfile::addressing(self : DiagnosticSessionProfile) -> DiagnosticAddressingModefn DiagnosticTroubleCode::observe(self : DiagnosticTroubleCode, status : Byte, timestamp_us : UInt64) -> Unitfn DiagnosticTroubleCode::set_extended_data(self : DiagnosticTroubleCode, data : Array[Byte]) -> Unitpub struct DiagnosticTroubleCodeStore {
capacity : Int
records : Array[DiagnosticTroubleCode]
generation : UInt
cleared_at_us : UInt64
}fn DiagnosticTroubleCodeStore::clear(self : DiagnosticTroubleCodeStore, timestamp_us : UInt64) -> Unitfn DiagnosticTroubleCodeStore::encode_report(self : DiagnosticTroubleCodeStore, selector : DtcQuery, limit? : Int) -> Array[Byte]fn DiagnosticTroubleCodeStore::find(self : DiagnosticTroubleCodeStore, code : UInt) -> DiagnosticTroubleCode?fn DiagnosticTroubleCodeStore::query(self : DiagnosticTroubleCodeStore, selector : DtcQuery) -> Array[DiagnosticTroubleCode]fn DiagnosticTroubleCodeStore::record(self : DiagnosticTroubleCodeStore, item : DiagnosticTroubleCode) -> Unitfn DiagnosticTroubleCodeStore::records(self : DiagnosticTroubleCodeStore) -> Array[DiagnosticTroubleCode]pub struct DiagnosticWorkflow {
steps : Array[DiagnosticWorkflowStep]
results : Array[DiagnosticWorkflowResult]
cursor : Int
state : DiagnosticWorkflowState
started_us : UInt64
last_timestamp_us : UInt64
failures : Int
}fn DiagnosticWorkflow::accept_current(self : DiagnosticWorkflow, payload : Array[Byte], timestamp_us : UInt64) -> Boolpub struct DiagnosticWorkflowResult {
step_name : String
service : String
positive : Bool
attempts : Int
duration_us : UInt64
response : DiagnosticResponse
}pub enum DiagnosticWorkflowState {
DiagnosticWorkflowIdle
DiagnosticWorkflowRunning
DiagnosticWorkflowWaiting
DiagnosticWorkflowSucceeded
DiagnosticWorkflowFailed
DiagnosticWorkflowCancelled
}pub struct DiagnosticWorkflowStep {
name : String
request : DiagnosticRequest
timeout_us : UInt64
retry : DiagnosticRetryPolicy
sent_at_us : UInt64?
completed : Bool
result : DiagnosticResponse?
}pub enum DtcQuery {
AllDtc
ByCode(UInt)
ByStatusMask(Byte)
BySeverityAtLeast(Byte)
ConfirmedOnly
WarningOnly
SeenAfter(UInt64)
}pub enum DtcStatusBit {
TestFailed
TestFailedThisOperationCycle
PendingDtc
ConfirmedDtc
TestNotCompletedSinceClear
TestFailedSinceClear
TestNotCompletedThisOperationCycle
WarningIndicatorRequested
}pub struct EcuEndpoint {
address : UInt
name : String
session : DiagnosticSessionProfile
data : DiagnosticDataTable
dtcs : DiagnosticTroubleCodeStore
memory : EcuMemoryMap
security : EcuSecurityPolicy
reset_count : Int
request_count : Int
positive_count : Int
negative_count : Int
last_timestamp_us : UInt64
pending_reset : EcuResetKind?
}fn EcuEndpoint::handle(self : EcuEndpoint, request : DiagnosticRequest, timestamp_us : UInt64) -> EcuRequestOutcomefn EcuFleet::handle(self : EcuFleet, address : UInt, request : DiagnosticRequest, timestamp_us : UInt64) -> EcuRequestOutcomefn EcuMemoryMap::read(self : EcuMemoryMap, address : UInt, length : Int) -> Array[Byte] raise EcuMemoryErrorfn EcuMemoryMap::write(self : EcuMemoryMap, address : UInt, data : Array[Byte]) -> Unit raise EcuMemoryErrorpub enum EcuMemoryPermission {
EcuMemoryReadable
EcuMemoryWritable
EcuMemoryReadWrite
EcuMemoryLocked
}pub struct EcuMemoryRegion {
start : UInt
length : Int
permission : EcuMemoryPermission
bytes : Array[Byte]
}fn EcuMemoryRegion::read(self : EcuMemoryRegion, address : UInt, length : Int) -> Array[Byte] raise EcuMemoryErrorfn EcuMemoryRegion::write(self : EcuMemoryRegion, address : UInt, data : Array[Byte]) -> Unit raise EcuMemoryErrorpub enum EcuRequestOutcome {
EcuPositiveResponse(Array[Byte])
EcuNegativeResponse(Byte)
EcuRequestRejected(String)
}pub enum EcuResetKind {
EcuHardReset
EcuKeyOffOnReset
EcuSoftReset
EcuResetBySupplier(Byte)
}pub struct EcuSecurityPolicy {
level : Byte
secret : UInt
max_attempts : Int
delay_us : UInt64
attempts : Int
state : EcuSecurityState
seed_counter : UInt
}fn EcuSecurityPolicy::unlock(self : EcuSecurityPolicy, key : UInt, seed : UInt, timestamp_us : UInt64) -> Boolpub enum EcuSecurityState {
EcuSecurityLocked
EcuSecuritySeedIssued(Byte)
EcuSecurityUnlocked(Byte)
EcuSecurityDelay(UInt64)
}pub struct Filter {
id : UInt
mask : UInt
extended : Bool?
}pub struct FrameAnalysis {
unique_ids : Int
changed_payloads : Int
repeated_payloads : Int
average_payload : Double
minimum_gap_us : UInt64?
maximum_gap_us : UInt64?
}pub enum FrameClass {
ClassicData
ClassicRemote
CanFdData
SimulationError
}fn FrameDeduplicator::accept(self : FrameDeduplicator, timestamp_us : UInt64, frame : Frame) -> Boolpub struct FramePipeline {
rules : Array[FramePipelineRule]
capacity : Int
processed : Int
accepted : Int
rejected : Int
unmatched : Int
failures : Int
}fn FramePipeline::add_rule(self : FramePipeline, rule : FramePipelineRule) -> Unit raise FramePipelineErrorpub struct FramePipelineRule {
name : String
filter : Filter
action : FramePipelineAction
max_payload : Int
allow_fd : Bool
enabled : Bool
hits : Int
}fn FramePipelineWindow::push(self : FramePipelineWindow, timestamp_us : UInt64, frame : Frame) -> Boolfn FrameQueue::enqueue(self : FrameQueue, channel : Byte, frame : Frame, enqueued_us : UInt64, deadline_us : UInt64) -> UInt raise QueueErrorfn FrameQueue::take_channel(self : FrameQueue, channel : Byte, limit : Int) -> Array[QueueItem] raise QueueErrorfn FrameRateLimiter::allow(self : FrameRateLimiter, identifier : UInt, timestamp_us : UInt64) -> Boolfn FrameRateLimiter::set_interval(self : FrameRateLimiter, identifier : UInt, interval_us : UInt64) -> Unitpub struct FrameReport {
valid : Bool
violations : Array[FrameViolation]
wire_bits : Int
stuffed_bits : Int
}pub enum FrameViolation {
IdentifierRange
ClassicPayloadRange
FdPayloadRange
RemoteCarriesData
FdControlOnClassic
InvalidErrorShape
NonCanonicalDlc
} derive(Debug)pub struct GatewayPolicyAudit {
timestamp_us : UInt64
rule_name : String
source_channel : String
destination_channel : String
decision : GatewayPolicyDecision
input_id : UInt
output_id : UInt?
}pub struct GatewayPolicyContext {
timestamp_us : UInt64
source_channel : String
destination_channel : String
frame : Frame
}pub enum GatewayPolicyDecision {
GatewayPolicyAllow
GatewayPolicyDeny(String)
GatewayPolicyRewrite(Frame)
GatewayPolicyRateLimited
}pub struct GatewayPolicyEngine {
rules : Array[GatewayPolicyRule]
audits : Array[GatewayPolicyAudit]
capacity : Int
evaluated : Int
allowed : Int
denied : Int
rewritten : Int
rate_limited : Int
}fn GatewayPolicyEngine::evaluate(self : GatewayPolicyEngine, context : GatewayPolicyContext) -> GatewayPolicyDecisionfn GatewayPolicyEngine::forward(self : GatewayPolicyEngine, context : GatewayPolicyContext) -> Frame?pub struct IsoTpChannel {
source_id : UInt
target_id : UInt
extended : Bool
addressing : IsoTpSessionAddressing
flow_control : IsoTpFlowControlConfig
}fn IsoTpChannel::frame(self : IsoTpChannel, payload : Array[Byte], transmit : Bool) -> Frame raise FrameErrorpub struct IsoTpConfig {
frame_bytes : Int
block_size : Byte
separation_time : Byte
}pub struct IsoTpFlowControlConfig {
block_size : Int
separation_time_us : UInt64
wait_frame_limit : Int
max_payload : Int
}pub struct IsoTpReceiver {
config : IsoTpConfig
total_length : Int
payload : Array[Byte]
next_sequence : Byte
block_count : Int
}fn IsoTpRouter::find_channel(self : IsoTpRouter, source_id : UInt, target_id : UInt) -> IsoTpChannel?pub struct IsoTpSession {
transmitter : IsoTpTransmitter?
receiver : IsoTpStreamReceiver
sent_frames : Int
received_frames : Int
dropped_frames : Int
}fn IsoTpSession::accept_flow_control(self : IsoTpSession, payload : Array[Byte], timestamp_us : UInt64) -> Boolfn IsoTpSession::receive(self : IsoTpSession, payload : Array[Byte], timestamp_us : UInt64) -> IsoTpReceiverResultfn IsoTpSession::start_transmit(self : IsoTpSession, payload : Array[Byte], timestamp_us : UInt64) -> Unitpub enum IsoTpSessionAddressing {
IsoTpNormalAddressing
IsoTpExtendedAddressing(Byte)
IsoTpMixedAddressing(Byte)
}pub struct IsoTpStreamReceiver {
expected_length : Int
received : Array[Byte]
next_sequence : Byte
block_received : Int
wait_frames : Int
last_timestamp_us : UInt64
active : Bool
complete : Bool
flow_control : IsoTpFlowControlConfig
timeout_us : UInt64
}fn IsoTpStreamReceiver::feed(self : IsoTpStreamReceiver, payload : Array[Byte], timestamp_us : UInt64) -> IsoTpReceiverResultpub struct IsoTpTransmitter {
payload : Array[Byte]
offset : Int
sequence : Byte
block_sent : Int
wait_frames : Int
state : IsoTpTransmitterState
flow_control : IsoTpFlowControlConfig
next_due_us : UInt64
started_us : UInt64
}fn IsoTpTransmitter::accept_flow_control(self : IsoTpTransmitter, payload : Array[Byte], timestamp_us : UInt64) -> Boolpub enum IsoTpTransmitterState {
IsoTpTxIdle
IsoTpTxWaitingFlowControl
IsoTpTxSending
IsoTpTxComplete
IsoTpTxAborted(String)
}pub struct J1939AddressClaim {
source_address : Byte
name : UInt64
manufacturer : UInt
function : Byte
instance : Byte
last_seen_us : UInt64
preferred : Bool
}pub struct J1939AddressManager {
claims : Array[J1939AddressClaim]
conflicts : Int
changes : Int
timeout_us : UInt64
}fn J1939AddressManager::find(self : J1939AddressManager, source_address : Byte) -> J1939AddressClaim?fn J1939AddressManager::refresh(self : J1939AddressManager, source_address : Byte, timestamp_us : UInt64) -> Boolpub struct J1939Id {
priority : Byte
data_page : Bool
pdu_format : Byte
pdu_specific : Byte
source_address : Byte
}pub struct J1939SpnDefinition {
spn : UInt
name : String
start_bit : Int
length : Int
factor : Double
offset : Double
minimum : Double
maximum : Double
unit : String
}fn J1939SpnDefinition::encode(self : J1939SpnDefinition, data : Array[Byte], value : Double) -> Array[Byte]pub enum J1939TransportDirection {
J1939TransportTransmit
J1939TransportReceive
}pub struct J1939TransportSession {
pgn : UInt
direction : J1939TransportDirection
total_length : Int
packet_count : Int
payload : Array[Byte]
next_sequence : Int
state : J1939TransportState
last_timestamp_us : UInt64
timeout_us : UInt64
retries : Int
}fn J1939TransportSession::accept_announcement(self : J1939TransportSession, announcement : Array[Byte], timestamp_us : UInt64) -> Boolfn J1939TransportSession::accept_packet(self : J1939TransportSession, packet : Array[Byte], timestamp_us : UInt64) -> Boolfn J1939TransportSession::start_transmit(self : J1939TransportSession, payload : Array[Byte], timestamp_us : UInt64) -> Array[Array[Byte]] raise J1939Errorpub enum J1939TransportState {
J1939TransportIdle
J1939TransportAnnounced
J1939TransportTransferring
J1939TransportComplete
J1939TransportTimedOut
J1939TransportAborted
}pub struct LatencySample {
sequence : UInt
created_us : UInt64
completed_us : UInt64
payload_bytes : Int
}pub struct LatencyStats {
count : Int
minimum_us : UInt64?
maximum_us : UInt64?
average_us : Double
p95_us : UInt64?
jitter_us : UInt64
payload_bytes : Int
}pub struct LatencyWindow {
capacity : Int
next_sequence : UInt
samples : Array[LatencySample]
last_completed_us : UInt64?
}fn LatencyWindow::record(self : LatencyWindow, created_us : UInt64, completed_us : UInt64, payload_bytes : Int) -> UInt raise LatencyErrorfn Message::encode_frame(self : Message, values : Map[String, Double], extended? : Bool) -> Frame raise DbcRuntimeErrorpub struct NetworkErrorBudget {
max_error_rate : Double
max_drop_rate : Double
max_offline_nodes : Int
total_frames : Int
error_frames : Int
dropped_frames : Int
offline_nodes : Int
}fn NetworkErrorBudget::record_frame(self : NetworkErrorBudget, error : Bool, dropped : Bool) -> Unitpub struct NetworkHealthReport {
timestamp_us : UInt64
nodes : Array[NetworkNodeHealth]
online : Int
degraded : Int
offline : Int
budget : NetworkErrorBudget
}pub struct NetworkHealthTracker {
nodes : Array[NetworkNodeHealth]
budget : NetworkErrorBudget
samples : Int
last_timestamp_us : UInt64
}fn NetworkHealthTracker::observe_frame(self : NetworkHealthTracker, node_id : Byte, timestamp_us : UInt64, frame : Frame, transmit : Bool) -> Boolfn NetworkHealthTracker::observe_heartbeat(self : NetworkHealthTracker, node_id : Byte, timestamp_us : UInt64, latency_us? : UInt64) -> Boolfn NetworkHealthTracker::poll(self : NetworkHealthTracker, timestamp_us : UInt64) -> NetworkHealthReportpub struct NetworkNode {
node_id : Byte
name : String
last_seen_us : UInt64
online : Bool
transmitted : Int
received : Int
}pub struct NetworkNodeHealth {
node_id : Byte
name : String
state : NetworkNodeHealthState
last_seen_us : UInt64
timeout_us : UInt64
received : Int
transmitted : Int
errors : Int
missed_heartbeats : Int
latency_samples : Array[UInt64]
}fn NetworkNodeHealth::observe_frame(self : NetworkNodeHealth, timestamp_us : UInt64, transmit : Bool) -> Unitfn NetworkNodeHealth::observe_heartbeat(self : NetworkNodeHealth, timestamp_us : UInt64, latency_us? : UInt64) -> Unitfn NetworkNodeHealth::poll(self : NetworkNodeHealth, timestamp_us : UInt64) -> NetworkNodeHealthStatepub enum NetworkNodeHealthState {
NetworkNodeUnknown
NetworkNodeHealthy
NetworkNodeDegraded
NetworkNodeOffline
NetworkNodeMaintenance
}fn NodeRegistry::record_transmission(self : NodeRegistry, node_id : Byte) -> Unit raise NodeRegistryErrorfn NodeRegistry::register(self : NodeRegistry, node_id : Byte, name : String, filter : Filter) -> Unit raise NodeRegistryErrorpub struct PayloadCodec {
options : PayloadCodecOptions
encoded : Int
decoded : Int
failures : Int
next_counter : Byte
}fn PayloadCodec::decode(self : PayloadCodec, data : Array[Byte], expected_counter : Byte?) -> PayloadCodecResultpub struct PayloadCodecOptions {
profile : PayloadCodecProfile
counter_offset : Int
counter_high_nibble : Bool
crc_offset : Int
checksum_offset : Int
expected_length : Int
counter_modulus : Int
}pub(all) enum PayloadCodecProfile {
PayloadCodecPlain
PayloadCodecCounterCrc
PayloadCodecCounterChecksum
PayloadCodecAliveAndCrc
}pub struct PayloadCodecResult {
status : PayloadCodecStatus
data : Array[Byte]
counter : Byte?
expected_counter : Byte?
checksum : Byte?
}pub(all) enum PayloadCodecStatus {
PayloadCodecAccepted
PayloadCodecBadLength
PayloadCodecBadCounter
PayloadCodecBadCrc
PayloadCodecBadChecksum
}pub struct PdoMapEntry {
index : UInt
sub_index : Byte
bit_offset : Int
bit_length : Int
}fn PdoMapping::add(self : PdoMapping, index : UInt, sub_index : Byte, bit_length : Int) -> Unit raise PdoErrorpub struct PdoValue {
index : UInt
sub_index : Byte
value : UInt
}pub struct Pgn {
number : UInt
name : String
data_length : Int
}pub struct QueueItem {
sequence : UInt
channel : Byte
frame : Frame
enqueued_us : UInt64
deadline_us : UInt64
}pub struct Signal {
name : String
start_bit : Int
size : Int
little_endian : Bool
signed : Bool
factor : Double
offset : Double
minimum : Double
maximum : Double
unit : String
}pub struct Simulation {
now_us : UInt64
bus : VirtualBus
events : Array[ScheduledFrame]
publishers : Array[PeriodicPublisher]
trace : Trace
scheduled : Int
delivered : Int
dropped : Int
arbitration_bits : UInt64
bitrate_kbps : UInt
}fn Simulation::add_periodic(self : Simulation, source : String, frame : Frame, first_timestamp_us : UInt64, period_us : UInt64, count : Int) -> Unit raise SimulationErrorfn Simulation::schedule(self : Simulation, timestamp_us : UInt64, frame : Frame, source? : String) -> Unit raise SimulationErrorpub struct SimulationReport {
start_us : UInt64
end_us : UInt64
scheduled : Int
delivered : Int
dropped : Int
arbitration_bits : UInt64
}pub struct SimulationScenario {
name : String
capacity : Int
bitrate_kbps : UInt
events : Array[SimulationScenarioEvent]
assertions : Array[SimulationScenarioAssertion]
state : SimulationScenarioState
}fn SimulationScenario::add_assertion(self : SimulationScenario, assertion : SimulationScenarioAssertion) -> Unitfn SimulationScenario::run(self : SimulationScenario) -> SimulationScenarioResult raise SimulationErrorfn SimulationScenario::schedule(self : SimulationScenario, timestamp_us : UInt64, frame : Frame, source? : String) -> Boolfn SimulationScenario::schedule_periodic(self : SimulationScenario, first_timestamp_us : UInt64, period_us : UInt64, count : Int, frame : Frame, source? : String) -> Boolpub enum SimulationScenarioAssertion {
SimulationAssertDeliveredAtLeast(Int)
SimulationAssertDroppedAtMost(Int)
SimulationAssertDurationAtMost(UInt64)
SimulationAssertIdentifierSeen(UInt)
SimulationAssertHealth(BusHealthState)
}pub struct SimulationScenarioResult {
name : String
state : SimulationScenarioState
report : SimulationReport
assertions : Array[SimulationScenarioAssertion]
failures : Array[String]
}fn SimulationScenarioResult::assertions(self : SimulationScenarioResult) -> Array[SimulationScenarioAssertion]pub enum SimulationScenarioState {
SimulationScenarioDraft
SimulationScenarioReady
SimulationScenarioRunning
SimulationScenarioPassed
SimulationScenarioFailed
}pub struct TraceDiff {
ordinal : Int
kind : TraceDiffKind
left : TraceQueryMatch?
right : TraceQueryMatch?
}pub enum TraceDiffKind {
TraceDiffMissingLeft
TraceDiffMissingRight
TraceDiffIdentifier
TraceDiffPayload
TraceDiffTimestamp
}pub enum TraceExportFormat {
TraceExportCanText
TraceExportCsv
TraceExportSummary
TraceExportReplayScript
}pub struct TraceExportOptions {
format : TraceExportFormat
include_channel : Bool
include_sequence : Bool
include_header : Bool
normalize_timestamps : Bool
max_rows : Int
}pub struct TraceExporter {
options : TraceExportOptions
records : Array[TraceExportRecord]
rows : Int
bytes : Int
errors : Int
}pub struct TraceQueryBucket {
start_us : UInt64
end_us : UInt64
frames : Int
payload_bytes : Int
wire_bits : Int
}pub enum TraceQueryPredicate {
TraceQueryAny
TraceQueryIdentifier(UInt)
TraceQueryExtended(Bool)
TraceQueryProtocol(Protocol)
TraceQueryFrameClass(FrameClass)
TraceQueryPayloadLength(Int)
TraceQueryPayloadAtLeast(Int)
TraceQueryPayloadByte(Int, Byte)
TraceQueryIdentifierRange(UInt, UInt)
}pub struct TraceQuerySpec {
start_us : UInt64?
end_us : UInt64?
predicates : Array[TraceQueryPredicate]
inspected : Int
matched : Int
}pub struct TraceReplayPlan {
events : Array[TraceReplayEvent]
scale_num : UInt64
scale_den : UInt64
cursor : Int
}pub struct UdsResponseInfo {
positive : Bool
response_service : Byte
payload : Array[Byte]
negative_code : Byte?
}pub enum UdsService {
DiagnosticSessionControl
EcuReset
ReadDataByIdentifier
WriteDataByIdentifier
ReadMemoryByAddress
WriteMemoryByAddress
RoutineControl
SecurityAccess
CommunicationControl
ClearDiagnosticInformation
ReadDtcInformation
RequestDownload
TransferData
RequestTransferExit
TesterPresent
}pub struct UdsSession {
state : UdsSessionState
unlocked : Bool
last_activity_us : UInt64
p2_timeout_us : UInt64
pending_service : UdsService?
}fn UdsSession::accept(self : UdsSession, request : DiagnosticRequest, payload : Array[Byte], timestamp_us : UInt64) -> UdsResponseInfo raise UdsSessionErrorfn UdsSession::begin(self : UdsSession, request : DiagnosticRequest, timestamp_us : UInt64) -> DiagnosticRequest raise UdsSessionErrorfn UdsSession::change_state(self : UdsSession, target : UdsSessionState) -> Unit raise UdsSessionErrorpub enum UdsSessionState {
DefaultSession
ProgrammingSession
ExtendedDiagnosticSession
SafetySystemDiagnosticSession
LockedSession
} derive(Debug)fn admission_rule(name : String, filter : Filter, max_payload? : Int, allow_fd? : Bool, allow_remote? : Bool, min_interval_us? : UInt64) -> AdmissionRule raise AdmissionErrorfn assess_bus_health(metrics : FrameMetrics, dropped : Int, duration_us : UInt64, bitrate_kbps : UInt) -> BusHealthfn bus_analysis_trace(trace : Trace, channel : String, mode? : BusAnalysisMode, bitrate_kbps? : UInt) -> BusAnalysisReportfn bus_observation(timestamp_us : UInt64, frame : Frame, channel? : String, sequence? : UInt) -> BusObservationfn calculate_bit_timing(clock_hz : UInt, bitrate : UInt, sample_point_percent : Double) -> CanBitTiming raise CanTimingErrorfn can_adapter_capabilities(classic? : Bool, can_fd? : Bool, bitrate_switch? : Bool, listen_only? : Bool, loopback? : Bool, timestamping? : Bool, max_rx_queue? : Int, max_tx_queue? : Int) -> CanAdapterCapabilitiesfn can_adapter_config(nominal_bitrate_kbps? : UInt, data_bitrate_kbps? : UInt, listen_only? : Bool, loopback? : Bool, receive_own? : Bool, filter? : Filter?) -> CanAdapterConfigfn can_adapter_message(timestamp_us : UInt64, frame : Frame, direction_tx : Bool, sequence : UInt) -> CanAdapterMessagefn can_frame_duration_us(frame : Frame, nominal_bitrate_kbps : UInt, data_bitrate_kbps : UInt) -> UInt64fn canopen_device_sdo_session(index : UInt, sub_index : Byte, upload : Bool, data : Array[Byte], block_size? : Int) -> CanOpenDeviceSdoSessionfn canopen_emergency(error_code : UInt, error_register : Byte, manufacturer_data : Array[Byte]) -> Array[Byte] raise CanOpenErrorfn canopen_object_entry(index : UInt, sub_index : Byte, name : String, access? : CanOpenObjectAccess, initial? : Array[Byte], max_length? : Int) -> CanOpenObjectEntryfn canopen_sdo_download(index : UInt, sub_index : Byte, data : Array[Byte]) -> Array[Byte] raise CanOpenErrorfn canopen_sdo_download_command(index : UInt, sub_index : Byte, data : Array[Byte]) -> CanOpenSdoCommand raise CanOpenErrorfn canopen_sdo_download_segment(toggle : Bool, data : Array[Byte], last : Bool) -> CanOpenSdoCommand raise CanOpenErrorfn canopen_sdo_frame(node_id : Byte, transmit : Bool, payload : Array[Byte]) -> Frame raise CanOpenErrorfn compatibility_compare_targets(source : CompatibilityTarget, destination : CompatibilityTarget) -> CompatibilityDeltafn compatibility_forbids_feature(code : String, feature : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_matrix_for_target(target : CompatibilityTarget, requirements : Array[CompatibilityRequirement], strict? : Bool) -> CompatibilityMatrixfn compatibility_minimum_bitrate(code : String, minimum : Int, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_minimum_data_bitrate(code : String, minimum : Int, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_minimum_identifier_bits(code : String, minimum : Int, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_minimum_node_capacity(code : String, minimum : Int, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_minimum_payload(code : String, minimum : Int, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_protocol_is(code : String, protocol : CompatibilityProtocol, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_release_gate(name? : String, minimum_score? : Int, require_all_targets? : Bool) -> CompatibilityReleaseGatefn compatibility_requires_classic(code : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_requires_diagnostics(code : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_requires_fd(code : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_requires_feature(code : String, feature : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_requires_isotp(code : String, description? : String, severity? : CompatibilitySeverity) -> CompatibilityRequirementfn compatibility_route(source : CompatibilityTarget, destination : CompatibilityTarget, transport : CompatibilityProtocol) -> CompatibilityRoutefn compatibility_schema_version() -> Stringfn compatibility_target(name : String, protocol : CompatibilityProtocol, nominal_bitrate : Int, data_bitrate : Int, max_payload : Int, identifier_bits : Int, node_capacity : Int, features? : Array[String], notes? : String) -> CompatibilityTargetfn compatibility_targets_for_protocol(protocol : CompatibilityProtocol) -> Array[CompatibilityTarget]fn counter_is_next(previous : Byte, current : Byte) -> Boolfn dbc_codegen_all_targets(messages : Array[Message], module_name : String) -> Array[DbcGeneratedArtifact]fn dbc_codegen_identifier(name : String) -> Stringfn dbc_codegen_options(target? : DbcCodegenTarget, module_name? : String, include_comments? : Bool, include_validation? : Bool, line_ending? : String) -> DbcCodegenOptionsfn dbc_codegen_workspace(workspace : DbcWorkspace, options : DbcCodegenOptions) -> DbcGeneratedArtifactfn dbc_workspace_binding(name : String, message : Message, selector? : DbcWorkspaceMuxSelector, extended? : Bool) -> DbcWorkspaceBindingfn dbc_workspace_signal_group(name : String, message_id : UInt, signals? : Array[Signal]) -> DbcWorkspaceSignalGroupfn diagnostic_data_identifier(identifier : UInt, name : String, length : Int, readable? : Bool, writable? : Bool, initial? : Array[Byte]) -> DiagnosticDataIdentifierfn diagnostic_event(timestamp_us : UInt64, request : DiagnosticRequest, response : Array[Byte], duration_us : UInt64) -> DiagnosticEventfn diagnostic_frame(request : DiagnosticRequest, id : UInt, extended? : Bool) -> Frame raise FrameErrorfn diagnostic_readiness(session_ok : Bool, security_ok : Bool, voltage_ok : Bool, temperature_ok : Bool, dtc_ok : Bool) -> DiagnosticReadinessfn diagnostic_retry_policy(max_attempts? : Int, backoff_us? : UInt64, retry_negative? : Bool) -> DiagnosticRetryPolicyfn diagnostic_session_profile(kind : DiagnosticSessionKind, p2_server_us : UInt64, p2_star_server_us : UInt64, s3_server_us : UInt64, addressing? : DiagnosticAddressingMode, security_level? : Byte) -> DiagnosticSessionProfilefn diagnostic_trouble_code(code : UInt, status : Byte, severity? : Byte, snapshot? : Array[Byte], extended_data? : Array[Byte], timestamp_us? : UInt64) -> DiagnosticTroubleCodefn diagnostic_workflow_step(name : String, request : DiagnosticRequest, timeout_us? : UInt64, retry? : DiagnosticRetryPolicy) -> DiagnosticWorkflowStepfn dtc_record(code : UInt, status : Byte, occurrence? : UInt, snapshot? : Array[Byte]) -> DtcRecord raise DtcCodecErrorfn ecu_memory_region(start : UInt, length : Int, permission? : EcuMemoryPermission) -> EcuMemoryRegion raise EcuMemoryErrorfn ecu_security_policy(level : Byte, secret : UInt, max_attempts? : Int, delay_us? : UInt64) -> EcuSecurityPolicyfn fd_frame(id : UInt, data : Array[Byte], extended? : Bool, bitrate_switch? : Bool, error_state_indicator? : Bool) -> Frame raise FrameErrorfn fd_length_from_dlc(dlc : Byte) -> Intfn frame_pipeline_rule(name : String, filter : Filter, action : FramePipelineAction, max_payload? : Int, allow_fd? : Bool) -> FramePipelineRule raise FramePipelineErrorfn gateway_policy_context(timestamp_us : UInt64, source_channel : String, destination_channel : String, frame : Frame) -> GatewayPolicyContextfn gateway_policy_pair(left : GatewayPolicyEngine, right : GatewayPolicyEngine, source : String, destination : String, timestamp_us : UInt64, frame : Frame) -> Frame?fn gateway_policy_rule(name : String, filter : Filter, output_id? : UInt?, prefix? : Array[Byte], max_payload? : Int, min_interval_us? : UInt64, allow_remote? : Bool) -> GatewayPolicyRule raise GatewayPolicyErrorfn isotp_channel(source_id : UInt, target_id : UInt, extended? : Bool, addressing? : IsoTpSessionAddressing, flow_control? : IsoTpFlowControlConfig) -> IsoTpChannelfn isotp_config(frame_bytes? : Int, block_size? : Byte, separation_time? : Byte) -> IsoTpConfig raise IsoTpErrorfn isotp_flow_control_config(block_size : Int, separation_time_us : UInt64, wait_frame_limit : Int, max_payload : Int) -> IsoTpFlowControlConfigfn isotp_frames(tx_id : UInt, payload : Array[Byte], config : IsoTpConfig, extended? : Bool) -> Array[Frame] raise IsoTpErrorfn isotp_reassemble_frames(frames : Array[Frame], config : IsoTpConfig) -> Array[Byte] raise IsoTpErrorfn isotp_segment_checked(payload : Array[Byte], config : IsoTpConfig) -> Array[Array[Byte]] raise IsoTpErrorfn j1939_address_claim(source_address : Byte, name : UInt64, manufacturer : UInt, function : Byte, instance : Byte, timestamp_us? : UInt64) -> J1939AddressClaimfn j1939_decode_spns(definitions : Array[J1939SpnDefinition], data : Array[Byte]) -> Array[(UInt, Double)]fn j1939_id(priority : Byte, data_page : Bool, pdu_format : Byte, pdu_specific : Byte, source_address : Byte) -> J1939Idfn j1939_reassemble_bam(packets : Array[Array[Byte]], total_length : Int) -> Array[Byte] raise J1939Errorfn j1939_spn(spn : UInt, name : String, start_bit : Int, length : Int, factor? : Double, offset? : Double, minimum? : Double, maximum? : Double, unit? : String) -> J1939SpnDefinitionfn network_error_budget(max_error_rate? : Double, max_drop_rate? : Double, max_offline_nodes? : Int) -> NetworkErrorBudgetfn new_bus_analyzer(mode : BusAnalysisMode, channel? : String, bitrate_kbps? : UInt, burst_window_us? : UInt64, jitter_limit_us? : UInt64) -> BusAnalyzerfn new_canopen_device(node_id : Byte, name : String, heartbeat_timeout_us? : UInt64) -> CanOpenDevicefn new_isotp_stream_receiver(flow_control : IsoTpFlowControlConfig, timeout_us : UInt64) -> IsoTpStreamReceiverfn new_isotp_transmitter(payload : Array[Byte], flow_control : IsoTpFlowControlConfig, started_us : UInt64) -> IsoTpTransmitterfn new_j1939_transport_session(pgn : UInt, direction : J1939TransportDirection, timeout_us? : UInt64) -> J1939TransportSessionfn new_simulation_scenario(name : String, capacity? : Int, bitrate_kbps? : UInt) -> SimulationScenariofn parse_uds_response(request : DiagnosticRequest, payload : Array[Byte]) -> UdsResponseInfo raise UdsErrorfn payload_codec_counter_valid(previous : Byte, current : Byte, modulus : Int) -> Boolfn payload_codec_options(profile? : PayloadCodecProfile, counter_offset? : Int, counter_high_nibble? : Bool, crc_offset? : Int, checksum_offset? : Int, expected_length? : Int, counter_modulus? : Int) -> PayloadCodecOptionsfn payload_codec_pack_counter(payload : Array[Byte], counter : Byte, offset : Int, high_nibble : Bool) -> Array[Byte] raise PayloadErrorfn payload_set_uint(data : Array[Byte], offset : Int, width : Int, value : UInt, order : ByteOrder) -> Array[Byte] raise PayloadErrorfn payload_uint(data : Array[Byte], offset : Int, width : Int, order : ByteOrder) -> UInt raise PayloadErrorfn process_frame_batch(pipeline : FramePipeline, limiter : FrameRateLimiter, frames : Array[(UInt64, Frame)]) -> Array[Frame]fn read_memory(address : UInt, length : UInt, address_bytes? : Int, length_bytes? : Int) -> DiagnosticRequest raise UdsErrorfn request_download(data_format : Byte, address : UInt, length : UInt, address_bytes? : Int, length_bytes? : Int) -> DiagnosticRequest raise UdsErrorfn route_batch(gateway : CanGateway, frames : Array[Frame]) -> Array[RoutedFrame] raise RoutingErrorfn route_rule(name : String, filter : Filter, output_id? : UInt?, output_extended? : Bool?, prefix? : Array[Byte], strip_prefix? : Int) -> RouteRule raise RoutingErrorfn routine_control(routine_type : Byte, identifier : UInt, data? : Array[Byte]) -> DiagnosticRequest raise UdsErrorfn run_simulation_scenarios(scenarios : Array[SimulationScenario]) -> Array[SimulationScenarioResult] raise SimulationErrorfn set_counter_nibble(data : Array[Byte], offset : Int, counter : Byte, high_nibble : Bool) -> Array[Byte] raise PayloadErrorfn signal(name : String, start_bit : Int, size : Int, little_endian? : Bool, signed? : Bool, factor? : Double, offset? : Double, minimum? : Double, maximum? : Double, unit? : String) -> Signalfn simulation_scenario_event(timestamp_us : UInt64, frame : Frame, source? : String) -> SimulationScenarioEventfn trace_export_between(records : Array[TraceExportRecord], start_us : UInt64, end_us : UInt64) -> Array[TraceExportRecord]fn trace_export_can_text(records : Array[TraceExportRecord], options : TraceExportOptions) -> Stringfn trace_export_difference_count(left : Array[TraceExportRecord], right : Array[TraceExportRecord]) -> Intfn trace_export_filter_id(records : Array[TraceExportRecord], identifier : UInt) -> Array[TraceExportRecord]fn trace_export_options(format? : TraceExportFormat, include_channel? : Bool, include_sequence? : Bool, include_header? : Bool, normalize_timestamps? : Bool, max_rows? : Int) -> TraceExportOptionsfn trace_export_record(timestamp_us : UInt64, sequence : Int, channel : String, frame : Frame) -> TraceExportRecordfn trace_export_records(trace : Trace, channel? : String, normalize_timestamps? : Bool) -> Array[TraceExportRecord]fn trace_export_sample(records : Array[TraceExportRecord], stride : Int) -> Array[TraceExportRecord]fn trace_query_buckets(trace : Trace, start_us : UInt64, end_us : UInt64, bucket_us : UInt64) -> Array[TraceQueryBucket]fn uds_negative_code_name(code : Byte) -> Stringfn write_memory(address : UInt, data : Array[Byte], address_bytes? : Int) -> DiagnosticRequest raise UdsErrorA deterministic, dependency-free CAN 2.0 and CAN-FD toolkit for MoonBit.