blob: b07cbafe9f5dc50fa7d731129d20f1e55a233aba [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/**
2 @file
3 ql_fota.h
4
5 @brief
6 This file provides the definitions for device, and declares the
7 API functions.
8
9*/
10/*============================================================================
11 Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
12 Quectel Wireless Solution Proprietary and Confidential.
13 =============================================================================*/
14/*===========================================================================
15
16 EDIT HISTORY FOR MODULE
17
18This section contains comments describing changes made to the module.
19Notice that changes are listed in reverse chronological order.
20
21
22WHEN WHO WHAT, WHERE, WHY
23---------- ------------ ----------------------------------------------------
2425/11/2021 jessie.lei create
25=============================================================================*/
26#ifndef __QL_FOTA_H__
27#define __QL_FOTA_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "fota_info.h"
34
35
36/*
37 * callback function define, used to get upgrade state and rate of process
38 */
39typedef int(*ql_fota_cb_f)(int state, int percent);
40
41
42/*******************************************************************************
43* @brief fota initialize
44 @param
45 @return
46 if success return 0, else return -1
47 *******************************************************************************/
48int ql_fota_init(void);
49
50
51/*******************************************************************************
52* @brief fota de-initialize
53 @param
54 @return
55 if success return 0, else return -1
56 *******************************************************************************/
57int ql_fota_deinit(void);
58
59
60/*******************************************************************************
61* @brief set fota callback
62 @param
63 cb: callback function
64 @return
65 if success return 0, else return -1
66 *******************************************************************************/
67int ql_fota_set_cb(ql_fota_cb_f cb);
68
69
70/*******************************************************************************
71* @brief fota initialize
72 @param
73 otasize: The OTA firmware size
74 @return
75 if success return 0, else return -1
76 *******************************************************************************/
77int ql_fota_start(unsigned int otasize);
78
79
80/*******************************************************************************
81* @brief write fota firmware data
82 @param
83 buffer: The buffer
84 size : Data length in buffer
85 @return
86 if success return 0, else return -1
87 *******************************************************************************/
88int ql_fota_write(unsigned char *buffer, unsigned int size);
89
90
91/*******************************************************************************
92* @brief get fota state
93 @param
94 state: fota state, refer to fota_state_t
95 @return
96 if success return 0, else return -1
97 *******************************************************************************/
98int ql_fota_get_state(fota_state_t *state);
99
100
101/*******************************************************************************
102* @brief set fota state
103 @param
104 state: fota state, refer to fota_state_t
105 @return
106 if success return 0, else return -1
107 *******************************************************************************/
108int ql_fota_set_state(fota_state_t state);
109
110
111/*******************************************************************************
112* @brief finish fota process
113 @param
114 @return
115 if success return 0, else return -1
116 *******************************************************************************/
117int ql_fota_done(void);
118
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif //__QL_FOTA_H__