# OIP-0022: Connector bindings, second set: LwM2M and SenML, Modbus, FDSN (miniSEED 3, StationXML), AIS and ADS-B, CCSDS space packets and CFDP, CAMARA location verification

| Field | Value |
|---|---|
| Status | DRAFT |
| Function | `observe` (§5.5), and `prove` (§5.11) for the CAMARA binding; no new function (the register keeps exactly twelve). A connector is part of Observe |
| Requires | OIP-0007 (connector contract CON-1 to CON-10, schemas `connector-mapping` and `connector-output`) with the amendments below, and OIP-0019 (the first binding set and its shared test helper `tests/connector_golden.py`). The patches apply to the current tree on their own and vendor neither draft; the acceptance order is below |
| Uses | OIP-0006 (observed-property register: every mapped property id is one its register patch names), OIP-0013 (trajectories, by UNI only), OIP-0010 (DownlinkRecords, by UNI only), OIP-0002 (location proofs and their sources, by UNI and source class only) |
| Affects | §5.5 (one bullet naming the six bindings, no new key word); new bindings `bindings/lwm2m/`, `bindings/modbus/`, `bindings/fdsn/`, `bindings/ais-adsb/`, `bindings/ccsds/`, `bindings/camara/` with their tests; `registers/relations.yaml` (new rows `EXT-LWM2M`, `EXT-MODBUS`, `EXT-FDSN`, `EXT-AISADSB`, `EXT-CCSDS-SPP`, `EXT-CAMARA`); `registers/implements-edges.json` and `registers/requirements.yaml` regenerated; new cases CT-NODE-100 to CT-NODE-105 (automated: the golden examples of each binding replayed, `obsp.golden`) with replay evidence in the OBSP-NODE example sets and the invariant module `sdk/python/src/obsp/inv_oip0022.py`; the demo-binding helper of `tests/test_validate.py` made independent of the shipped bindings (the same hunk as OIP-0009 and OIP-0019) |
| Protocol version | obsp/0.1 |
| Last call | 30 days (bindings of an existing function, no new object) unless the editors rule otherwise |

Work packages WP-CON-07 to WP-CON-12 of the master plan.

## Problem

OIP-0007 states what every connector must do and OIP-0019 binds the field technologies most stations use (LoRaWAN, OPC UA,
WIS 2.0 and BUFR, NMEA 0183, SDI-12). Six source families that observatories meet every day still have no binding:
constrained devices managed over LwM2M with SenML payloads, plant and utility devices polled over Modbus, seismic
waveforms in miniSEED with StationXML responses, vessel and aircraft positions from AIS and ADS-B, spacecraft telemetry in
CCSDS space packets and CFDP files, and mobile network location verification, which OIP-0002 needs as a second,
independent location source. Without a binding two connectors take different identities (an LwM2M registration id that
changes at each registration, a Modbus link without its unit, an FDSN channel with its location code dropped, the
receiving station instead of the MMSI), read the wrong clock (a server receive time, a ground receive time), convert raw
counts or registers by guess, turn a Modbus exception into a zero, fill a packet sequence gap silently, or keep a phone
number and coordinates where only a verification result belongs.

## Change

### Normative text (§5.5, one bullet after the section's first sentence)

- Field connector bindings, second set: `bindings/lwm2m/` (OMA LwM2M with SenML), `bindings/modbus/` (Modbus register
  maps), `bindings/fdsn/` (FDSN miniSEED 3 and StationXML), `bindings/ais-adsb/` (AIS and ADS-B positions as trajectory
  points), `bindings/ccsds/` (CCSDS space packets and CFDP) and `bindings/camara/` (mobile network location
  verification, an independent source for location proofs, never coordinates) fix the connector mapping for each
  technology; a connector that names one of them in its mapping is held to every requirement of that binding's profile.

The bullet carries no key word, so the requirement index keeps its ids. It sits between the first sentence of §5.5 and
the "Field-side transport" bullet, on lines no other draft edits: OIP-0019 inserts after "Field-side transport" and
OIP-0006 and OIP-0007 after the last bullet, and each still applies with this bullet in place (and the reverse).

### The six bindings (status proposed)

Each folder follows `bindings/README.md` and the pattern of OIP-0019: `PROFILE.md` (scope, standard, every requirement,
the mapping table by clause, examples, open questions), `binding.yaml`, `mapping.yaml` (every row with its clause and
`checked: not checked`, the decoder described as data in a `decoder` block, elements not mapped with the reason),
`connector-mapping.json` (a `connector-mapping` record whose `decoderDigest` is the SHA-256 of the canonical JSON form of
the `decoder` block and whose `goldens` list every example with its digest), positive and negative golden examples (the
native message rendered as JSON, with binary frames in hex, the connector's state before it where it matters, and the
expected output as a projection), and a test.

