blob: ebcd03c0dd67d207e34b24af0330191acfb33bd7 [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 * callback function define, used to get upgrade state and rate of process
37 */
38typedef int(*ql_fota_cb_f)(int state, int percent);
39
40
41/*******************************************************************************
42* @brief fota initialize
43 @param
44 @return
45 if success return 0, else return -1
46 *******************************************************************************/
47int ql_fota_init(void);
48
49
50/*******************************************************************************
51* @brief fota de-initialize
52 @param
53 @return
54 if success return 0, else return -1
55 *******************************************************************************/
56int ql_fota_deinit(void);
57
58
59/*******************************************************************************
60* @brief set fota callback
61 @param
62 cb: callback function
63 @return
64 if success return 0, else return -1
65 *******************************************************************************/
66int ql_fota_set_cb(ql_fota_cb_f cb);
67
68
69/*******************************************************************************
70* @brief fota initialize
71 @param
72 otasize: The OTA firmware size
73 @return
74 if success return 0, else return -1
75 *******************************************************************************/
76int ql_fota_start(unsigned int otasize);
77
78
79/*******************************************************************************
80* @brief write fota firmware data
81 @param
82 buffer: The buffer
83 size : Data length in buffer
84 @return
85 if success return 0, else return -1
86 *******************************************************************************/
87int ql_fota_write(unsigned char *buffer, unsigned int size);
88
89
90/*******************************************************************************
91* @brief get fota state
92 @param
93 state: fota state, refer to fota_state_t
94 @return
95 if success return 0, else return -1
96 *******************************************************************************/
97int ql_fota_get_state(fota_state_t *state);
98
99
100/*******************************************************************************
101* @brief set fota state
102 @param
103 state: fota state, refer to fota_state_t
104 @return
105 if success return 0, else return -1
106 *******************************************************************************/
107int ql_fota_set_state(fota_state_t state);
108
109
110/*******************************************************************************
111* @brief finish fota process
112 @param
113 @return
114 if success return 0, else return -1
115 *******************************************************************************/
116int ql_fota_done(void);
117
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif //__QL_FOTA_H__