KNX IoT
KNX IoT Point API stack implementation
oc_knx_swu.h File Reference

software update More...

#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef 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. More...
 

Enumerations

enum  oc_swu_result_t {
  OC_SWU_RESULT_INIT , OC_SWU_RESULT_SUCCESS , OC_SWU_RESULT_ERR_FLASH , OC_SWU_RESULT_ERR_RAM ,
  OC_SWU_RESULT_ERR_CONN , OC_SWU_RESULT_ERR_ICF , OC_SWU_RESULT_ERR_UPT , OC_SWU_RESULT_ERR_URL ,
  OC_SWU_RESULT_ERR_SUF , OC_SWU_RESULT_ERR_UP
}
 The software result states. More...
 
enum  oc_swu_state_t { OC_SWU_STATE_IDLE = 0 , OC_SWU_STATE_DOWNLOADING , OC_SWU_STATE_DOWNLOADED }
 The software update states. More...
 

Functions

void oc_create_knx_swu_resources (size_t device)
 Creation of the KNX software update resources. More...
 
void oc_set_swu_cb (oc_swu_cb_t cb, void *data)
 Set the software update callback. More...
 
void oc_swu_set_last_update (char *time)
 set the current last update time More...
 
void oc_swu_set_package_bytes (int package_bytes)
 set the current amount of the bytes written More...
 
void oc_swu_set_package_name (char *name)
 set the current firmware package name More...
 
void oc_swu_set_package_version (int major, int minor, int minor2)
 Sets the current package version. More...
 
void oc_swu_set_qurl (char *qurl)
 sets the url to be queried for downloading More...
 
void oc_swu_set_result (oc_swu_result_t result)
 sets the result of the download procedure More...
 
void oc_swu_set_state (oc_swu_state_t state)
 sets the current download state More...
 

Detailed Description

software update

Definition in file oc_knx_swu.h.

Typedef Documentation

◆ oc_swu_cb_t

typedef 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.

Parameters
[in]devicethe device index
[in]responsethe instance of an internal struct that is used to track the state of the separate response
[in]binary_sizethe full size of the binary
[in]block_offsetthe offset (in the file)
[in]block_datathe block data
[in]block_lenthe size of the block_data
[in]datathe user supplied data

Definition at line 132 of file oc_knx_swu.h.

Enumeration Type Documentation

◆ oc_swu_result_t

The software result states.

Enumerator
OC_SWU_RESULT_INIT 

0 Initial value.

Once the updating process is initiated (Download /Update), this Resource MUST be reset to Initial value.

OC_SWU_RESULT_SUCCESS 

1 Software updated successfully.

OC_SWU_RESULT_ERR_FLASH 

2 Not enough flash memory for the new software package.

OC_SWU_RESULT_ERR_RAM 

3 Out of RAM during downloading process

OC_SWU_RESULT_ERR_CONN 

4 Connection lost during downloading process.

OC_SWU_RESULT_ERR_ICF 

5 Integrity check failure for new downloaded package.

OC_SWU_RESULT_ERR_UPT 

6 Unsupported package type.

OC_SWU_RESULT_ERR_URL 

7 Invalid URL.

OC_SWU_RESULT_ERR_SUF 

8 Software update failed.

OC_SWU_RESULT_ERR_UP 

9 Unsupported protocol.

Definition at line 44 of file oc_knx_swu.h.

44  {
46  0,
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

◆ oc_swu_state_t

The software update states.

Enumerator
OC_SWU_STATE_IDLE 

state is idle

OC_SWU_STATE_DOWNLOADING 

state is downloading

OC_SWU_STATE_DOWNLOADED 

state is downloaded

Definition at line 34 of file oc_knx_swu.h.

34  {
35  OC_SWU_STATE_IDLE = 0,
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

Function Documentation

◆ oc_create_knx_swu_resources()

void oc_create_knx_swu_resources ( size_t  device)

Creation of the KNX software update resources.

Parameters
deviceindex of the device to which the resources are to be created

◆ oc_set_swu_cb()

void oc_set_swu_cb ( oc_swu_cb_t  cb,
void *  data 
)

Set the software update callback.

The host name callback is called by the stack when the software update is performed

Note
oc_set_hostname_cb() must be called before oc_main_init().
Parameters
[in]cboc_swu_cb_t function pointer to be called
[in]datacontext pointer that is passed to the oc_restart_cb_t the pointer must be a valid pointer till after oc_main_init() call completes.

◆ oc_swu_set_last_update()

void oc_swu_set_last_update ( char *  time)

set the current last update time

Parameters
timethe update time in IETF RFC 3339

◆ oc_swu_set_package_bytes()

void oc_swu_set_package_bytes ( int  package_bytes)

set the current amount of the bytes written

Parameters
package_bytesthe amount of bytes written

◆ oc_swu_set_package_name()

void oc_swu_set_package_name ( char *  name)

set the current firmware package name

Parameters
namethe name of the firmware package

◆ oc_swu_set_package_version()

void oc_swu_set_package_version ( int  major,
int  minor,
int  minor2 
)

Sets the current package version.

Parameters
majorthe major number e.g. 1 of [1, 2, 3]
minorthe minor number e.g. 2 of [1, 2, 3]
minor2the minor2 number e.g. 3 of [1, 2, 3]

◆ oc_swu_set_qurl()

void oc_swu_set_qurl ( char *  qurl)

sets the url to be queried for downloading

Parameters
qurlthe url

◆ oc_swu_set_result()

void oc_swu_set_result ( oc_swu_result_t  result)

sets the result of the download procedure

Parameters
resultthe result, including possible errors

◆ oc_swu_set_state()

void oc_swu_set_state ( oc_swu_state_t  state)

sets the current download state

Parameters
statethe download state