Helper function to initially setup a node if not already configured. This configuration can be modified later with remote API.
Example on use. Address, network address and channel is set if they are not yet set:
#define NETWORK_ADDRESS 0x123456
#define NETWORK_CHANNEL 1
static const uint8_t authen_key[16] = {0x11,...,0xff}
static const uint8_t cipher_key[16] = {0x11,...,0xff}
{
NETWORK_ADDRESS,
NETWORK_CHANNEL,
authen_key,
{
return;
}
...
}
__STATIC_INLINE app_res_e configureNode(app_addr_t my_addr, app_lib_settings_net_addr_t my_network_addr, app_lib_settings_net_channel_t my_network_ch, const uint8_t *my_authentication_key_p, const uint8_t *my_encryption_key_p)
Helper function to initially setup a node if not already configured. This configuration can be modifi...
__STATIC_INLINE app_addr_t getUniqueAddress()
Helper function to generate a unique unicast address.
List of global functions, passed to App_entrypoint()
69{
70
73
74 if (lib_settings->getNodeAddress(&node_addr) !=
APP_RES_OK)
75 {
76
77 res = lib_settings->setNodeAddress(my_addr);
79 {
80 return res;
81 }
82
83
84 if (my_authentication_key_p != NULL
85 && lib_settings->getAuthenticationKey(NULL) !=
APP_RES_OK)
86 {
87
88 res = lib_settings->setAuthenticationKey(my_authentication_key_p);
90 {
91 return res;
92 }
93 }
94
95
96 if (my_encryption_key_p != NULL
97 && lib_settings->getEncryptionKey(NULL) !=
APP_RES_OK)
98 {
99
100 res = lib_settings->setEncryptionKey(my_encryption_key_p);
102 {
103 return res;
104 }
105 }
106 }
107
108
110 if (lib_settings->getNetworkAddress(&network_addr) !=
APP_RES_OK)
111 {
112
113 res = lib_settings->setNetworkAddress(my_network_addr);
115 {
116 return res;
117 }
118 }
119
120
122 if (lib_settings->getNetworkChannel(&network_ch) !=
APP_RES_OK)
123 {
124
125 res = lib_settings->setNetworkChannel(my_network_ch);
127 {
128 return res;
129 }
130 }
131
133}
uint32_t app_lib_settings_net_addr_t
Network address type definition.
uint8_t app_lib_settings_net_channel_t
Channel type definition.