Bugfix for alignment issue. Added mechanism that allows five duplicate announcements before suppressing one's own.
This commit is contained in:
parent
71ffde578e
commit
cc3f609eaa
1 changed files with 8 additions and 3 deletions
|
@ -33,7 +33,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: polite-announcement.c,v 1.8 2010/01/21 11:39:35 fros4943 Exp $
|
* $Id: polite-announcement.c,v 1.9 2010/01/25 13:55:17 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,6 +62,8 @@ struct announcement_data {
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUM_DUPS 5
|
||||||
|
|
||||||
#define ANNOUNCEMENT_MSG_HEADERLEN 2
|
#define ANNOUNCEMENT_MSG_HEADERLEN 2
|
||||||
struct announcement_msg {
|
struct announcement_msg {
|
||||||
uint16_t num;
|
uint16_t num;
|
||||||
|
@ -130,7 +132,10 @@ adv_packet_received(struct ipolite_conn *ipolite, const rimeaddr_t *from)
|
||||||
struct announcement_data data;
|
struct announcement_data data;
|
||||||
|
|
||||||
/* Copy announcements */
|
/* Copy announcements */
|
||||||
memcpy(&data, &((struct announcement_msg *)packetbuf_dataptr())->data[i], sizeof(struct announcement_data));
|
memcpy(&data.id, &((struct announcement_msg *)packetbuf_dataptr())->data[i].id,
|
||||||
|
sizeof(uint16_t));
|
||||||
|
memcpy(&data.value, &((struct announcement_msg *)packetbuf_dataptr())->data[i].value,
|
||||||
|
sizeof(uint16_t));
|
||||||
announcement_heard(from,
|
announcement_heard(from,
|
||||||
data.id,
|
data.id,
|
||||||
data.value);
|
data.value);
|
||||||
|
@ -163,7 +168,7 @@ polite_announcement_init(uint16_t channel,
|
||||||
clock_time_t min,
|
clock_time_t min,
|
||||||
clock_time_t max)
|
clock_time_t max)
|
||||||
{
|
{
|
||||||
ipolite_open(&c.c, channel, &ipolite_callbacks);
|
ipolite_open(&c.c, channel, NUM_DUPS, &ipolite_callbacks);
|
||||||
|
|
||||||
c.min_interval = min;
|
c.min_interval = min;
|
||||||
c.max_interval = max;
|
c.max_interval = max;
|
||||||
|
|
Loading…
Reference in a new issue