org.apache.log4j.net
Class LCDAppender.SocketHandler

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.apache.log4j.net.LCDAppender.SocketHandler
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
LCDAppender

protected class LCDAppender.SocketHandler
extends java.lang.Thread


Field Summary
protected  java.io.BufferedReader _in
           
protected  java.io.PrintWriter _out
           
protected  int _prio
           
protected  java.net.Socket _s
           
protected  boolean done
           
protected  int height
           
protected  java.util.LinkedList img
          The image list holds the strings to be displayed.
protected  java.util.LinkedList ll
          Note: the list ll holds incoming messages from log4j.
protected  int width
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LCDAppender.SocketHandler(java.lang.String host, int port, int priority)
           
 
Method Summary
 void finalize()
           
 void queryStop()
           
 void run()
           
 java.lang.String sanitize(java.lang.String s)
          LCDd 0.4.3 does not handle nested strings very well.
 int scanValue(java.lang.String r)
           
 void send(java.lang.String message)
           
 void sendCommand(java.lang.String s)
           
 void sendCommand(java.lang.String s, java.lang.String expected)
           
 void updateWidthAndHeight(java.lang.String r)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

done

protected boolean done

_s

protected java.net.Socket _s

_prio

protected int _prio

_out

protected java.io.PrintWriter _out

_in

protected java.io.BufferedReader _in

ll

protected java.util.LinkedList ll
Note: the list ll holds incoming messages from log4j. We need to wait for the client-server communication to be stable before we may send data. Connecting to the server, setting up a screen and all the widgets takes some time. Messages which arrive during this time must be stored somewhere as we cannot send them to the server yet. Messages are added at the end and removed at the head (FIFO).

img

protected java.util.LinkedList img
The image list holds the strings to be displayed. The numer is equal to the number of lines on the display ('height'). Initially, all lines are set to the empty string. When a new message arrived (list ll is not empty), it is removed from ll an appended to img. The first element of img is removed so the number of elements in img always remains equal to 'height'. After changes to the image list have been made, all contained lines are written to the LCD.

width

protected int width

height

protected int height
Constructor Detail

LCDAppender.SocketHandler

public LCDAppender.SocketHandler(java.lang.String host,
                                 int port,
                                 int priority)
                          throws java.io.IOException
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

send

public void send(java.lang.String message)

run

public void run()
Overrides:
run in class java.lang.Thread

sendCommand

public void sendCommand(java.lang.String s)
                 throws java.io.IOException

sendCommand

public void sendCommand(java.lang.String s,
                        java.lang.String expected)
                 throws java.io.IOException

updateWidthAndHeight

public void updateWidthAndHeight(java.lang.String r)
                          throws java.io.IOException

scanValue

public int scanValue(java.lang.String r)

sanitize

public java.lang.String sanitize(java.lang.String s)
LCDd 0.4.3 does not handle nested strings very well. Removal of all single quotation marks makes this safe at least.

queryStop

public void queryStop()