wpa_supplicant v0.2.0 WpaSupplicant
Summary
Functions
Get a reference to the GenEvent event manager in use by this supplicant
Send a request to the wpa_supplicant
This is a helper function that will initiate a scan, wait for the scan to complete and return a list of all of the available access points. This can take a while if the wpa_supplicant hasn’t scanned for access points recently
Tell the wpa_supplicant to connect to the specified network. Invoke like this
Start and link a WpaSupplicant process that uses the specified control socket. A GenEvent will be spawned for managing wpa_supplicant events. Call event_manager/1 to get the GenEvent pid
Start and link a WpaSupplicant that uses the specified control socket and GenEvent event manager
Return the current status of the wpa_supplicant. It wraps the STATUS command
Functions
Send a request to the wpa_supplicant.
Examples
iex> WpaSupplicant.request(pid, :PING)
:PONG
This is a helper function that will initiate a scan, wait for the scan to complete and return a list of all of the available access points. This can take a while if the wpa_supplicant hasn’t scanned for access points recently.
Tell the wpa_supplicant to connect to the specified network. Invoke like this:
iex> WpaSupplicant.set_network(pid, ssid: "MyNetworkSsid", key_mgmt: :WPA_PSK, psk: "secret")
or like this:
iex> WpaSupplicant.set_network(pid, %{ssid: "MyNetworkSsid", key_mgmt: :WPA_PSK, psk: "secret"})
Many options are supported, but it is likely that ssid
and psk
are
the most useful. The full list can be found in the wpa_supplicant
documentation. Here’s a list of some common ones:
Option | Description
———————————|——————
:ssid | Network name. This is mandatory.
:key_mgmt | The security in use. This is mandatory. Set to :NONE, :WPA_PSK
:proto | Protocol use use. E.g., :WPA2
:psk | WPA preshared key. 8-63 chars or the 64 char one as processed by wpa_passphrase
:bssid | Optional BSSID. If set, only associate with the AP with a matching BSSID
:mode | Mode: 0 = infrastructure (default), 1 = ad-hoc, 2 = AP
:frequency | Channel frequency. e.g., 2412 for 802.11b/g channel 1
:wep_key0..3 | Static WEP key
:wep_tx_keyidx | Default WEP key index (0 to 3)
Note that this is a helper function that wraps several low level calls and is limited to specifying only one network at a time. If you’d like to register multiple networks with the supplicant, send the ADD_NETWORK, SET_NETWORK, SELECT_NETWORK messages manually.
Start and link a WpaSupplicant process that uses the specified control socket. A GenEvent will be spawned for managing wpa_supplicant events. Call event_manager/1 to get the GenEvent pid.
Start and link a WpaSupplicant that uses the specified control socket and GenEvent event manager.