mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-21 19:29:18 +00:00
Add rf230_listen_channel routine to force RX_ON state for sniffing and to read rssi for energy scan.
This commit is contained in:
parent
d86b7c4592
commit
aa7ad8c807
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: rf230bb.c,v 1.19 2010/12/15 14:11:06 dak664 Exp $
|
||||
* @(#)$Id: rf230bb.c,v 1.20 2010/12/15 16:50:44 dak664 Exp $
|
||||
*/
|
||||
/*
|
||||
* This code is almost device independent and should be easy to port.
|
||||
@ -412,20 +412,11 @@ radio_set_trx_state(uint8_t new_state)
|
||||
|
||||
void
|
||||
rf230_set_promiscuous_mode(bool isPromiscuous) {
|
||||
if(isPromiscuous) {
|
||||
is_promiscuous = true;
|
||||
is_promiscuous = isPromiscuous;
|
||||
#if RF230_CONF_AUTOACK
|
||||
/* For now only do promiscuous in Macintosh build */
|
||||
#if USB_CONF_MACINTOSH
|
||||
radio_set_trx_state(RX_ON);
|
||||
/* TODO: Figure out when to pass promisc state to 802.15.4 */
|
||||
// radio_set_trx_state(is_promiscuous?RX_ON:RX_AACK_ON);
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
is_promiscuous = false;
|
||||
#if RF230_CONF_AUTOACK
|
||||
radio_set_trx_state(RX_AACK_ON);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -466,12 +457,8 @@ on(void)
|
||||
rf230_waitidle();
|
||||
|
||||
#if RF230_CONF_AUTOACK
|
||||
/* For now only do promiscuous on Mac build */
|
||||
#if USB_CONF_MACINTOSH
|
||||
radio_set_trx_state(is_promiscuous?RX_ON:RX_AACK_ON);
|
||||
#else
|
||||
// radio_set_trx_state(is_promiscuous?RX_ON:RX_AACK_ON);
|
||||
radio_set_trx_state(RX_AACK_ON);
|
||||
#endif
|
||||
#else
|
||||
radio_set_trx_state(RX_ON);
|
||||
#endif
|
||||
@ -888,6 +875,15 @@ rf230_set_channel(uint8_t c)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rf230_listen_channel(uint8_t c)
|
||||
{
|
||||
/* Same as set channel but forces RX_ON state for sniffer or energy scan */
|
||||
// PRINTF("rf230: Listen Channel %u\n",c);
|
||||
rf230_set_channel(c);
|
||||
radio_set_trx_state(RX_ON);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rf230_set_pan_addr(unsigned pan,
|
||||
unsigned addr,
|
||||
const uint8_t ieee_addr[8])
|
||||
|
@ -45,7 +45,7 @@
|
||||
* \file
|
||||
* \brief This file contains radio driver code.
|
||||
*
|
||||
* $Id: rf230bb.h,v 1.5 2010/12/14 22:34:18 dak664 Exp $
|
||||
* $Id: rf230bb.h,v 1.6 2010/12/15 16:50:44 dak664 Exp $
|
||||
*/
|
||||
|
||||
#ifndef RADIO_H
|
||||
@ -199,6 +199,7 @@ int rf230_init(void);
|
||||
//int rf230_on(void);
|
||||
//int rf230_off(void);
|
||||
void rf230_set_channel(uint8_t channel);
|
||||
void rf230_listen_channel(uint8_t channel);
|
||||
uint8_t rf230_get_channel(void);
|
||||
void rf230_set_pan_addr(unsigned pan,unsigned addr,const uint8_t ieee_addr[8]);
|
||||
void rf230_set_txpower(uint8_t power);
|
||||
|
@ -389,12 +389,22 @@ void menu_process(char c)
|
||||
PRINTF_P(PSTR("Jackdaw now in sniffer mode\n\r"));
|
||||
usbstick_mode.sendToRf = 0;
|
||||
usbstick_mode.translate = 0;
|
||||
#if RF230BB
|
||||
rf230_listen_channel(rf230_get_channel());
|
||||
#else
|
||||
radio_set_trx_state(RX_ON);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
PRINTF_P(PSTR("Jackdaw now in network mode\n\r"));
|
||||
usbstick_mode.sendToRf = 1;
|
||||
usbstick_mode.translate = 1;
|
||||
#if RF230BB
|
||||
rf230_set_channel(rf230_get_channel());
|
||||
#else
|
||||
radio_set_trx_state(RX_AACK_ON); //TODO: Use startup state which may be RX_ON
|
||||
#endif
|
||||
break;
|
||||
|
||||
case '6':
|
||||
@ -594,7 +604,7 @@ extern uip_ds6_netif_t uip_ds6_if;
|
||||
for(j=0;j<(1<<12);j++) {
|
||||
for(i=11;i<=26;i++) {
|
||||
#if RF230BB
|
||||
rf230_set_channel(i);
|
||||
rf230_listen_channel(i);
|
||||
#else // RF230BB
|
||||
radio_set_operating_channel(i);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user