| Binding | Standard (edition, `checked: not checked`) | Native id (scheme) | Quality | Time source | Sequence | Requirements | Examples (+/-) |
|---|---|---|---|---|---|---|---|
| `lwm2m` | OMA LwM2M 1.2; RFC 8428 (SenML); IPSO objects | endpoint client name (`LWM2M_ENDPOINT`) | none: `NOT_CHECKED` | `DEVICE` (resolved SenML time) | none | BND-LWM2M-01 to -12 | 5 / 4 |
| `modbus` | Modbus application protocol V1.1b3; serial line V1.02 | link and unit (`MODBUS_UNIT`) | none: `NOT_CHECKED` | `CONNECTOR` (response time) | none | BND-MODBUS-01 to -13 | 4 / 4 |
| `fdsn` | FDSN miniSEED 3.0; StationXML 1.2; source identifiers 1.0 | NET.STA.LOC.CHA (`FDSN_NSLC`) | data quality indicator (`FDSN_DATA_QUALITY`) | `DEVICE` (record start) | none | BND-FDSN-01 to -13 | 5 / 4 |
| `ais-adsb` | ITU-R M.1371-5; IEC 61162-1:2016; ICAO Annex 10 Vol. IV; RTCA DO-260B | MMSI (`MMSI`), ICAO address (`ICAO_24BIT`) | none (accuracy as uncertainty) | `GATEWAY` (receiver) | none | BND-AISADSB-01 to -13 | 5 / 4 |
| `ccsds` | CCSDS 133.0-B-2; 727.0-B-5; 301.0-B-4 | spacecraft and APID (`CCSDS_APID`) | none: `NOT_CHECKED` | `DEVICE` (onboard CUC time) | packet sequence count, modulo 2^14 per APID | BND-CCSDS-01 to -13 | 6 / 4 |
| `camara` | CAMARA Device Location Verification API v2.0.0 | pseudonymous device reference (`CAMARA_DEVICE_REF`) | none (an outcome, not a flag) | `NETWORK_SERVER` (last location time) | none | BND-CAMARA-01 to -12 | 5 / 4 |

What each binding pins down beyond the contract:

- **LwM2M and SenML**: identity by endpoint client name, never the registration id; SenML records resolved as RFC 8428
  states (bn+n, bt+t, u else bu, bv+v); native field `<object>/<instance>/<resource>`, only resource 5700 of a mapped IPSO
  object converted; objects 3303, 3304, 3315 and 3301 map to `air_temperature`, `relative_humidity`,
  `air_pressure_station` and `illuminance`, and the generic 3323 (pressure) and 3330 (distance) to the property the
  mapping states (`pipe_pressure`, `liquid_level` in the examples); SenML units to UCUM only by table (Pa to hPa, Pa to
  kPa; no table row, no observation); a relative SenML time gives no observation; JSON (110) and CBOR (112) give the same
  observations.
- **Modbus**: identity `<link>/<unit>`; RTU CRC checked; a response must answer its request; the register map (address,
  function code, data type, word order, scale, offset, decimals; `register-map.schema.json`) is the only decoder; every
  register read is an observation or unmapped; an exception response is a missing-data record `DEVICE_EXCEPTION`, never a
  value or a zero; no write function code.
- **FDSN**: identity from the FDSN source identifier, location code kept; CRC-32C checked; samples decoded by encoding;
  counts converted only by the instrument sensitivity of the StationXML channel epoch named by document digest (the
  digest travels with every output); sample rate must match the epoch; record start time with the clock-locked and
  questionable-time flags and the timing quality as time evidence; a questionable time tag caps the flag at `SUSPECT`; the
  data quality indicator maps by table; calibration records give no ground motion.
- **AIS and ADS-B**: identity by MMSI or ICAO 24-bit address, never the receiver; checksum and CRC-24 parity checked; each
  source a `MOBILE` platform whose positions become trajectory points of the OIP-0013 trajectory the mapping names by UNI,
  never observations; AIS not-available positions give no point; the AIS position accuracy flag and the ADS-B type code
  set the horizontal uncertainty by table (never smaller than the table, unknown outside it); ADS-B positions decoded
  locally within 180 NM of the receiver; AIS time stamp applied to the receiver time.
