diff --git a/inc/opendefs.h b/inc/opendefs.h index 8dbf26cdae..804a3ba716 100644 --- a/inc/opendefs.h +++ b/inc/opendefs.h @@ -234,7 +234,6 @@ enum { // l2b ERR_SCHEDULE_ADD_DUPLICATE_SLOT = 0x20, // the slot {0} to be added is already in schedule ERR_NEIGHBORS_FULL = 0x21, // neighbors table is full (max number of neighbor is {0}) - ERR_NO_SENT_PACKET = 0x22, // there is no sent packet in queue ERR_NO_RECEIVED_PACKET = 0x23, // there is no received packet in queue ERR_SCHEDULE_OVERFLOWN = 0x24, // schedule overflown @@ -290,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 ========================================= diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c index 18bbcdd108..67de391b4d 100644 --- a/openstack/02b-MAChigh/neighbors.c +++ b/openstack/02b-MAChigh/neighbors.c @@ -7,6 +7,7 @@ #include "IEEE802154E.h" #include "openrandom.h" #include "msf.h" +#include "openserial.h" //=========================== variables ======================================= @@ -681,6 +682,14 @@ void registerNewNeighbor(open_addr_t *address, if (rssi < GOODNEIGHBORMINRSSI) { break; } + open_addr_t addr_16; + addr_16.type = ADDR_16B; + packetfunctions_mac64bToMac16b(address, &addr_16); + uint16_t 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;