@@ -133,29 +133,39 @@ class NetworkInterface: public DNS {
133
133
*/
134
134
virtual nsapi_error_t set_dhcp (bool dhcp);
135
135
136
- /* * Start the interface .
136
+ /* * Connect to a network .
137
137
*
138
- * This blocks until connection is established, but asynchronous operation can be enabled
139
- * by calling NetworkInterface::set_blocking(false).
138
+ * This blocks until connection is established, but asynchronous operation can be enabled
139
+ * by calling NetworkInterface::set_blocking(false).
140
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.
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
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.
145
+ * NetworkInterface internally handles reconnections until disconnect() is called.
146
+ *
147
+ * @return NSAPI_ERROR_OK if connection established in blocking mode.
148
+ * @return NSAPI_ERROR_OK if asynchronous operation started.
149
+ * @return NSAPI_ERROR_BUSY if asynchronous operation cannot be started.
150
+ Implementation guarantees event generation, which can be used as an
151
+ trigger to reissue the rejected request.
152
+ * @return NSAPI_ERROR_IS_CONNECTED if already connected.
153
+ * @return negative error code on failure.
149
154
*/
150
155
virtual nsapi_error_t connect () = 0;
151
156
152
- /* * Stop the interface.
157
+ /* * Disconnect from the network
153
158
*
154
159
* This blocks until interface is disconnected, unless interface is set to
155
160
* asynchronous (non-blocking) mode by calling NetworkInterface::set_blocking(false).
156
161
*
157
- * @return NSAPI_ERROR_OK on success, or if asynchronous operation started.
158
- @ @return negative error code on failure.
162
+ * @return NSAPI_ERROR_OK on successfully disconnected in blocking mode.
163
+ * @return NSAPI_ERROR_OK if asynchronous operation started.
164
+ * @return NSAPI_ERROR_BUSY if asynchronous operation cannot be started.
165
+ Implementation guarantees event generation, which can be used as an
166
+ trigger to reissue the rejected request.
167
+ * @return NSAPI_ERROR_NO_CONNECTION if already disconnected.
168
+ * @return negative error code on failure.
159
169
*/
160
170
virtual nsapi_error_t disconnect () = 0;
161
171
@@ -249,10 +259,15 @@ class NetworkInterface: public DNS {
249
259
*/
250
260
virtual nsapi_connection_status_t get_connection_status () const ;
251
261
252
- /* * Set blocking status of connect() which by default should be blocking .
262
+ /* * Set asynchronous operation of connect() and disconnect() calls .
253
263
*
254
- * @param blocking Use true to make connect() blocking.
255
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
264
+ * By default, interfaces are in synchronous mode which means that
265
+ * connect() or disconnect() blocks until it reach the target state or requested operation fails.
266
+ *
267
+ * @param blocking Use true to set NetworkInterface in asynchronous mode.
268
+ * @return NSAPI_ERROR_OK on success
269
+ * @return NSAPI_ERROR_UNSUPPORTED if driver does not support asynchronous mode.
270
+ * @return negative error code on failure.
256
271
*/
257
272
virtual nsapi_error_t set_blocking (bool blocking);
258
273
0 commit comments