Skip to content

Commit 45de986

Browse files
Added API tags
1 parent 12a02c9 commit 45de986

File tree

6 files changed

+252
-87
lines changed

6 files changed

+252
-87
lines changed

libraries/WiFiS3/src/Modem.h

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,47 @@ class ModemClass {
1919

2020
public:
2121
/**
22-
* Initializes an instance of the `ModemClass` class with
22+
* @param Initializes an instance of the `ModemClass` class with
2323
* specific transmit (tx) and receive (rx) pins for communication.
2424
*/
2525
ModemClass(int tx, int rx);
2626
ModemClass(UART * _serial);
2727
~ModemClass();
2828

2929
/**
30-
* Initializes the modem communication with a specified baud rate. By default,
31-
* the baud rate is set to 115200. Call function after creating an instance of the
30+
* @brief Initializes the modem communication with a specified baud rate.
31+
*
32+
* @param The baud rate is set to 115200. Call function after creating an instance of the
3233
* `ModemClass` to set up the communication parameters before sending or receiving data.
3334
*/
3435
void begin(int badurate = 115200);
3536

3637
/**
37-
* Shutts down the modem communication and releases any resources that were allocated during the
38-
* communication process.
38+
* @brief Shutts down the modem communication and releases any
39+
* resources that were allocated during the communication process.
3940
*/
4041
void end();
4142

4243
/**
43-
* Sends a command to the modem and waits for a response.
44-
* It takes a command string `cmd`, a string `str` where the response will be stored
44+
* @brief Sends a command to the modem and waits for a response.
45+
*
46+
* @param It takes a command string `cmd`, a string `str` where the response will be stored
4547
* and a format string `fmt` along with additional arguments.
4648
*/
4749
bool write(const std::string &cmd, std::string &str, const char * fmt, ...);
4850

4951
/**
50-
* Used to send a command to the modem without waiting for a response.
51-
* It takes a command string `cmd`, a string `str` where the response will be stored,
52+
* @brief Used to send a command to the modem without waiting for a response.
53+
*
54+
* @param It takes a command string `cmd`, a string `str` where the response will be stored,
5255
* and a format string `fmt` along with additional arguments.
5356
*/
5457
void write_nowait(const std::string &cmd, std::string &str, const char * fmt, ...);
5558

5659
/**
57-
* Sends binary data directly to the modem without any processing or interpretation.
58-
* It takes a pointer to the binary `data` and the `size` of the data as arguments.
60+
* @brief Sends binary data directly to the modem without any processing or interpretation.
61+
*
62+
* @param It takes a pointer to the binary `data` and the `size` of the data as arguments.
5963
* Used for sending raw binary commands or data to the modem for operations that
6064
* require direct communication without any additional formatting or parsing.
6165
*/
@@ -69,8 +73,8 @@ class ModemClass {
6973

7074

7175
/**
72-
* When this function is called, it enables a specific mode of reading
73-
* where the size of the data to be read is considered for processing.
76+
* @brief Enables a specific mode of reading where the size of the data
77+
* to be read is considered for processing.
7478
*/
7579
void read_using_size() {
7680
read_by_size = true;
@@ -93,7 +97,7 @@ class ModemClass {
9397
}
9498

9599
/**
96-
* Used to disable debugging output for the modem communication.
100+
* @brief Used to disable debugging output for the modem communication.
97101
*/
98102
void noDebug() {
99103
_serial_debug = nullptr;
@@ -106,8 +110,9 @@ class ModemClass {
106110
#endif
107111

108112
/**
109-
* Sets the timeout value for communication operations.
110-
* Can be called with a specified timeout value in milliseconds.
113+
* @brief Sets the timeout value for communication operations.
114+
*
115+
* @param Can be called with a specified timeout value in milliseconds.
111116
*/
112117
void timeout(size_t timeout_ms) {_timeout = timeout_ms;}
113118

libraries/WiFiS3/src/StringHelpers.h

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,68 @@
66
#include <algorithm>
77

88
/**
9-
* Trims whitespace characters from the beginning (left side) of the input string `s`.
9+
* @brief Trims whitespace characters from the beginning of a string.
10+
*
11+
* @param `s` is the string from which leading whitespace characters will be removed.
12+
* The function modifies this string directly.
1013
*/
1114
void ltrim(std::string &s);
1215

13-
// trim from end (in place)
16+
/**
17+
* @brief Trims trailing whitespace characters from a string.
18+
*
19+
* @param `s` the string from which trailing whitespace characters will be removed.
20+
* The function modifies this string directly.
21+
*/
1422
void rtrim(std::string &s);
1523

16-
// trim from both ends (in place)
24+
25+
/**
26+
* @brief Trims whitespace characters from both ends of a string.
27+
*
28+
* This function removes any leading and trailing whitespace characters (spaces,
29+
* tabs, etc.) from the given string. It modifies the string in place, erasing
30+
* whitespace from both the beginning and the end of the string.
31+
*
32+
* @param `s` is the string from which both leading and trailing whitespace characters
33+
* will be removed. The function modifies this string directly.
34+
*/
1735
void trim(std::string &s);
1836

1937
/**
20-
* Takes a string `str` and splits it into substrings based on a specified `delimiter`.
21-
* The resulting substrings are stored in the `res` vector of strings.
38+
* @brief Takes a string and splits it into substrings.
39+
*
40+
* This function splits a string into multiple substrings, storing each substring
41+
* as an element in the `res` vector. The string is split at each occurrence of
42+
* the specified delimiter. Optionally, the function can trim whitespace from
43+
* each token before storing it in the result vector.
44+
*
45+
* @param `res` is a reference to a vector of strings where the resulting tokens
46+
* will be stored.
47+
* `str` is the string to be split. This string will be modified as it is
48+
* split.
49+
* `delimiter` is the delimiter string that separates the tokens in `str`.
50+
* `_trim` is a boolean flag indicating whether to trim whitespace from each
51+
* token. If true, leading and trailing whitespace will be removed from each token. Defaults to true.
2252
*/
2353
void split(std::vector<std::string> &res, std::string &str, const std::string &delimiter, bool _trim = true);
2454

2555
/**
26-
* Checks if the input string `str` starts with the specified string `what`. If `str` starts
27-
* with `what`, the function removes `what` from the beginning of `str` and returns `true`.
56+
* @brief Removes a specified substring from the beginning of a string.
57+
*
58+
* This function attempts to remove the first occurrence of the specified substring
59+
* (`what`) from the beginning of the string (`str`). Before performing the removal,
60+
* it trims leading whitespace from the string. If the substring is found at the
61+
* beginning of the string, it is removed, and the function returns `true`. If the
62+
* substring is not found at the beginning, the string remains unchanged, and the
63+
* function returns `false`.
64+
*
65+
* @param `str` is a reference to the string from which the substring will be removed.
66+
* The string is modified if the substring is removed.
67+
* `what` is the substring to be removed from the beginning of `str`.
68+
*
69+
* @return `true` if the substring was found and removed from the beginning of
70+
* the string, `false` otherwise.
2871
*/
2972
bool removeAtBegin(std::string &str, const std::string &what);
3073

libraries/WiFiS3/src/WiFiClient.h

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,64 +40,68 @@ class WiFiClient : public Client {
4040
~WiFiClient();
4141

4242
/**
43-
* Establish a connection to a remote server using the specified IP address and port number.
43+
* @brief Establish a connection to a remote server using the specified IP address and port number.
4444
*/
4545
virtual int connect(IPAddress ip, uint16_t port);
4646

4747
/**
48-
* Establish a connection to a remote server
49-
* using the specified host (domain name or IP address) and port number.
48+
* @brief Establish a connection to a remote server.
49+
*
50+
* @param Uses the specified domain name or IP address `host` and `port` for port number.
5051
*/
5152
virtual int connect(const char *host, uint16_t port);
5253

5354
/**
54-
* Writes a single byte of data to the connected client.
55+
* @brief Writes a single byte of data to the connected client.
5556
*/
5657
virtual size_t write(uint8_t);
5758

5859
/**
59-
* Writes a buffer of data to the connected client.
60-
* Takes a pointer to a buffer `buf` containing the data to be written
60+
* @brief Writes a buffer of data to the connected client.
61+
*
62+
* @param Takes a pointer to a buffer `buf` containing the data to be written
6163
* and the size of the buffer `size` as parameters.
62-
* The function writes the data in the buffer to the connected client
64+
*
65+
* @return The function writes the data in the buffer to the connected client
6366
* and returns the number of bytes written.
6467
*/
6568
virtual size_t write(const uint8_t *buf, size_t size);
6669

6770
/**
68-
* Checks how many bytes are available for reading from the connected client.
71+
* @brief Checks how many bytes are available for reading from the connected client.
6972
*/
7073
virtual int available();
7174

7275
/**
73-
* Reads a single byte of data from the connected client.
76+
* @brief Reads a single byte of data from the connected client.
7477
*/
7578
virtual int read();
7679

7780
/**
78-
* Reads a specified number of bytes from the connected client into a buffer.
81+
* @brief Reads a specified number of bytes from the connected client into a buffer.
7982
*/
8083
virtual int read(uint8_t *buf, size_t size);
8184

8285
/**
83-
* Peeks at the next byte of incoming data without removing it from the internal buffer.
86+
* @brief Peeks at the next byte of incoming data without removing it from the internal buffer.
8487
*/
8588
virtual int peek();
8689

8790
/**
88-
* Clears any buffered outgoing data that has not been sent to the connected client.
91+
* @brief Clears any buffered outgoing data that has not been sent to the connected client.
8992
*/
9093
virtual void flush();
9194

9295
/**
93-
* Closes the connection to the remote server.
94-
* Terminates the connection and release any resources associated with it.
96+
* @brief Closes the connection to the remote server
97+
* and releases any resources associated with it.
9598
*/
9699
virtual void stop();
97100

98101
/**
99-
* Checks whether the client is currently connected to a remote server.
100-
* Returns a `uint8_t` value indicating the connection status of the client.
102+
* @brief Checks whether the client is currently connected to a remote server.
103+
*
104+
* @return Returns a `uint8_t` value indicating the connection status of the client.
101105
*/
102106
virtual uint8_t connected();
103107

@@ -111,19 +115,19 @@ class WiFiClient : public Client {
111115
};
112116

113117
/**
114-
* Returns the IP address of the remote server to which the client is connected.
118+
* @return Returns the IP address of the remote server to which the client is connected.
115119
*/
116120
virtual IPAddress remoteIP();
117121

118122
/**
119-
* Returns the port number of the remote server for the connetec client.
123+
* @return Returns the port number of the remote server for the connetec client.
120124
*/
121125
virtual uint16_t remotePort();
122126

123127
/**
124-
* Sets the connection timeout value for the client.
125-
* It takes an integer `timeout` as a parameter which determines how long the client will wait
126-
* for a connection to be established before timing out.
128+
* @brief Sets the connection timeout value for the client.
129+
* @param It takes an integer `timeout` as a parameter which determines how long the
130+
* client will wait for a connection to be established before timing out.
127131
*/
128132
void setConnectionTimeout(int timeout) {
129133
_connectionTimeout = timeout;

libraries/WiFiS3/src/WiFiFileSystem.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,38 @@ class WiFiFileSystem {
2828

2929
public:
3030
/**
31-
* Initializes objects of the `WiFiFileSystem` class.
31+
* @brief Initializes objects of the `WiFiFileSystem` class.
3232
*/
3333
WiFiFileSystem();
3434

3535
/**
36-
* Mounts the file system.
37-
* If `format_on_fault` is set to `true`,
36+
* @brief Mounts the file system and optionally formats it on failure.
37+
*
38+
* @param If `format_on_fault` is set to `true`,
3839
* the file system will be formatted if a fault occurs during mounting.
3940
*/
4041
void mount(bool format_on_fault = false);
4142

4243
/**
43-
* Writes data to a file in the file system.
44+
* @brief Writes data to a file in the file system.
45+
*
46+
* @param `name` is the name of the file to which the data will be written.
47+
* A pointer `data` to the data that will be written to the file.
48+
* `size` is the number of bytes to write from the provided data buffer.
49+
* `operation` determines the type of file operation to perform (e.g., create, overwrite).
50+
*
51+
* @return Returns the number of bytes successfully written. Returns 0 if the operation fails.
4452
*/
4553
size_t writefile(const char* name, const char* data, size_t size, int operation = WIFI_FILE_WRITE);
46-
54+
4755
/**
48-
* Reads data from a file in the file system.
49-
* It takes a `const char* name` parameter,
50-
* which specifies the name of the file to be read.
56+
* @brief Reads a file from the file system and prints its content.
57+
*
58+
* It sends the read request to the modem, which fetches the data. The content
59+
* is printed to the serial output in chunks, with each chunk being processed
60+
* until the entire file is read.
61+
*
62+
* @param `name` is the name of the file to be read from the file system.
5163
*/
5264
void readfile(const char* name);
5365

0 commit comments

Comments
 (0)