wonderly.jeaprs
Class JeAPRS.SocketAPRS

java.lang.Object
  |
  +--wonderly.jeaprs.JeAPRS.SocketAPRS
All Implemented Interfaces:
APRSInput, APRSOutput, IOModule, TNC
Enclosing class:
JeAPRS

public class JeAPRS.SocketAPRS
extends java.lang.Object
implements TNC


Field Summary
 
Fields inherited from interface wonderly.jeaprs.TNC
TNC_TYPE_EHF, TNC_TYPE_HF, TNC_TYPE_NET, TNC_TYPE_UHF, TNC_TYPE_VHF
 
Constructor Summary
JeAPRS.SocketAPRS(java.lang.String host, int port)
           
 
Method Summary
 void close()
          Close the stream when done
 void flush()
           
 java.io.InputStream getInputStream()
          Returns the input stream for the TNC.
 java.lang.String getModuleId()
          returns the name used to identify this TNC to the user
 java.io.OutputStream getOutputStream()
          Returns the output stream for the TNC
 int getTNCType()
          Returns what type this TNC was configured for (TNC_TYPE_*).
 void initialize(wonderly.jeaprs.ui.JeAPRSUI ui)
          Set everything up, open ports etc
 void initTNC()
          Send initialization commands to TNC
 boolean isInitialized()
          Tracks whether initTNC has been called
 boolean isKiss()
           
 boolean isStopped()
           
 void lockTNC(boolean lock)
          Causes this object to block/release access to the TNC stream
 byte[] readPacket()
          Reads a packet from the TNC.
 void setKiss(boolean how)
          sets the use of KISS mode based on the passed parameter
 void setModuleId(java.lang.String name)
          Sets the name used for identifying this TNC to the user
 void setTNCType(int type)
          Sets what type this TNC should be recognized as providing (TNC_TYPE_*).
 void startTNC()
           
 void stop()
           
 void waitReady()
          Waits until the TNC stream is ready to be used
 void write(wonderly.jeaprs.ByteString call, wonderly.jeaprs.ByteString toCall, wonderly.jeaprs.ByteString path, byte[] arr)
          Writes only the passed bytes to the TNC
 void write(wonderly.jeaprs.ByteString call, wonderly.jeaprs.ByteString toCall, wonderly.jeaprs.ByteString path, wonderly.jeaprs.ByteString str)
          Writes the passed string with a <CR> to the TNC
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JeAPRS.SocketAPRS

public JeAPRS.SocketAPRS(java.lang.String host,
                         int port)
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

close

public void close()
Description copied from interface: APRSInput
Close the stream when done

Specified by:
close in interface APRSInput

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface TNC
java.io.IOException

setTNCType

public void setTNCType(int type)
Description copied from interface: TNC
Sets what type this TNC should be recognized as providing (TNC_TYPE_*).

Specified by:
setTNCType in interface TNC

getTNCType

public int getTNCType()
Description copied from interface: TNC
Returns what type this TNC was configured for (TNC_TYPE_*).

Specified by:
getTNCType in interface TNC

isKiss

public boolean isKiss()
Specified by:
isKiss in interface TNC
Returns:
true if this TNC is in KISS mode

setKiss

public void setKiss(boolean how)
Description copied from interface: TNC
sets the use of KISS mode based on the passed parameter

Specified by:
setKiss in interface TNC

isStopped

public boolean isStopped()

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the input stream for the TNC.

Specified by:
getInputStream in interface TNC
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns the output stream for the TNC

Specified by:
getOutputStream in interface TNC
java.io.IOException

lockTNC

public void lockTNC(boolean lock)
Causes this object to block/release access to the TNC stream

Specified by:
lockTNC in interface TNC

initialize

public void initialize(wonderly.jeaprs.ui.JeAPRSUI ui)
Set everything up, open ports etc

Specified by:
initialize in interface TNC

startTNC

public void startTNC()

initTNC

public void initTNC()
             throws java.io.IOException
Send initialization commands to TNC

Specified by:
initTNC in interface TNC
java.io.IOException

isInitialized

public boolean isInitialized()
Tracks whether initTNC has been called

Specified by:
isInitialized in interface TNC

waitReady

public void waitReady()
Waits until the TNC stream is ready to be used

Specified by:
waitReady in interface TNC

write

public void write(wonderly.jeaprs.ByteString call,
                  wonderly.jeaprs.ByteString toCall,
                  wonderly.jeaprs.ByteString path,
                  wonderly.jeaprs.ByteString str)
           throws java.io.IOException
Writes the passed string with a <CR> to the TNC

Specified by:
write in interface APRSOutput
Parameters:
toCall - the to call/unproto field.
java.io.IOException

write

public void write(wonderly.jeaprs.ByteString call,
                  wonderly.jeaprs.ByteString toCall,
                  wonderly.jeaprs.ByteString path,
                  byte[] arr)
           throws java.io.IOException
Writes only the passed bytes to the TNC

Specified by:
write in interface APRSOutput
Parameters:
toCall - the to call/unproto field.
arr - the contents of the packet.
java.io.IOException

readPacket

public byte[] readPacket()
                  throws java.io.IOException
Description copied from interface: APRSInput
Reads a packet from the TNC. Normally, an APRSStreamHandler is using this stream and will be calling this method and then dispatching the packet to the listeners of that APRSStreamHandler.

Specified by:
readPacket in interface APRSInput
java.io.IOException
See Also:
APRSStreamHandler, wonderly.jeaprs.aprs.APRSEventListener, APRSStatusListener

stop

public void stop()