pynq.lib.wifi Module

The pynq.lib.wifi module is a python module for interacting with WiFI adapters. This module can be used to connect and disconnect to wireless networks.

class pynq.lib.wifi.Wifi(interface='wlan0')[source]

Bases: object

This class controls the WiFi connection.

For USB WiFi, RALink RT5370 devices are recommended.

Note

Administrator rights are necessary to create network interface file

wifi_port

string identifier of the wireless network device

Type:str
connect(ssid, password, auto=False, force=False)[source]

Make a new wireless connection.

This function creates a wireless connection using network ssid and WPA passphrase. Wrong ssid or passphrase will reject the connection.

Parameters:
  • ssid (str) – Unique identifier of the wireless network
  • password (str) – String WPA passphrase necessary to access the network
  • auto (bool) – Whether to set the interface as auto connected after boot.
  • force (bool) – By default the function will only show a warning if a connection already exists. Set this parameter to True to forcefully kill the existing connection and create a new one
Returns:

Return type:

None

gen_network_file(ssid, password, auto=False)[source]

Generate the network authentication file.

Generate the file from network SSID and WPA passphrase

Parameters:
  • ssid (str) – String unique identifier of the wireless network
  • password (str) – String WPA passphrase necessary to access the network
  • auto (bool) – Whether to set the interface as auto connected after boot.
Returns:

Return type:

None

reset()[source]

Shutdown the network connection.

This function shutdown the network connection and delete the interface file.

Returns:
Return type:None