diff --git a/platform/cooja/dev/radio-arch.c b/platform/cooja/dev/radio-arch.c index 1e9d6653b..6c0256a8d 100644 --- a/platform/cooja/dev/radio-arch.c +++ b/platform/cooja/dev/radio-arch.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: radio-arch.c,v 1.9 2006/10/11 09:06:41 fros4943 Exp $ + * $Id: radio-arch.c,v 1.10 2006/10/11 15:14:56 fros4943 Exp $ */ #include "dev/radio-arch.h" @@ -61,7 +61,14 @@ int simOutSize; char simRadioHWOn = 1; int simSignalStrength = -200; char simPower = 100; +int simRadioChannel = 1; +/*-----------------------------------------------------------------------------------*/ +void +radio_set_channel(int channel) +{ + simRadioChannel = channel; +} /*-----------------------------------------------------------------------------------*/ int radio_sstrength(void) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java index c821a5237..30f2f9c77 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java @@ -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.8 2006/10/09 13:41:57 fros4943 Exp $ + * $Id: ContikiRadio.java,v 1.9 2006/10/11 15:14:30 fros4943 Exp $ */ package se.sics.cooja.contikimote.interfaces; @@ -64,6 +64,7 @@ import se.sics.cooja.interfaces.Radio; *
* Dependency core interfaces are: @@ -160,6 +161,10 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface { return myMoteMemory.getIntValueOf("simInSize") != 0; } + + public int getChannel() { + return myMoteMemory.getIntValueOf("simRadioChannel"); + } public RadioEvent getLastEvent() { return lastEvent; diff --git a/tools/cooja/java/se/sics/cooja/interfaces/Radio.java b/tools/cooja/java/se/sics/cooja/interfaces/Radio.java index 7582163a6..a4072d80e 100644 --- a/tools/cooja/java/se/sics/cooja/interfaces/Radio.java +++ b/tools/cooja/java/se/sics/cooja/interfaces/Radio.java @@ -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.4 2006/10/05 14:47:48 fros4943 Exp $ + * $Id: Radio.java,v 1.5 2006/10/11 15:13:57 fros4943 Exp $ */ package se.sics.cooja.interfaces; @@ -145,4 +145,11 @@ public abstract class Radio extends MoteInterface { */ public abstract void setCurrentSignalStrength(double signalStrength); + /** + * Returns the current radio channel number. + * + * @return Current channel number + */ + public abstract int getChannel(); + } diff --git a/tools/cooja/java/se/sics/cooja/radiomediums/StandardRadioMedium.java b/tools/cooja/java/se/sics/cooja/radiomediums/StandardRadioMedium.java index 667dbc9e7..42f976a70 100644 --- a/tools/cooja/java/se/sics/cooja/radiomediums/StandardRadioMedium.java +++ b/tools/cooja/java/se/sics/cooja/radiomediums/StandardRadioMedium.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: StandardRadioMedium.java,v 1.7 2006/10/09 14:15:29 fros4943 Exp $ + * $Id: StandardRadioMedium.java,v 1.8 2006/10/11 15:14:10 fros4943 Exp $ */ package se.sics.cooja.radiomediums; @@ -394,7 +394,8 @@ public class StandardRadioMedium extends RadioMedium { * (0.01 * (double) sendingRadio .getCurrentOutputPowerIndicator()); - if (distance <= moteTransmissionRange) { + if (distance <= moteTransmissionRange + && sendingRadio.getChannel() == listeningRadio.getChannel()) { newConnection.addDestination(registeredRadios.get(listenNr), registeredPositions.get(listenNr), dataToSend); @@ -410,7 +411,8 @@ public class StandardRadioMedium extends RadioMedium { .getTransmissionEndTime()); listeningRadio.setCurrentSignalStrength(SS_OK); } - } else if (distance <= moteInterferenceRange) { + } else if (distance <= moteInterferenceRange + && sendingRadio.getChannel() == listeningRadio.getChannel()) { // If close enough to sabotage other transmissions.. listeningRadio.interferReception(sendingRadio .getTransmissionEndTime());