2007-03-20 13:21:17 +01:00
|
|
|
|
|
|
|
#include "net/rime/uabc.h"
|
|
|
|
#include "contiki.h"
|
2007-03-25 14:10:29 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2007-03-20 13:21:17 +01:00
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
PROCESS(test_uabc_process, "");
|
|
|
|
AUTOSTART_PROCESSES(&test_uabc_process);
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
recv(struct uabc_conn *c)
|
|
|
|
{
|
2007-03-25 14:10:29 +02:00
|
|
|
printf("recv '%s'\n", (char *)rimebuf_dataptr());
|
2007-03-20 13:21:17 +01:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
sent(struct uabc_conn *c)
|
|
|
|
{
|
|
|
|
printf("sent\n");
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
dropped(struct uabc_conn *c)
|
|
|
|
{
|
|
|
|
printf("dropped\n");
|
|
|
|
}
|
|
|
|
static const struct uabc_callbacks callbacks = { recv, sent, dropped };
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
PROCESS_THREAD(test_uabc_process, ev, data)
|
|
|
|
{
|
|
|
|
static struct uabc_conn c;
|
2007-03-25 14:10:29 +02:00
|
|
|
|
|
|
|
PROCESS_EXITHANDLER(uabc_close(&c));
|
|
|
|
|
2007-03-20 13:21:17 +01:00
|
|
|
PROCESS_BEGIN();
|
|
|
|
|
|
|
|
uabc_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);
|
2007-03-25 14:10:29 +02:00
|
|
|
uabc_send(&c, CLOCK_SECOND * 4);
|
2007-03-20 13:21:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
PROCESS_END();
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|