Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inc/opendefs: add new neighbors logging #539

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inc/opendefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ enum {
ERR_NO_RECEIVED_PACKET = 0x23, // there is no received packet in queue
ERR_SCHEDULE_OVERFLOWN = 0x24, // schedule overflown
ERR_SIXTOP_RETURNCODE = 0x25, // sixtop return code {0} at sixtop state {1}
ERR_SIXTOP_REQUEST = 0x26, // sending a 6top request
ERR_SIXTOP_REQUEST = 0x26, // sending a 6top request {0}
fjmolinas marked this conversation as resolved.
Show resolved Hide resolved
ERR_SIXTOP_COUNT = 0x27, // there are {0} cells to request mote
ERR_SIXTOP_LIST = 0x28, // the cells reserved to request mote contains slot {0} and slot {1}
ERR_UNSUPPORTED_FORMAT = 0x29, // the received packet format is not supported (code location {0})
Expand Down Expand Up @@ -289,6 +289,7 @@ enum {
ERR_INVALID_PARAM = 0x53, // received an invalid parameter
ERR_COPY_TO_SPKT = 0x54, // copy packet content to small packet (pkt len {} < max len {})
ERR_COPY_TO_BPKT = 0x55, // copy packet content to big packet (pkt len {} > max len {})
ERR_NEW_NEIGHBOR = 0x56, // New neighbor {1:04x} with RSSI {0},
};

//=========================== typedef =========================================
Expand Down
10 changes: 10 additions & 0 deletions openstack/02b-MAChigh/neighbors.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "IEEE802154E.h"
#include "openrandom.h"
#include "msf.h"
#include "openserial.h"

//=========================== variables =======================================

Expand Down Expand Up @@ -665,6 +666,8 @@ void registerNewNeighbor(open_addr_t *address,
uint8_t joinPrio,
bool insecure) {
uint8_t i;
open_addr_t addr_16;
uint16_t short_addr;

// filter errors
if (address->type != ADDR_64B) {
Expand All @@ -681,6 +684,13 @@ void registerNewNeighbor(open_addr_t *address,
if (rssi < GOODNEIGHBORMINRSSI) {
break;
}
addr_16.type = ADDR_16B;
packetfunctions_mac64bToMac16b(address, &addr_16);
short_addr = ((addr_16.addr_16b[0] << 8) & 0xff00) |
(addr_16.addr_16b[1] & 0x00ff);
LOG_VERBOSE(COMPONENT_NEIGHBORS, ERR_NEW_NEIGHBOR,
(errorparameter_t) rssi,
(errorparameter_t) short_addr);
// add this neighbor
neighbors_vars.neighbors[i].used = TRUE;
neighbors_vars.neighbors[i].insecure = insecure;
Expand Down