mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
splitting contiki messages on newlines
This commit is contained in:
parent
52d9bcaed5
commit
d9ce7927cb
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
@ -63,7 +63,7 @@ public class ESBLog extends Log implements USARTListener {
|
||||
}
|
||||
}
|
||||
|
||||
public String getLastLogMessages() {
|
||||
public String getLastLogMessage() {
|
||||
return lastLogMessage;
|
||||
}
|
||||
|
||||
@ -80,16 +80,16 @@ public class ESBLog extends Log implements USARTListener {
|
||||
logTextPane.setOpaque(false);
|
||||
logTextPane.setEditable(false);
|
||||
|
||||
if (getLastLogMessages() == null) {
|
||||
if (getLastLogMessage() == null) {
|
||||
logTextPane.setText("");
|
||||
} else {
|
||||
logTextPane.append(getLastLogMessages());
|
||||
logTextPane.append(getLastLogMessage());
|
||||
}
|
||||
|
||||
Observer observer;
|
||||
this.addObserver(observer = new Observer() {
|
||||
public void update(Observable obs, Object obj) {
|
||||
logTextPane.append(getLastLogMessages());
|
||||
logTextPane.append(getLastLogMessage());
|
||||
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
||||
}
|
||||
});
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
@ -98,7 +98,7 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
||||
}
|
||||
}
|
||||
|
||||
public String getLastLogMessages() {
|
||||
public String getLastLogMessage() {
|
||||
return lastLogMessage;
|
||||
}
|
||||
|
||||
@ -150,16 +150,16 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
||||
logTextPane.setOpaque(false);
|
||||
logTextPane.setEditable(false);
|
||||
|
||||
if (getLastLogMessages() == null) {
|
||||
if (getLastLogMessage() == null) {
|
||||
logTextPane.setText("");
|
||||
} else {
|
||||
logTextPane.append(getLastLogMessages());
|
||||
logTextPane.append(getLastLogMessage());
|
||||
}
|
||||
|
||||
Observer observer;
|
||||
this.addObserver(observer = new Observer() {
|
||||
public void update(Observable obs, Object obj) {
|
||||
logTextPane.append("< " + getLastLogMessages() + "\n");
|
||||
logTextPane.append("< " + getLastLogMessage() + "\n");
|
||||
logTextPane.setCaretPosition(logTextPane.getDocument().getLength());
|
||||
}
|
||||
});
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
@ -113,7 +113,7 @@ public class ContikiLog extends Log implements ContikiMoteInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public String getLastLogMessages() {
|
||||
public String getLastLogMessage() {
|
||||
return lastLogMessage;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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;
|
||||
@ -36,15 +36,15 @@ import se.sics.cooja.*;
|
||||
/**
|
||||
* A Log represents a mote logging output. An implementation should notify all
|
||||
* observers whenever new logging output is available.
|
||||
*
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("Log Output")
|
||||
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
|
||||
* 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;
|
||||
@ -84,7 +84,7 @@ public class LogListener extends VisPlugin {
|
||||
|
||||
Mote mote = (Mote) obj;
|
||||
Log moteLogInterface = (Log) obs;
|
||||
String lastMessage = moteLogInterface.getLastLogMessages();
|
||||
String lastMessage = moteLogInterface.getLastLogMessage();
|
||||
if (lastMessage.length() > 0 && lastMessage.charAt(lastMessage.length() - 1) == '\n') {
|
||||
lastMessage = lastMessage.substring(0, lastMessage.length() - 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user