wonderly.jeaprs.aprs.clients
Class APRSPacketLogger

java.lang.Object
  |
  +--wonderly.jeaprs.ClientImpl
        |
        +--wonderly.jeaprs.aprs.clients.APRSPacketLogger
All Implemented Interfaces:
Client, java.util.EventListener, java.beans.PropertyChangeListener

public class APRSPacketLogger
extends ClientImpl
implements java.beans.PropertyChangeListener

This is a JeAPRS module that provides packet logging facilities.

Version:
1.0
Author:
Gregg Wonderly - The information contained in this document is Copyright 2001-2003, Gregg Wonderly, all rights reserved.

Field Summary
 
Fields inherited from class wonderly.jeaprs.ClientImpl
actions, APRS, dirty, evLis, ins, me, name, outs, stopped, strmLis
 
Constructor Summary
APRSPacketLogger()
           
 
Method Summary
 void buildActions()
          Put code in here to register all of the actions that you want to use.
 javax.swing.JPanel buildPanel(javax.swing.JFrame f)
          Builds the applications user interface.
 wonderly.jeaprs.aprs.packet.APRSEventListener createEventListener()
          This method needs to be implemented by subclasses and should return an APRSEventListener implementation that is applicable for their client.
 java.io.OutputStream createStreamListener()
          This method needs to be implemented by subclasses and should return an OutputStream implementation that is applicable for their client.
 boolean getLogAll()
           
 boolean getLogCapabilities()
           
 java.lang.String getLogFile()
           
 boolean getLogGPS()
           
 boolean getLogItems()
           
 boolean getLogMessage()
           
 boolean getLogObjects()
           
 boolean getLogOthers()
           
 boolean getLogPosition()
           
 boolean getLogQuery()
           
 boolean getLogShelter()
           
 boolean getLogStatus()
           
 boolean getLogTelemetry()
           
 boolean getLogThirdParty()
           
 boolean getLogUser()
           
 boolean getLogWeather()
           
 void propertyChange(java.beans.PropertyChangeEvent ev)
           
 void setLogAll(boolean how)
           
 void setLogCapabilities(boolean how)
           
 void setLogFile(java.lang.String file)
           
 void setLogGPS(boolean how)
           
 void setLogItems(boolean how)
           
 void setLogMessage(boolean how)
           
 void setLogObjects(boolean how)
           
 void setLogOthers(boolean how)
           
 void setLogPosition(boolean how)
           
 void setLogQuery(boolean how)
           
 void setLogShelter(boolean how)
           
 void setLogStatus(boolean how)
           
 void setLogTelemetry(boolean how)
           
 void setLogThirdParty(boolean how)
           
 void setLogUser(boolean how)
           
 void setLogWeather(boolean how)
           
 
Methods inherited from class wonderly.jeaprs.ClientImpl
addAPRSEventGenerator, addAPRSOutputStream, buildMenu, getAction, getAPRSEventGenerators, getAPRSOutputStreams, getName, getUIFactory, isDirty, isInputUser, isOutputUser, removeAPRSEventGenerator, removeAPRSOutputStream, setDirty, setName, start, stop, toString, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

APRSPacketLogger

public APRSPacketLogger()
Method Detail

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent ev)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

getLogAll

public boolean getLogAll()

setLogAll

public void setLogAll(boolean how)

getLogFile

public java.lang.String getLogFile()

setLogFile

public void setLogFile(java.lang.String file)

getLogPosition

public boolean getLogPosition()

setLogPosition

public void setLogPosition(boolean how)

getLogWeather

public boolean getLogWeather()

getLogOthers

public boolean getLogOthers()

setLogOthers

public void setLogOthers(boolean how)

setLogWeather

public void setLogWeather(boolean how)

getLogObjects

public boolean getLogObjects()

setLogObjects

public void setLogObjects(boolean how)

getLogGPS

public boolean getLogGPS()

