Wirepas SDK
provisioning.h
Go to the documentation of this file.
1 /* Copyright 2019 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 #ifndef _PROVISIONING_H_
7 #define _PROVISIONING_H_
8 
9 #include <stdint.h>
10 #include "api.h"
11 #include "wms_joining.h"
12 #include "cbor.h"
13 
15 typedef enum
16 {
24 
26 typedef enum
27 {
41 
43 typedef enum
44 {
49 
58 typedef bool (*provisioning_end_cb_f)(provisioning_res_e result);
59 
71 typedef void (*provisioning_user_data_cb_f)(uint32_t id,
72  CborType type,
73  uint8_t * data,
74  uint8_t len);
75 
86 typedef const app_lib_joining_received_beacon_t *
87  (*provisioning_joining_beacon_cb_f)
88  (const app_lib_joining_received_beacon_t * beacons);
89 
94 typedef struct
95 {
105 
125  const uint8_t * uid,
126  uint8_t uid_len,
127  provisioning_method_e method,
128  provisioning_proxy_net_param_t * net_param);
129 
133 typedef struct
134 {
138  uint8_t nb_retry;
140  uint16_t timeout_s;
142  const uint8_t * uid;
144  uint8_t uid_len;
149  const uint8_t * key;
151  uint8_t key_len;
159 
167 typedef struct
168 {
170  uint8_t * payload;
172  uint8_t num_bytes;
174  int8_t tx_power;
183  const uint8_t * key;
185  uint8_t key_len;
189 
210 
217 
226 
240 
249 
257 
258 #endif //_PROVISIONING_H_
PROV_RES_ERROR_JOINING
@ PROV_RES_ERROR_JOINING
Definition: provisioning.h:36
provisioning_joining_beacon_cb_f
const typedef app_lib_joining_received_beacon_t *(* provisioning_joining_beacon_cb_f)(const app_lib_joining_received_beacon_t *beacons)
Selects which joining beacon to connect to at the end of a scan.
Definition: provisioning.h:88
provisioning_conf_t::uid
const uint8_t * uid
Definition: provisioning.h:142
provisioning_proxy_conf_t
This structure holds the joining proxy parameters.
Definition: provisioning.h:167
PROV_RET_INVALID_PARAM
@ PROV_RET_INVALID_PARAM
Definition: provisioning.h:19
PROV_RES_SUCCESS
@ PROV_RES_SUCCESS
Definition: provisioning.h:28
provisioning_res_e
provisioning_res_e
Provisioning result.
Definition: provisioning.h:26
app_lib_settings_net_channel_t
uint8_t app_lib_settings_net_channel_t
Network channel type definition.
Definition: wms_settings.h:60
wms_joining.h
provisioning_proxy_conf_t::num_bytes
uint8_t num_bytes
Definition: provisioning.h:172
PROV_RES_ERROR_SCANNING_BEACONS
@ PROV_RES_ERROR_SCANNING_BEACONS
Definition: provisioning.h:34
provisioning_conf_t::method
provisioning_method_e method
Definition: provisioning.h:136
PROV_RES_INVALID_PACKET
@ PROV_RES_INVALID_PACKET
Definition: provisioning.h:32
Provisioning_start
provisioning_ret_e Provisioning_start(void)
Start the provisioning process.
provisioning_user_data_cb_f
void(* provisioning_user_data_cb_f)(uint32_t id, CborType type, uint8_t *data, uint8_t len)
Received User provisioning data callback. Provisioning data is received as a map of id:data....
Definition: provisioning.h:71
PROV_RET_OK
@ PROV_RET_OK
Definition: provisioning.h:17
Provisioning_Proxy_init
provisioning_ret_e Provisioning_Proxy_init(provisioning_proxy_conf_t *conf)
Initialize the provisioning proxy.
Provisioning_Proxy_start
provisioning_ret_e Provisioning_Proxy_start(void)
Start sending joining beacons. Provisioning packets will be forwarded to provisioning server or treat...
Provisioning_init
provisioning_ret_e Provisioning_init(provisioning_conf_t *conf)
Initialize the provisioning process.
cbor.h
PROV_RES_ERROR_SENDING_DATA
@ PROV_RES_ERROR_SENDING_DATA
Definition: provisioning.h:33
provisioning_conf_t
This structure holds the provisioning parameters.
Definition: provisioning.h:133
PROV_RET_INVALID_STATE
@ PROV_RET_INVALID_STATE
Definition: provisioning.h:18
PROV_METHOD_UNSECURED
@ PROV_METHOD_UNSECURED
Definition: provisioning.h:45
provisioning_conf_t::timeout_s
uint16_t timeout_s
Definition: provisioning.h:140
provisioning_proxy_conf_t::payload
uint8_t * payload
Definition: provisioning.h:170
PROV_RET_JOINING_LIB_ERROR
@ PROV_RET_JOINING_LIB_ERROR
Definition: provisioning.h:21
app_lib_settings_net_addr_t
uint32_t app_lib_settings_net_addr_t
Network address type definition.
Definition: wms_settings.h:53
PROV_METHOD_SECURED
@ PROV_METHOD_SECURED
Definition: provisioning.h:46
provisioning_proxy_net_param_t::net_chan
app_lib_settings_net_channel_t net_chan
Definition: provisioning.h:103
Provisioning_stop
provisioning_ret_e Provisioning_stop(void)
Stops the provisioning process.
PROV_RET_INTERNAL_ERROR
@ PROV_RET_INTERNAL_ERROR
Definition: provisioning.h:22
provisioning_method_e
provisioning_method_e
supported provisioning methods
Definition: provisioning.h:43
provisioning_conf_t::uid_len
uint8_t uid_len
Definition: provisioning.h:144
provisioning_proxy_conf_t::is_local_unsec_allowed
bool is_local_unsec_allowed
Definition: provisioning.h:176
PROV_RES_TIMEOUT
@ PROV_RES_TIMEOUT
Definition: provisioning.h:29
PROV_RES_INVALID_DATA
@ PROV_RES_INVALID_DATA
Definition: provisioning.h:31
provisioning_ret_e
provisioning_ret_e
Return codes of provisioning functions.
Definition: provisioning.h:15
Provisioning_Proxy_stop
provisioning_ret_e Provisioning_Proxy_stop(void)
Stops the provisioning proxy.
CborType
CborType
Definition: cbor.h:82
provisioning_conf_t::beacon_joining_cb
provisioning_joining_beacon_cb_f beacon_joining_cb
Definition: provisioning.h:157
provisioning_conf_t::key
const uint8_t * key
Definition: provisioning.h:149
APP_LIB_SETTINGS_AES_KEY_NUM_BYTES
#define APP_LIB_SETTINGS_AES_KEY_NUM_BYTES
AES key size in bytes.
Definition: wms_settings.h:44
PROV_RES_STOPPED
@ PROV_RES_STOPPED
Definition: provisioning.h:38
provisioning_end_cb_f
bool(* provisioning_end_cb_f)(provisioning_res_e result)
The end provisioning callback. This function is called at the end of the provisioning process.
Definition: provisioning.h:58
provisioning_proxy_conf_t::tx_power
int8_t tx_power
Definition: provisioning.h:174
PROV_RET_INVALID_DATA
@ PROV_RET_INVALID_DATA
Definition: provisioning.h:20
provisioning_proxy_start_cb_f
bool(* provisioning_proxy_start_cb_f)(const uint8_t *uid, uint8_t uid_len, provisioning_method_e method, provisioning_proxy_net_param_t *net_param)
The proxy received START packet callback. This function is called when the proxy receives a valid STA...
Definition: provisioning.h:124
provisioning_conf_t::nb_retry
uint8_t nb_retry
Definition: provisioning.h:138
provisioning_conf_t::user_data_cb
provisioning_user_data_cb_f user_data_cb
Definition: provisioning.h:155
provisioning_proxy_conf_t::start_cb
provisioning_proxy_start_cb_f start_cb
Definition: provisioning.h:187
PROV_RES_ERROR_NO_ROUTE
@ PROV_RES_ERROR_NO_ROUTE
Definition: provisioning.h:37
PROV_RES_NACK
@ PROV_RES_NACK
Definition: provisioning.h:30
PROV_RES_ERROR_INTERNAL
@ PROV_RES_ERROR_INTERNAL
Definition: provisioning.h:39
provisioning_proxy_conf_t::is_local_sec_allowed
bool is_local_sec_allowed
Definition: provisioning.h:178
provisioning_conf_t::key_len
uint8_t key_len
Definition: provisioning.h:151
provisioning_proxy_net_param_t
This structure contains the network parameters sent by the provisioning proxy to the new node.
Definition: provisioning.h:94
PROV_METHOD_EXTENDED_UID
@ PROV_METHOD_EXTENDED_UID
Definition: provisioning.h:47
provisioning_conf_t::end_cb
provisioning_end_cb_f end_cb
Definition: provisioning.h:153
provisioning_proxy_net_param_t::net_addr
app_lib_settings_net_addr_t net_addr
Definition: provisioning.h:101
api.h