You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adapters/json-rpc-spec.md
+171Lines changed: 171 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -277,6 +277,177 @@ An empty `registers` array is valid and starts polling with no registers configu
277
277
278
278
---
279
279
280
+
### `adapter.dataPointSchema`
281
+
282
+
Returns the schema for data point expressions — what fields make up a data point address, how they should be rendered in the UI, and available data types. Call this after `adapter.describe` to discover how to build the data point input UI.
|`addressSchema`| JSON Schema describing the address input fields. The core renders this with `SchemaFormWidget`|
330
+
|`dataTypes`| Array of available data types. Each entry has `id` (used in expression strings) and `label` (UI display) |
331
+
|`defaultDataType`| The `id` of the type to pre-select in the UI |
332
+
333
+
The `addressSchema` follows standard JSON Schema conventions. The core application uses it to dynamically generate the address input portion of the data point dialog, so it must accurately describe all required fields and their constraints. The `dataType` property within `addressSchema` has no `enum` constraint; the available values are supplied by the top-level `dataTypes` array, and `defaultDataType` (`"16b"`) indicates which value to pre-select.
334
+
335
+
---
336
+
337
+
### `adapter.describeDataPoint`
338
+
339
+
Parses a data point expression into structured fields and returns a human-readable description. Used by the core to display data point details in tables and tooltips without understanding protocol-specific address formats.
340
+
341
+
**Params:**
342
+
```json
343
+
{
344
+
"expression": "${40001: 16b}"
345
+
}
346
+
```
347
+
348
+
**Result (valid):**
349
+
```json
350
+
{
351
+
"valid": true,
352
+
"fields": {
353
+
"objectType": "holding register",
354
+
"address": 0,
355
+
"deviceId": 1,
356
+
"dataType": "16b"
357
+
},
358
+
"description": "holding register, 0, unsigned 16-bit, device id 1"
359
+
}
360
+
```
361
+
362
+
**Result (invalid):**
363
+
```json
364
+
{
365
+
"valid": false,
366
+
"error": "Unknown type 'xyz'"
367
+
}
368
+
```
369
+
370
+
| Field | Description |
371
+
| --- | --- |
372
+
|`valid`| Whether the expression is syntactically and semantically valid |
373
+
|`fields`| Structured parsed fields — protocol-specific, but the core treats them as opaque display data |
374
+
|`description`| Human-readable description for display in tables, tooltips, and logs |
375
+
|`error`| Human-readable error message when `valid` is false |
376
+
377
+
**Errors:**
378
+
-`-32602` — Missing `expression` field
379
+
380
+
---
381
+
382
+
### `adapter.validateDataPoint`
383
+
384
+
Validates a single data point expression string without starting polling. Used for real-time validation feedback in the data point input dialog.
385
+
386
+
**Params:**
387
+
```json
388
+
{
389
+
"expression": "${40001: 16b}"
390
+
}
391
+
```
392
+
393
+
**Result (valid):**
394
+
```json
395
+
{ "valid": true }
396
+
```
397
+
398
+
**Result (invalid):**
399
+
```json
400
+
{
401
+
"valid": false,
402
+
"error": "Unknown type 'xyz'"
403
+
}
404
+
```
405
+
406
+
| Field | Description |
407
+
| --- | --- |
408
+
|`valid`| Whether the expression is valid |
409
+
|`error`| Human-readable error message when `valid` is false |
410
+
411
+
**Errors:**
412
+
-`-32602` — Missing `expression` field
413
+
414
+
---
415
+
416
+
### `adapter.buildExpression`
417
+
418
+
Constructs a register expression string from its component parts. The core calls this after the user fills in the register address form and selects a data type and device, so expression syntax stays entirely within the adapter.
419
+
420
+
**Params:**
421
+
422
+
```json
423
+
{
424
+
"fields": {
425
+
"objectType": "holding register",
426
+
"address": 0
427
+
},
428
+
"dataType": "f32b",
429
+
"deviceId": 2
430
+
}
431
+
```
432
+
433
+
| Field | Type | Required | Description |
434
+
| --- | --- | --- | --- |
435
+
|`fields`| object | yes | Address field values as returned by the data point schema form (structure matches `addressSchema` from `adapter.dataPointSchema`) |
436
+
|`dataType`| string | no | Data type identifier (e.g. `"16b"`). Omit to use the adapter default |
437
+
|`deviceId`| integer | no | Device identifier from `adapter.configure`. Omit to use the adapter default |
438
+
439
+
**Result:**
440
+
441
+
```json
442
+
{ "expression": "${h0@2:f32b}" }
443
+
```
444
+
445
+
**Errors:**
446
+
447
+
-`-32602` — Missing or invalid `fields`; unknown `dataType`
0 commit comments