only show printable characters in mote output plugin

This commit is contained in:
Fredrik Osterlind 2013-08-15 11:49:48 +02:00
parent e5fe37336e
commit 871ea380d0

View File

@ -110,7 +110,8 @@ public abstract class SerialUI extends Log implements SerialPort {
newMessage.append((char) data); newMessage.append((char) data);
if (newMessage.length() > MAX_LENGTH) { if (newMessage.length() > MAX_LENGTH) {
/*logger.warn("Dropping too large log message (>" + MAX_LENGTH + " bytes).");*/ /*logger.warn("Dropping too large log message (>" + MAX_LENGTH + " bytes).");*/
lastLogMessage = "# [1024 bytes binary data]"; lastLogMessage = "# [1024 bytes, no line ending]: " + newMessage.substring(0, 20) + "...";
lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}]", "");
newMessage.setLength(0); newMessage.setLength(0);
this.setChanged(); this.setChanged();
this.notifyObservers(getMote()); this.notifyObservers(getMote());