Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
WiFi Class Referencefinal

Provides an interface for managing WiFi connections on the Rishka system. More...

#include <wifi.h>

Static Public Member Functions

static bool connect (string ssid, string passkey, i32 channel=0, u8 *bssid=nullptr)
 Connects to a WiFi network. More...
 
static bool reconnect ()
 Reconnects to the last connected WiFi network. More...
 
static bool disconnect (bool wifi_off, bool erase_ap)
 Disconnects from the current WiFi network. More...
 
static bool erase_ap ()
 Erases the saved access point data from memory. More...
 
static bool is_connected ()
 Checks if the device is currently connected to a WiFi network. More...
 
static bool set_autoreconnect (bool auto_recon)
 Sets the auto-reconnect feature. More...
 
static bool is_autoreconnect ()
 Checks if the auto-reconnect feature is enabled. More...
 
static u8 wait_for_result (u64 timeout)
 Waits for a WiFi connection result within the specified timeout period. More...
 
static void set_min_security (u8 auth_mode)
 Sets the minimum security level for WiFi connections. More...
 
static void set_scan_method (u8 scan_method)
 Sets the WiFi scanning method. More...
 
static void set_sort_method (u8 sort_method)
 Sets the method for sorting access points in the scan list. More...
 
static u8 status ()
 Retrieves the current status of the WiFi module. More...
 
static string ssid ()
 Retrieves the SSID of the current WiFi network. More...
 
static string psk ()
 Retrieves the Pre-Shared Key (PSK) of the current WiFi network. More...
 
static string bssid ()
 Retrieves the BSSID of the current WiFi access point. More...
 
static i8 rssi ()
 Retrieves the Received Signal Strength Indicator (RSSI) of the current WiFi connection. More...
 
static bool set_local_ip (string ip)
 Sets the local IP address for the WiFi connection. More...
 
static bool set_gateway_ip (string ip)
 Sets the gateway IP address for the WiFi connection. More...
 

Detailed Description

Provides an interface for managing WiFi connections on the Rishka system.

The WiFi class offers a set of static methods for connecting to access points, configuring WiFi parameters, managing connection states, and retrieving WiFi-related information.

Member Function Documentation

◆ bssid()

string WiFi::bssid ( )
static

Retrieves the BSSID of the current WiFi access point.

Returns
The BSSID of the connected WiFi access point, or an empty string if not connected.

This method returns the Basic Service Set Identifier (BSSID) of the access point to which the device is currently connected.

◆ connect()

bool WiFi::connect ( string  ssid,
string  passkey,
i32  channel = 0,
u8 bssid = nullptr 
)
static

Connects to a WiFi network.

Parameters
ssidThe SSID of the WiFi network.
passkeyThe password of the WiFi network.
channelThe WiFi channel to connect to (optional; defaults to 0 for automatic channel selection).
bssidThe BSSID of the access point (optional; defaults to nullptr).
Returns
true if the connection was successful, false otherwise.

This method attempts to connect to the specified WiFi network using the provided SSID and passkey. Optionally, the channel and BSSID can be specified for more precise control over the connection.

◆ disconnect()

bool WiFi::disconnect ( bool  wifi_off,
bool  erase_ap 
)
static

Disconnects from the current WiFi network.

Parameters
wifi_offIf true, turns off the WiFi module after disconnecting.
erase_apIf true, erases the saved access point data after disconnecting.
Returns
true if the disconnection was successful, false otherwise.

This method disconnects from the current WiFi network. Optionally, the WiFi module can be turned off and the saved access point data can be erased.

◆ erase_ap()

bool WiFi::erase_ap ( )
static

Erases the saved access point data from memory.

Returns
true if the data was successfully erased, false otherwise.

This method erases the saved access point data from the device's memory.

◆ is_autoreconnect()

bool WiFi::is_autoreconnect ( )
static

Checks if the auto-reconnect feature is enabled.

