Skip to content

Commit c116b89

Browse files
GPT fix
1 parent 45de986 commit c116b89

File tree

2 files changed

+82
-13
lines changed

2 files changed

+82
-13
lines changed

libraries/WiFiS3/src/StringHelpers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ void split(std::vector<std::string> &res, std::string &str, const std::string &d
5858
* This function attempts to remove the first occurrence of the specified substring
5959
* (`what`) from the beginning of the string (`str`). Before performing the removal,
6060
* 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
61+
* beginning of the string, it is removed, and the function returns `true`. Otherwise the
6362
* function returns `false`.
6463
*
6564
* @param `str` is a reference to the string from which the substring will be removed.

libraries/WiFiS3/src/WiFiClient.h

Lines changed: 81 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,122 @@
3333
class WiFiClient : public Client {
3434

3535
public:
36+
/**
37+
* @brief Default constructor for the WiFiClient class.
38+
*/
3639
WiFiClient();
40+
3741
/* this constructor is not intended to be called outside of the Server class */
42+
/**
43+
* @brief Constructor to initialize a WiFiClient object with a specific socket.
44+
*
45+
* @param `s` is the socket descriptor to associate with this client.
46+
*/
3847
WiFiClient(int s);
48+
49+
/**
50+
* @brief Copy constructor for the WiFiClient class.
51+
*
52+
* @param `c` is the `WiFiClient` object to copy.
53+
*/
3954
WiFiClient(const WiFiClient& c);
4055
~WiFiClient();
4156

57+
4258
/**
43-
* @brief Establish a connection to a remote server using the specified IP address and port number.
59+
* @brief Establishes a connection to a server using an IP address and port.
60+
*
61+
* This function initiates a connection to a server using the specified IP address
62+
* and port. Internally, it converts the IP address to a string and delegates
63+
* the connection task to the `connect(const char*, uint16_t)` method.
64+
*
65+
* @param ip The IP address of the server to connect to.
66+
* @param port The port number on the server to connect to.
67+
*
68+
* @return `1` on a successful connection, `0` on failure.
69+
*/
70+
71+
/**
72+
* @brief Establishes a connection to a server using an IP address and port.
73+
*
74+
* @param Using `ip` as the IP address of the server to connect to.
75+
* And `port` as the port number on the server to connect to.
76+
*
77+
* @return `1` on a successful connection, `0` on failure.
4478
*/
4579
virtual int connect(IPAddress ip, uint16_t port);
4680

4781
/**
48-
* @brief Establish a connection to a remote server.
82+
* @brief Establishes a connection to a server using a hostname and port.
4983
*
50-
* @param Uses the specified domain name or IP address `host` and `port` for port number.
84+
* @param `host` is a pointer to a null-terminated string containing the hostname of the server.
85+
* And `port` is the port number on the server to connect to.
86+
*
87+
* @return `1` if the connection was successful, `0` otherwise.
5188
*/
5289
virtual int connect(const char *host, uint16_t port);
53-
90+
5491
/**
55-
* @brief Writes a single byte of data to the connected client.
92+
* @brief Sends a single byte of data to the connected server.
93+
*
94+
* @param `b` being the byte of data to send.
95+
*
96+
* @return The number of bytes successfully written, which is `1` on success or `0` on failure.
5697
*/
5798
virtual size_t write(uint8_t);
5899

59100
/**
60-
* @brief Writes a buffer of data to the connected client.
101+
* @brief Writes a buffer of data to the connected server.
61102
*
62103
* @param Takes a pointer to a buffer `buf` containing the data to be written
63104
* and the size of the buffer `size` as parameters.
64105
*
65-
* @return The function writes the data in the buffer to the connected client
66-
* and returns the number of bytes written.
106+
* @return The number of bytes successfully written, or `0` if the write operation fails.
67107
*/
68108
virtual size_t write(const uint8_t *buf, size_t size);
69109

70110
/**
71-
* @brief Checks how many bytes are available for reading from the connected client.
111+
* @brief Checks the number of bytes available for reading from the server.
112+
*
113+
* @return The number of bytes available to read. Returns `0` if no data is
114+
* available, or if the socket is invalid.
72115
*/
73116
virtual int available();
74117

75118
/**
76-
* @brief Reads a single byte of data from the connected client.
119+
* @brief Reads a single byte of data from the server.
120+
*
121+
* @return The byte read as an `int` (0–255). Returns `-1` if no data is available
122+
* or if an error occurs.
77123
*/
78124
virtual int read();
79125

80126
/**
81-
* @brief Reads a specified number of bytes from the connected client into a buffer.
127+
* @brief Reads multiple bytes of data from the server into a buffer.
128+
*
129+
* This function retrieves data from the server's receive buffer and stores it
130+
* into the provided array. It attempts to read up to the specified number of
131+
* bytes (`size`). The function stops reading if no more data is available or
132+
* if an error occurs.
133+
*
134+
* @param[out] buf Pointer to the buffer where the data will be stored.
135+
* @param[in] size Maximum number of bytes to read.
136+
* @return The number of bytes successfully read into the buffer.
137+
* Returns `0` if no data is available or if the socket is invalid.
138+
*/
139+
140+
/**
141+
* @brief Reads multiple bytes of data from the server into a buffer.
142+
*
143+
* This function retrieves data from the server's receive buffer and stores it
144+
* into the provided array. It attempts to read up to the specified number of
145+
* bytes (`size`).
146+
*
147+
* @param[out] `buf` is a pointer to the buffer where the data will be stored.
148+
* @param[in] `size` is the maximum number of bytes to read.
149+
*
150+
* @return The number of bytes successfully read into the buffer.
151+
* Returns `0` if no data is available or if the socket is invalid.
82152
*/
83153
virtual int read(uint8_t *buf, size_t size);
84154

0 commit comments

Comments
 (0)