setLogGPS

public void setLogGPS(boolean how)

getLogMessage

public boolean getLogMessage()

setLogMessage

public void setLogMessage(boolean how)

getLogCapabilities

public boolean getLogCapabilities()

setLogCapabilities

public void setLogCapabilities(boolean how)

getLogStatus

public boolean getLogStatus()

setLogStatus

public void setLogStatus(boolean how)

getLogQuery

public boolean getLogQuery()

setLogQuery

public void setLogQuery(boolean how)

getLogTelemetry

public boolean getLogTelemetry()

setLogTelemetry

public void setLogTelemetry(boolean how)

getLogUser

public boolean getLogUser()

setLogUser

public void setLogUser(boolean how)

getLogItems

public boolean getLogItems()

setLogItems

public void setLogItems(boolean how)

getLogShelter

public boolean getLogShelter()

setLogShelter

public void setLogShelter(boolean how)

getLogThirdParty

public boolean getLogThirdParty()

setLogThirdParty

public void setLogThirdParty(boolean how)

createEventListener

public wonderly.jeaprs.aprs.packet.APRSEventListener createEventListener()
Description copied from class: ClientImpl
This method needs to be implemented by subclasses and should return an APRSEventListener implementation that is applicable for their client. Many times, a simple inner class is all that is needed as in.
  return new APRSEventAdapter() {
		public void message( APRSPacket pkt, APRSMessage msg ) {
			// Do something with message
		}
	};
	
This will create a new object that is an instance of the APRSEventAdapter class. That class implements the APRSEventListener interface with empty methods so that you can just override the methods that you want APRS packets for, and not have to deal with implementing all methods. Just return null here if you don't need an event listener.

Specified by:
createEventListener in class ClientImpl
See Also:
APRSEventAdapter, APRSEventListener

createStreamListener

public java.io.OutputStream createStreamListener()
Description copied from class: ClientImpl
This method needs to be implemented by subclasses and should return an OutputStream implementation that is applicable for their client. This stream will be written to as data comes through a TNC implementatation, receiving copies of the text lines received by the TNC implementation. A simple mechanism is typically to use a thread and a PipedInputStream and PipedOutputStream pair to receive the data and process it. Just return null if you don't need raw stream events.
	public OutputStream createStreamListener() throws IOException {
		final PipedOutputStream pipe = new PipedOutputStream();
		final PipedInputStream is = new PipedInputStream(pipe);
		new Thread("TNC Stream listener") {
			public void run() {
				try {
					BufferedReader rd = new BufferedReader( new InputStreamReader(is) );
					String str;
					while( (str = rd.readLine()) != null ) {
						System.out.println( "Got TNC line: "+str );
					}
					System.out.println("End of TNC Stream, exiting");
				} finally {
					try {
						is.close();
						pipe.close();
					} catch( Exception ex ) {
						JeAPRS.getUI().reportException(ex);
					}
				}
			}
		}.start();
		return pipe;
	}
	

Specified by:
createStreamListener in class ClientImpl

buildPanel

public javax.swing.JPanel buildPanel(javax.swing.JFrame f)
Description copied from class: ClientImpl
Builds the applications user interface. The returned panel should contain all of the controls needed to provide the user with convienent access to the features of this client/module, except for a menu bar. The buildMenu() method can be used to create a menu bar if neededed.

Specified by:
buildPanel in class ClientImpl
See Also:
ClientImpl.buildMenu()

buildActions

public void buildActions()
Description copied from class: ClientImpl
Put code in here to register all of the actions that you want to use.
                actions.put(  "MyAction", act = new AbstractAction( "MyAction" ) {
                        public void actionPerformed( ActionEvent ev ) {
                                //...do something here
                        }
                });
                act.putValue( Action.NAME, "MyAction" );
 

Specified by:
buildActions in class ClientImpl
See Also:
ClientImpl.getAction(String)