wonderly.jeaprs.aprs
Class APRSStreamHandler

java.lang.Object
  |
  +--wonderly.jeaprs.aprs.APRSStreamHandler
All Implemented Interfaces:
APRSEventGenerator, APRSIOModule, IOModule
Direct Known Subclasses:
IGATEStream, TNCStream

public class APRSStreamHandler
extends java.lang.Object
implements APRSEventGenerator

This class contains methods for processing a java.io.InputStream of APRS packets and separate APRSPacket objects. It allows listeners to be added that will be sent events associated with the many types of APRS events that the protocol supports.

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

Constructor Summary
APRSStreamHandler()
           
 
Method Summary
 void addAPRSEventListener(wonderly.jeaprs.aprs.packet.APRSEventListener lis)
          Adds the passed APRSEventListener to the list of listeners receiving events as they are parsed and APRSData objects are created.
 void addAPRSStatusListener(wonderly.jeaprs.aprs.APRSStatusListener lis)
          Adds an APRSStatusListener to receive notification of events pertaining to the processing of this stream.
 void addStreamListener(java.io.OutputStream lis)
          Adds a stream listener that will receive the raw data as it is processed by this class.
 java.util.Vector getAPRSEventListeners()
          Returns all APRSEventListeners
 java.util.Vector getAPRSStatusListeners()
          Returns all APRSStatusListeners
 boolean getDebugging()
           
 java.lang.String getModuleId()
          returns the name used to identify this TNC to the user
 wonderly.jeaprs.aprs.packet.APRSData processAPRSPacket(wonderly.jeaprs.aprs.packet.APRSPacket pkt)
           
 void processTNCStream(wonderly.jeaprs.TNC rd)
           
 void removeAPRSEventListener(wonderly.jeaprs.aprs.packet.APRSEventListener lis)
          Removes the passed APRSEventListener so that it will no longer receives events.
 void removeAPRSStatusListener(wonderly.jeaprs.aprs.APRSStatusListener lis)
          Removes the passed APRSStatusListener
 void removeStreamListener(java.io.OutputStream lis)
          Removes the passed stream listener
protected  void sendBadPacket(byte[] data, java.lang.Exception ex)
          Sends EOF to all APRSStatusListeners
protected  void sendEOFStatus()
          Sends EOF to all APRSStatusListeners
 void setDebugging(boolean how)
           
 void setModuleId(java.lang.String name)
          Sets the name used for identifying this TNC to the user
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

APRSStreamHandler

public APRSStreamHandler()
Method Detail

setModuleId

public void setModuleId(java.lang.String name)
Sets the name used for identifying this TNC to the user

Specified by:
setModuleId in interface IOModule

getModuleId

public java.lang.String getModuleId()
returns the name used to identify this TNC to the user

Specified by:
getModuleId in interface IOModule

setDebugging

public void setDebugging(boolean how)

getDebugging

public boolean getDebugging()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addAPRSEventListener

public void addAPRSEventListener(wonderly.jeaprs.aprs.packet.APRSEventListener lis)
Adds the passed APRSEventListener to the list of listeners receiving events as they are parsed and APRSData objects are created.

Specified by:
addAPRSEventListener in interface APRSEventGenerator

removeAPRSEventListener

public void removeAPRSEventListener(wonderly.jeaprs.aprs.packet.APRSEventListener lis)
Removes the passed APRSEventListener so that it will no longer receives events. If the listener throws an exception it may be removed automatically!

Specified by:
removeAPRSEventListener in interface APRSEventGenerator

addStreamListener

public void addStreamListener(java.io.OutputStream lis)
Adds a stream listener that will receive the raw data as it is processed by this class.

Specified by:
addStreamListener in interface APRSEventGenerator

removeStreamListener

public void removeStreamListener(java.io.OutputStream lis)
Removes the passed stream listener

Specified by:
removeStreamListener in interface APRSEventGenerator

addAPRSStatusListener

public void addAPRSStatusListener(wonderly.jeaprs.aprs.APRSStatusListener lis)
Adds an APRSStatusListener to receive notification of events pertaining to the processing of this stream.

Specified by:
addAPRSStatusListener in interface APRSEventGenerator

removeAPRSStatusListener

public void removeAPRSStatusListener(wonderly.jeaprs.aprs.APRSStatusListener lis)
Removes the passed APRSStatusListener

Specified by:
removeAPRSStatusListener in interface APRSEventGenerator

getAPRSEventListeners

public java.util.Vector getAPRSEventListeners()
Returns all APRSEventListeners

Specified by:
getAPRSEventListeners in interface APRSEventGenerator

getAPRSStatusListeners

public java.util.Vector getAPRSStatusListeners()
Returns all APRSStatusListeners

Specified by:
getAPRSStatusListeners in interface APRSEventGenerator

sendEOFStatus

protected void sendEOFStatus()
Sends EOF to all APRSStatusListeners


sendBadPacket

protected void sendBadPacket(byte[] data,
                             java.lang.Exception ex)
Sends EOF to all APRSStatusListeners


processTNCStream

public void processTNCStream(wonderly.jeaprs.TNC rd)
                      throws java.io.IOException
Specified by:
processTNCStream in interface APRSEventGenerator
java.io.IOException

processAPRSPacket

public wonderly.jeaprs.aprs.packet.APRSData processAPRSPacket(wonderly.jeaprs.aprs.packet.APRSPacket pkt)