+ method for checking if radio can receive data. does not change simulation output, but allows the radio medium to better keep track of how many packets were received etc
This commit is contained in:
parent
7bc3df218c
commit
5af34f6800
6 changed files with 21 additions and 9 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiRadio.java,v 1.26 2009/02/25 14:46:22 fros4943 Exp $
|
||||
* $Id: ContikiRadio.java,v 1.27 2009/04/16 14:26:35 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -176,7 +176,7 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface, PolledA
|
|||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isOn() {
|
||||
public boolean isReceiverOn() {
|
||||
return radioOn;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ApplicationRadio.java,v 1.8 2009/03/09 14:08:54 fros4943 Exp $
|
||||
* $Id: ApplicationRadio.java,v 1.9 2009/04/16 14:26:36 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.interfaces;
|
||||
|
@ -320,4 +320,8 @@ public class ApplicationRadio extends Radio implements PolledBeforeActiveTicks {
|
|||
public Mote getMote() {
|
||||
return myMote;
|
||||
}
|
||||
|
||||
public boolean isReceiverOn() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Radio.java,v 1.9 2008/03/18 13:01:13 fros4943 Exp $
|
||||
* $Id: Radio.java,v 1.10 2009/04/16 14:26:36 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.interfaces;
|
||||
|
@ -119,6 +119,8 @@ public abstract class Radio extends MoteInterface {
|
|||
*/
|
||||
public abstract boolean isInterfered();
|
||||
|
||||
public abstract boolean isReceiverOn();
|
||||
|
||||
/**
|
||||
* Interferes with any current reception. If this method is called, the packet
|
||||
* will be dropped. This method can be used to simulate radio interference
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: DisturberRadio.java,v 1.10 2009/03/09 15:38:10 fros4943 Exp $
|
||||
* $Id: DisturberRadio.java,v 1.11 2009/04/16 14:26:35 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.motes;
|
||||
|
@ -269,4 +269,8 @@ public class DisturberRadio extends Radio implements PolledBeforeAllTicks {
|
|||
public Mote getMote() {
|
||||
return myMote;
|
||||
}
|
||||
|
||||
public boolean isReceiverOn() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: UDGMVisualizerSkin.java,v 1.4 2009/04/14 15:40:26 fros4943 Exp $
|
||||
* $Id: UDGMVisualizerSkin.java,v 1.5 2009/04/16 14:26:35 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins.skins;
|
||||
|
@ -52,7 +52,6 @@ import se.sics.cooja.ClassDescription;
|
|||
import se.sics.cooja.Mote;
|
||||
import se.sics.cooja.RadioConnection;
|
||||
import se.sics.cooja.Simulation;
|
||||
import se.sics.cooja.contikimote.interfaces.ContikiRadio;
|
||||
import se.sics.cooja.interfaces.Position;
|
||||
import se.sics.cooja.interfaces.Radio;
|
||||
import se.sics.cooja.plugins.Visualizer;
|
||||
|
@ -296,7 +295,7 @@ public class UDGMVisualizerSkin implements VisualizerSkin {
|
|||
return new Color[] { Color.CYAN };
|
||||
}
|
||||
|
||||
if (moteRadio instanceof ContikiRadio && !((ContikiRadio) moteRadio).isOn()) {
|
||||
if (!moteRadio.isReceiverOn()) {
|
||||
return new Color[] { Color.GRAY };
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: UDGM.java,v 1.23 2009/03/24 15:46:46 fros4943 Exp $
|
||||
* $Id: UDGM.java,v 1.24 2009/04/16 14:26:35 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.radiomediums;
|
||||
|
@ -120,6 +120,9 @@ public class UDGM extends AbstractRadioMedium {
|
|||
sendingRadio.getChannel() != listeningRadio.getChannel()) {
|
||||
continue;
|
||||
}
|
||||
if (!listeningRadio.isReceiverOn()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double distance = sendingPosition.getDistanceTo(listeningRadioPosition);
|
||||
|
||||
|
|
Loading…
Reference in a new issue