1 /*
2  * Copyright (C) 2015-2018 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __IOTX_OTA_H__
6 #define __IOTX_OTA_H__
7 
8 #include "ota_api.h"
9 
10 typedef struct {
11     const char *product_key; /* point to product key */
12     const char *device_name; /* point to device name */
13 
14     uint32_t id;                /* message id */
15     IOT_OTA_State_t state;      /* OTA state */
16     IOT_OTA_Type_t type;        /* OTA Type */
17     uint32_t size_last_fetched; /* size of last downloaded */
18     uint32_t size_fetched;      /* size of already downloaded */
19     uint32_t size_file;         /* size of file */
20     char *purl;                 /* point to URL */
21     char *version;              /* point to string */
22     char md5sum[33];            /* MD5 string */
23 
24     void *md5;       /* MD5 handle */
25     void *sha256;    /* Sha256 handle */
26     void *ch_signal; /* channel handle of signal exchanged with OTA server */
27     void *ch_fetch;  /* channel handle of download */
28 
29     /* cota */
30     char *configId;
31     uint32_t configSize;
32     char *sign;
33     char *signMethod;
34     char *cota_url;
35     char *getType;
36     int err; /* last error code */
37     ota_event_fpt ota_event_cb;
38 } OTA_Struct_t, *OTA_Struct_pt;
39 
40 int iotx_ota_get_config(void *handle, const char *configScope,
41                         const char *getType, const char *attributeKeys);
42 
43 int iotx_req_image(void *handle, const char *version);
44 
45 #endif /* #ifndef __IOTX_OTA_H__ */
46