@@ -33,7 +33,14 @@ class CAccessPoint {
3333
3434
3535
36-
36+ /* *
37+ * @brief Class to manage Wi-Fi connectivity and operations.
38+ *
39+ * The `CWifi` class provides an interface to manage Wi-Fi operations such as connecting
40+ * to networks, setting up an access point, retrieving network information, and more.
41+ * It interfaces with a modem to execute commands related to Wi-Fi functionality and manages
42+ * connection settings such as IP address, DNS, and other network configurations.
43+ */
3744class CWifi {
3845private:
3946 void _config (IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1, IPAddress dns2);
@@ -206,148 +213,225 @@ class CWifi {
206213 */
207214 void end (void );
208215
209- /*
210- * Get the interface MAC address.
211- *
212- * return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
216+
217+ /* *
218+ * @brief Retrieves the MAC address of the device.
219+ *
220+ * This function retrieves the MAC address of the device based on its current operating mode.
221+ * The value returned by this function is meaningfull only if called afert a
222+ * begin (both begin or beginAP) or a ScanNetwork function otherwise
223+ * an empty mac address is returned.
213224 *
214- * the value returned by this function is meaningfull only if called
215- * afert a begin (both begin or beginAP) or a ScanNetwork function
216- * otherwise an empty mac address is returned
225+ * @param `_mac` A pointer to a uint8_t array where the MAC address will be stored.
226+ *
227+ * @return uint8_t* The pointer to the array containing the MAC address.
217228 */
218229 uint8_t * macAddress (uint8_t * mac);
219230
220- /*
221- * Get the interface IP address.
222- *
223- * return: IP address value
231+ /* *
232+ * @brief Retrieves the local IP address of the device.
233+ *
234+ * This function retrieves the local IP address of the device. It checks the current mode (station or soft AP)
235+ * and retrieves the appropriate IP address based on the mode.
236+ *
237+ * @return `IPAddress` The local IP address of the device.
224238 */
225239 IPAddress localIP ();
226240
227- /*
228- * Get the interface subnet mask address.
229- *
230- * return: subnet mask address value
241+ /* *
242+ * @brief Retrieves the subnet mask of the device.
243+ *
244+ * This function retrieves the subnet mask of the device by querying the modem for the subnet information.
245+ * It sends a command to the modem to fetch the subnet mask and returns it as an `IPAddress` object.
246+ *
247+ * @return `IPAddress` The subnet mask address value of the device.
231248 */
232249 IPAddress subnetMask ();
233250
234- /*
235- * Get the gateway IP address.
236- *
237- * return: gateway IP address value
238- */
251+ /* *
252+ * @brief Retrieves the gateway IP address of the device.
253+ *
254+ * This function retrieves the gateway IP address of the device by querying the modem for the gateway
255+ * information. It sends a command to the modem to fetch the gateway IP address and returns it as an
256+ * `IPAddress` object.
257+ *
258+ * @return `IPAddress` The gateway IP address value of the device.
259+ */
239260 IPAddress gatewayIP ();
240261
262+ /* *
263+ * @brief Retrieves the DNS IP address.
264+ *
265+ * @param `n` The index of the DNS server to retrieve, `0` for the primary DNS server
266+ * and `1` for the secondary DNS server.
267+ *
268+ * @return `IPAddress` The DNS IP address as an `IPAddress` object, or `0.0.0.0` if not found.
269+ */
241270 IPAddress dnsIP (int n = 0 );
242271
243- /*
244- * Get the interface the AP IP address.
245- *
246- * return: IP address value
272+
273+ /* *
274+ * @brief Retrieves the IP address of the soft access point (AP).
275+ *
276+ * @return `IPAddress` The IP address of the soft AP as an `IPAddress` object, or `0.0.0.0` if not found.
247277 */
248278 IPAddress softAPIP ();
249279
250- /*
251- * Return the current SSID associated with the network
252- *
253- * return: ssid string
280+ /* *
281+ * @brief Retrieves the SSID of the current Wi-Fi connection or SoftAP.
282+ *
283+ * @return The SSID of the current Wi-Fi connection or SoftAP as a string.
284+ * If unable to retrieve the SSID, returns an empty string.
254285 */
255286 const char * SSID ();
256287
257- /*
258- * Return the current BSSID associated with the network.
259- *
260- * return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
261- */
288+ /* *
289+ * @brief Retrieves the BSSID (MAC address) of the currently connected Wi-Fi network.
290+ *
291+ * @param `bssid` A pointer to an array where the BSSID will be stored. The array must be large enough to hold the MAC address.
292+ *
293+ * @return A pointer to the `bssid` array containing the retrieved BSSID. If the BSSID cannot be retrieved, returns `nullptr`.
294+ */
262295 uint8_t * BSSID (uint8_t * bssid);
263296
264- /*
265- * Return the current RSSI/ Received Signal Strength in dBm)
266- * associated with the network
267- *
268- * return: signed value
269- */
297+ /* *
298+ * @brief Retrieves the RSSI ( Received Signal Strength Indicator) of the currently connected Wi-Fi network.
299+ *
300+ * @return The RSSI value representing the signal strength. A higher (less negative) value indicates a stronger signal.
301+ * If the RSSI cannot be retrieved, returns 0.
302+ */
270303 int32_t RSSI ();
271304
272- /*
273- * Return the current SSID associated with to the soft AP
274- *
275- * return: ssid string
305+ /* *
306+ * @brief Retrieves the SSID (Service Set Identifier) of the SoftAP (Software Access Point) mode.
307+ *
308+ * @ return The SSID of the SoftAP. If the SSID cannot be retrieved, an empty string is returned.
276309 */
277310 const char * softAPSSID ();
278311
279-
280- /*
281- * Start scan WiFi networks available
282- *
283- * return: Number of discovered networks
312+ /* *
313+ * @brief Scans for available Wi-Fi networks and stores the information in the `access_points` list.
314+ *
315+ * This function initiates a scan for nearby Wi-Fi networks and retrieves details such as SSID, BSSID,
316+ * RSSI (signal strength), channel, and encryption mode for each detected access point.
317+ *
318+ * @return The number of networks found during the scan. Returns a negative value in case of an error.
284319 */
285320 int8_t scanNetworks ();
286321
287- /*
288- * Return the SSID discovered during the network scan.
289- *
290- * param networkItem: specify from which network item want to get the information
291- *
292- * return: SSID string of the specified item on the networks scanned list
322+ /* *
323+ * @brief Retrieves the SSID of a specific Wi-Fi network from the scan results .
324+ *
325+ * @ param ` networkItem` The index of the network in the list of scanned access points.
326+ *
327+ * @ return The SSID of the specified network, or `nullptr` if the index is out of bounds.
293328 */
294329 const char * SSID (uint8_t networkItem);
295330
296- /*
297- * Return the encryption type of the networks discovered during the scanNetworks
298- *
299- * param networkItem: specify from which network item want to get the information
300- *
301- * return: encryption type (enum wl_enc_type) of the specified item on the networks scanned list
302-
303-
304-
331+ /* *
332+ * @brief Returns the encryption type for a specified network.
333+ *
334+ * This function retrieves the encryption type of a specific Wi-Fi access point
335+ * based on its index in the list of scanned networks.
336+ *
337+ * @param `networkItem` The index of the network in the list of available access points.
338+ *
339+ * @return The encryption type in numeric form (e.g., 0 for no encryption,
340+ * 1 for WEP, 2 for WPA, etc.). Returns 0 if the network item index is invalid.
305341 */
306342 uint8_t encryptionType (uint8_t networkItem);
343+
344+ /* *
345+ * @brief Returns the encryption type of the currently connected Wi-Fi network.
346+ *
347+ * @return The encryption type in numeric form (e.g., 0 for no encryption, 1 for WEP, 2 for WPA, etc.).
348+ * Returns `ENC_TYPE_UNKNOWN` if the encryption type cannot be determined.
349+ */
307350 uint8_t encryptionType ();
308351
352+ /* *
353+ * @brief Retrieves the BSSID of a specific Wi-Fi network.
354+ *
355+ * This function retrieves the BSSID (MAC address) of the Wi-Fi network at the specified
356+ * index from the list of available networks. The BSSID is stored in the provided
357+ * array of 6 bytes.
358+ *
359+ * @param `networkItem` The index of the Wi-Fi network in the list of available networks.
360+ * @param `bssid` A pointer to a byte array (of size 6) where the BSSID will be stored.
361+ *
362+ * @return A pointer to the `bssid` array if the BSSID is successfully retrieved,
363+ * or `nullptr` if the network index is out of range.
364+ */
309365 uint8_t * BSSID (uint8_t networkItem, uint8_t * bssid);
366+
367+ /* *
368+ * @brief Retrieves the channel number of a specific Wi-Fi network.
369+ *
370+ * @param `networkItem` The index of the Wi-Fi network in the list of available networks.
371+ *
372+ * @return The channel number of the specified network, or `0` if the network index
373+ * is out of range.
374+ */
310375 uint8_t channel (uint8_t networkItem);
311376
312- /*
313- * Return the RSSI of the networks discovered during the scanNetworks
314- *
315- * param networkItem: specify from which network item want to get the information
316- *
317- * return: signed value of RSSI of the specified item on the networks scanned list
377+ /* *
378+ * @brief Retrieves the RSSI (Received Signal Strength Indicator) of the networks discovered during the scanNetworks.
379+ *
380+ * @param `networkItem` The index of the Wi-Fi network in the list of available networks.
381+ *
382+ * @return The RSSI value of the specified network in dBm, or `-1000` if the network index
383+ * is out of range.
318384 */
319385 int32_t RSSI (uint8_t networkItem);
320386
321- /*
322- * Return Connection status.
323- *
324- * return: one of the value defined in wl_status_t
387+ /* *
388+ * @brief Retrieves the current connection status of the Wi-Fi connection .
389+ *
390+ * @ return One of the values defined in wl_status_t
325391 */
326392 uint8_t status ();
327393
328- /*
329- * Return The deauthentication reason code.
394+ /* *
395+ * @brief Retrieves The deauthentication reason code.
330396 *
331- * return: the deauthentication reason code
397+ * @ return The deauthentication reason code.
332398 */
333399 uint8_t reasonCode ();
334400
335- /*
336- * Resolve the given hostname to an IP address.
337- * param aHostname: Name to be resolved
338- * param aResult: IPAddress structure to store the returned IP address
339- * result: 1 if aIPAddrString was successfully converted to an IP address,
340- * else error code
401+ /* *
402+ * @brief Resolves a hostname to an IP address.
403+ *
404+ * @param `aHostname` The hostname to resolve (e.g., "www.example.com").
405+ * @param `aResult` IPAddress structure to store the returned IP address result:
406+ * 1 if aIPAddrString was successfully converted to an IP address, else error code
407+ *
408+ * @return Returns `1` if the hostname was successfully resolved, `0` otherwise.
341409 */
342410 int hostByName (const char * aHostname, IPAddress& aResult);
343411
412+ /* *
413+ * @brief Retrieves the current time from the modem.
414+ *
415+ * @return The current time value in seconds, or `0` if the time could not be retrieved.
416+ */
344417 unsigned long getTime ();
345418
419+ /* *
420+ * @brief Sets the timeout value for the WiFi connection.
421+ *
422+ * @param `timeout` The timeout value in milliseconds.
423+ */
346424 void setTimeout (unsigned long timeout);
347425
348426
349427};
350428
429+ /* *
430+ * @brief Global instance of the CWifi class.
431+ *
432+ * This external declaration provides access to a global instance of the `CWifi` class, which
433+ * facilitates interaction with the WiFi module.
434+ */
351435extern CWifi WiFi;
352436
353437
0 commit comments