Returns
true if auto-reconnect is enabled, false otherwise.

This method returns the status of the auto-reconnect feature.

◆ is_connected()

bool WiFi::is_connected ( )
static

Checks if the device is currently connected to a WiFi network.

Returns
true if the device is connected, false otherwise.

This method returns the connection status of the WiFi module.

◆ psk()

string WiFi::psk ( )
static

Retrieves the Pre-Shared Key (PSK) of the current WiFi network.

Returns
The PSK of the connected WiFi network, or an empty string if not connected.

This method returns the Pre-Shared Key (PSK) of the WiFi network to which the device is connected.

◆ reconnect()

bool WiFi::reconnect ( )
static

Reconnects to the last connected WiFi network.

Returns
true if the reconnection was successful, false otherwise.

This method attempts to reconnect to the last successfully connected WiFi network.

◆ rssi()

i8 WiFi::rssi ( )
static

Retrieves the Received Signal Strength Indicator (RSSI) of the current WiFi connection.

Returns
The RSSI value in dBm, or a negative value if not connected.

This method returns the signal strength (RSSI) of the WiFi network to which the device is connected.

◆ set_autoreconnect()

bool WiFi::set_autoreconnect ( bool  auto_recon)
static

Sets the auto-reconnect feature.

Parameters
auto_reconIf true, enables auto-reconnect; otherwise, disables it.
Returns
true if the operation was successful, false otherwise.

This method enables or disables the auto-reconnect feature, which automatically attempts to reconnect to the WiFi network after a disconnection.

◆ set_gateway_ip()

bool WiFi::set_gateway_ip ( string  ip)
static

Sets the gateway IP address for the WiFi connection.

Parameters
ipThe gateway IP address to assign.
Returns
true if the gateway IP address was successfully set, false otherwise.

This method sets the gateway IP address for the WiFi connection.

◆ set_local_ip()

bool WiFi::set_local_ip ( string  ip)
static

Sets the local IP address for the WiFi connection.

Parameters
ipThe IP address to assign.
Returns
true if the IP address was successfully set, false otherwise.

This method sets the local IP address for the WiFi connection.

◆ set_min_security()

void WiFi::set_min_security ( u8  auth_mode)
static

Sets the minimum security level for WiFi connections.

Parameters
auth_modeThe minimum authentication mode required for connection (e.g., WPA2, WPA3).

This method sets the minimum security level (authentication mode) that is required for connecting to WiFi networks.

◆ set_scan_method()

void WiFi::set_scan_method ( u8  scan_method)
static

Sets the WiFi scanning method.

Parameters
scan_methodThe scan method to use (e.g., fast scan, all-channel scan).

This method configures the scanning method used when searching for WiFi networks.

◆ set_sort_method()

void WiFi::set_sort_method ( u8  sort_method)
static

Sets the method for sorting access points in the scan list.

Parameters
sort_methodThe sort method to use (e.g., by signal strength, by security).

This method configures how the WiFi module sorts the access points found during a scan.

◆ ssid()

string WiFi::ssid ( )
static

Retrieves the SSID of the current WiFi network.

Returns
The SSID of the connected WiFi network, or an empty string if not connected.

This method returns the SSID of the WiFi network to which the device is currently connected.

◆ status()

u8 WiFi::status ( )
static

Retrieves the current status of the WiFi module.

Returns
The current WiFi status (e.g., connected, disconnected, scanning).

This method returns the current status of the WiFi module.

◆ wait_for_result()

u8 WiFi::wait_for_result ( u64  timeout)
static

Waits for a WiFi connection result within the specified timeout period.

Parameters
timeoutThe timeout period in milliseconds.
Returns
The WiFi connection status after the timeout period or upon connection.

This method waits for the result of the WiFi connection attempt, blocking the thread for the specified timeout period. It returns the connection status after the wait period.


The documentation for this class was generated from the following files: