Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device features support #1479

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add device features support #1479

wants to merge 2 commits into from

Conversation

jjcarstens
Copy link
Collaborator

Start of device features (previously "extensions") which allow for specialized features on device to report data and interactions safely outside the update mechanism.

Requires nerves-hub/nerves_hub_link#228

Based on conversations the last while, these are some of the core design decisions so far:

  • NervesHub selectively tells a device what features to enable
  • Features are off by default on device
  • Features should have no affect on socket connectivity or ability to update a device

With that in mind, this is the basic communication cycle for supporting features on device.

sequenceDiagram
    participant Device as Device (NHL)
    participant NH as NervesHub

    Device ->> NH: Connect
    NH ->> NH: Check `features_allowed?`
    NH ->> Device: Send "features:get"
    Device ->> NH: Join "features" channel with [%{<feature> => <version>}]
    NH ->> NH: Determine features to enable based on report
    NH ->> Device: Send "features:enable" to with list of features to enable

    loop For each feature to enable
        Device ->> NH: Report "<feature_name>:<event>" where event is enabled or error
    end
Loading

TODO: All the bits to selectively decide what features can be enabled for a device

Start of device features (previously "extensions") which allow for
specialized features on device to report data and interactions
safely outside the update mechanism.
Copy link
Contributor

@lawik lawik left a comment

Choose a reason for hiding this comment

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

Looks like a good approach to me. Want me to flesh out the allow mechanisms as a branch off of this branch or something?

Or we merge this once we tidy up the dbg and TODO notes?


{:reply, :ok, assign(socket, :device, device)}
def handle_in("location:update", location, socket) do
# Backwards compatibility for Geo feature
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the only devices that use Geo are ours from testing and we could absolutely break that contract and fix those devices.

The functionality has been added in nerves_hub_web but the other end only exists in branches of nerves_hub_link extension stuff.

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