Skip to content

Commit aae6bb1

Browse files
authored
Merge pull request #8836 from SeppoTakalo/clarify_connect_docs
Clarify asynchronous NetworkInterface::connect() documentation
2 parents 7fd4692 + 1b80f6b commit aae6bb1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

features/netsocket/NetworkInterface.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,27 @@ class NetworkInterface: public DNS {
135135

136136
/** Start the interface.
137137
*
138-
* @return NSAPI_ERROR_OK on success, negative error code on failure.
138+
* This blocks until connection is established, but asynchronous operation can be enabled
139+
* by calling NetworkInterface::set_blocking(false).
140+
*
141+
* In asynchronous mode this starts the connection sequence and returns immediately.
142+
* Status of the connection can then checked from NetworkInterface::get_connection_status()
143+
* or from status callbacks.
144+
*
145+
* @return NSAPI_ERROR_OK on success, or if asynchronous operation started.
146+
* @return NSAPI_ERROR_ALREADY if asynchronous connect operation already ongoing.
147+
* @return NSAPI_ERROR_IS_CONNECTED if interface is already connected.
148+
* @return negative error code on failure.
139149
*/
140150
virtual nsapi_error_t connect() = 0;
141151

142152
/** Stop the interface.
143153
*
144-
* @return NSAPI_ERROR_OK on success, negative error code on failure.
154+
* This blocks until interface is disconnected, unless interface is set to
155+
* asynchronous (non-blocking) mode by calling NetworkInterface::set_blocking(false).
156+
*
157+
* @return NSAPI_ERROR_OK on success, or if asynchronous operation started.
158+
@ @return negative error code on failure.
145159
*/
146160
virtual nsapi_error_t disconnect() = 0;
147161

0 commit comments

Comments
 (0)