- **CCSDS**: identity `<spacecraft>/<apid>`; idle packets, telecommands and length mismatches give nothing; unsegmented
  packets only; packet sequence count per APID modulo 2^14 as the CON-9 sequence; onboard CUC time from the stated epoch,
  never ground receive time; parameters by the APID's layout; every output references its OIP-0010 DownlinkRecord by UNI;
  a CFDP file is converted only once its transaction (source entity id, transaction sequence number) is complete.
- **CAMARA**: the verification result is a second, independent location source for an OIP-0002 location proof
  (`NETWORK_POSITIONING`, independence group `MOBILE_NETWORK`), never coordinates, never an observation and never a proof
  by itself; TRUE, FALSE, PARTIAL and UNKNOWN map to `CORROBORATES`, `CONTRADICTS`, `PARTIAL` (with match rate) and
  `NO_EVIDENCE`; a result older than the maximum age gives no evidence; FALSE is never dropped; the area is kept only as
  a digest; the device is named only by a pseudonymous reference derived by the operator with a keyed function, and no
  subscriber identifier reaches an output or its payload digest.

### Amendments asked of OIP-0007

The connector-mapping and connector-output schemas of OIP-0007 have closed lists (its open question 7). This proposal is
the OIP for these additions:

| List | Addition | Used by |
|---|---|---|
| `connector-mapping` `$defs/NativeId/properties/scheme/enum` | `MODBUS_UNIT` (`<link>/<unit>`), `CCSDS_APID` (`<spacecraft>/<apid>`), `CAMARA_DEVICE_REF` (operator pseudonym) | `modbus`, `ccsds`, `camara` |
| `connector-mapping` `$defs/QualityMap/properties/scheme/enum` | `FDSN_DATA_QUALITY` (D, R, Q, M) | `fdsn` |
| `connector-output` `$defs/MissingData/properties/reason/enum` | `DEVICE_EXCEPTION` (the device answered with an exception; `from` required as for the other non-sequence reasons) | `modbus` |
| `connector-mapping` `fields` `minItems` | 0 when the mapping's `extensions` declare its outputs as trajectory points (`obsp.trajectory`) or location corroborations (`obsp.locationCorroboration`) | `ais-adsb`, `camara` |

`LWM2M_ENDPOINT`, `FDSN_NSLC`, `MMSI` and `ICAO_24BIT` are already in OIP-0007's list. Because the schemas are not in the
tree, the amendments cannot be a patch that applies on its own; they are applied to OIP-0007's schemas when it is
accepted (if this proposal is accepted with it) or by a short patch at this proposal's acceptance. Each binding test
states them (`AMENDMENT`) and checks the mapping structurally against the contract with them.

### Tests without the drafts they need

OIP-0019's shared helper (`tests/connector_golden.py`) is not in the tree, so this proposal vendors nothing: each binding
test is self-contained (the structural contract checks, golden and decoder digests, derive and break harness), the
mapped properties are checked against `registers/observed-properties.yaml` only once it exists (skipped today), and at
acceptance after OIP-0019 the shared part of each test is replaced by `connector_golden.GoldenChecks`.

### Registers

- `registers/relations.yaml`: six new external rows at the end of `external`, each naming its binding folder in
  `artefacts`; functions `observe` (and `prove` for `EXT-CAMARA`); profiles OBSP-NODE (and OBSP-SITE for `EXT-CAMARA`);
  schemas in the tree today (`observation-record`, `time-quality`; `proof-receipt`, `time-quality` for `EXT-CAMARA`). No
  existing row states these standards. `EXT-CCSDS-SPP` is distinct from OIP-0010's proposed `EXT-CCSDS-CFDP` (CFDP for
  `downlink-record`); if both are accepted the editors may keep both or fold the CFDP mention of `EXT-CCSDS-SPP` into it.
- `registers/implements-edges.json` regenerated (47 edges); `registers/requirements.yaml` regenerated (the §5.5
  requirements gain the six cases; no id changes).

### Acceptance order

1. OIP-0007 is accepted first, with the amendments above in its schemas.
2. OIP-0019 is accepted (its shared helper and first binding set); if it is not, this proposal's tests stay
   self-contained.
3. This proposal's patches are applied together. In the same change: `connector-mapping` and `connector-output` join
   `schemas` of each `binding.yaml` and relation row; the shared part of each test moves to `connector_golden`; the tests
   validate each mapping against the schema; `python3 tools/build_edges.py` and `python3 tools/requirements.py` run again.
