#include "mesh/net.h"
#include "mesh/crypto.h"
#include "mesh/model.h"
-#include "mesh/display.h"
+#include "mesh/util.h"
#include "mesh/friend.h"
struct frnd_negotiation *neg = user_data;
/* LPN did not choose us */
- l_info("Did not win negotiation for %4.4x", neg->low_power_node);
+ l_debug("Did not win negotiation for %4.4x", neg->low_power_node);
net_key_unref(neg->key_id);
l_queue_remove(frnd_negotiations, neg);
uint8_t minCache = (minReq >> 0) & 7;
int32_t rsp_delay;
- l_info("RSSI of Request: %d dbm", rssi);
- l_info("Delay: %d ms", delay);
- l_info("Poll Timeout of Request: %d ms", timeout * 100);
- l_info("Previous Friend: %4.4x", prev);
- l_info("Num Elem: %2.2x", num_ele);
- l_info("Cache Requested: %d", cache_size(minCache));
- l_info("Cache to offer: %d", frnd_cache_size);
+ l_debug("RSSI of Request: %d dbm", rssi);
+ l_debug("Delay: %d ms", delay);
+ l_debug("Poll Timeout of Request: %d ms", timeout * 100);
+ l_debug("Previous Friend: %4.4x", prev);
+ l_debug("Num Elem: %2.2x", num_ele);
+ l_debug("Cache Requested: %d", cache_size(minCache));
+ l_debug("Cache to offer: %d", frnd_cache_size);
/* Determine our own suitability before
* deciding to participate in negotiation
* of 1, bit zero and additional 0.5
*/
rsp_delay = -(rssi * scaling[rssiScale]);
- l_info("RSSI Factor: %d ms", rsp_delay / 10);
+ l_debug("RSSI Factor: %d ms", rsp_delay / 10);
/* Relay Window (Positive Factor, larger values == more time)
* Scaling factor 0-3 == multiplier of 1.0 - 2.5
* of 1, bit zero and additional 0.5
*/
rsp_delay += frnd_relay_window * scaling[winScale];
- l_info("Win Size Factor: %d ms",
+ l_debug("Win Size Factor: %d ms",
(frnd_relay_window * scaling[winScale]) / 10);
/* Normalize to ms */
else if (rsp_delay > MAX_RESP_DELAY)
rsp_delay = MAX_RESP_DELAY;
- l_info("Total Response Delay: %d ms", rsp_delay);
+ l_debug("Total Response Delay: %d ms", rsp_delay);
/* Add in 100ms delay before start of "Offer Period" */
rsp_delay += RESPONSE_DELAY;
struct frnd_negotiation *neg = l_queue_remove_if(frnd_negotiations,
match_by_lpn, L_UINT_TO_PTR(lpn));
- l_info("Friend Clear confirmed %4.4x (cnt %4.4x)", lpn, lpnCounter);
+ l_debug("Friend Clear confirmed %4.4x (cnt %4.4x)", lpn, lpnCounter);
if (!neg)
return;
struct mesh_friend *frnd = user_data;
if (mesh_friend_clear(frnd->net, frnd))
- l_info("Friend Poll Timeout %4.4x", frnd->dst);
+ l_debug("Friend Poll Timeout %4.4x", frnd->dst);
l_timeout_remove(frnd->timeout);
frnd->timeout = NULL;
return;
}
- l_info("Friend Cleared %4.4x (%4.4x)", lpn, lpnCounter);
+ l_debug("Friend Cleared %4.4x (%4.4x)", lpn, lpnCounter);
l_put_be16(lpn, msg + 1);
l_put_be16(lpnCounter, msg + 3);
if (secs && ((secs << 1) < neg->poll_timeout/10)) {
neg->receive_delay++;
- l_info("Try FRND_CLR again in %d seconds (total timeout %d)",
+ l_debug("Try FRND_CLR again in %d seconds (total timeout %d)",
secs, neg->poll_timeout/10);
l_timeout_modify(neg->timeout, secs);
} else {
- l_info("FRND_CLR timed out %d", secs);
+ l_debug("FRND_CLR timed out %d", secs);
l_timeout_remove(timeout);
l_queue_remove(frnd_negotiations, neg);
l_free(neg);
seqZero &= SEQ_ZERO_MASK;
- l_info("Fwd ACK pkt %6.6x-%8.8x",
+ l_debug("Fwd ACK pkt %6.6x-%8.8x",
pkt->u.one[0].seq,
pkt->iv_index);
} else {
- l_info("Fwd CTL pkt %6.6x-%8.8x",
+ l_debug("Fwd CTL pkt %6.6x-%8.8x",
pkt->u.one[0].seq,
pkt->iv_index);
else
len = pkt->last_len;
- l_info("Fwd FRND pkt %6.6x",
+ l_debug("Fwd FRND pkt %6.6x",
pkt->u.s12[pkt->cnt_out].seq);
print_packet("Frnd-Msg", pkt->u.s12[pkt->cnt_out].data, len);
update:
/* No More Data -- send Update message with md = false */
net_seq = mesh_net_get_seq_num(net);
- l_info("Fwd FRND UPDATE %6.6x with MD == 0", net_seq);
+ l_debug("Fwd FRND UPDATE %6.6x with MD == 0", net_seq);
frnd->last = frnd->seq;
mesh_net_get_snb_state(net, upd + 1, &iv_index);
if (neg && !neg->clearing) {
uint8_t msg[5] = { NET_OP_FRND_CLEAR };
- l_info("Won negotiation for %4.4x", neg->low_power_node);
+ l_debug("Won negotiation for %4.4x", neg->low_power_node);
/* This call will clean-up and replace if already friends */
frnd = mesh_friend_new(net, src, neg->num_ele,
{
struct frnd_offers *offer;
- l_info("RSSI of Offer: %d dbm", l_rssi);
+ l_debug("RSSI of Offer: %d dbm", l_rssi);
/* Ignore RFU window value 0 */
if (window == 0)
{
struct mesh_net *net = user_data;
- l_info("frnd_negotiated_to");
+ l_debug("frnd_negotiated_to");
if (!mesh_net_get_friend(net)) {
l_timeout_remove(poll_period_to);
poll_period_to = NULL;
seq = !seq;
mesh_net_set_frnd_seq(net, seq);
} else if (!(poll_cnt--)) {
- l_info("Lost Friendship with %4.4x", old_friend);
+ l_debug("Lost Friendship with %4.4x", old_friend);
l_timeout_remove(poll_period_to);
poll_period_to = NULL;
frnd_poll_cancel(net);
if (poll_retry_to)
l_timeout_remove(poll_retry_to);
- l_info("TX-FRIEND POLL %d", seq);
+ l_debug("TX-FRIEND POLL %d", seq);
msg[1] = seq;
net_seq = mesh_net_get_seq_num(net);
mesh_net_transport_send(net, key_id, true,
l_free(best);
return;
} else if (!best) {
- l_info("No Offers Received");
+ l_debug("No Offers Received");
return;
}
old_keys_only:
- l_info("Winning offer %4.4x RSSI: %ddb Window: %dms Cache sz: %d",
+ l_debug("Winning offer %4.4x RSSI: %ddb Window: %dms Cache sz: %d",
best->src, best->local_rssi,
best->window, best->cache);
offers = l_queue_new();
msg[n++] = NET_OP_FRND_REQUEST;
- msg[n] = cache & 0x07; // MinRequirements - Cache
- msg[n++] |= (offer_delay & 0x0f) << 3; // Offer Delay
- poll_period_ms = (timeout * 300) / 4; // 3/4 of the time in ms
- l_put_be32(timeout, msg + n); // PollTimeout
- msg[n++] = delay; // ReceiveDelay
+ msg[n] = cache & 0x07; /* MinRequirements - Cache */
+ msg[n++] |= (offer_delay & 0x0f) << 3; /* Offer Delay */
+ poll_period_ms = (timeout * 300) / 4; /* 3/4 of the time in ms */
+ l_put_be32(timeout, msg + n); /* PollTimeout */
+ msg[n++] = delay; /* ReceiveDelay */
n += 3;
- l_put_be16(old_friend, msg + n); // PreviousAddress
+ l_put_be16(old_friend, msg + n); /* PreviousAddress */
n += 2;
- msg[n++] = mesh_net_get_num_ele(net); // NumElements
- l_put_be16(cnt + 1, msg + n); // Next counter
+ msg[n++] = mesh_net_get_num_ele(net); /* NumElements */
+ l_put_be16(cnt + 1, msg + n); /* Next counter */
n += 2;
print_packet("Tx-NET_OP_FRND_REQUEST", msg, n);
mesh_net_transport_send(net, 0, false,
mesh_net_get_iv_index(net), 0,
0, 0, FRIENDS_ADDRESS,
msg, n);
- l_timeout_create_ms(1000, req_timeout, net, NULL); // 1000 ms
+ l_timeout_create_ms(1000, req_timeout, net, NULL); /* 1000 ms */
mesh_net_set_friend(net, 0);
cnt++;
}
case 0:
case 3:
if (new_lpn_id) {
- l_info("LPN Retiring KeySet %d", lpn_key_id);
+ l_debug("LPN Retiring KeySet %d", lpn_key_id);
net_key_unref(lpn_key_id);
lpn_key_id = new_lpn_id;
}