temporarily turning on radio for sending a packet
This commit is contained in:
parent
03d1388c0d
commit
bee0ea4834
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: cooja-radio.c,v 1.11 2010/03/09 08:11:05 fros4943 Exp $
|
* $Id: cooja-radio.c,v 1.12 2010/03/23 12:13:43 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -150,9 +150,11 @@ radio_read(void *buf, unsigned short bufsize)
|
||||||
static int
|
static int
|
||||||
radio_send(const void *payload, unsigned short payload_len)
|
radio_send(const void *payload, unsigned short payload_len)
|
||||||
{
|
{
|
||||||
|
int radiostate = simRadioHWOn;
|
||||||
|
|
||||||
if(!simRadioHWOn) {
|
if(!simRadioHWOn) {
|
||||||
/* TODO Turn on radio temporarily during tx */
|
/* Turn on radio temporarily */
|
||||||
return RADIO_TX_ERR;
|
simRadioHWOn = 1;
|
||||||
}
|
}
|
||||||
if(payload_len > COOJA_RADIO_BUFSIZE) {
|
if(payload_len > COOJA_RADIO_BUFSIZE) {
|
||||||
return RADIO_TX_ERR;
|
return RADIO_TX_ERR;
|
||||||
|
@ -173,6 +175,7 @@ radio_send(const void *payload, unsigned short payload_len)
|
||||||
cooja_mt_yield();
|
cooja_mt_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
simRadioHWOn = radiostate;
|
||||||
return RADIO_TX_OK;
|
return RADIO_TX_OK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue