From ff1098037031ed946692418af43f9ca9025bb2d0 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Fri, 4 Dec 2020 12:13:20 +0100 Subject: [PATCH 1/2] inc/opendefs: add sixtop request type to log --- inc/opendefs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/opendefs.h b/inc/opendefs.h index 29076b5cae..8dbf26cdae 100644 --- a/inc/opendefs.h +++ b/inc/opendefs.h @@ -234,11 +234,12 @@ 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 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} 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}) From 547597dbc69800c4c402f464884c0877d68d2050 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Fri, 4 Dec 2020 12:45:03 +0100 Subject: [PATCH 2/2] inc/opendefs: add new neighbors logging --- inc/opendefs.h | 2 +- openstack/02b-MAChigh/neighbors.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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..9fcf0cec74 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 ======================================= @@ -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) { @@ -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;