@celestia-island/plana-types 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/evernightProtocol.ts +203 -0
- package/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Params of [`PROTOCOL_CONNECT_METHOD`].
|
|
5
|
+
*/
|
|
6
|
+
export type ConnectParamsDto = {
|
|
7
|
+
/**
|
|
8
|
+
* How to reach the device.
|
|
9
|
+
*/
|
|
10
|
+
transport: TransportInfoDto, };
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Result of [`PROTOCOL_CONNECT_METHOD`].
|
|
14
|
+
*/
|
|
15
|
+
export type ConnectResultDto = {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the connection was established.
|
|
18
|
+
*/
|
|
19
|
+
connected: boolean, };
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Identifies a data location across any industrial protocol: the
|
|
23
|
+
* `address` field of [`protocol.read`](PROTOCOL_READ_METHOD) and
|
|
24
|
+
* [`protocol.write`](PROTOCOL_WRITE_METHOD) params.
|
|
25
|
+
*/
|
|
26
|
+
export type DataAddressDto = { "kind": "modbus",
|
|
27
|
+
/**
|
|
28
|
+
* Modbus station/slave ID.
|
|
29
|
+
*/
|
|
30
|
+
station: number,
|
|
31
|
+
/**
|
|
32
|
+
* Modbus function code.
|
|
33
|
+
*/
|
|
34
|
+
fc: number,
|
|
35
|
+
/**
|
|
36
|
+
* Starting register address.
|
|
37
|
+
*/
|
|
38
|
+
address: number,
|
|
39
|
+
/**
|
|
40
|
+
* Number of registers to read/write.
|
|
41
|
+
*/
|
|
42
|
+
count: number, } | { "kind": "s7",
|
|
43
|
+
/**
|
|
44
|
+
* Data block number.
|
|
45
|
+
*/
|
|
46
|
+
db_number: number,
|
|
47
|
+
/**
|
|
48
|
+
* Byte offset within the DB.
|
|
49
|
+
*/
|
|
50
|
+
offset: number,
|
|
51
|
+
/**
|
|
52
|
+
* Number of bytes to read/write.
|
|
53
|
+
*/
|
|
54
|
+
length: number, } | { "kind": "mc",
|
|
55
|
+
/**
|
|
56
|
+
* Device code (e.g. "D", "M", "X", "Y").
|
|
57
|
+
*/
|
|
58
|
+
device: string,
|
|
59
|
+
/**
|
|
60
|
+
* Starting head address.
|
|
61
|
+
*/
|
|
62
|
+
head_address: number,
|
|
63
|
+
/**
|
|
64
|
+
* Number of elements.
|
|
65
|
+
*/
|
|
66
|
+
count: number, } | { "kind": "raw",
|
|
67
|
+
/**
|
|
68
|
+
* Raw address string (protocol-specific).
|
|
69
|
+
*/
|
|
70
|
+
address: string,
|
|
71
|
+
/**
|
|
72
|
+
* Expected data size in bytes.
|
|
73
|
+
*/
|
|
74
|
+
size: number, };
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Params of [`PROTOCOL_PING_METHOD`] — the empty params object `{}`.
|
|
78
|
+
*
|
|
79
|
+
* JSON-RPC 2.0 lets a no-argument method omit `params` entirely, and the
|
|
80
|
+
* sibling TypeScript client does exactly that when called without an
|
|
81
|
+
* argument; plana's router hands such a handler `Value::Null` for the
|
|
82
|
+
* missing field. Deserialization therefore tolerates `null` alongside the
|
|
83
|
+
* canonical `{}` (unknown fields are ignored, mirroring serde's derive
|
|
84
|
+
* default), while serialization always emits `{}`.
|
|
85
|
+
*/
|
|
86
|
+
export type PingParamsDto = Record<symbol, never>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Result of [`PROTOCOL_PING_METHOD`].
|
|
90
|
+
*/
|
|
91
|
+
export type PingResultDto = {
|
|
92
|
+
/**
|
|
93
|
+
* Whether the device answered the connectivity check.
|
|
94
|
+
*/
|
|
95
|
+
reachable: boolean, };
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Params of [`PROTOCOL_PROBE_METHOD`].
|
|
99
|
+
*/
|
|
100
|
+
export type ProbeParamsDto = {
|
|
101
|
+
/**
|
|
102
|
+
* The endpoint to probe.
|
|
103
|
+
*/
|
|
104
|
+
transport: TransportInfoDto, };
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Result of [`PROTOCOL_PROBE_METHOD`].
|
|
108
|
+
*
|
|
109
|
+
* Not to be confused with `plana_celestia_types::tools::polemos::
|
|
110
|
+
* ProtocolProbeResult` (the LLM terminal tool's probe report) — see the
|
|
111
|
+
* crate docs.
|
|
112
|
+
*/
|
|
113
|
+
export type ProbeResultDto = {
|
|
114
|
+
/**
|
|
115
|
+
* Human-readable protocol name that was detected (e.g. "modbus_tcp").
|
|
116
|
+
*/
|
|
117
|
+
protocol: string,
|
|
118
|
+
/**
|
|
119
|
+
* Detection confidence in `[0.0, 1.0]`.
|
|
120
|
+
*/
|
|
121
|
+
confidence: number, };
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Params of [`PROTOCOL_READ_METHOD`].
|
|
125
|
+
*/
|
|
126
|
+
export type ReadParamsDto = {
|
|
127
|
+
/**
|
|
128
|
+
* Where to read.
|
|
129
|
+
*/
|
|
130
|
+
address: DataAddressDto, };
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Result of [`PROTOCOL_READ_METHOD`].
|
|
134
|
+
*/
|
|
135
|
+
export type ReadResultDto = {
|
|
136
|
+
/**
|
|
137
|
+
* Raw bytes read from the device.
|
|
138
|
+
*/
|
|
139
|
+
raw: Array<number>,
|
|
140
|
+
/**
|
|
141
|
+
* Read latency in microseconds.
|
|
142
|
+
*/
|
|
143
|
+
latency_us: bigint, };
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Describes how to reach a device: the `transport` field of
|
|
147
|
+
* [`protocol.connect`](PROTOCOL_CONNECT_METHOD) and
|
|
148
|
+
* [`protocol.probe`](PROTOCOL_PROBE_METHOD) params.
|
|
149
|
+
*/
|
|
150
|
+
export type TransportInfoDto = { "kind": "tcp",
|
|
151
|
+
/**
|
|
152
|
+
* TCP hostname or IP address.
|
|
153
|
+
*/
|
|
154
|
+
host: string,
|
|
155
|
+
/**
|
|
156
|
+
* TCP port number.
|
|
157
|
+
*/
|
|
158
|
+
port: number, } | { "kind": "serial",
|
|
159
|
+
/**
|
|
160
|
+
* Serial device path (e.g. "/dev/ttyUSB0").
|
|
161
|
+
*/
|
|
162
|
+
port: string,
|
|
163
|
+
/**
|
|
164
|
+
* Optional baud rate hint. Serializes as `null` when absent and
|
|
165
|
+
* defaults to `None` when the field is missing on the wire.
|
|
166
|
+
*/
|
|
167
|
+
baud: number | null, };
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Params of [`PROTOCOL_WRITE_METHOD`].
|
|
171
|
+
*/
|
|
172
|
+
export type WriteParamsDto = {
|
|
173
|
+
/**
|
|
174
|
+
* Where to write.
|
|
175
|
+
*/
|
|
176
|
+
address: DataAddressDto,
|
|
177
|
+
/**
|
|
178
|
+
* Raw bytes to write.
|
|
179
|
+
*/
|
|
180
|
+
data: Array<number>, };
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Result of [`PROTOCOL_WRITE_METHOD`].
|
|
184
|
+
*/
|
|
185
|
+
export type WriteResultDto = {
|
|
186
|
+
/**
|
|
187
|
+
* Whether a read-back verification confirmed the write. `false` is not
|
|
188
|
+
* proof of failure — see [`verification`](Self::verification) for the
|
|
189
|
+
* precise tri-state.
|
|
190
|
+
*/
|
|
191
|
+
confirmed: boolean,
|
|
192
|
+
/**
|
|
193
|
+
* Precise verification status. `#[serde(default)]` keeps legacy
|
|
194
|
+
* `{ "confirmed": bool }` payloads deserializable (they map to
|
|
195
|
+
* [`WriteVerificationDto::Unknown`]).
|
|
196
|
+
*/
|
|
197
|
+
verification: WriteVerificationDto, };
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Tri-state confirmation of a
|
|
201
|
+
* [`protocol.write`](PROTOCOL_WRITE_METHOD) result.
|
|
202
|
+
*/
|
|
203
|
+
export type WriteVerificationDto = "confirmed" | "unconfirmed" | "unknown";
|