net: lib: mqtt: Enable blocking PUBLISH payload readout
It is convenient to have a blocking version of `mqtt_read_publish_payload` function, for cases when it is called from the event handler. Therefore, extend the 'mqtt_read_publish_payload' argument list with information whether the call should block or not. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
6f19d00659
commit
b8494d9a51
8 changed files with 61 additions and 17 deletions
|
@ -698,6 +698,20 @@ int mqtt_input(struct mqtt_client *client);
|
|||
int mqtt_read_publish_payload(struct mqtt_client *client, void *buffer,
|
||||
size_t length);
|
||||
|
||||
/**
|
||||
* @brief Blocking version of @ref mqtt_read_publish_payload function.
|
||||
*
|
||||
* @param[in] client Client instance for which the procedure is requested.
|
||||
* Shall not be NULL.
|
||||
* @param[out] buffer Buffer where payload should be stored.
|
||||
* @param[in] length Length of the buffer, in bytes.
|
||||
*
|
||||
* @return Number of bytes read or a negative error code (errno.h) indicating
|
||||
* reason of failure.
|
||||
*/
|
||||
int mqtt_read_publish_payload_blocking(struct mqtt_client *client, void *buffer,
|
||||
size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue