Skip to content

Feat/binary encodings and modularization#38

Merged
tipatterson-dev merged 33 commits into
mainfrom
feat/binary-encodings-and-modularization
Jul 2, 2026
Merged

Feat/binary encodings and modularization#38
tipatterson-dev merged 33 commits into
mainfrom
feat/binary-encodings-and-modularization

Conversation

@tipatterson-dev

Copy link
Copy Markdown
Collaborator

No description provided.

…I generated and will be manually reviewed as time permits
…prove overall doc coverage of streamableresource.py
…_/from_swejson_dict, to_/from_geojson_dict, and to_/from_csapi_dict methods across System/Datastream/ControlStream and their underlying pydantic resource/schema models for round-tripping CS API server JSON, deprecated the older

  System.from_system_resource and Datastream.from_resource factories, and fixed three latent bugs (Node._client_session initialization, TimeUtils.time_to_iso UTC handling, ObservationOMJSONInline alias direction) exposed by the new tests.
…endency to main publish workflow so we are less likely to publish a broken build
…used with underlying object representations that are needed for actual wire serialization. Update docs to reflect this.
…dd networked tests to verify that commands can be sent based off source schemas and maintain coherence across the wire.
…y of the base consysapi object by subclassing based on request type
… the properties were not honored due to only accepting the default value for the type property
… account for this. Add a SchemaFetchWarning to alert users when this fails so it doesn't get missed.
…unions and forcing rebuilds on the models to fix a forward ref to AnyComponent
Work-in-progress snapshot pushed to local Forgejo for backup/sharing.
Includes csapi4py module pruning, swe+binary/protobuf work, resource
split, and test updates.
Add a NATS.io pub/sub transport as a drop-in twin of the MQTT path,
targeting the osh-nats-dev consys-nats server, plus a working
FlexBuffers-based swe+flatbuffers codec.

NATS transport:
- NatsCommClient (csapi4py/nats.py): synchronous interface matching
  MQTTCommClient, backed by an asyncio loop on a background thread;
  qos/retain accepted-and-ignored for parity; clean shutdown.
- Node(enable_nats, nats_port, nats_token) mirrors enable_mqtt; resources
  select the active transport via get_comm_client().
- Nested-under-systems subjects (StreamableResource.get_nats_subject),
  matching ConSysApiNatsConnector.getResourceUri exactly (verified live).
- PROACTIVE format handling: PULL subscribes to a format wildcard
  (:data.*), reads the concrete format per-message from the delivered
  subject (nats_content_type_from_subject), and decodes via
  decode_observation(raw, obs_format=...). Publish keeps the exact format.
- nats-py added as a core dependency.

swe+flatbuffers:
- OSH's wire format is schemaless length-prefixed FlexBuffers, not
  compiled FlatBuffers, so the flatc vector-of-union limitation never
  applied. SWEFlatBuffersCodec now encodes/decodes real frames.
- Fix: swe-flatbuffers was missing from MQTT_TOPIC_FORMAT_TOKENS.

Tests: test_nats_subjects.py (subjects, wildcard, format extraction,
transport dispatch), rewritten test_swe_flatbuffers.py for the real
codec. Docs: tutorial, API ref, spec-deviations #3 (resolved) and #5.
…lity

Older OSH servers predate the CS API Part 3 topic scheme. Add an opt-in
legacy mode that reverts MQTT topic construction to the pre-Part-3 form:
a leading slash, no ':data' suffix, and no format subtopic
(e.g. /api/datastreams/{id}/observations vs
api/datastreams/{id}/observations:data/<token>).

- APIHelper gains a `legacy_topics` field and a per-call `legacy=` override
  on get_mqtt_topic(); in legacy mode data_topic/format are ignored.
- Node(mqtt_legacy_topics=True) flows the flag into its APIHelper.
- Resources are unaware — they call get_mqtt_topic as before and get the
  legacy strings transparently, so publish and subscribe both use them.
- Legacy mode affects MQTT topics only; NATS subjects are unaffected.

Tests: TestLegacyTopics covers legacy strings for datastream/controlstream/
status/system, init_mqtt wiring, off-by-default, and per-call override.
Docs: tutorial note by the MQTT section.
…to tutorial

Explain that OSHConnect is a client requiring a running OSH node with the
Connected Systems API service (and the CS API MQTT module + a broker for
real-time streaming), linking the official OpenSensorHub docs rather than
duplicating setup instructions. Add a table mapping the information to
gather from a node to the corresponding Node() constructor parameters,
with a worked example.
@tipatterson-dev

Copy link
Copy Markdown
Collaborator Author

We have investigated ourselves and found no wrongdoing

@tipatterson-dev tipatterson-dev merged commit ee3ffd8 into main Jul 2, 2026
12 checks passed
@tipatterson-dev tipatterson-dev deleted the feat/binary-encodings-and-modularization branch July 2, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant