plugin is updated to support non-visualized simulations
This commit is contained in:
parent
1daee93f63
commit
20d9f70b09
|
@ -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: SerialSocketServer.java,v 1.2 2010/03/19 15:03:14 fros4943 Exp $
|
* $Id: SerialSocketServer.java,v 1.3 2010/03/25 08:00:15 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
@ -118,7 +118,9 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Listening on port: " + LISTEN_PORT);
|
logger.info("Listening on port: " + LISTEN_PORT);
|
||||||
|
if (GUI.isVisualized()) {
|
||||||
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
||||||
|
}
|
||||||
server = new ServerSocket(LISTEN_PORT);
|
server = new ServerSocket(LISTEN_PORT);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -130,7 +132,9 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
startSocketReadThread(in);
|
startSocketReadThread(in);
|
||||||
|
if (GUI.isVisualized()) {
|
||||||
statusLabel.setText("Client connected: " + client.getInetAddress());
|
statusLabel.setText("Client connected: " + client.getInetAddress());
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.fatal("Listening thread shut down: " + e.getMessage());
|
logger.fatal("Listening thread shut down: " + e.getMessage());
|
||||||
server = null;
|
server = null;
|
||||||
|
@ -242,12 +246,14 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GUI.isVisualized()) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void closePlugin() {
|
public void closePlugin() {
|
||||||
cleanupClient();
|
cleanupClient();
|
||||||
|
|
Loading…
Reference in a new issue