From: Niclas F. <ni...@us...> - 2008-06-27 14:11:55
|
Update of /cvsroot/contiki/contiki-2.x/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13326/src/se/sics/cooja/mspmote/interfaces Modified Files: CC2420RadioPacketConverter.java SkyRadio.java Log Message: updated to latest version of MSPSim Index: CC2420RadioPacketConverter.java =================================================================== RCS file: /cvsroot/contiki/contiki-2.x/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacketConverter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CC2420RadioPacketConverter.java 18 Mar 2008 16:55:44 -0000 1.2 --- CC2420RadioPacketConverter.java 27 Jun 2008 14:11:52 -0000 1.3 *************** *** 55,59 **** */ public static CC2420RadioPacket fromCoojaToCC24240(RadioPacket coojaPacket) { ! return new CC2420RadioPacket(coojaPacket.getPacketData()); } --- 55,63 ---- */ public static CC2420RadioPacket fromCoojaToCC24240(RadioPacket coojaPacket) { ! byte[] data = coojaPacket.getPacketData(); ! byte[] cc2420Data = new byte[data.length + 3]; ! cc2420Data[0] = (byte) ((data.length + 2) & 0xff); ! System.arraycopy(data, 0, cc2420Data, 1, data.length); ! return new CC2420RadioPacket(cc2420Data); } *************** *** 65,69 **** */ public static COOJARadioPacket fromCC2420ToCooja(CC2420RadioPacket cc2420RadioPacket) { ! return new COOJARadioPacket(cc2420RadioPacket.getPacketData()); } --- 69,76 ---- */ public static COOJARadioPacket fromCC2420ToCooja(CC2420RadioPacket cc2420RadioPacket) { ! byte[] cc2420Data = cc2420RadioPacket.getPacketData(); ! byte[] data = new byte[cc2420Data.length - 3]; ! System.arraycopy(cc2420Data, 1, data, 0, data.length); ! return new COOJARadioPacket(data); } Index: SkyRadio.java =================================================================== RCS file: /cvsroot/contiki/contiki-2.x/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyRadio.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SkyRadio.java 18 Mar 2008 16:36:48 -0000 1.4 --- SkyRadio.java 27 Jun 2008 14:11:52 -0000 1.5 *************** *** 48,51 **** --- 48,53 ---- import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.chip.PacketListener; + import se.sics.mspsim.core.Chip; + import se.sics.mspsim.core.OperatingModeListener; /** *************** *** 71,74 **** --- 73,77 ---- private boolean isReceiving = false; + // private boolean hasFailedReception = false; private boolean radioOn = true; *************** *** 82,85 **** --- 85,90 ---- private RadioPacket lastIncomingPacket = null; + // private int mode; + //TODO: HW on/off *************** *** 97,106 **** } ! public void transmissionEnded(int[] receivedData) { ! byte[] outgoingCC2420Data = new byte[receivedData.length]; ! for (int i=0; i < receivedData.length; i++) { ! outgoingCC2420Data[i] = (byte) receivedData[i]; ! } ! lastOutgoingCC2420Packet = new CC2420RadioPacket(outgoingCC2420Data); --- 102,106 ---- } ! public void transmissionEnded(byte[] outgoingCC2420Data) { lastOutgoingCC2420Packet = new CC2420RadioPacket(outgoingCC2420Data); *************** *** 126,129 **** --- 126,136 ---- } }); + // cc2420.addOperatingModeListener(new OperatingModeListener() { + // + // public void modeChanged(Chip source, int mode) { + // SkyRadio.this.mode = mode; + // } + // + // }); } *************** *** 179,184 **** public void signalReceptionStart() { - isReceiving = true; cc2420.setCCA(true); /* TODO cc2420.setSFD(true); */ --- 186,192 ---- public void signalReceptionStart() { cc2420.setCCA(true); + // hasFailedReception = mode == CC2420.MODE_TXRX_OFF; + isReceiving = true; /* TODO cc2420.setSFD(true); */ *************** *** 192,206 **** public void signalReceptionEnd() { /* Deliver packet data */ ! if (isReceiving && !isInterfered && lastIncomingCC2420Packet != null) { byte[] packetData = lastIncomingCC2420Packet.getPacketData(); ! int[] incomingDataInts = new int[packetData.length]; ! for (int i=0; i < packetData.length; i++) { ! incomingDataInts[i] = packetData[i]; ! } ! ! cc2420.setIncomingPacket(incomingDataInts); } isReceiving = false; isInterfered = false; cc2420.setCCA(false); --- 200,210 ---- public void signalReceptionEnd() { /* Deliver packet data */ ! if (isReceiving && !isInterfered && lastIncomingCC2420Packet != null /* && !hasFailedReception */) { byte[] packetData = lastIncomingCC2420Packet.getPacketData(); ! cc2420.setIncomingPacket(packetData); } isReceiving = false; + // hasFailedReception = false; isInterfered = false; cc2420.setCCA(false); *************** *** 220,223 **** --- 224,228 ---- isInterfered = true; isReceiving = false; + // hasFailedReception = false; lastIncomingPacket = null; lastIncomingCC2420Packet = null; *************** *** 306,310 **** } else if (isReceiving()) { statusLabel.setText("receiving"); ! } else if (radioOn) { statusLabel.setText("listening for traffic"); } else { --- 311,315 ---- } else if (isReceiving()) { statusLabel.setText("receiving"); ! } else if (radioOn /* mode != CC2420.MODE_TXRX_OFF */) { statusLabel.setText("listening for traffic"); } else { *************** *** 322,329 **** observer.update(null, null); - // Saving observer reference for releaseInterfaceVisualizer - panel.putClientProperty("intf_obs", observer); - wrapperPanel.add(BorderLayout.NORTH, panel); return wrapperPanel; } --- 327,334 ---- observer.update(null, null); wrapperPanel.add(BorderLayout.NORTH, panel); + + // Saving observer reference for releaseInterfaceVisualizer + wrapperPanel.putClientProperty("intf_obs", observer); return wrapperPanel; } |