1 /*
2  * Copyright (c) 2024 Analog Devices, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __MQTT_CLIENT_H__
8 #define __MQTT_CLIENT_H__
9 
10 /** MQTT connection timeouts */
11 #define MSECS_NET_POLL_TIMEOUT	5000
12 #define MSECS_WAIT_RECONNECT	1000
13 
14 /** MQTT connection status flag */
15 extern bool mqtt_connected;
16 
17 /**
18  *  @brief Initialise the MQTT client & broker configuration
19  */
20 int app_mqtt_init(struct mqtt_client *client);
21 
22 /**
23  *  @brief Blocking function that establishes connectivity to the MQTT broker
24  */
25 void app_mqtt_connect(struct mqtt_client *client);
26 
27 /**
28  *  @brief  Subscribes to user-defined MQTT topics and continuously
29  *          processes incoming data while the MQTT connection is active
30  */
31 void app_mqtt_run(struct mqtt_client *client);
32 
33 /**
34  *  @brief   Subscribe to user-defined MQTT topics
35  */
36 int app_mqtt_subscribe(struct mqtt_client *client);
37 
38 /**
39  *  @brief  Publish MQTT payload
40  */
41 int app_mqtt_publish(struct mqtt_client *client);
42 
43 #endif /* __MQTT_CLIENT_H__ */
44