mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-10 11:29:38 +00:00
supporting new mspsim cc2420
This commit is contained in:
parent
8d790a19d8
commit
9c51ece052
@ -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: SkyRadio.java,v 1.5 2008/06/27 14:11:52 nifi Exp $
|
* $Id: SkyRadio.java,v 1.6 2008/09/17 12:08:45 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
@ -47,8 +47,7 @@ import se.sics.cooja.interfaces.Radio;
|
|||||||
import se.sics.cooja.mspmote.SkyMote;
|
import se.sics.cooja.mspmote.SkyMote;
|
||||||
import se.sics.mspsim.chip.CC2420;
|
import se.sics.mspsim.chip.CC2420;
|
||||||
import se.sics.mspsim.chip.PacketListener;
|
import se.sics.mspsim.chip.PacketListener;
|
||||||
import se.sics.mspsim.core.Chip;
|
import se.sics.mspsim.platform.sky.RadioWrapper;
|
||||||
import se.sics.mspsim.core.OperatingModeListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CC2420 to COOJA wrapper.
|
* CC2420 to COOJA wrapper.
|
||||||
@ -67,6 +66,8 @@ public class SkyRadio extends Radio implements CustomDataRadio {
|
|||||||
|
|
||||||
private CC2420 cc2420;
|
private CC2420 cc2420;
|
||||||
|
|
||||||
|
private RadioWrapper cc2420Wrapped;
|
||||||
|
|
||||||
private boolean isInterfered = false;
|
private boolean isInterfered = false;
|
||||||
|
|
||||||
private boolean isTransmitting = false;
|
private boolean isTransmitting = false;
|
||||||
@ -90,9 +91,9 @@ public class SkyRadio extends Radio implements CustomDataRadio {
|
|||||||
|
|
||||||
public SkyRadio(SkyMote mote) {
|
public SkyRadio(SkyMote mote) {
|
||||||
this.myMote = mote;
|
this.myMote = mote;
|
||||||
this.cc2420 = mote.skyNode.radio;
|
this.cc2420Wrapped = new RadioWrapper(mote.skyNode.radio);
|
||||||
|
|
||||||
cc2420.setPacketListener(new PacketListener() {
|
cc2420Wrapped.setPacketListener(new PacketListener() {
|
||||||
public void transmissionStarted() {
|
public void transmissionStarted() {
|
||||||
lastEventTime = myMote.getSimulation().getSimulationTime();
|
lastEventTime = myMote.getSimulation().getSimulationTime();
|
||||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||||
@ -201,7 +202,7 @@ public class SkyRadio extends Radio implements CustomDataRadio {
|
|||||||
/* Deliver packet data */
|
/* Deliver packet data */
|
||||||
if (isReceiving && !isInterfered && lastIncomingCC2420Packet != null /* && !hasFailedReception */) {
|
if (isReceiving && !isInterfered && lastIncomingCC2420Packet != null /* && !hasFailedReception */) {
|
||||||
byte[] packetData = lastIncomingCC2420Packet.getPacketData();
|
byte[] packetData = lastIncomingCC2420Packet.getPacketData();
|
||||||
cc2420.setIncomingPacket(packetData);
|
cc2420Wrapped.packetReceived(packetData);
|
||||||
}
|
}
|
||||||
|
|
||||||
isReceiving = false;
|
isReceiving = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user