vintage_net v0.6.0 VintageNet.WiFi.WPASupplicantLL View Source
This modules provides a low-level interface for interacting with the wpa_supplicant
Example use:
iex> {:ok, ws} = VintageNet.WiFi.WPASupplicantLL.start_link("/tmp/vintage_net/wpa_supplicant/wlan0")
{:ok, #PID<0.1795.0>}
iex> VintageNet.WiFi.WPASupplicantLL.subscribe(ws)
:ok
iex> VintageNet.WiFi.WPASupplicantLL.control_request(ws, "ATTACH")
{:ok, "OK
"}
iex> VintageNet.WiFi.WPASupplicantLL.control_request(ws, "SCAN")
{:ok, "OK
"}
iex> flush
{VintageNet.WiFi.WPASupplicant, 51, "CTRL-EVENT-SCAN-STARTED "}
{VintageNet.WiFi.WPASupplicant, 51, "CTRL-EVENT-BSS-ADDED 0 78:8a:20:87:7a:50"}
{VintageNet.WiFi.WPASupplicant, 51, "CTRL-EVENT-SCAN-RESULTS "}
{VintageNet.WiFi.WPASupplicant, 51, "CTRL-EVENT-NETWORK-NOT-FOUND "}
:ok
iex> VintageNet.WiFi.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=BopbeLAN
snr=18
est_throughput=48000
update_idx=1
beacon_ie=0008426f7062654c414e010882848b968c1298240301060504010300002a01003204b048606c0b0504000a00002d1aac011bffffff00000000000000000001000000000000000000003d1606080c000000000000000000000000000000000000007f080000000000000040dd180050f2020101000003a4000027a4000042435e0062322f00dd0900037f01010000ff7fdd1300156d00010100010237e58106788a20867a5030140100000fac040100000fac040100000fac020000
"}
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Start the WPASupplicant low-level interface
Subscribe to wpa_supplicant notifications
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
control_request(server, request)
View Sourcecontrol_request(GenServer.server(), binary()) :: {:ok, binary()} | {:error, any()}
Start the WPASupplicant low-level interface
Pass the path to the wpa_supplicant control file
Link to this function
subscribe(server, pid \\ self())
View Sourcesubscribe(GenServer.server(), pid()) :: :ok
Subscribe to wpa_supplicant notifications