Merge branch 'develop' into contrib/coap-lwm2m-dtls

This commit is contained in:
George Oikonomou 2018-02-01 00:17:38 +00:00 committed by GitHub
commit 63a96752c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 560 additions and 419 deletions

View File

@ -253,6 +253,7 @@ void
platform_init_stage_two()
{
set_lladdr();
serial_line_init();
}
/*---------------------------------------------------------------------------*/
void

View File

@ -66,7 +66,9 @@ void input_callback(const void *data, uint16_t len,
const linkaddr_t *src, const linkaddr_t *dest)
{
if(len == sizeof(unsigned)) {
LOG_INFO("Received %u from ", *(unsigned *)data);
unsigned count;
memcpy(&count, data, sizeof(count));
LOG_INFO("Received %u from ", count);
LOG_INFO_LLADDR(src);
LOG_INFO_("\n");
}

View File

@ -68,7 +68,9 @@ void input_callback(const void *data, uint16_t len,
const linkaddr_t *src, const linkaddr_t *dest)
{
if(len == sizeof(unsigned)) {
LOG_INFO("Received %u from ", *(unsigned *)data);
unsigned count;
memcpy(&count, data, sizeof(count));
LOG_INFO("Received %u from ", count);
LOG_INFO_LLADDR(src);
LOG_INFO_("\n");
}

View File

@ -32,7 +32,5 @@
#define QUEUEBUF_CONF_NUM 4
#define UIP_CONF_BUFFER_SIZE 140
#define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_cc2420
#define SLIP_RADIO_CONF_SENSORS slip_radio_sky_sensors
#define UART1_CONF_RX_WITH_DMA 1
/*---------------------------------------------------------------------------*/

View File

@ -1,60 +0,0 @@
/*
* 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.
*
* Sets up some commands for the CC2420 radio chip.
*/
#include "contiki.h"
#include "cc2420.h"
#include "cmd.h"
#include <stdio.h>
int
cmd_handler_cc2420(const uint8_t *data, int len)
{
if(data[0] == '!') {
if(data[1] == 'C') {
printf("cc2420_cmd: setting channel: %d\n", data[2]);
cc2420_set_channel(data[2]);
return 1;
}
} else if(data[0] == '?') {
if(data[1] == 'C') {
uint8_t buf[4];
printf("cc2420_cmd: getting channel: %d\n", data[2]);
buf[0] = '!';
buf[1] = 'C';
buf[2] = cc2420_get_channel();
cmd_send(buf, 3);
return 1;
}
}
return 0;
}

View File

@ -1,90 +0,0 @@
/*
* 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.
*/
#include "contiki.h"
#include "lib/sensors.h"
#include "dev/sht11/sht11-sensor.h"
#include "slip-radio.h"
#include "cmd.h"
#include <stdio.h>
/*---------------------------------------------------------------------------*/
static void
init(void)
{
}
/*---------------------------------------------------------------------------*/
static int
write_percent_float(char *data, int maxlen, int temp)
{
int t;
t = temp % 100;
if(t < 0) {
t = -t;
}
return snprintf(data, maxlen, "%d.%02d", temp / 100, t);
}
/*---------------------------------------------------------------------------*/
static void
send(void)
{
#define MAX_SIZE 40
char data[MAX_SIZE];
int temperature;
int ms;
long hum;
int pos = 0;
/* SENSORS_ACTIVATE(light_sensor); */
SENSORS_ACTIVATE(sht11_sensor);
pos += snprintf(data, MAX_SIZE, "!D");
/* int light1 = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC); */
/* int light2 = light_sensor.value(LIGHT_SENSOR_TOTAL_SOLAR); */
temperature = -3970 + sht11_sensor.value(SHT11_SENSOR_TEMP);
ms = sht11_sensor.value(SHT11_SENSOR_HUMIDITY);
/* this is in * 10000 */
/* -2.0468 + 0.0367 * ms + -1.5955e-6 * ms * ms ...too small value... */
hum = (-20468L + 367L * ms) / 100L;
/* SENSORS_DEACTIVATE(light_sensor); */
SENSORS_DEACTIVATE(sht11_sensor);
pos += snprintf(&data[pos], MAX_SIZE - pos, "temp=");
pos += write_percent_float(&data[pos], MAX_SIZE - pos, temperature);
pos += snprintf(&data[pos], MAX_SIZE - pos, ";hum=");
pos += write_percent_float(&data[pos], MAX_SIZE - pos, hum);
cmd_send((uint8_t *)data, pos);
}
/* ---------------------------------------------------------------------- */
const struct slip_radio_sensors slip_radio_sky_sensors = {
init, send
};
/* ---------------------------------------------------------------------- */

View File

@ -64,7 +64,7 @@ slipnet_input(void)
packetbuf_datalen(), i);
for(i = 0; i < uip_len; i++) {
LOG_DBG("%02x", (unsigned char)uip_buf[i]);
LOG_DBG_("%02x", (unsigned char)uip_buf[i]);
if((i & 15) == 15) {
LOG_DBG_("\n");
} else if((i & 7) == 7) {

View File

@ -166,6 +166,25 @@ slip_radio_cmd_handler(const uint8_t *data, int len)
packet_pos = 0;
}
return 1;
} else if(data[1] == 'V') {
int type = ((uint16_t)data[2] << 8) | data[3];
int value = ((uint16_t)data[4] << 8) | data[5];
int param = type; /* packetutils_to_radio_param(type); */
if(param < 0) {
printf("radio: unknown parameter %d (can not set to %d)\n", type, value);
} else {
if(param == RADIO_PARAM_RX_MODE) {
printf("radio: setting rxmode to 0x%x\n", value);
} else if(param == RADIO_PARAM_PAN_ID) {
printf("radio: setting pan id to 0x%04x\n", value);
} else if(param == RADIO_PARAM_CHANNEL) {
printf("radio: setting channel: %u\n", value);
} else {
printf("radio: setting param %d to %d (0x%02x)\n", param, value, value);
}
NETSTACK_RADIO.set_value(param, value);
}
return 1;
}
} else if(uip_buf[0] == '?') {
@ -180,6 +199,25 @@ slip_radio_cmd_handler(const uint8_t *data, int len)
uip_len = 10;
cmd_send(uip_buf, uip_len);
return 1;
} else if(data[1] == 'V') {
/* ask the radio about the specific parameter and send it back... */
int type = ((uint16_t)data[2] << 8) | data[3];
int value;
int param = type; /* packetutils_to_radio_param(type); */
if(param < 0) {
printf("radio: unknown parameter %d\n", type);
}
NETSTACK_RADIO.get_value(param, &value);
uip_buf[0] = '!';
uip_buf[1] = 'V';
uip_buf[2] = type >> 8;
uip_buf[3] = type & 0xff;
uip_buf[4] = value >> 8;
uip_buf[5] = value & 0xff;
uip_len = 6;
cmd_send(uip_buf, uip_len);
}
}
return 0;
@ -189,7 +227,9 @@ static void
slip_input_callback(void)
{
LOG_DBG("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]);
cmd_input(uip_buf, uip_len);
if(!cmd_input(uip_buf, uip_len)) {
cmd_send((uint8_t *)"EUnknown command", 16);
}
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/

View File

@ -36,7 +36,27 @@
* Joakim Eriksson <joakime@sics.se>
*/
#include "net/mac/framer/framer.h"
#include "net/packetbuf.h"
#ifdef NULLFRAMER_CONF_PARSE_802154
#define NULLFRAMER_PARSE_802154 NULLFRAMER_CONF_PARSE_802154
#else
/* defaults to parsing of the 802154 header as that is used for Slip-Radio */
#define NULLFRAMER_PARSE_802154 1
#endif
/*---------------------------------------------------------------------------*/
static int
is_broadcast_addr(uint8_t mode, uint8_t *addr)
{
int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8;
while(i-- > 0) {
if(addr[i] != 0xff) {
return 0;
}
}
return 1;
}
/*---------------------------------------------------------------------------*/
static int
hdr_length(void)
@ -55,6 +75,21 @@ create(void)
static int
parse(void)
{
#if NULLFRAMER_PARSE_802154
frame802154_t frame;
int len;
len = packetbuf_datalen();
if(frame802154_parse(packetbuf_dataptr(), len, &frame)) {
if(frame.fcf.dest_addr_mode) {
if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) {
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr);
}
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq);
return 0;
}
#endif
return 0;
}
/*---------------------------------------------------------------------------*/

