vintage_net_wizard v0.3.0 VintageNetWizard.Backend behaviour View Source

Backends define the boundaries of getting access points, handling incoming messages, and scanning the network

Link to this section Summary

Callbacks

Get all the access points that the backend knowns about

Apply the WiFi configurations

Perform final completion steps.

Return the configuration status of a configuration that has been applied

Return information about the device for populating the web UI footer

Handle any message the is received by another process

Do any initialization work like subscribing to messages

Apply any actions required to set the backend back to an initial default state

Start scanning for WiFi access points

Stop the scan for WiFi access points

Link to this section Types

Link to this type

configuration_status()

View Source

Specs

configuration_status() :: :not_configured | :good | :bad

Link to this section Callbacks

Specs

access_points(state :: any()) :: [VintageNetWiFi.AccessPoint.t()]

Get all the access points that the backend knowns about

Specs

apply([VintageNetWizard.WiFiConfiguration.t()], state :: any()) ::
  {:ok, state :: any()} | {:error, :invalid_state}

Apply the WiFi configurations

Specs

complete([VintageNetWizard.WiFiConfiguration.t()], state :: any()) ::
  {:ok, state :: any()}

Perform final completion steps.

Link to this callback

configuration_status(state)

View Source

Specs

configuration_status(state :: any()) :: configuration_status()

Return the configuration status of a configuration that has been applied

Specs

device_info() :: [{String.t(), String.t()}]

Return information about the device for populating the web UI footer

Specs

handle_info(any(), state :: any()) ::
  {:reply, any(), state :: any()} | {:noreply, state :: any()}

Handle any message the is received by another process

If you want the socket to send data to the client return {:reply, message, state}, otherwise return {:noreply, state}

Specs

init() :: state :: any()

Do any initialization work like subscribing to messages

Specs

reset() :: state :: any()

Apply any actions required to set the backend back to an initial default state

Specs

start_scan(state :: any()) :: state :: any()

Start scanning for WiFi access points

Specs

stop_scan(state :: any()) :: state :: any()

Stop the scan for WiFi access points