Merge pull request #795 from ejoerns/pull-req/cooja-println-cleanup
[Cooja] Println cleanup
This commit is contained in:
commit
718e488b78
|
@ -3152,7 +3152,7 @@ public class Cooja extends Observable {
|
||||||
if (new File(logConfigFile).exists()) {
|
if (new File(logConfigFile).exists()) {
|
||||||
DOMConfigurator.configure(logConfigFile);
|
DOMConfigurator.configure(logConfigFile);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Failed to open " + logConfigFile);
|
logger.error("Failed to open " + logConfigFile);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
} else if (new File(LOG_CONFIG_FILE).exists()) {
|
} else if (new File(LOG_CONFIG_FILE).exists()) {
|
||||||
|
|
|
@ -26,13 +26,6 @@
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* -----------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Fredrik Osterlind
|
|
||||||
* Created : 2006-06-14
|
|
||||||
* Updated : $Date: 2009/11/13 14:27:46 $
|
|
||||||
* $Revision: 1.15 $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.contikios.cooja.dialogs;
|
package org.contikios.cooja.dialogs;
|
||||||
|
@ -64,11 +57,21 @@ import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
import javax.swing.ListModel;
|
import javax.swing.ListModel;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.contikios.cooja.Cooja;
|
import org.contikios.cooja.Cooja;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adam Dunkels
|
||||||
|
* @author Joakim Eriksson
|
||||||
|
* @author Niclas Finne
|
||||||
|
* @author Fredrik Osterlind
|
||||||
|
*/
|
||||||
public class MessageList extends JList {
|
public class MessageList extends JList {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(MessageList.class);
|
||||||
|
|
||||||
public static final int NORMAL = 0;
|
public static final int NORMAL = 0;
|
||||||
public static final int WARNING = 1;
|
public static final int WARNING = 1;
|
||||||
public static final int ERROR = 2;
|
public static final int ERROR = 2;
|
||||||
|
@ -130,6 +133,7 @@ public class MessageList extends JList {
|
||||||
final BufferedReader stringInput = new BufferedReader(new InputStreamReader(input));
|
final BufferedReader stringInput = new BufferedReader(new InputStreamReader(input));
|
||||||
|
|
||||||
Thread readThread = new Thread(new Runnable() {
|
Thread readThread = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String readLine;
|
String readLine;
|
||||||
try {
|
try {
|
||||||
|
@ -145,8 +149,8 @@ public class MessageList extends JList {
|
||||||
readThread.start();
|
readThread.start();
|
||||||
|
|
||||||
return new PrintStream(output);
|
return new PrintStream(output);
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Exception: "+ e);
|
logger.error(messages);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,6 +188,7 @@ public class MessageList extends JList {
|
||||||
messages.add(msg);
|
messages.add(msg);
|
||||||
|
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateModel();
|
updateModel();
|
||||||
}
|
}
|
||||||
|
@ -195,6 +200,7 @@ public class MessageList extends JList {
|
||||||
((DefaultListModel) getModel()).clear();
|
((DefaultListModel) getModel()).clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setModel(ListModel model) {
|
public void setModel(ListModel model) {
|
||||||
throw new IllegalArgumentException("changing model not permitted");
|
throw new IllegalArgumentException("changing model not permitted");
|
||||||
}
|
}
|
||||||
|
@ -203,16 +209,19 @@ public class MessageList extends JList {
|
||||||
if (popup == null) {
|
if (popup == null) {
|
||||||
popup = new JPopupMenu();
|
popup = new JPopupMenu();
|
||||||
addMouseListener(new MouseAdapter() {
|
addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
if (e.isPopupTrigger()) {
|
||||||
popup.show(MessageList.this, e.getX(), e.getY());
|
popup.show(MessageList.this, e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
if (e.isPopupTrigger()) {
|
||||||
popup.show(MessageList.this, e.getX(), e.getY());
|
popup.show(MessageList.this, e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
if (e.isPopupTrigger()) {
|
||||||
popup.show(MessageList.this, e.getX(), e.getY());
|
popup.show(MessageList.this, e.getX(), e.getY());
|
||||||
|
@ -230,6 +239,7 @@ public class MessageList extends JList {
|
||||||
final JMenuItem hideNormalMenuItem = new JCheckBoxMenuItem("Hide normal output");
|
final JMenuItem hideNormalMenuItem = new JCheckBoxMenuItem("Hide normal output");
|
||||||
hideNormalMenuItem.setEnabled(true);
|
hideNormalMenuItem.setEnabled(true);
|
||||||
hideNormalMenuItem.addActionListener(new ActionListener() {
|
hideNormalMenuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
MessageList.this.hideNormal = hideNormalMenuItem.isSelected();
|
MessageList.this.hideNormal = hideNormalMenuItem.isSelected();
|
||||||
((MessageModel)getModel()).updateList();
|
((MessageModel)getModel()).updateList();
|
||||||
|
@ -240,16 +250,17 @@ public class MessageList extends JList {
|
||||||
JMenuItem consoleOutputMenuItem = new JMenuItem("Output to console");
|
JMenuItem consoleOutputMenuItem = new JMenuItem("Output to console");
|
||||||
consoleOutputMenuItem.setEnabled(true);
|
consoleOutputMenuItem.setEnabled(true);
|
||||||
consoleOutputMenuItem.addActionListener(new ActionListener() {
|
consoleOutputMenuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
MessageContainer[] messages = getMessages();
|
MessageContainer[] messages = getMessages();
|
||||||
System.out.println("\nCOMPILATION OUTPUT:\n");
|
logger.info("\nCOMPILATION OUTPUT:\n");
|
||||||
for (MessageContainer msg: messages) {
|
for (MessageContainer msg: messages) {
|
||||||
if (hideNormal && msg.type == NORMAL) {
|
if (hideNormal && msg.type == NORMAL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
System.out.println(msg);
|
logger.info(msg);
|
||||||
}
|
}
|
||||||
System.out.println();
|
logger.info("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popup.add(consoleOutputMenuItem);
|
popup.add(consoleOutputMenuItem);
|
||||||
|
@ -257,6 +268,7 @@ public class MessageList extends JList {
|
||||||
JMenuItem clipboardMenuItem = new JMenuItem("Copy to clipboard");
|
JMenuItem clipboardMenuItem = new JMenuItem("Copy to clipboard");
|
||||||
clipboardMenuItem.setEnabled(true);
|
clipboardMenuItem.setEnabled(true);
|
||||||
clipboardMenuItem.addActionListener(new ActionListener() {
|
clipboardMenuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
|
|
||||||
|
@ -299,6 +311,7 @@ public class MessageList extends JList {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
@ -318,6 +331,7 @@ public class MessageList extends JList {
|
||||||
|
|
||||||
private class MessageRenderer extends DefaultListCellRenderer {
|
private class MessageRenderer extends DefaultListCellRenderer {
|
||||||
private Dimension nullDimension = new Dimension(0,0);
|
private Dimension nullDimension = new Dimension(0,0);
|
||||||
|
@Override
|
||||||
public Component getListCellRendererComponent(
|
public Component getListCellRendererComponent(
|
||||||
JList list,
|
JList list,
|
||||||
Object value,
|
Object value,
|
||||||
|
|
|
@ -165,8 +165,7 @@ public abstract class SerialUI extends Log implements SerialPort {
|
||||||
writeString(command);
|
writeString(command);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.err.println("could not send '" + command + "':");
|
logger.error("could not send '" + command + "':", ex);
|
||||||
ex.printStackTrace();
|
|
||||||
JOptionPane.showMessageDialog(
|
JOptionPane.showMessageDialog(
|
||||||
logTextPane,
|
logTextPane,
|
||||||
"Could not send '" + command + "':\n" + ex.getMessage(), "Error sending message",
|
"Could not send '" + command + "':\n" + ex.getMessage(), "Error sending message",
|
||||||
|
|
|
@ -29,12 +29,7 @@
|
||||||
*/
|
*/
|
||||||
package org.contikios.cooja.emulatedmote;
|
package org.contikios.cooja.emulatedmote;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.GridLayout;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.swing.*;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
@ -53,7 +48,7 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
|
|
||||||
private final static boolean DEBUG = false;
|
private final static boolean DEBUG = false;
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(Radio802154.class);
|
private static final Logger logger = Logger.getLogger(Radio802154.class);
|
||||||
|
|
||||||
protected long lastEventTime = 0;
|
protected long lastEventTime = 0;
|
||||||
|
|
||||||
|
@ -103,10 +98,9 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
|
|
||||||
buffer[len++] = val;
|
buffer[len++] = val;
|
||||||
|
|
||||||
//System.out.println("## 802.15.4: " + (val&0xff) + " transmitted...");
|
logger.debug("802.15.4: " + (val & 0xff) + " transmitted...");
|
||||||
|
|
||||||
if (len == 6) {
|
if (len == 6) {
|
||||||
//System.out.println("## CC2420 Packet of length: " + val + " expected...");
|
|
||||||
expLen = val + 6;
|
expLen = val + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +114,8 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
setChanged();
|
setChanged();
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
|
|
||||||
// System.out.println("## CC2420 Transmission finished...");
|
|
||||||
|
|
||||||
lastEventTime = mote.getSimulation().getSimulationTime();
|
lastEventTime = mote.getSimulation().getSimulationTime();
|
||||||
/*logger.debug("----- SKY TRANSMISSION FINISHED -----");*/
|
logger.debug("----- 802.15.4 TRANSMISSION FINISHED -----");
|
||||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||||
setChanged();
|
setChanged();
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
|
@ -132,26 +124,32 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Packet radio support */
|
/* Packet radio support */
|
||||||
|
@Override
|
||||||
public RadioPacket getLastPacketTransmitted() {
|
public RadioPacket getLastPacketTransmitted() {
|
||||||
return lastOutgoingPacket;
|
return lastOutgoingPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public RadioPacket getLastPacketReceived() {
|
public RadioPacket getLastPacketReceived() {
|
||||||
return lastIncomingPacket;
|
return lastIncomingPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setReceivedPacket(RadioPacket packet) {
|
public void setReceivedPacket(RadioPacket packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom data radio support */
|
/* Custom data radio support */
|
||||||
|
@Override
|
||||||
public Object getLastCustomDataTransmitted() {
|
public Object getLastCustomDataTransmitted() {
|
||||||
return lastOutgoingByte;
|
return lastOutgoingByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getLastCustomDataReceived() {
|
public Object getLastCustomDataReceived() {
|
||||||
return lastIncomingByte;
|
return lastIncomingByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void receiveCustomData(Object data) {
|
public void receiveCustomData(Object data) {
|
||||||
if (data instanceof RadioByte) {
|
if (data instanceof RadioByte) {
|
||||||
lastIncomingByte = (RadioByte) data;
|
lastIncomingByte = (RadioByte) data;
|
||||||
|
@ -160,14 +158,17 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General radio support */
|
/* General radio support */
|
||||||
|
@Override
|
||||||
public boolean isTransmitting() {
|
public boolean isTransmitting() {
|
||||||
return isTransmitting;
|
return isTransmitting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isReceiving() {
|
public boolean isReceiving() {
|
||||||
return isReceiving;
|
return isReceiving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isInterfered() {
|
public boolean isInterfered() {
|
||||||
return isInterfered;
|
return isInterfered;
|
||||||
}
|
}
|
||||||
|
@ -176,23 +177,31 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
|
|
||||||
protected abstract void handleEndOfReception();
|
protected abstract void handleEndOfReception();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract int getChannel();
|
public abstract int getChannel();
|
||||||
|
|
||||||
public abstract int getFrequency();
|
public abstract int getFrequency();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract boolean isRadioOn();
|
public abstract boolean isRadioOn();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract double getCurrentOutputPower();
|
public abstract double getCurrentOutputPower();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract int getCurrentOutputPowerIndicator();
|
public abstract int getCurrentOutputPowerIndicator();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract int getOutputPowerIndicatorMax();
|
public abstract int getOutputPowerIndicatorMax();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract double getCurrentSignalStrength();
|
public abstract double getCurrentSignalStrength();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract void setCurrentSignalStrength(double signalStrength);
|
public abstract void setCurrentSignalStrength(double signalStrength);
|
||||||
|
|
||||||
/* need to add a few more methods later??? */
|
/* need to add a few more methods later??? */
|
||||||
|
@Override
|
||||||
public void signalReceptionStart() {
|
public void signalReceptionStart() {
|
||||||
isReceiving = true;
|
isReceiving = true;
|
||||||
|
|
||||||
|
@ -207,6 +216,7 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void signalReceptionEnd() {
|
public void signalReceptionEnd() {
|
||||||
/* Deliver packet data */
|
/* Deliver packet data */
|
||||||
isReceiving = false;
|
isReceiving = false;
|
||||||
|
@ -226,10 +236,12 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public RadioEvent getLastEvent() {
|
public RadioEvent getLastEvent() {
|
||||||
return lastEvent;
|
return lastEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void interfereAnyReception() {
|
public void interfereAnyReception() {
|
||||||
isInterfered = true;
|
isInterfered = true;
|
||||||
isReceiving = false;
|
isReceiving = false;
|
||||||
|
@ -249,18 +261,22 @@ public abstract class Radio802154 extends Radio implements CustomDataRadio {
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Mote getMote() {
|
public Mote getMote() {
|
||||||
return mote;
|
return mote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
return mote.getInterfaces().getPosition();
|
return mote.getInterfaces().getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collection<Element> getConfigXML() {
|
public Collection<Element> getConfigXML() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,6 @@ public class MemoryLayout {
|
||||||
int nextsize = nextType.getSize();
|
int nextsize = nextType.getSize();
|
||||||
/* limit padding to word size */
|
/* limit padding to word size */
|
||||||
nextsize = nextsize > WORD_SIZE ? WORD_SIZE : nextsize;
|
nextsize = nextsize > WORD_SIZE ? WORD_SIZE : nextsize;
|
||||||
System.out.println("Nextsize: " + nextsize);
|
|
||||||
/* calc padding */
|
/* calc padding */
|
||||||
int pad = nextsize - currType.getSize();
|
int pad = nextsize - currType.getSize();
|
||||||
return pad;
|
return pad;
|
||||||
|
|
|
@ -2,11 +2,14 @@ package org.contikios.cooja.plugins.analyzers;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.contikios.cooja.util.StringUtils;
|
import org.contikios.cooja.util.StringUtils;
|
||||||
|
|
||||||
public class IEEE802154Analyzer extends PacketAnalyzer {
|
public class IEEE802154Analyzer extends PacketAnalyzer {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(IEEE802154Analyzer.class);
|
||||||
|
|
||||||
// Addressing modes
|
// Addressing modes
|
||||||
public static final int NO_ADDRESS = 0;
|
public static final int NO_ADDRESS = 0;
|
||||||
public static final int RSV_ADDRESS = 1;
|
public static final int RSV_ADDRESS = 1;
|
||||||
|
@ -33,7 +36,7 @@ public class IEEE802154Analyzer extends PacketAnalyzer {
|
||||||
try {
|
try {
|
||||||
pcapExporter = new PcapExporter();
|
pcapExporter = new PcapExporter();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +46,7 @@ public class IEEE802154Analyzer extends PacketAnalyzer {
|
||||||
try {
|
try {
|
||||||
pcapExporter.openPcap(pcapFile);
|
pcapExporter.openPcap(pcapFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Could not open pcap file");
|
logger.error("Could not open pcap file", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,8 +71,7 @@ public class IEEE802154Analyzer extends PacketAnalyzer {
|
||||||
try {
|
try {
|
||||||
pcapExporter.exportPacketData(packet.getPayload());
|
pcapExporter.exportPacketData(packet.getPayload());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Could not export PCap data");
|
logger.error("Could not export PCap data", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package org.contikios.cooja.plugins.analyzers;
|
package org.contikios.cooja.plugins.analyzers;
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class PcapExporter {
|
public class PcapExporter {
|
||||||
|
private static final Logger logger = Logger.getLogger(PcapExporter.class);
|
||||||
|
|
||||||
DataOutputStream out;
|
DataOutputStream out;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class PcapExporter {
|
||||||
out.writeInt(195); /* 195 for LINKTYPE_IEEE802_15_4 */
|
out.writeInt(195); /* 195 for LINKTYPE_IEEE802_15_4 */
|
||||||
|
|
||||||
out.flush();
|
out.flush();
|
||||||
System.out.println("Opened pcap file " + pcapFile);
|
logger.info("Opened pcap file " + pcapFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closePcap() throws IOException {
|
public void closePcap() throws IOException {
|
||||||
|
@ -56,7 +56,7 @@ public class PcapExporter {
|
||||||
out.write(data);
|
out.write(data);
|
||||||
out.flush();
|
out.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue