You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# class `CWifi` <aid="class_c_wifi"class="anchor"></a>
78
-
79
-
Class to manage Wi-Fi connectivity and operations.
80
-
81
-
The [CWifi](#class_c_wifi) class provides an interface to manage Wi-Fi operations such as connecting to networks, setting up an access point, retrieving network information, and more. It interfaces with a modem to execute commands related to Wi-Fi functionality and manages connection settings such as IP address, DNS, and other network configurations.
|[`CWifi`](#class_c_wifi_1a64b74dbe44a73d1b7fd4618b5b606c02)| Default constructor for the [CWifi](#class_c_wifi) class. |
88
-
|[`begin`](#class_c_wifi_1a9c4fc0f23a197e9dc5ddf02bc1793c35)| Start WiFi connection for OPEN networks. |
89
-
|[`begin`](#class_c_wifi_1a4a2bf8820b00494648188c7c06871a26)| start WiFi connection with passphrase the most secure supported mode will be automatically selected. |
|[`beginAP`](#class_c_wifi_1ae9059d5f875a96b5cdf19d2cf87e9848)| Starts a Wi-Fi Access Point (AP) with the specified SSID and channel. |
92
-
|[`beginAP`](#class_c_wifi_1aee76c2fbb9f83a3f085b034e80c1025c)| Starts a Wi-Fi Access Point (AP) with the specified SSID and passphrase. |
93
-
|[`beginAP`](#class_c_wifi_1a9e1257e9b28cd3489209d7c7d5ea8845)| Initializes a Wi-Fi Access Point (AP) with the specified SSID, passphrase, and channel. |
94
-
|[`config`](#class_c_wifi_1a75742aab24859611b36e74e08602dc47)| Change IP configuration settings disabling the DHCP client. |
95
-
|[`config`](#class_c_wifi_1ac799224e1f9c65e4808e2c8deb802ead)| Configures the network settings for the Wi-Fi connection with a specified DNS server. |
96
-
|[`config`](#class_c_wifi_1acd5a6e9bb901fb4dbaec311378f99eb6)| Configures the network settings for the Wi-Fi connection with a specified gateway and DNS server. |
97
-
|[`config`](#class_c_wifi_1afc80a6fd238b6d0e59aebb2d27ec8e9e)| Configures the network settings for the Wi-Fi connection with a specified subnet mask, gateway, and DNS server. |
98
-
|[`setDNS`](#class_c_wifi_1a4043b10b6a83cb3add95e127c79056a0)| Sets the primary DNS server for the Wi-Fi connection. |
99
-
|[`setDNS`](#class_c_wifi_1adaa95a2dd3a8bab54080669e612f9d37)| Sets the primary and secondary DNS servers for the Wi-Fi connection. |
100
-
|[`setHostname`](#class_c_wifi_1aece8d82cb1f1a55c0c22a606d66f8ea7)| Sets the hostname for for DHCP requests. |
101
-
|[`disconnect`](#class_c_wifi_1a59591cd8450c695f3588df818fb58d34)| Disconnects from the current Wi-Fi network. |
102
-
|[`end`](#class_c_wifi_1a50a8e7ca94f40d31ea5c9b2def045575)| Resets and disables the Wi-Fi module. |
103
-
|[`macAddress`](#class_c_wifi_1a58ebcdba481cc413f32f06226dba8481)| Retrieves the MAC address of the device. |
104
-
|[`localIP`](#class_c_wifi_1ae6885ef712d13bfcfe54a23f28b2aecb)| Retrieves the local IP address of the device. |
105
-
|[`subnetMask`](#class_c_wifi_1afcdd6b286e90258b5296c8f30f4e7c81)| Retrieves the subnet mask of the device. |
106
-
|[`gatewayIP`](#class_c_wifi_1a775e014fc255686df09b1f40f6cb9453)| Retrieves the gateway IP address of the device. |
107
-
|[`dnsIP`](#class_c_wifi_1a3ee65c20906927f5772b96386d6b5700)| Retrieves the DNS IP address. |
108
-
|[`softAPIP`](#class_c_wifi_1a6e64918a2784cb53588f1553c97dc333)| Retrieves the IP address of the soft access point (AP). |
109
-
|[`SSID`](#class_c_wifi_1a46c576561933d9f067121b81ab8b3806)| Retrieves the SSID of the current Wi-Fi connection or SoftAP. |
110
-
|[`BSSID`](#class_c_wifi_1a9b153ec8de3bd6e95255e94140314ad2)| Retrieves the BSSID (MAC address) of the currently connected Wi-Fi network. |
111
-
|[`RSSI`](#class_c_wifi_1a39a8f1b67aee1a1f52d8c0f2085ebb52)| Retrieves the RSSI (Received Signal Strength Indicator) of the currently connected Wi-Fi network. |
112
-
|[`softAPSSID`](#class_c_wifi_1accf0212b364b4686a4d47f7e6f58485b)| Retrieves the SSID (Service Set Identifier) of the SoftAP (Software Access Point) mode. |
113
-
|[`scanNetworks`](#class_c_wifi_1af31d8a0baaa568178e2091b7a9e830a1)| Scans for available Wi-Fi networks and stores the information in the `access_points` list. |
114
-
|[`SSID`](#class_c_wifi_1a452fefff75ab36097d6f4b6ad401ffcb)| Retrieves the SSID of a specific Wi-Fi network from the scan results. |
115
-
|[`encryptionType`](#class_c_wifi_1ab434b47d2935bf6d0b58ec50d78c3799)| Returns the encryption type for a specified network. |
116
-
|[`encryptionType`](#class_c_wifi_1a8da9fb03f5349f7887d3cdda3268ed8c)| Returns the encryption type of the currently connected Wi-Fi network. |
117
-
|[`BSSID`](#class_c_wifi_1a10793238a64c312f2652b710c693022e)| Retrieves the BSSID of a specific Wi-Fi network. |
118
-
|[`channel`](#class_c_wifi_1a871866aab35d3c10b98e27e51b37d8b6)| Retrieves the channel number of a specific Wi-Fi network. |
119
-
|[`RSSI`](#class_c_wifi_1a86ecf1c49591c18296a6d1b1400954e5)| Retrieves the RSSI (Received Signal Strength Indicator) of the networks discovered during the scanNetworks. |
120
-
|[`status`](#class_c_wifi_1aeeddb0fe0a897d043415a97d363f68e0)| Retrieves the current connection status of the Wi-Fi connection. |
121
-
|[`reasonCode`](#class_c_wifi_1a453afce0d716bb1b92c3d73ba4f621e4)| Retrieves The deauthentication reason code. |
122
-
|[`hostByName`](#class_c_wifi_1a97ef95bf4e58c3c11a88ab03a4702425)| Resolves a hostname to an IP address. |
123
-
|[`getTime`](#class_c_wifi_1a9c3f3a794a063c20b9ef81851226a625)| Retrieves the current time from the modem. |
124
-
|[`setTimeout`](#class_c_wifi_1a53250475083a7537de61d2fc14217345)| Sets the timeout value for the WiFi connection. |
125
-
|[`firmwareVersion`](#class_c_wifi_1a4b2746f36f799c1e075d8f083b8bd6ee)| Get firmware version. |
Initializes a Wi-Fi Access Point (AP) with the specified SSID, passphrase, and channel.
218
-
219
-
This function configures the device as a Wi-Fi Access Point (AP) with the provided parameters. It sets the mode to AP and attempts to start the network.
220
-
221
-
#### Parameters
222
-
*`ssid` The SSID (name) of the Wi-Fi Access Point.
223
-
224
-
*`passphrase` The passphrase for securing the Access Point. If empty, the network will be open.
225
-
226
-
*`channel` The Wi-Fi channel on which the Access Point will operate (1-14, depending on region).
227
-
228
-
#### Returns
229
-
`WL_AP_LISTENING` if the Access Point is successfully started. `WL_AP_FAILED` if the Access Point failed to start.
Configures the network settings for the Wi-Fi connection with a specified DNS server.
251
-
252
-
Sets the device's IP configuration using the specified local IP address and DNS server. The gateway and subnet mask are set to default values based on the provided local IP.
253
-
254
-
#### Parameters
255
-
*`local_ip` The static IP address to assign to the device.
256
-
257
-
*`dns_server` The primary DNS server to use for domain name resolution.
This function retrieves the MAC address of the device based on its current operating mode. The value returned by this function is meaningfull only if called afert a begin (both begin or beginAP) or a ScanNetwork function otherwise an empty mac address is returned.
363
-
364
-
#### Parameters
365
-
*`_mac` A pointer to a uint8_t array where the MAC address will be stored.
366
-
367
-
#### Returns
368
-
uint8_t* The pointer to the array containing the MAC address.
This function retrieves the local IP address of the device. It checks the current mode (station or soft AP) and retrieves the appropriate IP address based on the mode.
This function retrieves the subnet mask of the device by querying the modem for the subnet information. It sends a command to the modem to fetch the subnet mask and returns it as an `IPAddress` object.
394
-
395
-
#### Returns
396
-
`IPAddress` The subnet mask address value of the device.
This function retrieves the gateway IP address of the device by querying the modem for the gateway information. It sends a command to the modem to fetch the gateway IP address and returns it as an `IPAddress` object.
408
-
409
-
#### Returns
410
-
`IPAddress` The gateway IP address value of the device.
Retrieves the RSSI (Received Signal Strength Indicator) of the currently connected Wi-Fi network.
474
-
475
-
#### Returns
476
-
The RSSI value representing the signal strength. A higher (less negative) value indicates a stronger signal. If the RSSI cannot be retrieved, returns 0.
Scans for available Wi-Fi networks and stores the information in the `access_points` list.
498
-
499
-
This function initiates a scan for nearby Wi-Fi networks and retrieves details such as SSID, BSSID, RSSI (signal strength), channel, and encryption mode for each detected access point.
500
-
501
-
#### Returns
502
-
The number of networks found during the scan. Returns a negative value in case of an error.
Returns the encryption type of the currently connected Wi-Fi network.
544
-
545
-
#### Returns
546
-
The encryption type in numeric form (e.g., 0 for no encryption, 1 for WEP, 2 for WPA, etc.). Returns `ENC_TYPE_UNKNOWN` if the encryption type cannot be determined.
This function retrieves the BSSID (MAC address) of the Wi-Fi network at the specified index from the list of available networks. The BSSID is stored in the provided array of 6 bytes.
558
-
559
-
#### Parameters
560
-
* `networkItem` The index of the Wi-Fi network in the list of available networks.
561
-
562
-
* `bssid` A pointer to a byte array (of size 6) where the BSSID will be stored.
563
-
564
-
#### Returns
565
-
A pointer to the `bssid` array if the BSSID is successfully retrieved, or `nullptr` if the network index is out of range.
* `aHostname` The hostname to resolve (e.g., "www.example.com").
632
-
633
-
* `aResult` IPAddress structure to store the returned IP address result: 1 if aIPAddrString was successfully converted to an IP address, else error code
634
-
635
-
#### Returns
636
-
Returns `1` if the hostname was successfully resolved, `0` otherwise.
# class `ModemClass` <aid="class_modem_class"class="anchor"></a>
674
-
675
-
A class that provides methods to interact with a modem.
676
-
677
-
This class is responsible for providing an interface to communicate with a modem through serial communication. It includes methods for initialization, sending and receiving data, and handling modem configurations.
|[`ModemClass`](#class_modem_class_1acce8d910277f180f32607ed8e84f090b)| Constructor for the [ModemClass](#class_modem_class), which initializes the modem with the specified transmit (TX) and receive (RX) pins. |
686
-
|[`ModemClass`](#class_modem_class_1af222286fa398b86d02bd6230e0c42039)| Constructor for the [ModemClass](#class_modem_class), which initializes the modem with the specified UART interface. |
687
-
|[`~ModemClass`](#class_modem_class_1a458f1f4e43e27fdc522caaf4c40d9579)| Destructor for [ModemClass](#class_modem_class). |
688
-
|[`begin`](#class_modem_class_1a36c32d41d4111e5fc63d8bf1a017368f)| Initializes the modem communication with a specified baud rate. |
689
-
|[`end`](#class_modem_class_1a434e5c4b8c67d90c10eff5e20da56556)| Ends the modem communication. |
690
-
|[`write`](#class_modem_class_1acd102543a8544be0686128fea53c9a11)| Sends a formatted command string to a device and stores the response. |
691
-
|[`write_nowait`](#class_modem_class_1aa9923ac664a16c2aaf5024de9de1ef03)| Used to send a command to the modem without waiting for a response. |
692
-
|[`passthrough`](#class_modem_class_1aa8750f17b14472819ffb8016118f869b)| Sends binary data directly to the modem without any processing or interpretation. |
693
-
|[`avoid_trim_results`](#class_modem_class_1ac7aff51f7bb09bbfd7190af1715274f8)| Disables automatic trimming of results for one operation. |
694
-
|[`read_using_size`](#class_modem_class_1a83d1105d39191e2c902331b3f0c4c8f5)| Enables a specific mode of reading where the size of the data to be read is considered for processing. |
Sends a formatted command string to a device and stores the response.
783
-
784
-
This function formats a command string using the provided format and arguments, sends it to a device, and waits for a response, which is stored in the `str` string.
785
-
786
-
#### Parameters
787
-
* `cmd` A string representing the command to be sent to the device.
788
-
789
-
* `str` A reference to a string that will hold the device's response.
790
-
791
-
* `fmt` A format string for constructing the command.
792
-
793
-
#### Returns
794
-
`true` if the command was successfully sent and a response was received, `false` otherwise.
Sends binary data directly to the modem without any processing or interpretation.
816
-
817
-
#### Parameters
818
-
* `It` takes a pointer to the binary `data` and the `size` of the data as arguments. Used for sending raw binary commands or data to the modem for operations that require direct communication without any additional formatting or parsing.
Disables automatic trimming of results for one operation.
828
-
829
-
This function disables the automatic trimming of results for one operation. After it is called, the results will not be trimmed automatically until the function is called again.
Sends a single byte of data to the connected server.
1006
137
1007
138
#### Parameters
1008
-
* `b` being the byte of data to send.
139
+
* `<tt>b</tt>` being the byte of data to send.
1009
140
1010
141
#### Returns
1011
142
The number of bytes successfully written, which is `1` on success or `0` on failure.
@@ -1061,9 +192,9 @@ Reads multiple bytes of data from the server into a buffer.
1061
192
This function retrieves data from the server's receive buffer and stores it into the provided array. It attempts to read up to the specified number of bytes (`size`).
1062
193
1063
194
#### Parameters
1064
-
* `buf` is a pointer to the buffer where the data will be stored.
195
+
* `<tt>buf</tt>` is a pointer to the buffer where the data will be stored.
1065
196
1066
-
* `size` is the maximum number of bytes to read.
197
+
* `<tt>size</tt>` is the maximum number of bytes to read.
1067
198
1068
199
#### Returns
1069
200
The number of bytes successfully read into the buffer. Returns `0` if no data is available or if the socket is invalid.
@@ -1156,7 +287,7 @@ Inequality operator for comparing two `[WiFiClient](#class_wi_fi_client)` object
1156
287
Compares the current `[WiFiClient](#class_wi_fi_client)` object with another `[WiFiClient](#class_wi_fi_client)` object to determine if they represent different socket connections.
1157
288
1158
289
#### Parameters
1159
-
*`whs` is the `[WiFiClient](#class_wi_fi_client)` object to compare with.
290
+
*`<tt>whs</tt>` is the `[WiFiClient](#class_wi_fi_client)` object to compare with.
1160
291
1161
292
#### Returns
1162
293
`true` if both [WiFiClient](#class_wi_fi_client) objects represent different sockets, `false` if they represent the same socket.
*`name` is the name of the file to which the data will be written. A pointer `data` to the data that will be written to the file. `size` is the number of bytes to write from the provided data buffer. `operation` determines the type of file operation to perform (e.g., create, overwrite).
380
+
*`<tt>name</tt>` is the name of the file to which the data will be written. A pointer `data` to the data that will be written to the file. `size` is the number of bytes to write from the provided data buffer. `operation` determines the type of file operation to perform (e.g., create, overwrite).
1250
381
1251
382
#### Returns
1252
383
Returns the number of bytes successfully written. Returns 0 if the operation fails.
@@ -1263,7 +394,7 @@ Reads a file from the file system and prints its content.
1263
394
It sends the read request to the modem, which fetches the data. The content is printed to the serial output in chunks, with each chunk being processed until the entire file is read.
1264
395
1265
396
#### Parameters
1266
-
* `name` is the name of the file to be read from the file system.
397
+
* `<tt>name</tt>` is the name of the file to be read from the file system.
1267
398
<hr />
1268
399
1269
400
# class `WiFiServer` <a id="class_wi_fi_server" class="anchor"></a>
@@ -1315,7 +446,7 @@ WiFiServer(int p)
1315
446
Constructs a [WiFiServer](#class_wi_fi_server) object with the specified port.
1316
447
1317
448
#### Parameters
1318
-
* `p` The port number on which the server will listen for incoming connections.
449
+
* `<tt>p</tt>` The port number on which the server will listen for incoming connections.
@@ -1390,7 +521,7 @@ Writes data to all connected clients.
1390
521
This function sends a buffer of data to all clients connected to the server. It writes the specified number of bytes to the server socket and returns the count of successfully written bytes.
1391
522
1392
523
#### Parameters
1393
-
*`buf` is a pointer to the buffer containing the data to be sent. `size` is the number of bytes to write from the buffer.
524
+
*`<tt>buf</tt>` is a pointer to the buffer containing the data to be sent. `size` is the number of bytes to write from the buffer.
1394
525
1395
526
#### Returns
1396
527
The number of bytes successfully written. Returns 0 if the data could not be sent.
@@ -1449,7 +580,7 @@ Compares two [WiFiServer](#class_wi_fi_server) objects for inequality.
1449
580
This virtual operator compares the underlying socket (`_sock`) of two [WiFiServer](#class_wi_fi_server) objects. It returns `true` if the objects do not refer to the same server connection (i.e., they have different socket values), and `false` otherwise.
1450
581
1451
582
#### Parameters
1452
-
*`whs` The [WiFiServer](#class_wi_fi_server) object to compare against.
583
+
*`<tt>whs</tt>` The [WiFiServer](#class_wi_fi_server) object to compare against.
1453
584
1454
585
#### Returns
1455
586
`true` if the [WiFiServer](#class_wi_fi_server) objects have different sockets; `false` otherwise.
Sets the Certificate Authority (CA) for SSL/TLS verification.
1551
682
1552
683
#### Parameters
1553
-
* `root_ca` is a pointer to a null-terminated string containing the root CA certificate in PEM format. If set to `nullptr`, the default root CA bundle will be used.
684
+
* `<tt>root_ca</tt>` is a pointer to a null-terminated string containing the root CA certificate in PEM format. If set to `nullptr`, the default root CA bundle will be used.
Comparison operator to check equality between two `[WiFiSSLClient](#class_wi_fi_s_s_l_client)` objects.
1711
842
1712
843
#### Parameters
1713
-
*`WiFiSSLClient` object to compare.
844
+
*`<tt>WiFiSSLClient</tt>` object to compare.
1714
845
1715
846
#### Returns
1716
847
`true` if both [WiFiSSLClient](#class_wi_fi_s_s_l_client) objects are equivalent (i.e., they have the same socket), `false` otherwise.
@@ -1727,7 +858,7 @@ Inequality operator to compare two `[WiFiSSLClient](#class_wi_fi_s_s_l_client)`
1727
858
This operator compares the current `[WiFiSSLClient](#class_wi_fi_s_s_l_client)` object with another `[WiFiSSLClient](#class_wi_fi_s_s_l_client)` object to determine if they are not equal, based on their underlying socket or connection.
1728
859
1729
860
#### Parameters
1730
-
*`whs` The [WiFiSSLClient](#class_wi_fi_s_s_l_client) object to compare with.
861
+
*`<tt>whs</tt>` The [WiFiSSLClient](#class_wi_fi_s_s_l_client) object to compare with.
1731
862
1732
863
#### Returns
1733
864
`true` if the two [WiFiSSLClient](#class_wi_fi_s_s_l_client) objects do not represent the same connection (i.e., have different sockets), `false` otherwise.
Sends a buffer of data to the currently opened UDP packet.
1953
1084
1954
1085
#### Parameters
1955
-
*`buffer` A pointer to the buffer containing the data to send.
1086
+
*`<tt>buffer</tt>` A pointer to the buffer containing the data to send.
1956
1087
1957
-
*`size` The number of bytes from the buffer to write.
1088
+
*`<tt>size</tt>` The number of bytes from the buffer to write.
1958
1089
1959
1090
#### Returns
1960
1091
Returns the number of bytes successfully written if the operation is successful. Or `0` if the data was not successfully written, or if the packet was not properly initialized.
0 commit comments