[cooja/serialsocket] Added @Override annotations
This commit is contained in:
parent
af7f9ced81
commit
404fd82399
2 changed files with 16 additions and 0 deletions
|
@ -128,6 +128,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
|||
|
||||
/* Observe serial port for outgoing data */
|
||||
serialPort.addSerialDataObserver(serialDataObserver = new Observer() {
|
||||
@Override
|
||||
public void update(Observable obs, Object obj) {
|
||||
try {
|
||||
if (out == null) {
|
||||
|
@ -149,6 +150,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
|||
private void startSocketReadThread(final DataInputStream in) {
|
||||
/* Forward data: virtual port -> mote */
|
||||
Thread incomingDataThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int numRead = 0;
|
||||
byte[] data = new byte[1024];
|
||||
|
@ -193,10 +195,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
|||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
@ -227,6 +231,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
|||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SerialSocketClient.this.setTitle(SerialSocketClient.this.getTitle() + " *DISCONNECTED*");
|
||||
statusLabel.setText("Disconnected from server");
|
||||
|
@ -234,10 +239,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closePlugin() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
}
|
||||
server = new ServerSocket(LISTEN_PORT);
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (server != null) {
|
||||
try {
|
||||
|
@ -157,6 +158,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
|
||||
/* Observe serial port for outgoing data */
|
||||
serialPort.addSerialDataObserver(serialDataObserver = new Observer() {
|
||||
@Override
|
||||
public void update(Observable obs, Object obj) {
|
||||
try {
|
||||
if (out == null) {
|
||||
|
@ -178,6 +180,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
private void startSocketReadThread(final DataInputStream in) {
|
||||
/* Forward data: virtual port -> mote */
|
||||
Thread incomingDataThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int numRead = 0;
|
||||
byte[] data = new byte[1024];
|
||||
|
@ -218,10 +221,12 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
@ -251,6 +256,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
|
||||
if (Cooja.isVisualized()) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
||||
}
|
||||
|
@ -259,6 +265,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
}
|
||||
|
||||
private boolean closed = false;
|
||||
@Override
|
||||
public void closePlugin() {
|
||||
closed = true;
|
||||
cleanupClient();
|
||||
|
@ -269,12 +276,14 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
private static final int UPDATE_INTERVAL = 150;
|
||||
private Timer updateTimer = new Timer(UPDATE_INTERVAL, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (closed) {
|
||||
updateTimer.stop();
|
||||
|
|
Loading…
Reference in a new issue