com.ibm.manplato.Transport
Class SLPTransportInterface

java.lang.Object
  |
  +--com.ibm.manplato.Transport.SLPTransportInterface
Direct Known Subclasses:
CommAPITransport, IrDATransport, ModemTransport

public abstract class SLPTransportInterface
extends java.lang.Object

SLP Transport Abstract Class. This abstract class provides a standardized manner in which to define the possible transport mechanisms for a SLP packet, including various serial interfaces, and potentially through the embedding of SLP into other protocols.

Version:
$Rev$-$Date: 2001/03/15 16:55:33 $$State: Exp $
Author:
File Created By: Brad BARCLAY <bbarclay@ca.ibm.com>, Last Modified By: $Author: Yaztromo $

Field Summary
protected  java.lang.String portName
          The name of the selected serial port, in device-dependent format.
 
Constructor Summary
SLPTransportInterface(java.lang.String portName)
          Creates a new SLPTransportInterface.
 
Method Summary
abstract  void close()
          Closes the implemented transport.
abstract  void flush()
          Flushes the input buffer of any remaining data.
static java.lang.String getName()
          Returns the name of this Transport Interface.
static java.lang.String[] getPortNames()
          Returns an array of Strings representing the names of available ports.
 java.lang.String getSelectedPortName()
          Retrieves the port name for the active serial port.
abstract  void open()
          Opens a read/write connection to the implemented transport.
abstract  byte readByte()
          Read a single byte from the underlying data stream.
abstract  void setSpeed(int speed)
          Changes the speed of the underlying transport mechanism.
abstract  void writeBytes(byte[] data)
          Write an array of bytes to the underlying data stream.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portName

protected java.lang.String portName
The name of the selected serial port, in device-dependent format.
Constructor Detail

SLPTransportInterface

public SLPTransportInterface(java.lang.String portName)
Creates a new SLPTransportInterface.
Parameters:
portName - the device-dependent name of the port to open.
Method Detail

close

public abstract void close()
                    throws java.lang.Exception
Closes the implemented transport. This method should close the transport device being implemented.
Throws:
java.lang.Exception - throws any required exception.

flush

public abstract void flush()
                    throws java.io.IOException
Flushes the input buffer of any remaining data.
Throws:
thrown - when a problem occurs with flushing the stream.

getName

public static java.lang.String getName()
Returns the name of this Transport Interface. This method will return a string containing the name of this transport interface. This is used when searching for and selecting from one of many available transport interfaces that are installed on the system.
Returns:
the name of this transport interface.

getPortNames

public static java.lang.String[] getPortNames()
Returns an array of Strings representing the names of available ports. This method will return to the caller an array of strings representing the serial ports available on this system.
Returns:
an array of String representing the names of the available ports.

getSelectedPortName

public java.lang.String getSelectedPortName()
Retrieves the port name for the active serial port.
Returns:
the port ID name of the active serial port.

open

public abstract void open()
                   throws java.lang.Exception
Opens a read/write connection to the implemented transport. This method should open the transport device being implemented using default parameters.
Throws:
java.lang.Exception - any exception the underlying code may throw.

readByte

public abstract byte readByte()
Read a single byte from the underlying data stream. This method call should abstract the underlying data connection stream to allow the SLP protocol to read a single byte from the stream.

setSpeed

public abstract void setSpeed(int speed)
                       throws java.lang.Exception
Changes the speed of the underlying transport mechanism. This method should allow the protocol stack to set the speed for communications, if the underlying transport supports speed changing. This is implemented for speed negotiation for serial line transports, other transports should present a null implementation if speed negotiation is not supported (ie: for a TCP/IP based transport)
Parameters:
speed - - The speed to set the transport to.
Throws:
java.lang.Exception - any exception the underlying code may throw.

writeBytes

public abstract void writeBytes(byte[] data)
Write an array of bytes to the underlying data stream. This method call should abstract the underlying data connection stream to allow the SLP protocol to write an array of bytes to the stream.
Parameters:
data - the bytes to be written to the underlying stream.