KNX IoT
KNX IoT Point API stack implementation
oc_knx_swu.h
Go to the documentation of this file.
1 /*
2 // Copyright (c) 2021-2022 Cascoda Ltd
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
21 #ifndef OC_KNX_SWU_INTERNAL_H
22 #define OC_KNX_SWU_INTERNAL_H
23 
24 #include <stddef.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 typedef enum {
39 
44 typedef enum {
46  0,
60 
66 void oc_create_knx_swu_resources(size_t device);
67 
73 void oc_swu_set_package_name(char *name);
74 
80 void oc_swu_set_last_update(char *time);
81 
87 void oc_swu_set_package_bytes(int package_bytes);
88 
96 void oc_swu_set_package_version(int major, int minor, int minor2);
97 
104 
110 void oc_swu_set_qurl(char *qurl);
111 
118 
132 typedef void (*oc_swu_cb_t)(size_t device, oc_separate_response_t *response,
133  size_t binary_size, size_t block_offset,
134  uint8_t *block_data, size_t block_len, void *data);
135 
149 void oc_set_swu_cb(oc_swu_cb_t cb, void *data);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif /* OC_KNX_SWU_INTERNAL_H */
void oc_swu_set_package_bytes(int package_bytes)
set the current amount of the bytes written
void oc_swu_set_state(oc_swu_state_t state)
sets the current download state
void oc_swu_set_last_update(char *time)
set the current last update time
void oc_swu_set_package_name(char *name)
set the current firmware package name
void oc_create_knx_swu_resources(size_t device)
Creation of the KNX software update resources.
void oc_swu_set_qurl(char *qurl)
sets the url to be queried for downloading
void oc_swu_set_package_version(int major, int minor, int minor2)
Sets the current package version.
void oc_set_swu_cb(oc_swu_cb_t cb, void *data)
Set the software update callback.
void oc_swu_set_result(oc_swu_result_t result)
sets the result of the download procedure
oc_swu_state_t
The software update states.
Definition: oc_knx_swu.h:34
@ OC_SWU_STATE_DOWNLOADING
state is downloading
Definition: oc_knx_swu.h:36
@ OC_SWU_STATE_IDLE
state is idle
Definition: oc_knx_swu.h:35
@ OC_SWU_STATE_DOWNLOADED
state is downloaded
Definition: oc_knx_swu.h:37
oc_swu_result_t
The software result states.
Definition: oc_knx_swu.h:44
@ OC_SWU_RESULT_INIT
0 Initial value.
Definition: oc_knx_swu.h:45
@ OC_SWU_RESULT_ERR_FLASH
2 Not enough flash memory for the new software package.
Definition: oc_knx_swu.h:49
@ OC_SWU_RESULT_ERR_CONN
4 Connection lost during downloading process.
Definition: oc_knx_swu.h:52
@ OC_SWU_RESULT_ERR_SUF
8 Software update failed.
Definition: oc_knx_swu.h:57
@ OC_SWU_RESULT_ERR_ICF
5 Integrity check failure for new downloaded package.
Definition: oc_knx_swu.h:53
@ OC_SWU_RESULT_SUCCESS
1 Software updated successfully.
Definition: oc_knx_swu.h:48
@ OC_SWU_RESULT_ERR_RAM
3 Out of RAM during downloading process
Definition: oc_knx_swu.h:51
@ OC_SWU_RESULT_ERR_UP
9 Unsupported protocol.
Definition: oc_knx_swu.h:58
@ OC_SWU_RESULT_ERR_URL
7 Invalid URL.
Definition: oc_knx_swu.h:56
@ OC_SWU_RESULT_ERR_UPT
6 Unsupported package type.
Definition: oc_knx_swu.h:55
void(* oc_swu_cb_t)(size_t device, oc_separate_response_t *response, size_t binary_size, size_t block_offset, uint8_t *block_data, size_t block_len, void *data)
Callback invoked by the stack to set the software.
Definition: oc_knx_swu.h:132
struct oc_separate_response_s oc_separate_response_t
separate response type
Definition: oc_ri.h:238