How i can sensing the network in Contiki os

145 Views Asked by At

I’m new in contiki os and Cooja simulator i want to know how i can sense the network so

  1. If there is two nodes start communication
  2. The third node catch the communication and know the IP address for the sender.

I found and try this code but what should i add to check the network and the channel do the sensing

if(NETSTACK_RADIO().channel_clear()) {
      printf("channel not busy\n");
    } else {
      printf("channel busy\n");
    }
1

There are 1 best solutions below

0
On

I am also no contiki expert but I think for your problem you should check out os/net/routing/rpl-lite/rpl-neigbor.c. If you compile your code by default it will be used rpl-lite, that is the standard for contiki-ng.

You could do something like this:

include "net/routing/rpl-lite/rpl.h";

if (rpl_neighbor_count() == 1) {
    // start communication
}

Hope I could help.