added printout of sender of received messages

This commit is contained in:
nifi 2009-11-19 17:29:41 +00:00
parent 4f2318152e
commit e6015bce4c

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: example-broadcast.c,v 1.1 2009/10/18 17:49:24 adamdunkels Exp $ * $Id: example-broadcast.c,v 1.2 2009/11/19 17:29:41 nifi Exp $
*/ */
/** /**
@ -52,9 +52,10 @@ PROCESS(example_broadcast_process, "BROADCAST example");
AUTOSTART_PROCESSES(&example_broadcast_process); AUTOSTART_PROCESSES(&example_broadcast_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
broadcast_recv(struct broadcast_conn *c) broadcast_recv(struct broadcast_conn *c, const rimeaddr_t *from)
{ {
printf("broadcast message received '%s'\n", (char *)packetbuf_dataptr()); printf("broadcast message received from %d.%d: '%s'\n",
from->u8[0], from->u8[1], (char *)packetbuf_dataptr());
} }
static const struct broadcast_callbacks broadcast_call = {broadcast_recv}; static const struct broadcast_callbacks broadcast_call = {broadcast_recv};
static struct broadcast_conn broadcast; static struct broadcast_conn broadcast;