Merge remote-tracking branch 'sf/master' into rpl-patch
This commit is contained in:
commit
0e32956a63
406 changed files with 26884 additions and 3635 deletions
|
@ -1,20 +1,37 @@
|
|||
all: border-router
|
||||
CONTIKI_PROJECT=border-router
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI=../../..
|
||||
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
#Override inclusion of internal webserver with make WITH_WEBSERVER=0
|
||||
WITH_WEBSERVER=1
|
||||
#linker optimizations
|
||||
SMALL=1
|
||||
|
||||
ifeq ($(WITH_WEBSERVER), 0)
|
||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||
PROJECT_SOURCEFILES += slip-bridge.c
|
||||
else
|
||||
APPS += webserver
|
||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -DWEBSERVER
|
||||
PROJECT_SOURCEFILES += slip-bridge.c httpd-simple.c
|
||||
|
||||
#Simple built-in webserver is the default.
|
||||
#Override with make WITH_WEBSERVER=0 for no webserver.
|
||||
#WITH_WEBSERVER=webserver-name will use /apps/webserver-name if it can be
|
||||
#found in the /apps, /platform/$(TARGET)/apps/, or current directory (in that order).
|
||||
# WITH_WEBSERVER=webserver for /apps/webserver
|
||||
# WITH_WEBSERVER=raven-webserver for /platform/avr-raven/apps/raven-webserver/
|
||||
#make clean before changing webservers!
|
||||
|
||||
#Note /apps/webserver contains a 2500 byte style sheet which is a severe test
|
||||
#of the slip connection. Large MSS together with low baud rates without flow
|
||||
#control will overrun the transmit buffer when the style sheet is requested.
|
||||
|
||||
WITH_WEBSERVER=1
|
||||
ifeq ($(WITH_WEBSERVER),1)
|
||||
CFLAGS += -DWEBSERVER=1
|
||||
PROJECT_SOURCEFILES += httpd-simple.c
|
||||
else ifneq ($(WITH_WEBSERVER), 0)
|
||||
APPS += $(WITH_WEBSERVER)
|
||||
CFLAGS += -DWEBSERVER=2
|
||||
endif
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
|
|
@ -46,18 +46,12 @@
|
|||
#include "dev/button-sensor.h"
|
||||
#include "dev/slip.h"
|
||||
|
||||
/* For internal webserver Makefile must set APPS += webserver and PROJECT_SOURCEFILES += httpd-simple.c */
|
||||
#if WEBSERVER
|
||||
#include "webserver-nogui.h"
|
||||
#include "httpd-simple.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define DEBUG DEBUG_PRINT
|
||||
#define DEBUG DEBUG_NONE
|
||||
#include "net/uip-debug.h"
|
||||
|
||||
uint16_t dag_id[] = {0x1111, 0x1100, 0, 0, 0, 0, 0, 0x0011};
|
||||
|
@ -69,11 +63,33 @@ static uip_ipaddr_t prefix;
|
|||
static uint8_t prefix_set;
|
||||
|
||||
PROCESS(border_router_process, "Border router process");
|
||||
AUTOSTART_PROCESSES(&border_router_process);
|
||||
|
||||
#if WEBSERVER
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Only one single web request at time */
|
||||
#if WEBSERVER==0
|
||||
/* No webserver */
|
||||
AUTOSTART_PROCESSES(&border_router_process);
|
||||
#elif WEBSERVER>1
|
||||
/* Use an external webserver application */
|
||||
#include "webserver-nogui.h"
|
||||
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
|
||||
#else
|
||||
/* Use simple webserver with only one page */
|
||||
#include "httpd-simple.h"
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
httpd_init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||
httpd_appcall(data);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
|
||||
|
||||
static const char *TOP = "<html><head><title>ContikiRPL</title></head><body>\n";
|
||||
static const char *BOTTOM = "</body></html>\n";
|
||||
static char buf[128];
|
||||
|
@ -114,11 +130,11 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
|||
SEND_STRING(&s->sout, TOP);
|
||||
|
||||
blen = 0;
|
||||
ADD("<h2>Neighbors</h2>");
|
||||
ADD("Neighbors<pre>");
|
||||
for(i = 0; i < UIP_DS6_NBR_NB; i++) {
|
||||
if(uip_ds6_nbr_cache[i].isused) {
|
||||
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
|
||||
ADD("<br>\n");
|
||||
ADD("\n");
|
||||
if(blen > sizeof(buf) - 45) {
|
||||
SEND_STRING(&s->sout, buf);
|
||||
blen = 0;
|
||||
|
@ -126,7 +142,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
|||
}
|
||||
}
|
||||
|
||||
ADD("<h2>Routes</h2>");
|
||||
ADD("</pre>Routes<pre>");
|
||||
SEND_STRING(&s->sout, buf);
|
||||
blen = 0;
|
||||
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
|
||||
|
@ -135,18 +151,19 @@ PT_THREAD(generate_routes(struct httpd_state *s))
|
|||
ADD("/%u (via ", uip_ds6_routing_table[i].length);
|
||||
ipaddr_add(&uip_ds6_routing_table[i].nexthop);
|
||||
if(uip_ds6_routing_table[i].state.lifetime < 600) {
|
||||
ADD(") %lus<br>\n", uip_ds6_routing_table[i].state.lifetime);
|
||||
ADD(") %lus\n", uip_ds6_routing_table[i].state.lifetime);
|
||||
} else {
|
||||
ADD(")<br>\n");
|
||||
ADD(")\n");
|
||||
}
|
||||
SEND_STRING(&s->sout, buf);
|
||||
blen = 0;
|
||||
}
|
||||
}
|
||||
if(blen > 0) {
|
||||
ADD("</pre>");
|
||||
//if(blen > 0) {
|
||||
SEND_STRING(&s->sout, buf);
|
||||
blen = 0;
|
||||
}
|
||||
// blen = 0;
|
||||
//}
|
||||
|
||||
SEND_STRING(&s->sout, BOTTOM);
|
||||
|
||||
|
@ -212,10 +229,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
|||
|
||||
PROCESS_PAUSE();
|
||||
|
||||
#if WEBSERVER
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
#endif
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
PRINTF("RPL-Border router started\n");
|
||||
|
|
|
@ -43,12 +43,11 @@
|
|||
|
||||
#include "contiki-net.h"
|
||||
|
||||
#include "webserver.h"
|
||||
#include "lib/petsciiconv.h"
|
||||
#include "http-strings.h"
|
||||
#include "urlconv.h"
|
||||
//#include "urlconv.h"
|
||||
|
||||
#include "httpd-simple.h"
|
||||
#define webserver_log_file(...)
|
||||
#define webserver_log(...)
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define CONNS UIP_CONNS
|
||||
|
@ -90,6 +89,7 @@ PT_THREAD(send_string(struct httpd_state *s, const char *str))
|
|||
PSOCK_END(&s->sout);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const char http_content_type_html[] = "Content-type: text/html\r\n\r\n";
|
||||
static
|
||||
PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))
|
||||
{
|
||||
|
@ -120,18 +120,17 @@ PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))
|
|||
PSOCK_END(&s->sout);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const char http_header_200[] = "HTTP/1.0 200 OK\r\nServer: Contiki/2.4 http://www.sics.se/contiki/\r\nConnection: close\r\n";
|
||||
const char http_header_404[] = "HTTP/1.0 404 Not found\r\nServer: Contiki/2.4 http://www.sics.se/contiki/\r\nConnection: close\r\n";
|
||||
static
|
||||
PT_THREAD(handle_output(struct httpd_state *s))
|
||||
{
|
||||
PT_BEGIN(&s->outputpt);
|
||||
|
||||
s->script = NULL;
|
||||
petsciiconv_topetscii(s->filename, sizeof(s->filename));
|
||||
s->script = httpd_simple_get_script(&s->filename[1]);
|
||||
petsciiconv_toascii(s->filename, sizeof(s->filename));
|
||||
if(s->script == NULL) {
|
||||
strcpy(s->filename, "/notfound.html");
|
||||
petsciiconv_toascii(s->filename, sizeof(s->filename));
|
||||
strncpy(s->filename, "/notfound.html", sizeof(s->filename));
|
||||
PT_WAIT_THREAD(&s->outputpt,
|
||||
send_headers(s, http_header_404));
|
||||
PT_WAIT_THREAD(&s->outputpt,
|
||||
|
@ -149,6 +148,9 @@ PT_THREAD(handle_output(struct httpd_state *s))
|
|||
PT_END(&s->outputpt);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const char http_get[] = "GET ";
|
||||
const char http_index_html[] = "/index.html";
|
||||
//const char http_referer[] = "Referer:"
|
||||
static
|
||||
PT_THREAD(handle_input(struct httpd_state *s))
|
||||
{
|
||||
|
@ -177,19 +179,18 @@ PT_THREAD(handle_input(struct httpd_state *s))
|
|||
}
|
||||
#endif /* URLCONV */
|
||||
|
||||
petsciiconv_topetscii(s->filename, sizeof(s->filename));
|
||||
webserver_log_file(&uip_conn->ripaddr, s->filename);
|
||||
petsciiconv_toascii(s->filename, sizeof(s->filename));
|
||||
|
||||
s->state = STATE_OUTPUT;
|
||||
|
||||
while(1) {
|
||||
PSOCK_READTO(&s->sin, ISO_nl);
|
||||
|
||||
#if 0
|
||||
if(strncmp(s->inputbuf, http_referer, 8) == 0) {
|
||||
s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0;
|
||||
petsciiconv_topetscii(s->inputbuf, PSOCK_DATALEN(&s->sin) - 2);
|
||||
webserver_log(s->inputbuf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PSOCK_END(&s->sin);
|
||||
|
@ -203,6 +204,7 @@ handle_connection(struct httpd_state *s)
|
|||
handle_output(s);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_appcall(void *state)
|
||||
|
@ -245,10 +247,12 @@ httpd_appcall(void *state)
|
|||
uip_abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_init(void)
|
||||
{
|
||||
|
||||
tcp_listen(UIP_HTONS(80));
|
||||
memb_init(&conns);
|
||||
#if URLCONV
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: httpd-simple.h,v 1.1 2010/05/09 12:52:05 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -43,8 +42,10 @@
|
|||
|
||||
#include "contiki-net.h"
|
||||
|
||||
/* The current internal border router webserver ignores the requested file name */
|
||||
/* and needs no per-connection output buffer, so save some RAM */
|
||||
#ifndef WEBSERVER_CONF_CFS_PATHLEN
|
||||
#define HTTPD_PATHLEN 80
|
||||
#define HTTPD_PATHLEN 2
|
||||
#else /* WEBSERVER_CONF_CFS_CONNS */
|
||||
#define HTTPD_PATHLEN WEBSERVER_CONF_CFS_PATHLEN
|
||||
#endif /* WEBSERVER_CONF_CFS_CONNS */
|
||||
|
@ -56,8 +57,8 @@ struct httpd_state {
|
|||
struct timer timer;
|
||||
struct psock sin, sout;
|
||||
struct pt outputpt;
|
||||
char inputbuf[HTTPD_PATHLEN + 30];
|
||||
char outputbuf[UIP_TCP_MSS];
|
||||
char inputbuf[HTTPD_PATHLEN + 24];
|
||||
/*char outputbuf[UIP_TCP_MSS]; */
|
||||
char filename[HTTPD_PATHLEN];
|
||||
httpd_simple_script_t script;
|
||||
char state;
|
||||
|
|
|
@ -5,6 +5,11 @@ PROJECT_SOURCEFILES += collect-common.c
|
|||
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
ifdef PERIOD
|
||||
CFLAGS=-DPERIOD=$(PERIOD)
|
||||
endif
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: collect-common.c,v 1.2 2010/11/06 11:55:15 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -44,13 +43,16 @@
|
|||
#include "collect-common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static unsigned long time_offset;
|
||||
static int send_active = 1;
|
||||
|
||||
#ifndef PERIOD
|
||||
#define PERIOD 60
|
||||
#define RANDWAIT 60
|
||||
#endif
|
||||
#define RANDWAIT (PERIOD)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(collect_common_process, "collect common process");
|
||||
|
|
|
@ -137,7 +137,9 @@ collect_common_send(void)
|
|||
uip_ds6_nbr_t *nbr;
|
||||
nbr = uip_ds6_nbr_lookup(&preferred_parent->addr);
|
||||
if(nbr != NULL) {
|
||||
rimeaddr_copy(&parent, (rimeaddr_t *)&nbr->ipaddr.u8[8]);
|
||||
/* Use parts of the IPv6 address as the parent address, in reversed byte order. */
|
||||
parent.u8[RIMEADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2];
|
||||
parent.u8[RIMEADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1];
|
||||
parent_etx = neighbor_info_get_metric((rimeaddr_t *) &nbr->lladdr) / 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,18 @@ CONTIKI=../../..
|
|||
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
ifdef WITH_COMPOWER
|
||||
APPS+=powertrace
|
||||
CFLAGS+= -DCONTIKIMAC_CONF_COMPOWER=1 -DWITH_COMPOWER=1 -DQUEUEBUF_CONF_NUM=4
|
||||
endif
|
||||
|
||||
ifdef SERVER_REPLY
|
||||
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
|
||||
endif
|
||||
ifdef PERIOD
|
||||
CFLAGS+=-DPERIOD=$(PERIOD)
|
||||
endif
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
|
584
examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
Normal file
584
examples/ipv6/rpl-udp/rpl-udp-powertrace.csc
Normal file
|
@ -0,0 +1,584 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<simconf>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mobility</project>
|
||||
<simulation>
|
||||
<title>Data collection network using IPv6 and RPL</title>
|
||||
<delaytime>0</delaytime>
|
||||
<randomseed>generated</randomseed>
|
||||
<motedelay_us>5000000</motedelay_us>
|
||||
<radiomedium>
|
||||
se.sics.cooja.radiomediums.UDGM
|
||||
<transmitting_range>50.0</transmitting_range>
|
||||
<interference_range>50.0</interference_range>
|
||||
<success_ratio_tx>1.0</success_ratio_tx>
|
||||
<success_ratio_rx>1.0</success_ratio_rx>
|
||||
</radiomedium>
|
||||
<events>
|
||||
<logoutput>40000</logoutput>
|
||||
</events>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky1</identifier>
|
||||
<description>Sky Mote Type #sky1</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-server.c</source>
|
||||
<commands EXPORT="discard">make udp-server.sky TARGET=sky WITH_COMPOWER=1</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-server.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky2</identifier>
|
||||
<description>Sky Mote Type #sky2</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-client.c</source>
|
||||
<commands EXPORT="discard">make udp-client.sky TARGET=sky WITH_COMPOWER=1</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-udp/udp-client.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>48.435974731198804</x>
|
||||
<y>-66.16503914182063</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>1</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>4.049356309774755</x>
|
||||
<y>98.28771308774003</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>2</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>127.9689727848476</x>
|
||||
<y>91.71883780610729</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>3</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>57.897299848739024</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>4</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>47.34887596588397</x>
|
||||
<y>-30.341495695501195</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>5</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>47.13486576528276</x>
|
||||
<y>32.944481932122315</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>6</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-11.42091423859419</x>
|
||||
<y>17.879870626121914</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>7</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>118.92746659954325</x>
|
||||
<y>57.05973076244069</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>8</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>53.68872892015448</x>
|
||||
<y>59.887319605093715</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>16.45706316609417</x>
|
||||
<y>23.9075414163248</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-18.9555027263478</x>
|
||||
<y>75.14274313304935</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>11</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>29.265863595275306</x>
|
||||
<y>85.6911670159044</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>12</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-39.298891643282545</x>
|
||||
<y>-3.9704359883635574</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>13</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>66.93880603404335</x>
|
||||
<y>-42.39683727590697</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>14</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>94.81678343873172</x>
|
||||
<y>26.921376811426246</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>15</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-43.06618588715935</x>
|
||||
<y>30.68867105530305</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>16</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-34.02467970185502</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>17</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-28.750467760427494</x>
|
||||
<y>48.01822457713635</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>18</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>124.95513738974614</x>
|
||||
<y>20.140247172447996</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>19</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>15.703604317318808</x>
|
||||
<y>-47.6710492173345</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>20</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-40.05235049205791</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>21</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>121.18784314586934</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>22</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>88.03565379975346</x>
|
||||
<y>-44.657213822233054</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>23</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>24.745110502623138</x>
|
||||
<y>-1.7100594420374744</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>24</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>94.06332458995635</x>
|
||||
<y>-2.4635182908128352</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>25</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-4.639784599615941</x>
|
||||
<y>-9.998106778566445</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>26</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>-13.681290784920272</x>
|
||||
<y>-50.684884612435944</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>27</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>103.10483077526068</x>
|
||||
<y>96.99304974753483</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>28</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>8.922474678340558</x>
|
||||
<y>59.320107308766765</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>29</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>58.650758697514384</x>
|
||||
<y>2.8106936506146916</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>30</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>90.59867707439</x>
|
||||
<y>67.97632874312737</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>31</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.SimControl
|
||||
<width>259</width>
|
||||
<z>1</z>
|
||||
<height>184</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.Visualizer
|
||||
<plugin_config>
|
||||
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.AttributeVisualizerSkin</skin>
|
||||
<viewport>2.349818846983307 0.0 0.0 2.349818846983307 150.19773526533348 176.95275613586946</viewport>
|
||||
</plugin_config>
|
||||
<width>520</width>
|
||||
<z>3</z>
|
||||
<height>523</height>
|
||||
<location_x>269</location_x>
|
||||
<location_y>14</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.LogListener
|
||||
<plugin_config>
|
||||
<filter />
|
||||
</plugin_config>
|
||||
<width>937</width>
|
||||
<z>0</z>
|
||||
<height>213</height>
|
||||
<location_x>21</location_x>
|
||||
<location_y>464</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.ScriptRunner
|
||||
<plugin_config>
|
||||
<script>TIMEOUT(12000000, log.log("Total PRR " + totalPRR + "\n"));
|
||||
packetsReceived= new Array();
|
||||
packetsSent = new Array();
|
||||
serverID = 1;
|
||||
nodeCount = 31;
|
||||
totalPRR = 0;
|
||||
|
||||
for(i = 0; i <= nodeCount; i++) {
|
||||
packetsReceived[i] = 0;
|
||||
packetsSent[i] = 0;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
YIELD();
|
||||
|
||||
msgArray = msg.split(' ');
|
||||
if(msgArray[0].equals("DATA")) {
|
||||
if(msgArray.length == 9) {
|
||||
// Received packet
|
||||
senderID = parseInt(msgArray[8]);
|
||||
packetsReceived[senderID]++;
|
||||
|
||||
log.log("SenderID " + senderID + " PRR " + packetsReceived[senderID] / packetsSent[senderID] + "\n");
|
||||
totalReceived = totalSent = 0;
|
||||
for(i = serverID + 1; i <= nodeCount; i++) {
|
||||
totalReceived += packetsReceived[i];
|
||||
totalSent += packetsSent[i];
|
||||
}
|
||||
totalPRR = totalReceived / totalSent;
|
||||
log.log("Total PRR " + totalPRR + " recv " + totalReceived + " sent " + totalSent + "\n");
|
||||
} else if(msgArray.length == 6) {
|
||||
// Sent packet
|
||||
packetsSent[id]++;
|
||||
}
|
||||
}
|
||||
}</script>
|
||||
<active>true</active>
|
||||
</plugin_config>
|
||||
<width>600</width>
|
||||
<z>2</z>
|
||||
<height>700</height>
|
||||
<location_x>665</location_x>
|
||||
<location_y>6</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
|
@ -34,7 +34,9 @@
|
|||
#include "net/uip-ds6.h"
|
||||
#include "net/uip-udp-packet.h"
|
||||
#include "sys/ctimer.h"
|
||||
|
||||
#ifdef WITH_COMPOWER
|
||||
#include "powertrace.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -46,8 +48,12 @@
|
|||
#define DEBUG DEBUG_PRINT
|
||||
#include "net/uip-debug.h"
|
||||
|
||||
#ifndef PERIOD
|
||||
#define PERIOD 60
|
||||
#endif
|
||||
|
||||
#define START_INTERVAL (15 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (60 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
#define MAX_PAYLOAD_LEN 30
|
||||
|
||||
|
@ -141,6 +147,7 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
|||
{
|
||||
static struct etimer periodic;
|
||||
static struct ctimer backoff_timer;
|
||||
static int print = 0;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
|
@ -161,6 +168,10 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
|||
PRINTF(" local/remote port %u/%u\n",
|
||||
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
|
||||
|
||||
#if WITH_COMPOWER
|
||||
powertrace_sniff(POWERTRACE_ON);
|
||||
#endif
|
||||
|
||||
etimer_set(&periodic, SEND_INTERVAL);
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
|
@ -171,6 +182,16 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
|||
if(etimer_expired(&periodic)) {
|
||||
etimer_reset(&periodic);
|
||||
ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
|
||||
|
||||
#if WITH_COMPOWER
|
||||
if (print == 0) {
|
||||
powertrace_print("#P");
|
||||
}
|
||||
if (++print == 3) {
|
||||
print = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ tcpip_handler(void)
|
|||
UIP_IP_BUF->srcipaddr.u8[sizeof(UIP_IP_BUF->srcipaddr.u8) - 1]);
|
||||
PRINTF("\n");
|
||||
#if SERVER_REPLY
|
||||
PRINTF("DATA sending reply\n");
|
||||
uip_ipaddr_copy(&server_conn->ripaddr, &UIP_IP_BUF->srcipaddr);
|
||||
uip_udp_packet_send(server_conn, "Reply", sizeof("Reply"));
|
||||
uip_create_unspecified(&server_conn->ripaddr);
|
||||
|
|
9
examples/ipv6/simple-udp-rpl/Makefile
Normal file
9
examples/ipv6/simple-udp-rpl/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
all: broadcast-example unicast-sender unicast-receiver
|
||||
APPS=servreg-hack
|
||||
CONTIKI=../../..
|
||||
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
96
examples/ipv6/simple-udp-rpl/broadcast-example.c
Normal file
96
examples/ipv6/simple-udp-rpl/broadcast-example.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/random.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "net/uip.h"
|
||||
#include "net/uip-ds6.h"
|
||||
|
||||
#include "simple-udp.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define UDP_PORT 1234
|
||||
|
||||
#define SEND_INTERVAL (20 * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
|
||||
static struct simple_udp_connection broadcast_connection;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(broadcast_example_process, "UDP broadcast example process");
|
||||
AUTOSTART_PROCESSES(&broadcast_example_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
receiver(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
printf("Data received on port %d from port %d with length %d\n",
|
||||
receiver_port, sender_port, datalen);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(broadcast_example_process, ev, data)
|
||||
{
|
||||
static struct etimer periodic_timer;
|
||||
static struct etimer send_timer;
|
||||
uip_ipaddr_t addr;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
simple_udp_register(&broadcast_connection, UDP_PORT,
|
||||
NULL, UDP_PORT,
|
||||
receiver);
|
||||
|
||||
etimer_set(&periodic_timer, SEND_INTERVAL);
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
etimer_reset(&periodic_timer);
|
||||
etimer_set(&send_timer, SEND_TIME);
|
||||
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
|
||||
printf("Sending broadcast\n");
|
||||
uip_create_linklocal_allnodes_mcast(&addr);
|
||||
simple_udp_sendto(&broadcast_connection, "Test", 4, &addr);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
248
examples/ipv6/simple-udp-rpl/broadcast-example.csc
Normal file
248
examples/ipv6/simple-udp-rpl/broadcast-example.csc
Normal file
|
@ -0,0 +1,248 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<simconf>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/native_gateway</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/serial_socket</project>
|
||||
<project EXPORT="discard">/home/user/contikiprojects/sics.se/mobility</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/collect-view</project>
|
||||
<project EXPORT="discard">/home/user/nes/papers/smartip-paper/code/cooja_qr</project>
|
||||
<simulation>
|
||||
<title>Simple UDP broadcast example</title>
|
||||
<delaytime>0</delaytime>
|
||||
<randomseed>123456</randomseed>
|
||||
<motedelay_us>1000000</motedelay_us>
|
||||
<radiomedium>
|
||||
se.sics.cooja.radiomediums.UDGM
|
||||
<transmitting_range>50.0</transmitting_range>
|
||||
<interference_range>100.0</interference_range>
|
||||
<success_ratio_tx>1.0</success_ratio_tx>
|
||||
<success_ratio_rx>1.0</success_ratio_rx>
|
||||
</radiomedium>
|
||||
<events>
|
||||
<logoutput>40000</logoutput>
|
||||
</events>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky1</identifier>
|
||||
<description>Broadcast example</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/broadcast-example.c</source>
|
||||
<commands EXPORT="discard">make broadcast-example.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/broadcast-example.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>64.1956818968534</x>
|
||||
<y>28.591062627059372</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>1</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>51.81261061627534</x>
|
||||
<y>24.647047255346667</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>2</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>9.068527629624546</x>
|
||||
<y>46.26817786392282</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>3</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>87.5626508274206</x>
|
||||
<y>4.896101751816129</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>4</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>55.15853460164762</x>
|
||||
<y>3.4681662067903796</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>5</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>99.33682438963966</x>
|
||||
<y>49.73072195748186</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>6</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>61.26294736288044</x>
|
||||
<y>61.845254356789646</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>7</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>70.4693668755668</x>
|
||||
<y>52.43101713632271</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>8</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>33.5789440978246</x>
|
||||
<y>48.10557568631877</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>62.6079314243491</x>
|
||||
<y>76.96581640898913</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.SimControl
|
||||
<width>318</width>
|
||||
<z>3</z>
|
||||
<height>192</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.Visualizer
|
||||
<plugin_config>
|
||||
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.GridVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<viewport>2.9205864417411154 0.0 0.0 2.9205864417411154 -13.303600659817928 3.5428004585568913</viewport>
|
||||
</plugin_config>
|
||||
<width>300</width>
|
||||
<z>2</z>
|
||||
<height>300</height>
|
||||
<location_x>1122</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.LogListener
|
||||
<plugin_config>
|
||||
<filter />
|
||||
</plugin_config>
|
||||
<width>1422</width>
|
||||
<z>0</z>
|
||||
<height>236</height>
|
||||
<location_x>-1</location_x>
|
||||
<location_y>302</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.TimeLine
|
||||
<plugin_config>
|
||||
<mote>0</mote>
|
||||
<mote>1</mote>
|
||||
<mote>2</mote>
|
||||
<mote>3</mote>
|
||||
<mote>4</mote>
|
||||
<mote>5</mote>
|
||||
<mote>6</mote>
|
||||
<mote>7</mote>
|
||||
<mote>8</mote>
|
||||
<mote>9</mote>
|
||||
<showRadioRXTX />
|
||||
<showRadioHW />
|
||||
<split>125</split>
|
||||
<zoomfactor>500.0</zoomfactor>
|
||||
</plugin_config>
|
||||
<width>1422</width>
|
||||
<z>1</z>
|
||||
<height>190</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>539</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
287
examples/ipv6/simple-udp-rpl/unicast-example.csc
Normal file
287
examples/ipv6/simple-udp-rpl/unicast-example.csc
Normal file
|
@ -0,0 +1,287 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<simconf>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/native_gateway</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/serial_socket</project>
|
||||
<project EXPORT="discard">/home/user/contikiprojects/sics.se/mobility</project>
|
||||
<project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/collect-view</project>
|
||||
<project EXPORT="discard">/home/user/nes/papers/smartip-paper/code/cooja_qr</project>
|
||||
<simulation>
|
||||
<title>Simple UDP unicast example</title>
|
||||
<delaytime>0</delaytime>
|
||||
<randomseed>123456</randomseed>
|
||||
<motedelay_us>1000000</motedelay_us>
|
||||
<radiomedium>
|
||||
se.sics.cooja.radiomediums.UDGM
|
||||
<transmitting_range>50.0</transmitting_range>
|
||||
<interference_range>100.0</interference_range>
|
||||
<success_ratio_tx>1.0</success_ratio_tx>
|
||||
<success_ratio_rx>1.0</success_ratio_rx>
|
||||
</radiomedium>
|
||||
<events>
|
||||
<logoutput>40000</logoutput>
|
||||
</events>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky1</identifier>
|
||||
<description>UDP receiver</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-receiver.c</source>
|
||||
<commands EXPORT="discard">make unicast-receiver.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-receiver.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<motetype>
|
||||
se.sics.cooja.mspmote.SkyMoteType
|
||||
<identifier>sky2</identifier>
|
||||
<description>UDP sender</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-sender.c</source>
|
||||
<commands EXPORT="discard">make unicast-sender.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/simple-udp-rpl/unicast-sender.sky</firmware>
|
||||
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
|
||||
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
|
||||
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyTemperature</moteinterface>
|
||||
</motetype>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>82.45117687053667</x>
|
||||
<y>90.0660093026363</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>1</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>44.53120632368774</x>
|
||||
<y>89.83566130147413</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>2</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>91.76407203945963</x>
|
||||
<y>8.764533976596468</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>3</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>10.771554112657956</x>
|
||||
<y>16.155558894723033</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>4</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>40.99108749529099</x>
|
||||
<y>33.68910640819968</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>5</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>49.762281669516085</x>
|
||||
<y>15.219756237459913</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>6</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>26.209078576184762</x>
|
||||
<y>97.71885344901867</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>7</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>96.30596045236783</x>
|
||||
<y>3.353548431613529</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>8</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>52.22023117695779</x>
|
||||
<y>56.516553603970586</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>57.92282771739404</x>
|
||||
<y>34.17317501704098</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>3.8628214275088335</x>
|
||||
<y>52.90298303308778</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>11</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.SimControl
|
||||
<width>318</width>
|
||||
<z>3</z>
|
||||
<height>192</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.Visualizer
|
||||
<plugin_config>
|
||||
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.GridVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
|
||||
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<viewport>2.3409990660057263 0.0 0.0 2.3409990660057263 27.752487588138713 2.6948007992423</viewport>
|
||||
</plugin_config>
|
||||
<width>300</width>
|
||||
<z>2</z>
|
||||
<height>300</height>
|
||||
<location_x>1122</location_x>
|
||||
<location_y>0</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.LogListener
|
||||
<plugin_config>
|
||||
<filter />
|
||||
</plugin_config>
|
||||
<width>1422</width>
|
||||
<z>1</z>
|
||||
<height>239</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>293</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.TimeLine
|
||||
<plugin_config>
|
||||
<mote>0</mote>
|
||||
<mote>1</mote>
|
||||
<mote>2</mote>
|
||||
<mote>3</mote>
|
||||
<mote>4</mote>
|
||||
<mote>5</mote>
|
||||
<mote>6</mote>
|
||||
<mote>7</mote>
|
||||
<mote>8</mote>
|
||||
<mote>9</mote>
|
||||
<mote>10</mote>
|
||||
<showRadioRXTX />
|
||||
<showRadioHW />
|
||||
<split>125</split>
|
||||
<zoomfactor>500.0</zoomfactor>
|
||||
</plugin_config>
|
||||
<width>1422</width>
|
||||
<z>0</z>
|
||||
<height>198</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>531</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
142
examples/ipv6/simple-udp-rpl/unicast-receiver.c
Normal file
142
examples/ipv6/simple-udp-rpl/unicast-receiver.c
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/random.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "net/uip.h"
|
||||
#include "net/uip-ds6.h"
|
||||
#include "net/uip-debug.h"
|
||||
|
||||
#include "simple-udp.h"
|
||||
#include "servreg-hack.h"
|
||||
|
||||
#include "net/rpl/rpl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define UDP_PORT 1234
|
||||
#define SERVICE_ID 190
|
||||
|
||||
#define SEND_INTERVAL (10 * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
|
||||
static struct simple_udp_connection unicast_connection;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(unicast_receiver_process, "Unicast receiver example process");
|
||||
AUTOSTART_PROCESSES(&unicast_receiver_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
receiver(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
printf("Data received from ");
|
||||
uip_debug_ipaddr_print(sender_addr);
|
||||
printf(" on port %d from port %d with length %d: '%s'\n",
|
||||
receiver_port, sender_port, datalen, data);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uip_ipaddr_t *
|
||||
set_global_address(void)
|
||||
{
|
||||
static uip_ipaddr_t ipaddr;
|
||||
int i;
|
||||
uint8_t state;
|
||||
|
||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||
|
||||
printf("IPv6 addresses: ");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return &ipaddr;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
create_rpl_dag(uip_ipaddr_t *ipaddr)
|
||||
{
|
||||
struct uip_ds6_addr *root_if;
|
||||
|
||||
root_if = uip_ds6_addr_lookup(ipaddr);
|
||||
if(root_if != NULL) {
|
||||
rpl_dag_t *dag;
|
||||
uip_ipaddr_t prefix;
|
||||
|
||||
rpl_set_root(ipaddr);
|
||||
dag = rpl_get_dag(RPL_ANY_INSTANCE);
|
||||
uip_ip6addr(&prefix, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
rpl_set_prefix(dag, &prefix, 64);
|
||||
PRINTF("created a new RPL dag\n");
|
||||
} else {
|
||||
PRINTF("failed to create a new RPL DAG\n");
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(unicast_receiver_process, ev, data)
|
||||
{
|
||||
uip_ipaddr_t *ipaddr;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
servreg_hack_init();
|
||||
|
||||
ipaddr = set_global_address();
|
||||
|
||||
create_rpl_dag(ipaddr);
|
||||
|
||||
servreg_hack_register(SERVICE_ID, ipaddr);
|
||||
|
||||
simple_udp_register(&unicast_connection, UDP_PORT,
|
||||
NULL, UDP_PORT, receiver);
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT();
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
137
examples/ipv6/simple-udp-rpl/unicast-sender.c
Normal file
137
examples/ipv6/simple-udp-rpl/unicast-sender.c
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/random.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "net/uip.h"
|
||||
#include "net/uip-ds6.h"
|
||||
#include "net/uip-debug.h"
|
||||
|
||||
#include "node-id.h"
|
||||
|
||||
#include "simple-udp.h"
|
||||
#include "servreg-hack.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define UDP_PORT 1234
|
||||
#define SERVICE_ID 190
|
||||
|
||||
#define SEND_INTERVAL (60 * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
|
||||
static struct simple_udp_connection unicast_connection;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(unicast_sender_process, "Unicast sender example process");
|
||||
AUTOSTART_PROCESSES(&unicast_sender_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
receiver(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
printf("Data received on port %d from port %d with length %d\n",
|
||||
receiver_port, sender_port, datalen);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_global_address(void)
|
||||
{
|
||||
uip_ipaddr_t ipaddr;
|
||||
int i;
|
||||
uint8_t state;
|
||||
|
||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||
|
||||
printf("IPv6 addresses: ");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(unicast_sender_process, ev, data)
|
||||
{
|
||||
static struct etimer periodic_timer;
|
||||
static struct etimer send_timer;
|
||||
uip_ipaddr_t *addr;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
servreg_hack_init();
|
||||
|
||||
set_global_address();
|
||||
|
||||
simple_udp_register(&unicast_connection, UDP_PORT,
|
||||
NULL, UDP_PORT, receiver);
|
||||
|
||||
etimer_set(&periodic_timer, SEND_INTERVAL);
|
||||
while(1) {
|
||||
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
etimer_reset(&periodic_timer);
|
||||
etimer_set(&send_timer, SEND_TIME);
|
||||
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
|
||||
addr = servreg_hack_lookup(SERVICE_ID);
|
||||
if(addr != NULL) {
|
||||
static unsigned int message_number;
|
||||
char buf[20];
|
||||
|
||||
printf("Sending unicast to ");
|
||||
uip_debug_ipaddr_print(addr);
|
||||
printf("\n");
|
||||
sprintf(buf, "Message %d", message_number);
|
||||
message_number++;
|
||||
simple_udp_sendto(&unicast_connection, buf, strlen(buf) + 1, addr);
|
||||
} else {
|
||||
printf("Service %d not found\n", SERVICE_ID);
|
||||
}
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
|
@ -4,10 +4,11 @@ CONTIKI=../../..
|
|||
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
APPS += webserver webbrowser
|
||||
APPS += webbrowser
|
||||
|
||||
CFLAGS += -DPROJECT_CONF_H=1
|
||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||
CONTIKI_SOURCEFILES += wget.c
|
||||
PROJECTDIRS += ../rpl-border-router
|
||||
PROJECT_SOURCEFILES += httpd-simple.c
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#define __PROJECT_RPL_WEB_CONF_H__
|
||||
|
||||
#undef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 6
|
||||
#define QUEUEBUF_CONF_NUM 5
|
||||
|
||||
#undef UIP_CONF_BUFFER_SIZE
|
||||
#define UIP_CONF_BUFFER_SIZE 140
|
||||
|
@ -44,4 +44,8 @@
|
|||
#undef WEBSERVER_CONF_CFS_CONNS
|
||||
#define WEBSERVER_CONF_CFS_CONNS 2
|
||||
|
||||
/* Reserve space for a file name (default is to not use file name) */
|
||||
#undef WEBSERVER_CONF_CFS_PATHLEN
|
||||
#define WEBSERVER_CONF_CFS_PATHLEN 80
|
||||
|
||||
#endif /* __PROJECT_RPL_WEB_CONF_H__ */
|
||||
|
|
|
@ -40,15 +40,27 @@
|
|||
|
||||
#include "contiki.h"
|
||||
#include "httpd-simple.h"
|
||||
#include "webserver-nogui.h"
|
||||
#include "dev/sht11-sensor.h"
|
||||
#include "dev/light-sensor.h"
|
||||
#include "dev/leds.h"
|
||||
#include <stdio.h>
|
||||
|
||||
PROCESS(web_sense_process, "Sense Web Demo");
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
AUTOSTART_PROCESSES(&web_sense_process);
|
||||
httpd_init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||
httpd_appcall(data);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
AUTOSTART_PROCESSES(&web_sense_process,&webserver_nogui_process);
|
||||
|
||||
#define HISTORY 16
|
||||
static int temperature[HISTORY];
|
||||
|
@ -148,7 +160,6 @@ PROCESS_THREAD(web_sense_process, ev, data)
|
|||
PROCESS_BEGIN();
|
||||
|
||||
sensors_pos = 0;
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
|
||||
etimer_set(&timer, CLOCK_SECOND * 2);
|
||||
SENSORS_ACTIVATE(light_sensor);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "dev/button-sensor.h"
|
||||
#include "dev/leds.h"
|
||||
#include "wget.h"
|
||||
#include "webserver-nogui.h"
|
||||
#include "httpd-simple.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -59,8 +58,21 @@
|
|||
#define SET_LEDS_OFF "/0"
|
||||
|
||||
PROCESS(websense_remote_process, "Websense Remote");
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
AUTOSTART_PROCESSES(&websense_remote_process);
|
||||
httpd_init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||
httpd_appcall(data);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
AUTOSTART_PROCESSES(&websense_remote_process,&webserver_nogui_process);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const char *TOP = "<html><head><title>Contiki Websense Remote</title></head><body>\n";
|
||||
|
@ -141,7 +153,6 @@ PROCESS_THREAD(websense_remote_process, ev, data)
|
|||
|
||||
mode = 0;
|
||||
wget_init();
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
|
|
|
@ -68,6 +68,37 @@ static const char *file;
|
|||
static uint16_t port;
|
||||
static const struct wget_callbacks *callbacks;
|
||||
|
||||
const char http_10[9] =
|
||||
/* "HTTP/1.0" */
|
||||
{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, };
|
||||
const char http_11[9] =
|
||||
/* "HTTP/1.1" */
|
||||
{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, };
|
||||
const char http_200[5] =
|
||||
/* "200 " */
|
||||
{0x32, 0x30, 0x30, 0x20, };
|
||||
const char http_301[5] =
|
||||
/* "301 " */
|
||||
{0x33, 0x30, 0x31, 0x20, };
|
||||
const char http_302[5] =
|
||||
/* "302 " */
|
||||
{0x33, 0x30, 0x32, 0x20, };
|
||||
const char http_crnl[3] =
|
||||
/* "\r\n" */
|
||||
{0xd, 0xa, };
|
||||
const char http_host[7] =
|
||||
/* "host: " */
|
||||
{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, };
|
||||
const char http_content_type[15] =
|
||||
/* "content-type: " */
|
||||
{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, };
|
||||
const char http_location[11] =
|
||||
/* "location: " */
|
||||
{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, };
|
||||
const char http_http[8] =
|
||||
/* "http://" */
|
||||
{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, };
|
||||
|
||||
PROCESS(wget_process, "wget");
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue