nerves_hub v0.2.1 NervesHub.Client behaviour

Responsible for determining if an update should be applied.

Link to this section Summary

Types

Update that comes over a socket

Callbacks

Called whenever a stream fails or exits for a non-normal reason. The return value of this function is not checked

Called whenever a message comes from a FWUP stream. The return value of this function is not checked

Called before an update is downloaded and applied. May return one of:

  • apply - Download and apply the update right now.
  • ignore - Don’t download this update now or ever.
  • {:reschedule, timeout} -> Don't donload the update. Call this function again intimeout` milliseconds

Link to this section Types

Link to this type fwup_message()
fwup_message() ::
  {:ok, pos_integer(), String.t()}
  | {:warning, pos_integer(), String.t()}
  | {:error, pos_integer(), String.t()}
  | {:progress, 0..100}
Link to this type update_data()
update_data() :: map()

Update that comes over a socket.

Link to this section Functions

Link to this function apply_wrap(client, function, args \\ [])
Link to this function handle_error(client, data)
Link to this function handle_fwup_message(client, data)
Link to this function update_available(client, data)

Link to this section Callbacks

Link to this callback handle_error(any)
handle_error(any()) :: :ok

Called whenever a stream fails or exits for a non-normal reason. The return value of this function is not checked.

Link to this callback handle_fwup_message(fwup_message)
handle_fwup_message(fwup_message()) :: :ok

Called whenever a message comes from a FWUP stream. The return value of this function is not checked.

Link to this callback update_available(update_data)
update_available(update_data()) ::
  :apply | :ignore | {:reschedule, pos_integer()}

Called before an update is downloaded and applied. May return one of:

  • apply - Download and apply the update right now.
  • ignore - Don’t download this update now or ever.
  • {:reschedule, timeout} -> Don't donload the update. Call this function again intimeout` milliseconds.