Skip to content

Feat/consys custom formats - #354

Open
tipatterson-dev wants to merge 3 commits into
opensensorhub:masterfrom
tipatterson-dev:feat/consys-custom-formats
Open

Feat/consys custom formats#354
tipatterson-dev wants to merge 3 commits into
opensensorhub:masterfrom
tipatterson-dev:feat/consys-custom-formats

Conversation

@tipatterson-dev

Copy link
Copy Markdown
Member

This adds an extension for modules to add custom formats. In particular, swe+proto requires that other formats be exposed via the Connected Systems API module. See opensensorhub/osh-addons#224

@tipatterson-dev
tipatterson-dev marked this pull request as draft June 29, 2026 22:05
@tipatterson-dev
tipatterson-dev marked this pull request as ready for review June 29, 2026 22:14
@drewbotts
drewbotts self-requested a review July 16, 2026 15:14
… schemas

Extend the CustomObsFormat SPI with command-side hooks (getCommandBinding,
getCommandSchemaBinding) and an isAutoSelectable flag, and thread the
configured customFormats map through the obs, command, command-status,
datastream-schema and command-stream-schema handlers so a registered format
(e.g. application/swe+proto) can serve its own data and schema views.
… POST

Dispatch datastream and control-stream creation to a registered custom
format's binding when the embedded schema names it. DataStreamBindingJson
gains a custom-format branch ahead of the application/swe+ prefix match;
CommandStreamBindingJson buffers the schema object and dispatches on
commandFormat, staying backward-compatible (a missing commandFormat still
uses the default JSON binding); CommandStreamHandler threads the
customFormats map through to the binding.
@tipatterson-dev
tipatterson-dev force-pushed the feat/consys-custom-formats branch from 94c17c0 to 706a2d3 Compare July 17, 2026 05:07

@alexrobin alexrobin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making progress on this. Overall it looks good, just a few minor changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably create a dedicated CustomCommandFormat class instead of overloading this one.

// param still takes precedence
var defaultFormat = ctx.getFormat() != null ? ctx.getFormat() : ResourceFormat.AUTO;
var responseFormat = parseFormat(queryParams, defaultFormat);
ctx.setFormatOptions(responseFormat, parseSelectArg(queryParams));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the query param in the MQTT layer instead to avoid this special case?

if (binding != null)
return binding;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you implement this as close as possible to what was done for obs (I see I created a getCustomFormatBinding method so we should do the same here.

// (e.g. MQTT ":data/<format-token>" subtopics); an explicit f= query
// param still takes precedence
var defaultFormat = ctx.getFormat() != null ? ctx.getFormat() : ResourceFormat.AUTO;
var responseFormat = parseFormat(queryParams, defaultFormat);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for obs: not sure we need this if the MQTT layer adds the proper query param in the context instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this class does not serialize the list of compatible custom formats so we should add that too (see DataStremBindingJson.serialize method that uses SWECommonUtils.getAvailableFormats())

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.

2 participants