From 8b277d3c34f2613c1e204fcf055ebe91f119715b Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Wed, 1 Feb 2023 14:25:12 +1100 Subject: [PATCH] docs/library/network: Update docs for network.country, network.hostname. Also marks wlan.config(hostname) as deprecated. Signed-off-by: Jim Mussared --- docs/library/network.WLAN.rst | 2 +- docs/library/network.rst | 31 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/library/network.WLAN.rst b/docs/library/network.WLAN.rst index c67319470..d1e620ef0 100644 --- a/docs/library/network.WLAN.rst +++ b/docs/library/network.WLAN.rst @@ -130,7 +130,7 @@ Methods hidden Whether SSID is hidden (boolean) security Security protocol supported (enumeration, see module constants) key Access key (string) - hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP) + hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP). (Deprecated, use :func:`network.hostname` instead) reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited) txpower Maximum transmit power in dBm (integer or float) ============= =========== diff --git a/docs/library/network.rst b/docs/library/network.rst index 0a6f5506e..b13c84123 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -158,12 +158,39 @@ Network functions The following are functions available in the network module. +.. function:: country([code]) + + Get or set the two-letter ISO 3166-1 Alpha-2 country code to be used for + radio compliance. + + If the *code* parameter is provided, the country will be set to this value. + If the function is called without parameters, it returns the current + country. + + The default code ``"XX"`` represents the "worldwide" region. + +.. function:: hostname([name]) + + Get or set the hostname that will identify this device on the network. It is + applied to all interfaces. + + This hostname is used for: + * Sending to the DHCP server in the client request. (If using DHCP) + * Broadcasting via mDNS. (If enabled) + + If the *name* parameter is provided, the hostname will be set to this value. + If the function is called without parameters, it returns the current + hostname. + + The default hostname is typically the name of the board. + .. function:: phy_mode([mode]) Get or set the PHY mode. - If the *mode* parameter is provided, sets the mode to its value. If - the function is called without parameters, returns the current mode. + If the *mode* parameter is provided, the PHY mode will be set to this value. + If the function is called without parameters, it returns the current PHY + mode. The possible modes are defined as constants: * ``MODE_11B`` -- IEEE 802.11b,