ICTP: lowered radio power + print unicast data

This commit is contained in:
Enric M. Calvo 2011-03-07 22:33:59 +01:00
parent 7fc41e1706
commit 7c3527a062
2 changed files with 6 additions and 0 deletions

View file

@ -66,6 +66,8 @@ PROCESS_THREAD(example_unicast_process, ev, data)
PROCESS_EXITHANDLER(unicast_close(&uc);) PROCESS_EXITHANDLER(unicast_close(&uc);)
PROCESS_BEGIN(); PROCESS_BEGIN();
cc2420_set_txpower(5);
unicast_open(&uc, 222, &unicast_callbacks); unicast_open(&uc, 222, &unicast_callbacks);

View file

@ -54,8 +54,11 @@ AUTOSTART_PROCESSES(&example_unicast_process);
static void static void
recv_uc(struct unicast_conn *c, const rimeaddr_t *from) recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
{ {
char mypkt[16];
printf("unicast message received from %d.%d\n", printf("unicast message received from %d.%d\n",
from->u8[0], from->u8[1]); from->u8[0], from->u8[1]);
memcpy(mypkt, packetbuf_dataptr(),sizeof(mypkt));
printf("Data = %s\n", mypkt);
leds_toggle(LEDS_GREEN); leds_toggle(LEDS_GREEN);
} }
static const struct unicast_callbacks unicast_callbacks = {recv_uc}; static const struct unicast_callbacks unicast_callbacks = {recv_uc};
@ -66,6 +69,7 @@ PROCESS_THREAD(example_unicast_process, ev, data)
PROCESS_EXITHANDLER(unicast_close(&uc);) PROCESS_EXITHANDLER(unicast_close(&uc);)
PROCESS_BEGIN(); PROCESS_BEGIN();
cc2420_set_txpower(5);
unicast_open(&uc, 222, &unicast_callbacks); unicast_open(&uc, 222, &unicast_callbacks);