#include "storage.h"
#define DEBUG_LOG_MODULE_NAME "PROV APP"
#define DEBUG_LOG_MAX_LEVEL LVL_INFO
const app_lib_joining_received_beacon_t * select_joining_beacon(
const app_lib_joining_received_beacon_t * beacons)
{
const app_lib_joining_received_beacon_t * strongest_beacon = NULL;
int16_t strongest_rssi = INT16_MIN;
while (beacons != NULL)
{
if (beacons->rssi > strongest_rssi)
{
strongest_beacon = beacons;
strongest_rssi = beacons->rssi;
}
beacons = beacons->next;
}
return strongest_beacon;
}
void user_data_cb(uint32_t
id,
CborType type, uint8_t * data, uint8_t len)
{
LOG(
LVL_INFO,
"User Data, id:%d, type:%d, data:",
id, type);
return;
}
{
LOG(
LVL_INFO,
"Provisioning ended with result: %d", res);
return true;
}
{
}
{
int8_t uid_len, key_len;
{
#ifdef LOW_LATENCY_NODE
.timeout_s = 20,
#else
.timeout_s = 120,
#endif
.end_cb = end_cb,
.user_data_cb = user_data_cb,
.beacon_joining_cb = select_joining_beacon
};
{
return;
}
#ifdef LOW_LATENCY_NODE
#else
#endif
lib_settings->getNodeAddress(&addr);
lib_settings->getNetworkAddress(&net_addr);
lib_settings->getNetworkChannel(&net_channel);
if (!Storage_init())
{
}
else
{
uid_len = Storage_getUID(&conf.
uid);
key_len = Storage_getKey(&conf.
key);
method = Storage_getMethod();
if (uid_len != -1 && key_len != -1)
{
}
else
{
LOG(
LVL_ERROR,
"Can't retrieve node UID or provisioning Key.");
}
}
lib_state->startStack();
}