vintage_net_wizard v0.2.3 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
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
configuration_status()
View Sourceconfiguration_status() :: :not_configured | :good | :bad
Link to this section Functions
access_points()
View Sourceaccess_points() :: [VintageNetWiFi.AccessPoint.t()]
List out access points
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
configurations()
View Sourceconfigurations() :: [VintageNetWizard.WiFiConfiguration.t()]
Get a list of the current configurations
delete_configuration(ssid)
View Sourcedelete_configuration(String.t()) :: :ok
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(config)
View Sourcesave(VintageNetWizard.WiFiConfiguration.t()) :: :ok | {:error, any()}
Save a WiFiConfiguration
to the backend
set_priority_order(priority_order)
View Sourceset_priority_order([String.t()]) :: :ok
Pass list of SSIDs (priority_order
), sort the configurations
to match that order.
start_link(backend)
View Sourcestart_link(backend :: module()) :: GenServer.on_start()
Start scanning for WiFi access points
Stop scanning for WiFi access points
Subscribe to messages from the backend
Link to this section Callbacks
access_points(state)
View Sourceaccess_points(state :: any()) :: [VintageNetWiFi.AccessPoint.t()]
Get all the access points that the backend knowns about
apply(list, state)
View Sourceapply([VintageNetWizard.WiFiConfiguration.t()], state :: any()) :: {:ok, state :: any()} | {:error, :invalid_state}
Apply the WiFi configurations
complete(list, state)
View Sourcecomplete([VintageNetWizard.WiFiConfiguration.t()], state :: any()) :: {:ok, state :: any()}
Perform final completion steps.
configuration_status(state)
View Sourceconfiguration_status(state :: any()) :: configuration_status()
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
If you want the socket to send data to the client
return {:reply, message, state}
, otherwise return
{:noreply, state}
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