4. When OIP-0006 is accepted, the tests check every mapped property against the register (skipped today).

## Compatibility

Additive: six bindings, six relation rows, six automated cases, one non-normative bullet. No existing document changes
meaning and no schema changes in this proposal. The OBSP-NODE example set gains six replay evidence documents (the digests of the golden outputs) and the OBSP-NODE
negative set gains the same six, so that it still fails only the two cases it was built to fail.

## Tests

| Requirement | Case | Kind |
|---|---|---|
| BND-LWM2M-01 to -12 | CT-NODE-100 | automated: replay of every golden message (`binding-replay-lwm2m`); `tests/test_lwm2m_binding.py` |
| BND-MODBUS-01 to -13 | CT-NODE-101 | automated: replay of every golden example (`binding-replay-modbus`); `tests/test_modbus_binding.py` |
| BND-FDSN-01 to -13 | CT-NODE-102 | automated: replay of every golden example (`binding-replay-fdsn`); `tests/test_fdsn_binding.py` |
| BND-AISADSB-01 to -13 | CT-NODE-103 | automated: replay of every golden example (`binding-replay-ais-adsb`); `tests/test_ais_adsb_binding.py` |
| BND-CCSDS-01 to -13 | CT-NODE-104 | automated: replay of every golden example (`binding-replay-ccsds`); `tests/test_ccsds_binding.py` |
| BND-CAMARA-01 to -12 | CT-NODE-105 | automated: replay of every golden example (`binding-replay-camara`); `tests/test_camara_binding.py` (the binding also names OBSP-SITE, where the proof is verified) |

Each test derives every positive example's expected output from its native message and the binding's tables (decoding
the binary forms itself: SenML CBOR, Modbus RTU frames with CRC-16, miniSEED 3 records with CRC-32C and the StationXML
document, AIVDM sentences and extended squitters with CRC-24 and CPR, space packets with CUC time), shows that each
negative example breaks exactly the requirement its file name states (and only that one), checks the decoder and golden
digests, checks the connector mapping structurally against OIP-0007 with the amendments, and has binding-specific checks
(JSON and CBOR agree; register map schema and overlap; StationXML digest and response; a published CPR teaching frame;
sequence wrap at 2^14; no subscriber identifier or coordinate in any output).

Negative examples, one broken requirement each: LwM2M `registration-id-as-identity` (-01), `base-time-not-applied`
(-03), `pascal-not-converted` (-05), `server-time-as-result-time` (-06); Modbus `link-as-identity` (-01), `crc-ignored`
(-03), `word-order-ignored` (-05), `exception-as-zero` (-07); FDSN `location-code-dropped` (-01), `crc-ignored` (-03),
`counts-not-converted` (-06), `questionable-time-as-good` (-08); AIS and ADS-B `receiver-as-identity` (-01),
`crc-ignored` (-04), `unavailable-position-as-point` (-06), `low-accuracy-as-high` (-07); CCSDS `idle-packet-converted`
(-02), `sequence-gap-not-recorded` (-06), `receive-time-as-result-time` (-07), `incomplete-cfdp-converted` (-10); CAMARA
`phone-number-retained` (-02), `false-as-no-evidence` (-04), `stale-true-as-corroboration` (-06),
`coordinates-retained` (-07).

## Open questions

1. Every clause number, code, bit position, unit code, edition and API version in the six bindings is
   `checked: not checked` against the published texts. A person must compare them before any binding leaves proposed
   status.
2. MMSI and ICAO addresses identify platforms the operator does not own, and a CAMARA device reference is personal data
   under most regimes. Should published outputs of `ais-adsb` carry pseudonyms too, and should the CAMARA pseudonym rotate
   per proof window, under OIP-0014?
3. Is a CAMARA verification independent of the node's GNSS when the network locates the device with GNSS assistance?
   The API does not return the network's method (OIP-0002 PRV-6 independence groups).
4. Should FDSN data quality Q and other source-declared codes map to `GOOD` (as OIP-0019 open question 3 asks for its
   bindings)?
5. Should register maps (Modbus), packet layouts (CCSDS) and object tables (LwM2M) become registers with digests?
6. `DEVICE_EXCEPTION` carries no exception code in the missing-data record (closed properties); is link evidence enough?
7. Should the connector cases move to an optional connector overlay instead of OBSP-NODE (OIP-0007 open question 5)?

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT and none of the six
bindings exists in the protocol.