View File

@ -1,8 +1,13 @@
MODULES += os/services/slip-cmd
MODULES += os/services/shell
MAKE_MAC = MAKE_MAC_OTHER
MAKE_NET = MAKE_NET_IPV6
PREFIX ?= fd00::1/64
connect-router: border-router.native
sudo ./border-router.native $(PREFIX)
connect-router-cooja: border-router.native
sudo ./border-router.native -a localhost $(PREFIX)

View File

@ -43,6 +43,8 @@
#include "rpl.h"
#include "net/ipv6/uiplib.h"
#include <string.h>
#include "shell.h"
#include <stdio.h>
#define DEBUG DEBUG_NONE
#include "net/ipv6/uip-debug.h"
@ -54,6 +56,56 @@ void nbr_print_stat(void);
/*---------------------------------------------------------------------------*/
PROCESS(border_router_cmd_process, "Border router cmd process");
/*---------------------------------------------------------------------------*/
static const uint8_t *
hextoi(const uint8_t *buf, int len, int *v)
{
*v = 0;
for(; len > 0; len--, buf++) {
if(*buf >= '0' && *buf <= '9') {
*v = (*v << 4) + ((*buf - '0') & 0xf);
} else if(*buf >= 'a' && *buf <= 'f') {
*v = (*v << 4) + ((*buf - 'a' + 10) & 0xf);
} else if(*buf >= 'A' && *buf <= 'F') {
*v = (*v << 4) + ((*buf - 'A' + 10) & 0xf);
} else {
break;
}
}
return buf;
}
/*---------------------------------------------------------------------------*/
static const uint8_t *
dectoi(const uint8_t *buf, int len, int *v)
{
int negative = 0;
*v = 0;
if(len <= 0) {
return buf;
}
if(*buf == '$') {
return hextoi(buf + 1, len - 1, v);
}
if(*buf == '0' && *(buf + 1) == 'x' && len > 2) {
return hextoi(buf + 2, len - 2, v);
}
if(*buf == '-') {
negative = 1;
buf++;
}
for(; len > 0; len--, buf++) {
if(*buf < '0' || *buf > '9') {
break;
}
*v = (*v * 10) + ((*buf - '0') & 0xf);
}
if(negative) {
*v = - *v;
}
return buf;
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* TODO: the below code needs some way of identifying from where the command */
/* comes. In this case it can be from stdin or from SLIP. */
@ -64,35 +116,64 @@ border_router_cmd_handler(const uint8_t *data, int len)
/* handle global repair, etc here */
if(data[0] == '!') {
PRINTF("Got configuration message of type %c\n", data[1]);
if(data[1] == 'G' && command_context == CMD_CONTEXT_STDIO) {
/* This is supposed to be from stdin */
printf("Performing Global Repair...\n");
if(command_context == CMD_CONTEXT_STDIO) {
switch(data[1]) {
case 'G':
/* This is supposed to be from stdin */
printf("Performing Global Repair...\n");
#if UIP_CONF_IPV6_RPL_LITE
rpl_global_repair();
rpl_global_repair();
#else
rpl_repair_root(RPL_DEFAULT_INSTANCE);
rpl_repair_root(RPL_DEFAULT_INSTANCE);
#endif
return 1;
} else if(data[1] == 'M' && command_context == CMD_CONTEXT_RADIO) {
return 1;
case 'C': {
/* send on a set-param thing! */
uint8_t set_param[] = {'!', 'V', 0, RADIO_PARAM_CHANNEL, 0, 0 };
int channel = -1;
dectoi(&data[2], len - 2, &channel);
if(channel >= 0) {
set_param[5] = channel & 0xff;
write_to_slip(set_param, sizeof(set_param));
}
return 1;
}
case 'P': {
/* send on a set-param thing! */
uint8_t set_param[] = {'!', 'V', 0, RADIO_PARAM_PAN_ID, 0, 0 };
int pan_id;
dectoi(&data[2], len - 2, &pan_id);
set_param[4] = (pan_id >> 8) & 0xff;
set_param[5] = pan_id & 0xff;
write_to_slip(set_param, sizeof(set_param));
return 1;
}
default:
return 0;
}
} else if(command_context == CMD_CONTEXT_RADIO) {
/* We need to know that this is from the slip-radio here. */
PRINTF("Setting MAC address\n");
border_router_set_mac(&data[2]);
return 1;
} else if(data[1] == 'C' && command_context == CMD_CONTEXT_RADIO) {
/* We need to know that this is from the slip-radio here. */
printf("Channel is:%d\n", data[2]);
return 1;
} else if(data[1] == 'R' && command_context == CMD_CONTEXT_RADIO) {
/* We need to know that this is from the slip-radio here. */
PRINTF("Packet data report for sid:%d st:%d tx:%d\n",
data[2], data[3], data[4]);
packet_sent(data[2], data[3], data[4]);
return 1;
} else if(data[1] == 'D' && command_context == CMD_CONTEXT_RADIO) {
/* We need to know that this is from the slip-radio here... */
PRINTF("Sensor data received\n");
border_router_set_sensors((const char *)&data[2], len - 2);
return 1;
switch(data[1]) {
case 'M':
PRINTF("Setting MAC address\n");
border_router_set_mac(&data[2]);
return 1;
case 'V':
if(data[3] == RADIO_PARAM_CHANNEL) {
printf("Channel is %d\n", data[5]);
}
if(data[3] == RADIO_PARAM_PAN_ID) {
printf("PAN_ID is 0x%04x\n", (data[4] << 8) + data[5]);
}
return 1;
case 'R':
PRINTF("Packet data report for sid:%d st:%d tx:%d\n",
data[2], data[3], data[4]);
packet_sent(data[2], data[3], data[4]);
return 1;
default:
return 0;
}
}
} else if(data[0] == '?') {
PRINTF("Got request message of type %c\n", data[1]);
@ -110,8 +191,14 @@ border_router_cmd_handler(const uint8_t *data, int len)
cmd_send(buf, 18);
return 1;
} else if(data[1] == 'C' && command_context == CMD_CONTEXT_STDIO) {
/* send on! */
write_to_slip(data, len);
/* send on a set-param thing! */
uint8_t set_param[] = {'?', 'V', 0, RADIO_PARAM_CHANNEL};
write_to_slip(set_param, sizeof(set_param));
return 1;
} else if(data[1] == 'P' && command_context == CMD_CONTEXT_STDIO) {
/* send on a set-param thing! */
uint8_t set_param[] = {'?', 'V', 0, RADIO_PARAM_PAN_ID};
write_to_slip(set_param, sizeof(set_param));
return 1;
} else if(data[1] == 'S') {
border_router_print_stat();
@ -132,17 +219,33 @@ border_router_cmd_output(const uint8_t *data, int data_len)
printf("\n");
}
/*---------------------------------------------------------------------------*/
static void
serial_shell_output(const char *str)
{
printf("%s", str);
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(border_router_cmd_process, ev, data)
{
static struct pt shell_input_pt;
PROCESS_BEGIN();
PRINTF("Started br-cmd process\n");
shell_init();
while(1) {
PROCESS_YIELD();
if(ev == serial_line_event_message && data != NULL) {
PRINTF("Got serial data!!! %s of len: %d\n",
PRINTF("Got serial data!!! %s of len: %lu\n",
(char *)data, strlen((char *)data));
command_context = CMD_CONTEXT_STDIO;
cmd_input(data, strlen((char *)data));
if(cmd_input(data, strlen((char *)data))) {
/* Commnand executed - all is fine */
} else {
/* did not find command - run shell and see if ... */
PROCESS_PT_SPAWN(&shell_input_pt, shell_input(&shell_input_pt, serial_shell_output, data));
}
}
}
PROCESS_END();

View File

@ -63,7 +63,7 @@ struct tx_callback {
struct packetbuf_attr attrs[PACKETBUF_NUM_ATTRS];
struct packetbuf_addr addrs[PACKETBUF_NUM_ADDRS];
};
/*---------------------------------------------------------------------------*/
static struct tx_callback callbacks[MAX_CALLBACKS];
/*---------------------------------------------------------------------------*/
void
@ -111,6 +111,10 @@ send_packet(mac_callback_t sent, void *ptr)
/* ack or not ? */
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
/* Will make it send only DATA packets... for now */
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME);
/* printf("Sending packet of type: %s \n", get_frame_type(packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE))); */
if(NETSTACK_FRAMER.create() < 0) {
/* Failed to allocate space for headers */
PRINTF("br-rdc: send failed, too large header\n");

View File

@ -51,18 +51,11 @@
#include <stdlib.h>
#define MAX_SENSORS 4
extern long slip_sent;
extern long slip_received;
static uint8_t mac_set;
static uint8_t sensor_count = 0;
/* allocate MAX_SENSORS char[32]'s */
static char sensors[MAX_SENSORS][32];
extern int contiki_argc;
extern char **contiki_argv;
extern const char *slip_config_ipaddr;
@ -101,30 +94,6 @@ border_router_print_stat()
printf("bytes sent over SLIP: %ld\n", slip_sent);
}
/*---------------------------------------------------------------------------*/
/* Format: <name=value>;<name=value>;...;<name=value>*/
/* this function just cut at ; and store in the sensor array */
void
border_router_set_sensors(const char *data, int len)
{
int i;
int last_pos = 0;
int sc = 0;
for(i = 0; i < len; i++) {
if(data[i] == ';') {
sensors[sc][i - last_pos] = 0;
memcpy(sensors[sc++], &data[last_pos], i - last_pos);
last_pos = i + 1; /* skip the ';' */
}
if(sc == MAX_SENSORS) {
sensor_count = sc;
return;
}
}
sensors[sc][len - last_pos] = 0;
memcpy(sensors[sc++], &data[last_pos], len - last_pos);
sensor_count = sc;
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(border_router_process, ev, data)
{
static struct etimer et;

View File

@ -712,11 +712,6 @@ shell_commands_init(void)
/* Set up Ping Reply callback */
uip_icmp6_echo_reply_callback_add(&echo_reply_notification,
echo_reply_handler);
/* Start with soft log level 0 so as to minimize interference with shell */
log_set_level("all", LOG_LEVEL_NONE);
#if MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT
tsch_log_stop();
#endif /* MAC_CONF_WITH_TSCH && TSCH_LOG_PER_SLOT */
}
/*---------------------------------------------------------------------------*/
struct shell_command_t shell_commands[] = {

View File

@ -48,19 +48,18 @@ void CMD_OUTPUT(const uint8_t *data, int data_len);
extern const cmd_handler_t cmd_handlers[];
/*---------------------------------------------------------------------------*/
void
int
cmd_input(const uint8_t *data, int data_len)
{
int i;
for(i = 0; cmd_handlers[i] != NULL; i++) {
if(cmd_handlers[i](data, data_len)) {
/* Command has been handled */
return;
return 1;
}
}
/* Unknown command */
cmd_send((uint8_t *)"EUnknown command", 16);
return 0;
}
/*---------------------------------------------------------------------------*/
void

View File

@ -47,7 +47,7 @@ typedef int (* cmd_handler_t)(const uint8_t *data, int len);
#define CMD_HANDLERS(...) \
const cmd_handler_t cmd_handlers[] = {__VA_ARGS__, NULL}
void cmd_input(const uint8_t *data, int data_len);
int cmd_input(const uint8_t *data, int data_len);
void cmd_send(const uint8_t *data, int data_len);
#endif /* CMD_H_ */

View File

@ -1,189 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>slip radio 1</title>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>15.0</transmitting_range>
<interference_range>15.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>slip radio</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/slip-radio/slip-radio.c</source>
<commands EXPORT="discard">make -j slip-radio.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/slip-radio/slip-radio.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.Msp802154Radio</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>wait-dag</description>
<source EXPORT="discard">[CONFIG_DIR]/code-slip-radio/wait-dag.c</source>
<commands EXPORT="discard">make -j wait-dag.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONFIG_DIR]/code-slip-radio/wait-dag.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.Msp802154Radio</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>43.565500781711165</x>
<y>14.697933087406794</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>53.849666651434326</x>
<y>14.629826028666905</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>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>315</width>
<z>1</z>
<height>175</height>
<location_x>433</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.TrafficVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<viewport>14.682765905648006 0.0 0.0 14.682765905648006 -512.6620495401903 -96.80631081927221</viewport>
</plugin_config>
<width>432</width>
<z>4</z>
<height>291</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
</plugin_config>
<width>758</width>
<z>3</z>
<height>289</height>
<location_x>748</location_x>
<location_y>159</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.Notes
<plugin_config>
<notes>Slip-radio Tests, 01-sky-slip-radio-dio
Test that we can send a packet over a slip-radio.
In this basic test, we send a DIO from mote 1, and wait for "DAG Found" in mote 2.</notes>
<decorations>true</decorations>
</plugin_config>
<width>928</width>
<z>5</z>
<height>159</height>
<location_x>749</location_x>
<location_y>-1</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.ScriptRunner
<plugin_config>
<script>TIMEOUT(30000, log.log("last msg: " + msg + "\n")); /* print last msg at timeout */
YIELD_THEN_WAIT_UNTIL(msg.contains("Slip Radio started..."));
//Wait for 5 sec
GENERATE_MSG(5000, "sleep");
YIELD_THEN_WAIT_UNTIL(msg.equals("sleep"));
//Configure 802.15.4 Channel (checks that we can detect commands on serial input)
write(sim.getMoteWithID(1), String.fromCharCode(0x21,67,26,192));
YIELD_THEN_WAIT_UNTIL(msg.contains("setting channel: 26"));
/*Send a DIO over SLIP with !S... ugly, but enough to test the radio
note: 192 = SLIP_END */
write(sim.getMoteWithID(1), String.fromCharCode(192,0x21,0x53,0x1,0x2,0x6,0x0,0xd0,0x7,0x0,0x1,0x41,0xc8,0xd0,0xcd,0xab,0xff,0xff,0x1,0x1,0x1,0x0,0x1,0x74,0x12,0x0,0x7a,0x1b,0x3a,0x4,0x1,0x0,0xff,0xff,0x1,0x1,0x1,0x1a,0x9b,0x1,0x2c,0x7c,0xa0,0x78,0x1,0x0,0x08,0xf0,0x0,0x0,0xfe,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x12,0x74,0x1,0x0,0x1,0x1,0x1,0x2,0x6,0x7,0x4,0x0,0x2,0x0,0x0,0x4,0xe,0x0,0x8,0xc,0xa,0x7,0x0,0x1,0x0,0x0,0x1,0x0,0x1e,0x1,0x0,0x8,0x1e,0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xaa,0xaa,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,192));
//Check that the other mote receives the DIO and joins the DAG
YIELD_THEN_WAIT_UNTIL(msg.equals("DAG Found"));
log.testOK();</script>
<active>true</active>
</plugin_config>
<width>758</width>
<z>2</z>
<height>502</height>
<location_x>749</location_x>
<location_y>449</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.RadioLogger
<plugin_config>
<split>150</split>
</plugin_config>
<width>746</width>
<z>0</z>
<height>657</height>
<location_x>3</location_x>
<location_y>294</location_y>
</plugin>
</simconf>

View File

@ -41,7 +41,7 @@ done
echo "Closing native node"
sleep 2
pgrep hello-world | sudo xargs kill -9
pgrep coap-example | sudo xargs kill -9
if [ $TESTCOUNT -eq $OKCOUNT ] ; then
printf "%-32s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;

View File

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>My simulation</title>
<speedlimit>1.0</speedlimit>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
org.contikios.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>
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype295</identifier>
<description>Cooja Mote Type #1</description>
<source>[CONTIKI_DIR]/examples/slip-radio/slip-radio.c</source>
<commands>make TARGET=cooja clean
make -j slip-radio.cooja TARGET=cooja</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<motetype>
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype686</identifier>
<description>Cooja Mote Type #2</description>
<source>[CONTIKI_DIR]/examples/hello-world/hello-world.c</source>
<commands>make TARGET=cooja clean
make -j hello-world.cooja TARGET=cooja</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>54.36775767371176</x>
<y>24.409055040864118</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>1</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype295</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>83.54989222799365</x>
<y>52.63050856506214</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>2</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype686</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>108.91767775240822</x>
<y>78.59778809170032</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>3</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype686</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>139.91021061864723</x>
<y>98.34190023350419</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>4</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype686</motetype_identifier>
</mote>
</simulation>
<plugin>
org.contikios.cooja.plugins.SimControl
<width>280</width>
<z>1</z>
<height>160</height>
<location_x>400</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Visualizer
<plugin_config>
<moterelations>true</moterelations>
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
<viewport>1.9798610460263038 0.0 0.0 1.9798610460263038 -61.112037797038525 -1.2848438586294648</viewport>
</plugin_config>
<width>400</width>
<z>4</z>
<height>400</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.LogListener
<plugin_config>
<filter>ID:4</filter>
<formatted_time />
<coloring />
</plugin_config>
<width>1404</width>
<z>2</z>
<height>240</height>
<location_x>400</location_x>
<location_y>160</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.TimeLine
<plugin_config>
<mote>0</mote>
<mote>1</mote>
<mote>2</mote>
<mote>3</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />
<zoomfactor>500.0</zoomfactor>
</plugin_config>
<width>1804</width>
<z>6</z>
<height>166</height>
<location_x>0</location_x>
<location_y>753</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Notes
<plugin_config>
<notes>Enter notes here</notes>
<decorations>true</decorations>
</plugin_config>
<width>1124</width>
<z>5</z>
<height>160</height>
<location_x>680</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.serialsocket.SerialSocketServer
<mote_arg>0</mote_arg>
<plugin_config>
<port>60001</port>
<bound>true</bound>
</plugin_config>
<width>362</width>
<z>3</z>
<height>116</height>
<location_x>13</location_x>
<location_y>414</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>TIMEOUT(10000000000); /* milliseconds. no action at timeout */
/* Set simulaion speed to real time. Required for
* Native BR test, as the Native BR will run as a
* unix process, at real time. */
sim.setSpeedLimit(1.0);</script>
<active>true</active>
</plugin_config>
<width>600</width>
<z>0</z>
<height>700</height>
<location_x>1037</location_x>
<location_y>40</location_y>
</plugin>
</simconf>

View File

@ -0,0 +1,9 @@
#!/bin/bash
# Contiki directory
CONTIKI=$1
# Simulation file
BASENAME=07-native-border-router-cooja
bash test-nbr.sh $CONTIKI $BASENAME fd00::204:4:4:4

View File

@ -9,6 +9,9 @@ BASENAME=$2
# Destination IPv6
IPADDR=$3
# ICMP request-reply count
COUNT=5
# Start simulation
echo "Starting Cooja simulation $BASENAME.csc"
java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog &
@ -28,9 +31,10 @@ sleep 5
# Do ping
echo "Pinging"
ping6 $IPADDR -c 5 | tee $BASENAME.scriptlog
ping6 $IPADDR -c $COUNT | tee $BASENAME.scriptlog
# Fetch ping6 status code (not $? because this is piped)
STATUS=${PIPESTATUS[0]}
REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog`
echo "Closing simulation and tunslip6"
sleep 1
@ -40,7 +44,7 @@ sleep 1
rm COOJA.testlog
rm COOJA.log
if [ $STATUS -eq 0 ] ; then
if [ $STATUS -eq 0 ] && [ $REPLIES -eq $COUNT ] ; then
printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog;
else
echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog;

View File

@ -0,0 +1,59 @@
#!/bin/bash
# Contiki directory
CONTIKI=$1
# Simulation file
BASENAME=$2
# Destination IPv6
IPADDR=$3
# ICMP request-reply count
COUNT=5
# Start simulation
echo "Starting Cooja simulation $BASENAME.csc"
java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog &
JPID=$!
sleep 20
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Connect to the simlation
echo "Starting native border-router"
nohup make -C $CONTIKI/examples/rpl-border-router/ connect-router-cooja TARGET=native >> $BASENAME.nbr.log 2>&1 &
MPID=$!
echo "Waiting for network formation"
sleep 60 # runs in real time so we need to wait a bit
# Do ping
echo "Pinging"
ping6 $IPADDR -c $COUNT | tee $BASENAME.scriptlog
# Fetch ping6 status code (not $? because this is piped)
STATUS=${PIPESTATUS[0]}
REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog`
echo "Closing simulation and nbr"
sleep 1
kill -9 $JPID
kill -9 $MPID
sleep 1
rm COOJA.testlog
rm COOJA.log
if [ $STATUS -eq 0 ] && [ $REPLIES -eq $COUNT ] ; then
printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog;
else
echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog;
echo "==== $BASENAME.nbr.log ====" ; cat $BASENAME.nbr.log;
echo "==== $BASENAME.scriptlog ====" ; cat $BASENAME.scriptlog;
printf "%-32s TEST FAIL\n" "$BASENAME" | tee $BASENAME.testlog;
fi
# We do not want Make to stop -> Return 0
# The Makefile will check if a log contains FAIL at the end
exit 0