Added display of radio status: a green ring appears around nodes with their radio turned on. Added a command that prints out a .fig file that shows the current network setup (press the 'd' key).

This commit is contained in:
adamdunkels 2008-05-14 19:22:57 +00:00
parent 1feb4fe3cb
commit 7aa8508e0b
8 changed files with 165 additions and 50 deletions

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ethernode.c,v 1.14 2008/01/14 09:38:16 adamdunkels Exp $
* $Id: ethernode.c,v 1.15 2008/05/14 19:22:58 adamdunkels Exp $
*/
/**
* \file
@ -75,8 +75,20 @@ struct hdr {
u8_t seqno;
};
static int ethernode_on(void) {return 0;}
static int ethernode_safe_off(void) {return 0;}
static int radio_is_on = 1;
static int
ethernode_on(void)
{
radio_is_on = 1;
ether_set_radio_status(radio_is_on);
}
static int
ethernode_safe_off(void)
{
radio_is_on = 0;
ether_set_radio_status(radio_is_on);
}
#include "net/ethernode.h"
@ -157,7 +169,11 @@ ethernode_read(void *buf, unsigned short bufsize)
if(len == 0) {
return 0;
}
if(radio_is_on == 0) {
/* Drop the incoming packet if the simulated radio is switched off. */
return 0;
}
/* printf("ethernode_poll: received data packet with len %d type %d\n", len, hdr->type);*/
switch(hdr->type) {