Skip to content

Commit 92bbdbb

Browse files
authored
Merge pull request #6329 from TeemuKultala/callback_changes
Cellular: add callback API
2 parents 1580774 + bd75d53 commit 92bbdbb

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

features/cellular/framework/API/CellularNetwork.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,30 @@ class CellularNetwork : public NetworkInterface
381381
* @return NSAPI_ERROR_OK on success, negative error code on failure
382382
*/
383383
virtual nsapi_error_t get_operator_params(int &format, operator_t &operator_params) = 0;
384+
385+
/** Register callback for status reporting
386+
*
387+
* The specified status callback function will be called on status changes
388+
* on the network. The parameters on the callback are the event type and
389+
* event-type dependent reason parameter.
390+
*
391+
* @param status_cb The callback for status changes
392+
*/
393+
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) = 0;
394+
395+
/** Get the connection status
396+
*
397+
* @return The connection status according to ConnectionStatusType
398+
*/
399+
virtual nsapi_connection_status_t get_connection_status() const = 0;
400+
401+
/** Set blocking status of connect() which by default should be blocking
402+
*
403+
* @param blocking true if connect is blocking
404+
* @return 0 on success, negative error code on failure
405+
*/
406+
virtual nsapi_error_t set_blocking(bool blocking) = 0;
407+
384408
};
385409

386410
} // namespace mbed

0 commit comments

Comments
 (0)