splitting contiki messages on newlines
This commit is contained in:
parent
52d9bcaed5
commit
d9ce7927cb
5 changed files with 19 additions and 19 deletions
|
@ -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: ESBLog.java,v 1.1 2008/02/07 14:54:16 fros4943 Exp $
|
* $Id: ESBLog.java,v 1.2 2008/10/03 10:39:29 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
|
@ -63,7 +63,7 @@ public class ESBLog extends Log implements USARTListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastLogMessages() {
|
public String getLastLogMessage() {
|
||||||
return lastLogMessage;
|
return lastLogMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,16 +80,16 @@ public class ESBLog extends Log implements USARTListener {
|
||||||
logTextPane.setOpaque(false);
|
logTextPane.setOpaque(false);
|
||||||
logTextPane.setEditable(false);
|
logTextPane.setEditable(false);
|
||||||
|
|
||||||
if (getLastLogMessages() == null) {
|
if (getLastLogMessage() == null) {
|
||||||
logTextPane.setText("");
|
logTextPane.setText("");
|
||||||
} else {
|
} else {
|
||||||
logTextPane.append(getLastLogMessages());
|
logTextPane.append(getLastLogMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Observer observer;
|
Observer observer;
|
||||||
this.addObserver(observer = new Observer() {
|
this.addObserver(observer = new Observer() {
|
||||||
public void update(Observable obs, Object obj) {
|
public void update(Observable obs, Object obj) {
|
||||||
logTextPane.append(getLastLogMessages());
|
logTextPane.append(getLastLogMessage());
|
||||||
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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: SkySerial.java,v 1.2 2008/09/17 12:05:45 fros4943 Exp $
|
* $Id: SkySerial.java,v 1.3 2008/10/03 10:39:29 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
|
@ -98,7 +98,7 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastLogMessages() {
|
public String getLastLogMessage() {
|
||||||
return lastLogMessage;
|
return lastLogMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,16 +150,16 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
||||||
logTextPane.setOpaque(false);
|
logTextPane.setOpaque(false);
|
||||||
logTextPane.setEditable(false);
|
logTextPane.setEditable(false);
|
||||||
|
|
||||||
if (getLastLogMessages() == null) {
|
if (getLastLogMessage() == null) {
|
||||||
logTextPane.setText("");
|
logTextPane.setText("");
|
||||||
} else {
|
} else {
|
||||||
logTextPane.append(getLastLogMessages());
|
logTextPane.append(getLastLogMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Observer observer;
|
Observer observer;
|
||||||
this.addObserver(observer = new Observer() {
|
this.addObserver(observer = new Observer() {
|
||||||
public void update(Observable obs, Object obj) {
|
public void update(Observable obs, Object obj) {
|
||||||
logTextPane.append("< " + getLastLogMessages() + "\n");
|
logTextPane.append("< " + getLastLogMessage() + "\n");
|
||||||
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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: ContikiLog.java,v 1.3 2008/10/03 10:36:39 fros4943 Exp $
|
* $Id: ContikiLog.java,v 1.4 2008/10/03 10:39:49 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.contikimote.interfaces;
|
package se.sics.cooja.contikimote.interfaces;
|
||||||
|
@ -113,7 +113,7 @@ public class ContikiLog extends Log implements ContikiMoteInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastLogMessages() {
|
public String getLastLogMessage() {
|
||||||
return lastLogMessage;
|
return lastLogMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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: Log.java,v 1.1 2006/08/21 12:12:59 fros4943 Exp $
|
* $Id: Log.java,v 1.2 2008/10/03 10:39:49 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.interfaces;
|
package se.sics.cooja.interfaces;
|
||||||
|
@ -36,15 +36,15 @@ import se.sics.cooja.*;
|
||||||
/**
|
/**
|
||||||
* A Log represents a mote logging output. An implementation should notify all
|
* A Log represents a mote logging output. An implementation should notify all
|
||||||
* observers whenever new logging output is available.
|
* observers whenever new logging output is available.
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Log Output")
|
@ClassDescription("Log Output")
|
||||||
public abstract class Log extends MoteInterface {
|
public abstract class Log extends MoteInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Last log messages available
|
* @return Last log message. Note that several messages may appear during one tick.
|
||||||
*/
|
*/
|
||||||
public abstract String getLastLogMessages();
|
public abstract String getLastLogMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: LogListener.java,v 1.10 2008/09/01 13:01:05 fros4943 Exp $
|
* $Id: LogListener.java,v 1.11 2008/10/03 10:39:49 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
|
@ -84,7 +84,7 @@ public class LogListener extends VisPlugin {
|
||||||
|
|
||||||
Mote mote = (Mote) obj;
|
Mote mote = (Mote) obj;
|
||||||
Log moteLogInterface = (Log) obs;
|
Log moteLogInterface = (Log) obs;
|
||||||
String lastMessage = moteLogInterface.getLastLogMessages();
|
String lastMessage = moteLogInterface.getLastLogMessage();
|
||||||
if (lastMessage.length() > 0 && lastMessage.charAt(lastMessage.length() - 1) == '\n') {
|
if (lastMessage.length() > 0 && lastMessage.charAt(lastMessage.length() - 1) == '\n') {
|
||||||
lastMessage = lastMessage.substring(0, lastMessage.length() - 1);
|
lastMessage = lastMessage.substring(0, lastMessage.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue