maix.network.wifi

maix.network.wifi module

You can use maix.network.wifi to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

Variable

Function

list_devices

def list_devices() -> list[str]

List WiFi interfaces

item description
return WiFi interface list, string type

C++ defination code:

std::vector<std::string> list_devices()

Class

AP_Info

WiFi AP info

C++ defination code:

class AP_Info

ssid

WiFi AP info SSID

item description
type var
static False
readonly False

C++ defination code:

std::vector<uint8_t> ssid

bssid

WiFi AP info BSSID

item description
type var
static False
readonly False

C++ defination code:

std::string bssid

security

WiFi AP info security

item description
type var
static False
readonly False

C++ defination code:

std::string security

channel

WiFi AP info channel

item description
type var
static False
readonly False

C++ defination code:

int channel

frequency

WiFi AP info frequency

item description
type var
static False
readonly False

C++ defination code:

int frequency

rssi

WiFi AP info rssi

item description
type var
static False
readonly False

C++ defination code:

int rssi

ssid_str

def ssid_str(self) -> str

WiFi AP info ssid_str

item description
type func
static False

C++ defination code:

std::string ssid_str()

Wifi

Wifi class

C++ defination code:

class Wifi

__init__

def __init__(self, iface: str = 'wlan0') -> None

Wifi class

item description
type func
param iface: wifi interface name, default is wlan0
static False

C++ defination code:

Wifi(std::string iface = "wlan0")

get_ip

def get_ip(self) -> str

Get current WiFi ip

item description
type func
return ip, string type, if network not connected, will return empty string.
static False

C++ defination code:

std::string get_ip()

get_mac

def get_mac(self) -> str

Get current WiFi MAC address

item description
type func
return ip, string type.
static False

C++ defination code:

std::string get_mac()

get_ssid

def get_ssid(self, from_cache: bool = True) -> str

Get current WiFi SSID

item description
type func
param from_cache: if true, will not read config from file, direct use ssid in cache.
attention, first time call this method will auto matically read config from file, and if call connect method will set cache.
return SSID, string type.
static False

C++ defination code:

std::string get_ssid(bool from_cache = true)

get_gateway

def get_gateway(self) -> str

Get current WiFi ip

item description
type func
return ip, string type, if network not connected, will return empty string.
static False

C++ defination code:

std::string get_gateway()

start_scan

def start_scan(self) -> maix.err.Err

WiFi start scan AP info around in background.

item description
type func
return If success, return err.Err.ERR_NONE, else means failed.
static False

C++ defination code:

err::Err start_scan()

get_scan_result

def get_scan_result(self) -> list[AP_Info]

Get WiFi scan AP info.

item description
type func
return wifi.AP_Info list.
static False

C++ defination code:

std::vector<network::wifi::AP_Info> get_scan_result()

stop_scan

def stop_scan(self) -> None

Stop WiFi scan AP info.

item description
type func
static False

C++ defination code:

void stop_scan()

connect

def connect(self, ssid: str, password: str, wait: bool = True, timeout: int = 60) -> maix.err.Err

Connect to WiFi AP.

item description
type func
param ssid: SSID of AP
password: password of AP, if no password, leave it empty.
wait: wait for got IP or failed or timeout.
timeout: connect timeout internal, unit second.
return If success, return err.Err.ERR_NONE, else means failed.
static False

C++ defination code:

err::Err connect(const std::string &ssid, const std::string &password, bool wait = true, int timeout = 60)

disconnect

def disconnect(self) -> maix.err.Err

Disconnect from WiFi AP.

item description
type func
return If success, return err.Err.ERR_NONE, else means failed.
static False

C++ defination code:

err::Err disconnect()

is_connected

def is_connected(self) -> bool

See if WiFi is connected to AP.

item description
type func
return If connected return true, else false.
static False

C++ defination code:

bool is_connected()

start_ap

def start_ap(self, ssid: str, password: str, mode: str = 'g', channel: int = 0, ip: str = '192.168.66.1', netmask: str = '255.255.255.0', hidden: bool = False) -> maix.err.Err

Start WiFi AP.

item description
type func
param ssid: SSID of AP.
password: password of AP, if no password, leave it empty.
ip: ip address of hostap, default empty string means auto generated one according to hardware.
netmask: netmask, default 255.255.255.0, now only support 255.255.255.0 .
mode: WiFi mode, default g(IEEE 802.11g (2.4 GHz)), a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz).
channel: WiFi channel number, 0 means auto select. MaixCAM not support auto, will default channel 1.
hidden: hidden SSID or not.
return If success, return err.Err.ERR_NONE, else means failed.
static False

C++ defination code:

err::Err start_ap(const std::string &ssid, const std::string &password,
                          std::string mode = "g", int channel = 0,
                          const std::string &ip = "192.168.66.1", const std::string &netmask = "255.255.255.0",
                          bool hidden = false)

stop_ap

def stop_ap(self) -> maix.err.Err

Stop WiFi AP.

item description
type func
return If success, return err.Err.ERR_NONE, else means failed.
static False

C++ defination code:

err::Err stop_ap()

is_ap_mode

def is_ap_mode(self) -> bool

Whether WiFi is AP mode

item description
type func
return True if AP mode now, or False.
static False

C++ defination code:

bool is_ap_mode()