Wirepas SDK
wms_settings.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 
22 #ifndef APP_LIB_SETTINGS_H_
23 #define APP_LIB_SETTINGS_H_
24 
25 #include <stdlib.h>
26 #include <stdint.h>
27 #include <stdbool.h>
28 
29 #include "wms_app.h"
30 
32 #define APP_LIB_SETTINGS_NAME 0x74ced676
33 
34 
35 #define APP_LIB_SETTINGS_VERSION 0x208
36 
44 #define APP_LIB_SETTINGS_AES_KEY_NUM_BYTES 16
45 
46 // Device address definition is in app/app.h */
47 
53 typedef uint32_t app_lib_settings_net_addr_t;
54 
61 
62 typedef enum {
82 
88 typedef uint8_t app_lib_settings_role_t;
89 
111 typedef bool
113 
129 typedef app_res_e
131 
147 typedef app_res_e
149 
162 typedef app_res_e
164 
177 typedef app_res_e
179 
199 typedef app_res_e
200  (*app_lib_settings_set_feature_lock_key_f)(const uint8_t * key_p);
201 
211 typedef app_res_e
213 
227 typedef app_res_e
229 
239 typedef app_res_e
241 
254 typedef app_res_e
256 
265 typedef app_res_e
267 
285 typedef app_res_e
287 
300 typedef app_res_e
302 
327 typedef app_res_e
329 
343 typedef app_res_e
345 
365 typedef app_res_e
366  (*app_lib_settings_set_authentication_key_f)(const uint8_t * key_p);
367 
381 typedef app_res_e
383 
403 typedef app_res_e
404  (*app_lib_settings_set_encryption_key_f)(const uint8_t * key_p);
405 
427 typedef app_res_e
428  (*app_lib_settings_get_ac_range_f)(uint16_t * ac_min_value_p,
429  uint16_t * ac_max_value_p);
430 
478 typedef app_res_e
479  (*app_lib_settings_set_ac_range_f)(uint16_t ac_min_value,
480  uint16_t ac_max_value);
481 
494 typedef app_res_e
495  (*app_lib_settings_get_offline_scan_f)(uint16_t * max_scan_p);
496 
522 typedef app_res_e
523  (*app_lib_settings_set_offline_scan_f)(uint16_t max_scan);
524 
539 typedef app_res_e
541  uint16_t * max_value_p);
542 
557 typedef app_res_e
558  (*app_lib_settings_get_ac_range_limits_f)(uint16_t * min_value_p,
559  uint16_t * max_value_p);
560 
590 typedef app_res_e
592 
616 typedef app_res_e
618  size_t num_bytes);
619 
658 typedef app_res_e
659  (*app_lib_settings_set_reserved_channels_f)(const uint8_t * channels_p,
660  size_t num_bytes);
661 
670 
678 
686 
694 
698 typedef struct
699 {
731 
732 #endif /* APP_LIB_SETTINGS_H_ */
app_lib_settings_t::isValidNetworkAddress
app_lib_settings_is_valid_network_address_f isValidNetworkAddress
Definition: wms_settings.h:726
app_lib_settings_get_reserved_channels_f
app_res_e(* app_lib_settings_get_reserved_channels_f)(uint8_t *channels_p, size_t num_bytes)
Get reserved channels.
Definition: wms_settings.h:617
app_lib_settings_t::registerGroupQuery
app_lib_settings_set_group_query_cb_f registerGroupQuery
Definition: wms_settings.h:723
app_lib_settings_set_network_channel_f
app_res_e(* app_lib_settings_set_network_channel_f)(app_lib_settings_net_channel_t channel)
Set network channel.
Definition: wms_settings.h:286
app_lib_settings_set_authentication_key_f
app_res_e(* app_lib_settings_set_authentication_key_f)(const uint8_t *key_p)
Set authentication key.
Definition: wms_settings.h:366
app_lib_settings_net_channel_t
uint8_t app_lib_settings_net_channel_t
Network channel type definition.
Definition: wms_settings.h:60
APP_LIB_SETTINGS_ROLE_SUBNODE_LE
@ APP_LIB_SETTINGS_ROLE_SUBNODE_LE
Definition: wms_settings.h:72
app_lib_settings_set_reserved_channels_f
app_res_e(* app_lib_settings_set_reserved_channels_f)(const uint8_t *channels_p, size_t num_bytes)
Set reserved channels.
Definition: wms_settings.h:659
APP_LIB_SETTINGS_ROLE_ADVERTISER
@ APP_LIB_SETTINGS_ROLE_ADVERTISER
Definition: wms_settings.h:80
app_lib_settings_t::getFeatureLockKey
app_lib_settings_get_feature_lock_key_f getFeatureLockKey
Definition: wms_settings.h:703
app_lib_settings_t::getAuthenticationKey
app_lib_settings_get_authentication_key_f getAuthenticationKey
Definition: wms_settings.h:713
app_lib_settings_set_node_address_f
app_res_e(* app_lib_settings_set_node_address_f)(app_addr_t addr)
Set node address.
Definition: wms_settings.h:228
APP_LIB_SETTINGS_ROLE_HEADNODE_LE
@ APP_LIB_SETTINGS_ROLE_HEADNODE_LE
Definition: wms_settings.h:68
app_lib_joining_received_beacon_s::channel
app_lib_settings_net_channel_t channel
Definition: wms_joining.h:149
app_lib_settings_t::getAcRange
app_lib_settings_get_ac_range_f getAcRange
Definition: wms_settings.h:717
app_lib_settings_set_offline_scan_f
app_res_e(* app_lib_settings_set_offline_scan_f)(uint16_t max_scan)
Set the maximum offline scan interval in seconds.
Definition: wms_settings.h:523
app_res_e
app_res_e
Definition: wms_app.h:201
app_lib_settings_t::isValidNodeRole
app_lib_settings_is_valid_node_role_f isValidNodeRole
Definition: wms_settings.h:729
app_lib_settings_get_network_address_f
app_res_e(* app_lib_settings_get_network_address_f)(app_lib_settings_net_addr_t *addr_p)
Get network address.
Definition: wms_settings.h:240
app_lib_settings_is_group_cb_f
bool(* app_lib_settings_is_group_cb_f)(app_addr_t group_addr)
Callback used for determining on which multicast groups the device belongs.
Definition: wms_settings.h:112
app_lib_settings_get_ac_range_f
app_res_e(* app_lib_settings_get_ac_range_f)(uint16_t *ac_min_value_p, uint16_t *ac_max_value_p)
Get the access cycle range.
Definition: wms_settings.h:428
wms_app.h
app_lib_settings_get_node_role_f
app_res_e(* app_lib_settings_get_node_role_f)(app_lib_settings_role_t *role_p)
Definition: wms_settings.h:301
app_lib_settings_is_valid_network_channel_f
bool(* app_lib_settings_is_valid_network_channel_f)(uint8_t channel)
Check that the network channel is valid.
Definition: wms_settings.h:677
app_lib_settings_t::getOfflineScan
app_lib_settings_get_offline_scan_f getOfflineScan
Definition: wms_settings.h:719
app_lib_settings_t::setEncryptionKey
app_lib_settings_set_encryption_key_f setEncryptionKey
Definition: wms_settings.h:716
app_lib_settings_get_node_address_f
app_res_e(* app_lib_settings_get_node_address_f)(app_addr_t *addr_p)
Get node address.
Definition: wms_settings.h:212
app_lib_settings_net_addr_t
uint32_t app_lib_settings_net_addr_t
Network address type definition.
Definition: wms_settings.h:53
app_lib_settings_get_network_channel_limits_f
app_res_e(* app_lib_settings_get_network_channel_limits_f)(uint16_t *min_value_p, uint16_t *max_value_p)
Get network channel range.
Definition: wms_settings.h:540
app_lib_settings_t::setNodeRole
app_lib_settings_set_node_role_f setNodeRole
Definition: wms_settings.h:712
app_lib_settings_get_feature_lock_key_f
app_res_e(* app_lib_settings_get_feature_lock_key_f)(uint8_t *key_p)
Check if feature lock key is set.
Definition: wms_settings.h:178
app_lib_settings_get_offline_scan_f
app_res_e(* app_lib_settings_get_offline_scan_f)(uint16_t *max_scan_p)
Get the maximum offline scan interval in seconds.
Definition: wms_settings.h:495
app_lib_settings_reset_all_f
app_res_e(* app_lib_settings_reset_all_f)(void)
Reset all settings to default values.
Definition: wms_settings.h:130
app_lib_settings_get_ac_range_limits_f
app_res_e(* app_lib_settings_get_ac_range_limits_f)(uint16_t *min_value_p, uint16_t *max_value_p)
Get access cycle range.
Definition: wms_settings.h:558
app_lib_settings_is_valid_node_role_f
bool(* app_lib_settings_is_valid_node_role_f)(app_lib_settings_role_t role)
Check that the node role is valid.
Definition: wms_settings.h:693
app_lib_settings_set_feature_lock_key_f
app_res_e(* app_lib_settings_set_feature_lock_key_f)(const uint8_t *key_p)
Set feature lock key.
Definition: wms_settings.h:200
app_lib_settings_t::getNetworkChannel
app_lib_settings_get_network_channel_f getNetworkChannel
Definition: wms_settings.h:709
app_lib_settings_t::setNetworkAddress
app_lib_settings_set_network_address_f setNetworkAddress
Definition: wms_settings.h:708
app_lib_settings_t::getReservedChannels
app_lib_settings_get_reserved_channels_f getReservedChannels
Definition: wms_settings.h:724
app_lib_settings_t::getAcRangeLimits
app_lib_settings_get_ac_range_limits_f getAcRangeLimits
Definition: wms_settings.h:722
app_lib_settings_role_e
app_lib_settings_role_e
Definition: wms_settings.h:62
app_lib_settings_set_feature_lock_bits_f
app_res_e(* app_lib_settings_set_feature_lock_bits_f)(uint32_t bits)
Set feature lock bits.
Definition: wms_settings.h:163
app_lib_settings_get_network_channel_f
app_res_e(* app_lib_settings_get_network_channel_f)(app_lib_settings_net_channel_t *channel_p)
Get network channel.
Definition: wms_settings.h:266
app_lib_settings_set_encryption_key_f
app_res_e(* app_lib_settings_set_encryption_key_f)(const uint8_t *key_p)
Set encryption key.
Definition: wms_settings.h:404
app_lib_settings_t::getNodeAddress
app_lib_settings_get_node_address_f getNodeAddress
Definition: wms_settings.h:705
app_lib_settings_t::setNodeAddress
app_lib_settings_set_node_address_f setNodeAddress
Definition: wms_settings.h:706
app_lib_settings_t::getFeatureLockBits
app_lib_settings_get_feature_lock_bits_f getFeatureLockBits
Definition: wms_settings.h:701
app_lib_joining_received_beacon_s::addr
app_lib_settings_net_addr_t addr
Definition: wms_joining.h:147
app_lib_settings_set_ac_range_f
app_res_e(* app_lib_settings_set_ac_range_f)(uint16_t ac_min_value, uint16_t ac_max_value)
Set range for access cycle.
Definition: wms_settings.h:479
app_lib_settings_set_network_address_f
app_res_e(* app_lib_settings_set_network_address_f)(app_lib_settings_net_addr_t addr)
Set network address.
Definition: wms_settings.h:255
APP_LIB_SETTINGS_ROLE_SINK_LL
@ APP_LIB_SETTINGS_ROLE_SINK_LL
Definition: wms_settings.h:66
app_lib_settings_t::getEncryptionKey
app_lib_settings_get_encryption_key_f getEncryptionKey
Definition: wms_settings.h:715
APP_LIB_SETTINGS_ROLE_AUTOROLE_LE
@ APP_LIB_SETTINGS_ROLE_AUTOROLE_LE
Definition: wms_settings.h:76
app_lib_settings_t::setNetworkChannel
app_lib_settings_set_network_channel_f setNetworkChannel
Definition: wms_settings.h:710
app_lib_settings_get_encryption_key_f
app_res_e(* app_lib_settings_get_encryption_key_f)(uint8_t *key_p)
Check if encryption key is set.
Definition: wms_settings.h:382
app_addr_t
uint32_t app_addr_t
Definition: wms_app.h:228
APP_LIB_SETTINGS_ROLE_SINK_LE
@ APP_LIB_SETTINGS_ROLE_SINK_LE
Definition: wms_settings.h:64
APP_LIB_SETTINGS_ROLE_SUBNODE_LL
@ APP_LIB_SETTINGS_ROLE_SUBNODE_LL
Definition: wms_settings.h:74
app_lib_settings_set_node_role_f
app_res_e(* app_lib_settings_set_node_role_f)(app_lib_settings_role_t role)
Set node role.
Definition: wms_settings.h:328
app_lib_settings_is_valid_network_address_f
bool(* app_lib_settings_is_valid_network_address_f)(app_lib_settings_net_addr_t addr)
Check that the network address is valid.
Definition: wms_settings.h:669
app_lib_settings_t
Definition: wms_settings.h:698
app_lib_settings_t::isValidNodeAddress
app_lib_settings_is_valid_node_address_f isValidNodeAddress
Definition: wms_settings.h:728
app_lib_settings_set_group_query_cb_f
app_res_e(* app_lib_settings_set_group_query_cb_f)(app_lib_settings_is_group_cb_f cb)
Set the callback function for multicat groups.
Definition: wms_settings.h:591
app_lib_settings_t::setFeatureLockKey
app_lib_settings_set_feature_lock_key_f setFeatureLockKey
Definition: wms_settings.h:704
app_lib_settings_role_t
uint8_t app_lib_settings_role_t
Node role type.
Definition: wms_settings.h:88
app_lib_settings_t::getNetworkAddress
app_lib_settings_get_network_address_f getNetworkAddress
Definition: wms_settings.h:707
app_lib_settings_t::setAcRange
app_lib_settings_set_ac_range_f setAcRange
Definition: wms_settings.h:718
app_lib_settings_t::getNetworkChannelLimits
app_lib_settings_get_network_channel_limits_f getNetworkChannelLimits
Definition: wms_settings.h:721
app_lib_settings_t::setReservedChannels
app_lib_settings_set_reserved_channels_f setReservedChannels
Definition: wms_settings.h:725
app_lib_settings_get_feature_lock_bits_f
app_res_e(* app_lib_settings_get_feature_lock_bits_f)(uint32_t *bits_p)
Get feature lock bits.
Definition: wms_settings.h:148
app_lib_settings_is_valid_node_address_f
bool(* app_lib_settings_is_valid_node_address_f)(app_addr_t addr)
Check that the node address is valid.
Definition: wms_settings.h:685
app_lib_settings_t::resetAll
app_lib_settings_reset_all_f resetAll
Definition: wms_settings.h:700
app_lib_joining_received_beacon_s::num_bytes
size_t num_bytes
Definition: wms_joining.h:137
app_lib_settings_t::setFeatureLockBits
app_lib_settings_set_feature_lock_bits_f setFeatureLockBits
Definition: wms_settings.h:702
app_lib_settings_t::getNodeRole
app_lib_settings_get_node_role_f getNodeRole
Definition: wms_settings.h:711
app_lib_settings_t::isValidNetworkChannel
app_lib_settings_is_valid_network_channel_f isValidNetworkChannel
Definition: wms_settings.h:727
APP_LIB_SETTINGS_ROLE_HEADNODE_LL
@ APP_LIB_SETTINGS_ROLE_HEADNODE_LL
Definition: wms_settings.h:70
app_lib_settings_get_authentication_key_f
app_res_e(* app_lib_settings_get_authentication_key_f)(uint8_t *key_p)
Check if authentication key is set.
Definition: wms_settings.h:344
app_lib_settings_t::setAuthenticationKey
app_lib_settings_set_authentication_key_f setAuthenticationKey
Definition: wms_settings.h:714
app_lib_settings_t::setOfflineScan
app_lib_settings_set_offline_scan_f setOfflineScan
Definition: wms_settings.h:720
APP_LIB_SETTINGS_ROLE_AUTOROLE_LL
@ APP_LIB_SETTINGS_ROLE_AUTOROLE_LL
Definition: wms_settings.h:78