vintage_net_wizard v0.1.5 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

Functions

List out access points

Apply the configurations saved in the backend to the system.

Returns a specification to start this module under a supervisor.

Get the current state of the WiFi configuration

Get the current configuration status

Get a list of the current configurations

Delete the configuration by ssid

Return information about the device for the web page's footer

Reset the backend to an initial default state.

Save a WiFiConfiguration to the backend

Pass list of SSIDs (priority_order), sort the configurations to match that order.

Start scanning for WiFi access points

Stop scanning for WiFi access points

Subscribe to messages from the backend

Callbacks

Get all the access points that the backend knowns about

Apply the WiFi configurations

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
configuration_status() :: :not_configured | :good | :bad

Link to this section Functions

List out access points

Link to this function

apply()

View Source
apply() :: :ok | {:error, :no_configurations}

Apply the configurations saved in the backend to the system.

Returns a specification to start this module under a supervisor.

See Supervisor.

Get the current state of the WiFi configuration

Get the current configuration status

Get a list of the current configurations

Link to this function

delete_configuration(ssid)

View Source
delete_configuration(String.t()) :: :ok

Delete the configuration by ssid

Link to this function

device_info()

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

Return information about the device for the web page's footer

Reset the backend to an initial default state.

Save a WiFiConfiguration to the backend

Link to this function

set_priority_order(priority_order)

View Source
set_priority_order([String.t()]) :: :ok

Pass list of SSIDs (priority_order), sort the configurations to match that order.

Link to this function

start_link(backend)

View Source
start_link(backend :: module()) :: GenServer.on_start()
Link to this function

start_scan()

View Source
start_scan() :: :ok

Start scanning for WiFi access points

Link to this function

stop_scan()

View Source
stop_scan() :: :ok

Stop scanning for WiFi access points

Link to this function

subscribe()

View Source
subscribe() :: :ok

Subscribe to messages from the backend

Link to this section Callbacks

Link to this callback

access_points(state)

View Source
access_points(state :: any()) :: [VintageNet.WiFi.AccessPoint.t()]

Get all the access points that the backend knowns about

Link to this callback

apply(list, state)

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

Apply the WiFi configurations

Link to this callback

configuration_status(state)

View Source
configuration_status(state :: any()) :: configuration_status()

Return the configuration status of a configuration that has been applied

Link to this callback

device_info()

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

Return information about the device for populating the web UI footer

Link to this callback

handle_info(any, state)

View Source
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}

Link to this callback

init()

View Source
init() :: state :: any()

Do any initialization work like subscribing to messages

Link to this callback

reset()

View Source
reset() :: state :: any()

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

Link to this callback

start_scan(state)

View Source
start_scan(state :: any()) :: state :: any()

Start scanning for WiFi access points

Link to this callback

stop_scan(state)

View Source
stop_scan(state :: any()) :: state :: any()

Stop the scan for WiFi access points