Renamed uabc to polite

This commit is contained in:
adamdunkels 2007-05-22 21:04:00 +00:00
parent a250698b71
commit 0db074ae29
3 changed files with 13 additions and 61 deletions

View file

@ -2,7 +2,7 @@ CONTIKI = ../..
ifndef TARGET
TARGET=netsim
endif
all: test-abc test-meshroute test-treeroute test-trickle test-uabc \
all: test-abc test-meshroute test-treeroute test-trickle test-polite \
test-rudolph0 test-rudolph1 test-rudolph2 test-rucb
include $(CONTIKI)/Makefile.include

View file

@ -1,46 +1,46 @@
#include "net/rime/uabc.h"
#include "net/rime/polite.h"
#include "contiki.h"
#include <stdio.h>
/*---------------------------------------------------------------------------*/
PROCESS(test_uabc_process, "");
AUTOSTART_PROCESSES(&test_uabc_process);
PROCESS(test_polite_process, "");
AUTOSTART_PROCESSES(&test_polite_process);
/*---------------------------------------------------------------------------*/
static void
recv(struct uabc_conn *c)
recv(struct polite_conn *c)
{
printf("recv '%s'\n", (char *)rimebuf_dataptr());
}
static void
sent(struct uabc_conn *c)
sent(struct polite_conn *c)
{
printf("sent\n");
}
static void
dropped(struct uabc_conn *c)
dropped(struct polite_conn *c)
{
printf("dropped\n");
}
static const struct uabc_callbacks callbacks = { recv, sent, dropped };
static const struct polite_callbacks callbacks = { recv, sent, dropped };
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_uabc_process, ev, data)
PROCESS_THREAD(test_polite_process, ev, data)
{
static struct uabc_conn c;
static struct polite_conn c;
PROCESS_EXITHANDLER(uabc_close(&c));
PROCESS_EXITHANDLER(polite_close(&c));
PROCESS_BEGIN();
uabc_open(&c, 128, &callbacks);
polite_open(&c, 128, &callbacks);
while(1) {
static struct etimer et;
etimer_set(&et, CLOCK_SECOND * 4);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
rimebuf_copyfrom("Hej", 4);
uabc_send(&c, CLOCK_SECOND * 4);
polite_send(&c, CLOCK_SECOND * 4, 4);
}

View file

@ -1,48 +0,0 @@
#include "net/rime/uibc.h"
#include "contiki.h"
/*---------------------------------------------------------------------------*/
PROCESS(test_uibc_process, "");
AUTOSTART_PROCESSES(&test_uibc_process);
/*---------------------------------------------------------------------------*/
static void
recv(struct uibc_conn *c, rimeaddr_t *from)
{
printf("recv '%s' from %d.%d\n", rimebuf_dataptr(),
from->u8[0], from->u8[1]);
}
static void
sent(struct uibc_conn *c)
{
printf("sent\n");
}
static void
dropped(struct uibc_conn *c)
{
printf("dropped\n");
}
static const struct uibc_callbacks callbacks = { recv, sent, dropped };
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_uibc_process, ev, data)
{
static struct uibc_conn c;
PROCESS_EXITHANDLER(uibc_close(&c));
PROCESS_BEGIN();
uibc_open(&c, 128, &callbacks);
while(1) {
static struct etimer et;
etimer_set(&et, CLOCK_SECOND * 4);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
rimebuf_copyfrom("Hej", 4);
uibc_send(&c, CLOCK_SECOND * 4);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/