fixed announcement compilation error

This commit is contained in:
fros4943 2009-11-27 14:27:50 +00:00
parent aeefa75304
commit a1b4597b95

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: xmac.c,v 1.42 2009/11/27 12:49:27 adamdunkels Exp $ * $Id: xmac.c,v 1.43 2009/11/27 14:27:50 fros4943 Exp $
*/ */
/** /**
@ -278,7 +278,7 @@ powercycle(struct rtimer *t, void *ptr)
off(); off();
#if XMAC_CONF_COMPOWER #if XMAC_CONF_COMPOWER
compower_accumulate(&compower_idle_activity); compower_accumulate(&compower_idle_activity);
#endif /* XMAC_CONF_COMPOWER */ #endif /* XMAC_CONF_COMPOWER */
} else { } else {
waiting_for_packet++; waiting_for_packet++;
if(waiting_for_packet > 2) { if(waiting_for_packet > 2) {
@ -354,7 +354,7 @@ parse_announcements(const rimeaddr_t *from)
int i; int i;
memcpy(&adata, packetbuf_dataptr(), MIN(packetbuf_datalen(), sizeof(adata))); memcpy(&adata, packetbuf_dataptr(), MIN(packetbuf_datalen(), sizeof(adata)));
/* printf("%d.%d: probe from %d.%d with %d announcements\n", /* printf("%d.%d: probe from %d.%d with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
from->u8[0], from->u8[1], adata->num);*/ from->u8[0], from->u8[1], adata->num);*/
@ -362,13 +362,13 @@ parse_announcements(const rimeaddr_t *from)
printf("%02x ", ((uint8_t *)packetbuf_dataptr())[i]); printf("%02x ", ((uint8_t *)packetbuf_dataptr())[i]);
} }
printf("\n");*/ printf("\n");*/
for(i = 0; i < adata.num; ++i) { for(i = 0; i < adata.num; ++i) {
/* printf("%d.%d: announcement %d: %d\n", /* printf("%d.%d: announcement %d: %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
adata->data[i].id, adata->data[i].id,
adata->data[i].value);*/ adata->data[i].value);*/
announcement_heard(from, announcement_heard(from,
adata.data[i].id, adata.data[i].id,
adata.data[i].value); adata.data[i].value);
@ -381,21 +381,21 @@ format_announcement(char *hdr)
{ {
struct announcement_msg adata; struct announcement_msg adata;
struct announcement *a; struct announcement *a;
/* Construct the announcements */ /* Construct the announcements */
/* adata = (struct announcement_msg *)hdr;*/ /* adata = (struct announcement_msg *)hdr;*/
adata.num = 0; adata.num = 0;
for(a = announcement_list(); for(a = announcement_list();
a != NULL && adata.num < ANNOUNCEMENT_MAX; a != NULL && adata.num < ANNOUNCEMENT_MAX;
a = a->next) { a = a->next) {
adata.data[adata->num].id = a->id; adata.data[adata.num].id = a->id;
adata.data[adata->num].value = a->value; adata.data[adata.num].value = a->value;
adata.num++; adata.num++;
} }
memcpy(hdr, &adata, sizeof(struct announcement_msg)); memcpy(hdr, &adata, sizeof(struct announcement_msg));
if(adata.num > 0) { if(adata.num > 0) {
return ANNOUNCEMENT_MSG_HEADERLEN + return ANNOUNCEMENT_MSG_HEADERLEN +
sizeof(struct announcement_data) * adata.num; sizeof(struct announcement_data) * adata.num;
@ -468,7 +468,7 @@ send_packet(void)
} }
#endif /* WITH_RANDOM_WAIT_BEFORE_SEND */ #endif /* WITH_RANDOM_WAIT_BEFORE_SEND */
/* Create the X-MAC header for the data packet. */ /* Create the X-MAC header for the data packet. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr); packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) { if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
@ -496,7 +496,7 @@ send_packet(void)
len = framer_get()->create(); len = framer_get()->create();
strobe_len = len + sizeof(struct xmac_hdr); strobe_len = len + sizeof(struct xmac_hdr);
if(len == 0 || strobe_len > sizeof(strobe)) { if(len == 0 || strobe_len > sizeof(strobe)) {
/* Failed to send */ /* Failed to send */
PRINTF("xmac: send failed, too large header\n"); PRINTF("xmac: send failed, too large header\n");
return 0; return 0;
} }
@ -528,7 +528,7 @@ send_packet(void)
} }
waiting_for_packet = 0; waiting_for_packet = 0;
} }
while(someone_is_sending); while(someone_is_sending);
#endif /* WITH_CHANNEL_CHECK */ #endif /* WITH_CHANNEL_CHECK */
@ -612,7 +612,7 @@ send_packet(void)
} }
if(!is_already_streaming) { if(!is_already_streaming) {
watchdog_stop(); watchdog_stop();
got_strobe_ack = 0; got_strobe_ack = 0;
for(strobes = 0; for(strobes = 0;
@ -725,7 +725,7 @@ send_packet(void)
the next packet. */ the next packet. */
compower_clear(&current_packet); compower_clear(&current_packet);
#endif /* XMAC_CONF_COMPOWER */ #endif /* XMAC_CONF_COMPOWER */
we_are_sending = 0; we_are_sending = 0;
LEDS_OFF(LEDS_BLUE); LEDS_OFF(LEDS_BLUE);
@ -828,7 +828,7 @@ read_packet(void)
} else if(hdr->type == TYPE_STROBE) { } else if(hdr->type == TYPE_STROBE) {
someone_is_sending = 2; someone_is_sending = 2;
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr)) { &rimeaddr_node_addr)) {
/* This is a strobe packet for us. */ /* This is a strobe packet for us. */
@ -891,7 +891,7 @@ send_announcement(void *ptr)
{ {
struct xmac_hdr *hdr; struct xmac_hdr *hdr;
int announcement_len; int announcement_len;
/* Set up the probe header. */ /* Set up the probe header. */
packetbuf_clear(); packetbuf_clear();
hdr = packetbuf_dataptr(); hdr = packetbuf_dataptr();
@ -958,7 +958,7 @@ xmac_init(const struct radio_driver *d)
list_init(encounter_list); list_init(encounter_list);
memb_init(&encounter_memb); memb_init(&encounter_memb);
#endif /* WITH_ENCOUNTER_OPTIMIZATION */ #endif /* WITH_ENCOUNTER_OPTIMIZATION */
#if XMAC_CONF_ANNOUNCEMENTS #if XMAC_CONF_ANNOUNCEMENTS
announcement_register_listen_callback(listen_callback); announcement_register_listen_callback(listen_callback);
ctimer_set(&announcement_cycle_ctimer, ANNOUNCEMENT_TIME, ctimer_set(&announcement_cycle_ctimer, ANNOUNCEMENT_TIME,