From ec1677ca6c1c30f14538b2286717621c9a3d8a32 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 23 Mar 2009 21:06:26 +0000 Subject: [PATCH] Added a function (quick hack) that sets the radio transmission power of outgoing announcement packets in xmac --- core/net/mac/xmac.c | 14 +++++++++++++- core/net/mac/xmac.h | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index 7d9d2d969..137011795 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.c,v 1.29 2009/03/23 21:00:25 adamdunkels Exp $ + * $Id: xmac.c,v 1.30 2009/03/23 21:06:26 adamdunkels Exp $ */ /** @@ -162,6 +162,8 @@ static const struct radio_driver *radio; #if XMAC_CONF_ANNOUNCEMENTS /* Timers for keeping track of when to send announcements. */ static struct ctimer announcement_cycle_ctimer, announcement_ctimer; + +static int announcement_radio_txpower; #endif /* XMAC_CONF_ANNOUNCEMENTS */ /* Flag that is used to keep track of whether or not we are listening @@ -704,6 +706,8 @@ send_announcement(void *ptr) if(announcement_len > 0) { packetbuf_set_datalen(sizeof(struct xmac_hdr) + announcement_len); + + packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower); radio->send(packetbuf_hdrptr(), packetbuf_totlen()); } } @@ -727,6 +731,14 @@ listen_callback(int periods) } #endif /* XMAC_CONF_ANNOUNCEMENTS */ /*---------------------------------------------------------------------------*/ +void +xmac_set_announcement_radio_txpower(int txpower) +{ +#if XMAC_CONF_ANNOUNCEMENTS + announcement_radio_txpower = txpower; +#endif /* XMAC_CONF_ANNOUNCEMENTS */ +} +/*---------------------------------------------------------------------------*/ const struct mac_driver * xmac_init(const struct radio_driver *d) { diff --git a/core/net/mac/xmac.h b/core/net/mac/xmac.h index 23df1217d..38b7a075a 100644 --- a/core/net/mac/xmac.h +++ b/core/net/mac/xmac.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.h,v 1.6 2007/11/12 22:29:37 adamdunkels Exp $ + * $Id: xmac.h,v 1.7 2009/03/23 21:06:26 adamdunkels Exp $ */ /** @@ -64,4 +64,6 @@ const struct mac_driver *xmac_init(const struct radio_driver *d); extern struct xmac_config xmac_config; +void xmac_set_announcement_radio_txpower(int txpower); + #endif /* __XMAC_H__ */