1 /** @defgroup ota_hal_transport_api
2  * @{
3  *
4  * This is an include file of OTA transport interface.
5  *
6  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
7  */
8 #ifndef OTA_HAL_TRANSPORT_H
9 #define OTA_HAL_TRANSPORT_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /*MQTT*/
16 typedef struct {
17     unsigned short  packet_id;
18     unsigned char   qos;
19     unsigned char   dup;
20     unsigned char   retain;
21     unsigned short  topic_len;
22     unsigned int    payload_len;
23     const char     *ptopic;
24     const char     *payload;
25 } ota_mqtt_topic_t;
26 
27 typedef enum {
28     OTA_MQTT_EVENT_SUB_SUCCESS  = 3,
29     OTA_MQTT_EVENT_PUB_RECEIVED = 12,
30     OTA_MQTT_EVENT_BUF_OVERFLOW = 13,
31 } ota_mqtt_event_t;
32 
33 typedef struct {
34     ota_mqtt_event_t  event;
35     ota_mqtt_topic_t *topic;
36 } ota_mqtt_msg_t;
37 
38 int ota_hal_mqtt_subscribe(void *mqtt_client, char *topic, void* cb, void *ctx);
39 int ota_hal_mqtt_publish(void *mqtt_client, char *topic, int qos, void *data, int len);
40 /**
41  * @}
42  */
43 #ifdef __cplusplus
44 }
45 #endif
46 #endif /*OTA_HAL_TRANSPORT_H*/
47 
48