vintage_net v0.6.0 VintageNet.Technology.WiFi View Source
Support for common Wi-Fi interface configurations
Configurations for this technology are maps with a :type
field set
to VintageNet.Technology.WiFi
. The following additional fields
are supported:
:wifi
- WiFi options:ipv4
- IPv4 options. See VintageNet.IP.IPv4Config.
To scan for WiFi networks it's sufficient to pass an empty configuration:
%{type: VintageNet.Technology.WiFi}
Here's a typical configuration for connecting to a WPA2-protected Wi-Fi network:
%{
type: VintageNet.Technology.WiFi,
wifi: %{
mode: :client,
networks: [%{ssid: "my_network_ssid", key_mgmt: :wpa_psk, psk: "a_passphrase_or_psk"}]
},
ipv4: %{method: :dhcp}
}
If your Wi-Fi adapter or module has support for running as an Access Point, then the following configuration puts it in AP mode, assigns a static IP address of 192.168.0.1 and gives clients IP addresses from 192.168.0.30 to 192.168.0.254.
%{
type: VintageNet.Technology.WiFi,
wifi: %{
mode: :host,
networks: [
%{
ssid: "test ssid",
key_mgmt: :none
}
]
},
ipv4: %{
method: :static,
address: {192, 168, 0, 1},
prefix_length: 24
},
dhcpd: %{
start: {192, 168, 0, 30},
end: {192, 168, 0, 254}
}
}
To enable verbose log messages from the wpa_supplicant
, add verbose: true
to the
configuration.