Added radio signal strength simulation
This commit is contained in:
parent
d2172da359
commit
0e8cdd9e8e
|
@ -7,12 +7,12 @@ endif
|
||||||
CONTIKI_TARGET_DIRS = . dev apps net
|
CONTIKI_TARGET_DIRS = . dev apps net
|
||||||
|
|
||||||
SENSORS = sensors.c beep.c button-sensor.c pir-sensor.c vib-sensor.c \
|
SENSORS = sensors.c beep.c button-sensor.c pir-sensor.c vib-sensor.c \
|
||||||
irq.c eeprom.c \
|
radio-sensor.c irq.c eeprom.c \
|
||||||
dummy-sensors.c leds.c leds-arch.c esb-sensors.c
|
dummy-sensors.c leds.c leds-arch.c esb-sensors.c
|
||||||
NETSIM = ether.c ethernode.c ethernode-drv.c tr1001.c tr1001-drv.c lpm.c \
|
NETSIM = ether.c ethernode.c ethernode-drv.c tr1001.c tr1001-drv.c lpm.c \
|
||||||
tapdev-drv.c tapdev-service.c tapdev.c rs232.c flash.c \
|
tapdev-drv.c tapdev-service.c tapdev.c rs232.c flash.c \
|
||||||
node.c nodes.c sensor.c display.c random.c radio.c \
|
node.c nodes.c sensor.c display.c random.c radio.c \
|
||||||
dlloader.c main.c init.c contiki-main.c
|
dlloader.c main.c init.c contiki-main.c symtab.c symbols.c
|
||||||
|
|
||||||
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS)
|
CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS)
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||||
|
|
||||||
### Define the CPU directory
|
### Define the CPU directory
|
||||||
CONTIKI_CPU=$(CONTIKI)/cpu/x86
|
CONTIKI_CPU=$(CONTIKI)/cpu/x86
|
||||||
|
include $(CONTIKI)/cpu/x86/Makefile.x86
|
||||||
|
|
||||||
### Compiler definitions
|
### Compiler definitions
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
@ -34,7 +35,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \
|
||||||
${addprefix -I,$(APPDIRS)} \
|
${addprefix -I,$(APPDIRS)} \
|
||||||
-DWITH_UIP -DWITH_ASCII \
|
-DWITH_UIP -DWITH_ASCII \
|
||||||
-Wall -g -I. -I/usr/local/include \
|
-Wall -g -I. -I/usr/local/include \
|
||||||
`gtk-config --cflags`
|
`gtk-config --cflags` -DNETSIM=1
|
||||||
CFLAGS += $(CFLAGSNO)
|
CFLAGS += $(CFLAGSNO)
|
||||||
LDFLAGS = -Wl,-Map=contiki-$(TARGET).map,-export-dynamic `gtk-config --libs`
|
LDFLAGS = -Wl,-Map=contiki-$(TARGET).map,-export-dynamic `gtk-config --libs`
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: contiki-main.c,v 1.2 2006/08/14 14:01:02 bg- Exp $
|
* $Id: contiki-main.c,v 1.3 2006/10/06 08:25:30 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
#include "dev/button-sensor.h"
|
#include "dev/button-sensor.h"
|
||||||
#include "dev/pir-sensor.h"
|
#include "dev/pir-sensor.h"
|
||||||
#include "dev/vib-sensor.h"
|
#include "dev/vib-sensor.h"
|
||||||
|
#include "dev/radio-sensor.h"
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
|
|
||||||
static struct uip_fw_netif tapif =
|
static struct uip_fw_netif tapif =
|
||||||
|
@ -63,7 +64,7 @@ static const struct uip_eth_addr ethaddr = {{0x00,0x06,0x98,0x01,0x02,0x12}};
|
||||||
/*PROCESS(test_send_process, "Test send stuff");
|
/*PROCESS(test_send_process, "Test send stuff");
|
||||||
PROCESS(test_tcp_process, "Test TCP");*/
|
PROCESS(test_tcp_process, "Test TCP");*/
|
||||||
|
|
||||||
SENSORS(&button_sensor, &pir_sensor, &vib_sensor);
|
SENSORS(&button_sensor, &pir_sensor, &vib_sensor, &radio_sensor);
|
||||||
|
|
||||||
PROCINIT(&sensors_process, &etimer_process, &tcpip_process,
|
PROCINIT(&sensors_process, &etimer_process, &tcpip_process,
|
||||||
ðernode_drv_process,
|
ðernode_drv_process,
|
||||||
|
|
|
@ -29,18 +29,17 @@
|
||||||
* This file is part of the Configurable Sensor Network Application
|
* This file is part of the Configurable Sensor Network Application
|
||||||
* Architecture for sensor nodes running the Contiki operating system.
|
* Architecture for sensor nodes running the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: dummy-sensors.c,v 1.1 2006/06/17 22:41:36 adamdunkels Exp $
|
* $Id: dummy-sensors.c,v 1.2 2006/10/06 08:25:31 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||||
* Created : 2005-11-01
|
* Created : 2005-11-01
|
||||||
* Updated : $Date: 2006/06/17 22:41:36 $
|
* Updated : $Date: 2006/10/06 08:25:31 $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dev/temperature-sensor.h"
|
#include "dev/temperature-sensor.h"
|
||||||
#include "dev/radio-sensor.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
@ -91,6 +90,3 @@ status(int type)
|
||||||
SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
|
SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
|
||||||
init, irq, activate, deactivate, active,
|
init, irq, activate, deactivate, active,
|
||||||
value, configure, status);
|
value, configure, status);
|
||||||
SENSORS_SENSOR(radio_sensor, RADIO_SENSOR,
|
|
||||||
init, irq, activate, deactivate, active,
|
|
||||||
value, configure, status);
|
|
||||||
|
|
91
platform/netsim/dev/radio-sensor.c
Normal file
91
platform/netsim/dev/radio-sensor.c
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2005, Swedish Institute of Computer Science
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* @(#)$Id: radio-sensor.c,v 1.1 2006/10/06 08:25:31 adamdunkels Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/sensors.h"
|
||||||
|
#include "dev/radio-sensor.h"
|
||||||
|
|
||||||
|
const struct sensors_sensor radio_sensor;
|
||||||
|
|
||||||
|
unsigned int radio_sensor_signal;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
init(void)
|
||||||
|
{
|
||||||
|
radio_sensor_signal = 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
irq(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
activate(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
deactivate(void)
|
||||||
|
{
|
||||||
|
radio_sensor_signal = 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
active(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static unsigned int
|
||||||
|
value(int type)
|
||||||
|
{
|
||||||
|
return radio_sensor_signal;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
configure(int type, void *c)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void *
|
||||||
|
status(int type)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
SENSORS_SENSOR(radio_sensor, RADIO_SENSOR,
|
||||||
|
init, irq, activate, deactivate, active,
|
||||||
|
value, configure, status);
|
|
@ -24,7 +24,7 @@
|
||||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
* OF SUCH DAMAGE.
|
* OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: display.c,v 1.2 2006/09/26 22:10:12 adamdunkels Exp $
|
* $Id: display.c,v 1.3 2006/10/06 08:25:30 adamdunkels Exp $
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
|
@ -251,7 +251,11 @@ display_tick(void)
|
||||||
} else {
|
} else {
|
||||||
e = NULL;
|
e = NULL;
|
||||||
}
|
}
|
||||||
|
if(d->size > 40) {
|
||||||
|
d->size -= 8;
|
||||||
|
} else {
|
||||||
d->size -= 4;
|
d->size -= 4;
|
||||||
|
}
|
||||||
/* --(d->intensity);*/
|
/* --(d->intensity);*/
|
||||||
if(d->size > 0) {
|
if(d->size > 0) {
|
||||||
list_push(tempdots, d);
|
list_push(tempdots, d);
|
||||||
|
@ -329,7 +333,8 @@ key_press_event (GtkWidget * widget, GdkEventKey * event)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if(event->keyval == 'q') {
|
if(event->keyval == 'q') {
|
||||||
exit(0);
|
gtk_exit(0);
|
||||||
|
/* exit(0);*/
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ether.c,v 1.2 2006/09/26 22:10:12 adamdunkels Exp $
|
* $Id: ether.c,v 1.3 2006/10/06 08:25:30 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
|
@ -59,6 +59,8 @@
|
||||||
#include "lib/list.h"
|
#include "lib/list.h"
|
||||||
#include "nodes.h"
|
#include "nodes.h"
|
||||||
|
|
||||||
|
#include "dev/radio-sensor.h"
|
||||||
|
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
|
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
@ -91,6 +93,7 @@ struct ether_hdr {
|
||||||
int type;
|
int type;
|
||||||
struct sensor_data sensor_data;
|
struct sensor_data sensor_data;
|
||||||
clock_time_t clock;
|
clock_time_t clock;
|
||||||
|
int signal;
|
||||||
int srcx, srcy;
|
int srcx, srcy;
|
||||||
int srcpid;
|
int srcpid;
|
||||||
int srcid;
|
int srcid;
|
||||||
|
@ -102,6 +105,7 @@ struct ether_hdr {
|
||||||
static int strength;
|
static int strength;
|
||||||
|
|
||||||
static int collisions = 1;
|
static int collisions = 1;
|
||||||
|
static int num_collisions = 0;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -193,7 +197,7 @@ ether_client_poll(void)
|
||||||
FD_SET(sc, &fdset);
|
FD_SET(sc, &fdset);
|
||||||
|
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 1000;
|
tv.tv_usec = 5000;
|
||||||
|
|
||||||
|
|
||||||
ret = select(sc + 1, &fdset, NULL, NULL, &tv);
|
ret = select(sc + 1, &fdset, NULL, NULL, &tv);
|
||||||
|
@ -209,6 +213,7 @@ ether_client_poll(void)
|
||||||
len = ret;
|
len = ret;
|
||||||
|
|
||||||
memcpy(uip_buf, &rxbuffer[sizeof(struct ether_hdr)], len);
|
memcpy(uip_buf, &rxbuffer[sizeof(struct ether_hdr)], len);
|
||||||
|
radio_sensor_signal = hdr->signal;
|
||||||
|
|
||||||
if(hdr->type == PTYPE_DATA && hdr->srcid != node.id) {
|
if(hdr->type == PTYPE_DATA && hdr->srcid != node.id) {
|
||||||
return len - sizeof(struct ether_hdr);
|
return len - sizeof(struct ether_hdr);
|
||||||
|
@ -240,7 +245,7 @@ ether_server_poll(void)
|
||||||
|
|
||||||
|
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 4000;
|
tv.tv_usec = 100;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -348,6 +353,9 @@ ether_tick(void)
|
||||||
(p->y - y) * (p->y - y) <=
|
(p->y - y) * (p->y - y) <=
|
||||||
ether_strength() * ether_strength()) {
|
ether_strength() * ether_strength()) {
|
||||||
|
|
||||||
|
hdr->signal = ether_strength() * ether_strength() -
|
||||||
|
(p->x - x) * (p->x - x) -
|
||||||
|
(p->y - y) * (p->y - y);
|
||||||
/* This packet was sent in the reception range of this node,
|
/* This packet was sent in the reception range of this node,
|
||||||
so we check against all other packets to see if there is
|
so we check against all other packets to see if there is
|
||||||
more than one packet sent towards this node. If so, we have
|
more than one packet sent towards this node. If so, we have
|
||||||
|
@ -368,6 +376,11 @@ ether_tick(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(interference) {
|
||||||
|
num_collisions++;
|
||||||
|
/* printf("Collisions %d\n", num_collisions);*/
|
||||||
|
}
|
||||||
|
|
||||||
if(!interference) {
|
if(!interference) {
|
||||||
/* printf("ether: delivering packet from %d to %d\n",
|
/* printf("ether: delivering packet from %d to %d\n",
|
||||||
hdr->srcid, port);*/
|
hdr->srcid, port);*/
|
||||||
|
@ -476,7 +489,7 @@ ether_send_sensor_data(struct sensor_data *d, int srcx, int srcy, int strength)
|
||||||
int i;
|
int i;
|
||||||
struct ether_hdr hdr;
|
struct ether_hdr hdr;
|
||||||
|
|
||||||
printf("Sensor data at (%d, %d)\n", srcx, srcy);
|
/* printf("Sensor data at (%d, %d)\n", srcx, srcy);*/
|
||||||
|
|
||||||
for(i = 0; i < nodes_num(); ++i) {
|
for(i = 0; i < nodes_num(); ++i) {
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: init.h,v 1.1 2006/06/17 22:41:35 adamdunkels Exp $
|
* @(#)$Id: init.h,v 1.2 2006/10/06 08:25:30 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef __INIT_H__
|
#ifndef __INIT_H__
|
||||||
#define __INIT_H__
|
#define __INIT_H__
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
|
|
||||||
void main_add_node(int x, int y);
|
int main_add_node(int x, int y);
|
||||||
void main_add_base(int x, int y);
|
void main_add_base(int x, int y);
|
||||||
|
|
||||||
#endif /* __INIT_H__ */
|
#endif /* __INIT_H__ */
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.2 2006/08/14 14:01:02 bg- Exp $
|
* $Id: main.c,v 1.3 2006/10/06 08:25:30 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,7 @@ idle(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static int
|
||||||
start_node(int x, int y, int b)
|
start_node(int x, int y, int b)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -123,7 +123,7 @@ start_node(int x, int y, int b)
|
||||||
|
|
||||||
usleep(1000 * ((random() & 0x0f) << 6) );
|
usleep(1000 * ((random() & 0x0f) << 6) );
|
||||||
|
|
||||||
node_init(port - NODES_PORTBASE, x, y, b);
|
node_init(port - NODES_PORTBASE + 1, x, y, b);
|
||||||
ethernode_init(port);
|
ethernode_init(port);
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,12 +138,13 @@ start_node(int x, int y, int b)
|
||||||
|
|
||||||
|
|
||||||
++port;
|
++port;
|
||||||
|
return port - NODES_PORTBASE;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
int
|
||||||
main_add_node(int x, int y)
|
main_add_node(int x, int y)
|
||||||
{
|
{
|
||||||
start_node(x, y, 0);
|
return start_node(x, y, 0);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ethernode-drv.c,v 1.1 2006/06/17 22:41:36 adamdunkels Exp $
|
* $Id: ethernode-drv.c,v 1.2 2006/10/06 08:25:31 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -41,6 +41,8 @@
|
||||||
#include "net/hc.h"
|
#include "net/hc.h"
|
||||||
#include "net/tapdev.h"
|
#include "net/tapdev.h"
|
||||||
|
|
||||||
|
#include "node-id.h"
|
||||||
|
|
||||||
PROCESS(ethernode_drv_process, "Ethernode driver");
|
PROCESS(ethernode_drv_process, "Ethernode driver");
|
||||||
|
|
||||||
enum { NULLEVENT };
|
enum { NULLEVENT };
|
||||||
|
@ -49,14 +51,13 @@ u8_t
|
||||||
ethernode_drv_send(void)
|
ethernode_drv_send(void)
|
||||||
{
|
{
|
||||||
uip_len = hc_compress();
|
uip_len = hc_compress();
|
||||||
/* uip_len = hc_inflate();*/
|
|
||||||
|
|
||||||
return ethernode_send();
|
return ethernode_send();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(ethernode_drv_process, ev, data)
|
PROCESS_THREAD(ethernode_drv_process, ev, data)
|
||||||
{
|
{
|
||||||
/* static int drop = 0; */
|
static int drop = 3;
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
@ -67,10 +68,10 @@ PROCESS_THREAD(ethernode_drv_process, ev, data)
|
||||||
uip_len = ethernode_poll();
|
uip_len = ethernode_poll();
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
|
/* printf("%d: new packet len %d\n", node_id, uip_len);*/
|
||||||
|
|
||||||
/* if(drop++ >= (random_rand() % 10)) {
|
/* if((random_rand() % drop) <= drop / 2) {
|
||||||
printf("Bropp\n");
|
printf("Bropp\n");
|
||||||
drop = 0;
|
|
||||||
} else*/ {
|
} else*/ {
|
||||||
|
|
||||||
uip_len = hc_inflate();
|
uip_len = hc_inflate();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: ethernode.c,v 1.1 2006/06/17 22:41:36 adamdunkels Exp $
|
* $Id: ethernode.c,v 1.2 2006/10/06 08:25:31 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
|
@ -181,7 +181,7 @@ ethernode_send(void)
|
||||||
|
|
||||||
dest = ID_BROADCAST;
|
dest = ID_BROADCAST;
|
||||||
|
|
||||||
usleep(800 * (random_rand() % 1000));
|
/* usleep(800 * (random_rand() % 1000));*/
|
||||||
|
|
||||||
do_send(TYPE_DATA, dest, hdr, len);
|
do_send(TYPE_DATA, dest, hdr, len);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue