View Source VintageNetWiFi.WPASupplicantLL (vintage_net_wifi v0.12.5)
This modules provides a low-level interface for interacting with the wpa_supplicant
Example use:
iex> {:ok, ws} = VintageNetWiFi.WPASupplicantLL.start_link(path: "/tmp/vintage_net/wpa_supplicant/wlan0", notification_pid: self())
{:ok, #PID<0.1795.0>}
iex> VintageNetWiFi.WPASupplicantLL.control_request(ws, "ATTACH")
{:ok, "OK
"}
iex> VintageNetWiFi.WPASupplicantLL.control_request(ws, "SCAN")
{:ok, "OK
"}
iex> flush
{VintageNetWiFi.WPASupplicant, 51, "CTRL-EVENT-SCAN-STARTED "}
{VintageNetWiFi.WPASupplicant, 51, "CTRL-EVENT-BSS-ADDED 0 78:8a:20:87:7a:50"}
{VintageNetWiFi.WPASupplicant, 51, "CTRL-EVENT-SCAN-RESULTS "}
{VintageNetWiFi.WPASupplicant, 51, "CTRL-EVENT-NETWORK-NOT-FOUND "}
:ok
iex> VintageNetWiFi.WPASupplicantLL.control_request(ws, "BSS 0")
{:ok,
"id=0
bssid=78:8a:20:82:7a:50
freq=2437
beacon_int=100
capabilities=0x0431
qual=0
noise=-89
level=-71
tsf=0000333220048880
age=14
ie=0008426f7062654c414e010882848b968c1298240301062a01003204b048606c0b0504000a00002d1aac011bffffff00000000000000000001000000000000000000003d1606080c000000000000000000000000000000000000007f080000000000000040dd180050f2020101000003a4000027a4000042435e0062322f00dd0900037f01010000ff7fdd1300156d00010100010237e58106788a20867a5030140100000fac040100000fac040100000fac020000
flags=[WPA2-PSK-CCMP][ESS]
ssid=HelloWiFi
snr=18
est_throughput=48000
update_idx=1
beacon_ie=0008426f7062654c414e010882848b968c1298240301060504010300002a01003204b048606c0b0504000a00002d1aac011bffffff00000000000000000001000000000000000000003d1606080c000000000000000000000000000000000000007f080000000000000040dd180050f2020101000003a4000027a4000042435e0062322f00dd0900037f01010000ff7fdd1300156d00010100010237e58106788a20867a5030140100000fac040100000fac040100000fac020000
"}
Summary
Functions
Returns a specification to start this module under a supervisor.
Start the WPASupplicant low-level interface
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec control_request(GenServer.server(), binary()) :: {:ok, binary()} | {:error, any()}
@spec start_link(path: Path.t(), notification_pid: pid()) :: GenServer.on_start()
Start the WPASupplicant low-level interface
Pass the path to the wpa_supplicant control file.
Notifications from the wpa_supplicant are sent to the process that calls this.