Merge pull request #1993 from yatch/pr/bugfix-rime-sky-collect
Bugfix on regression-tests/04-rime/07-sky-collect.csc
This commit is contained in:
commit
9ef28c7eae
2 changed files with 16 additions and 16 deletions
|
@ -58,10 +58,10 @@ static void
|
||||||
recv(const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
|
recv(const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
|
||||||
{
|
{
|
||||||
printf("Sink got message from %d.%d, seqno %d, hops %d: len %d '%s'\n",
|
printf("Sink got message from %d.%d, seqno %d, hops %d: len %d '%s'\n",
|
||||||
originator->u8[0], originator->u8[1],
|
originator->u8[0], originator->u8[1],
|
||||||
seqno, hops,
|
seqno, hops,
|
||||||
packetbuf_datalen(),
|
packetbuf_datalen(),
|
||||||
(char *)packetbuf_dataptr());
|
(char *)packetbuf_dataptr());
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static const struct collect_callbacks callbacks = { recv };
|
static const struct collect_callbacks callbacks = { recv };
|
||||||
|
@ -70,15 +70,15 @@ PROCESS_THREAD(example_collect_process, ev, data)
|
||||||
{
|
{
|
||||||
static struct etimer periodic;
|
static struct etimer periodic;
|
||||||
static struct etimer et;
|
static struct etimer et;
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
collect_open(&tc, 130, COLLECT_ROUTER, &callbacks);
|
collect_open(&tc, 130, COLLECT_ROUTER, &callbacks);
|
||||||
|
|
||||||
if(linkaddr_node_addr.u8[0] == 1 &&
|
if(linkaddr_node_addr.u8[0] == 1 &&
|
||||||
linkaddr_node_addr.u8[1] == 0) {
|
linkaddr_node_addr.u8[1] == 0) {
|
||||||
printf("I am sink\n");
|
printf("I am sink\n");
|
||||||
collect_set_sink(&tc, 1);
|
collect_set_sink(&tc, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow some time for the network to settle. */
|
/* Allow some time for the network to settle. */
|
||||||
|
@ -88,22 +88,19 @@ PROCESS_THREAD(example_collect_process, ev, data)
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
/* Send a packet every 30 seconds. */
|
/* Send a packet every 30 seconds. */
|
||||||
if(etimer_expired(&periodic)) {
|
etimer_set(&periodic, CLOCK_SECOND * 30);
|
||||||
etimer_set(&periodic, CLOCK_SECOND * 30);
|
etimer_set(&et, random_rand() % (CLOCK_SECOND * 30));
|
||||||
etimer_set(&et, random_rand() % (CLOCK_SECOND * 30));
|
|
||||||
}
|
|
||||||
|
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_UNTIL(etimer_expired(&et));
|
||||||
|
|
||||||
|
{
|
||||||
if(etimer_expired(&et)) {
|
|
||||||
static linkaddr_t oldparent;
|
static linkaddr_t oldparent;
|
||||||
const linkaddr_t *parent;
|
const linkaddr_t *parent;
|
||||||
|
|
||||||
printf("Sending\n");
|
printf("Sending\n");
|
||||||
packetbuf_clear();
|
packetbuf_clear();
|
||||||
packetbuf_set_datalen(sprintf(packetbuf_dataptr(),
|
packetbuf_set_datalen(sprintf(packetbuf_dataptr(),
|
||||||
"%s", "Hello") + 1);
|
"%s", "Hello") + 1);
|
||||||
collect_send(&tc, 15);
|
collect_send(&tc, 15);
|
||||||
|
|
||||||
parent = collect_parent(&tc);
|
parent = collect_parent(&tc);
|
||||||
|
@ -118,6 +115,7 @@ PROCESS_THREAD(example_collect_process, ev, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROCESS_WAIT_UNTIL(etimer_expired(&periodic));
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
|
|
|
@ -362,7 +362,7 @@ make example-collect.sky TARGET=sky</commands>
|
||||||
<plugin>
|
<plugin>
|
||||||
org.contikios.cooja.plugins.ScriptRunner
|
org.contikios.cooja.plugins.ScriptRunner
|
||||||
<plugin_config>
|
<plugin_config>
|
||||||
<script>TIMEOUT(600000);
|
<script>TIMEOUT(450000);
|
||||||
|
|
||||||
num_nodes = mote.getSimulation().getMotesCount();
|
num_nodes = mote.getSimulation().getMotesCount();
|
||||||
|
|
||||||
|
@ -408,6 +408,8 @@ while(true) {
|
||||||
dups = received[source].substr(seqno, 1);
|
dups = received[source].substr(seqno, 1);
|
||||||
if(dups == "_") {
|
if(dups == "_") {
|
||||||
dups = 1;
|
dups = 1;
|
||||||
|
} else if (dups == "") {
|
||||||
|
continue;
|
||||||
} else if(dups < 9) {
|
} else if(dups < 9) {
|
||||||
dups++;
|
dups++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue