-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmqtt_task.h
49 lines (44 loc) · 1.79 KB
/
mqtt_task.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __MQTT_TASK_H__
#define __MQTT_TASK_H__
/**
* @brief Structure holding the MQTT client configuration parameters.
*
* This structure contains all the necessary information required to connect
* to an MQTT broker, including the broker's IP address, port, device details,
* and security certificates.
*/
typedef struct
{
char *broker_ip; /**< IP address of the MQTT broker */
char *broker_port; /**< Port number of the MQTT broker */
char *device_name; /**< Name of the device connecting to the broker */
char *topic; /**< Topic to subscribe or publish to */
char *ca_cert_file; /**< Path to the CA certificate file for TLS */
char *client_cert_file; /**< Path to the client's certificate file for TLS */
char *client_key_file; /**< Path to the client's private key file for TLS */
} mqtt_config_t;
/**
* @brief Function implementing the MqttClientSubTask thread.
*
* This function runs as a separate thread and handles the MQTT client's
* subscription-related tasks, including message handling and topic management.
* It continuously listens for incoming MQTT messages on subscribed topics.
*
* @param[in] arg Pointer to arguments required by the thread (if any).
*
* @retval Pointer to the result of the thread execution or NULL.
*/
void *mqtt_sub_task(void *arg);
/**
* @brief Function implementing the MqttClientPubTask thread.
*
* This function runs as a separate thread and handles the MQTT client's
* publishing tasks. It is responsible for sending messages to specified
* MQTT topics based on the application's needs.
*
* @param[in] arg Pointer to arguments required by the thread (if any).
*
* @retval Pointer to the result of the thread execution or NULL.
*/
void *mqtt_pub_task(void *arg);
#endif