com.ibm.manplato.Transport
Class IrDATransport

java.lang.Object
  |
  +--com.ibm.manplato.Transport.SLPTransportInterface
        |
        +--com.ibm.manplato.Transport.IrDATransport

public class IrDATransport
extends SLPTransportInterface

Infrared Socket API Transport. This class provides a bridge between IrDA Socket API and the SLP Protocol class.

Version:
$Rev$-$Date: 2001/07/13 08:15:56 $$State: Exp $
Author:
File Created By: Ferenc PAL <fpal@hu.ibm.com>, Last Modified By: $Author: fpal $

Fields inherited from class com.ibm.manplato.Transport.SLPTransportInterface
portName
 
Constructor Summary
IrDATransport()
          Create a new instance of the IrDATransport.
 
Method Summary
 void close()
          Closes both the socket and the server socket if it is open.
protected  void finalize()
          Finalizes this object by closing it's connection.
 void flush()
          Flushes the input buffer of any remaining data.
static java.lang.String getName()
          Returns the name of this Transport Interface.
 void open()
          Opens a connection to the IrDA Socket Library.
 byte readByte()
          Read a single byte from the IrDA socket.
 void setSpeed(int speed)
          This is a null implementation, because speed negotiation is not supported by IrDA Socket Library.
 void writeBytes(byte[] data)
          Write an array of bytes to the IrDA socket.
 
Methods inherited from class com.ibm.manplato.Transport.SLPTransportInterface
getPortNames, getSelectedPortName
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IrDATransport

public IrDATransport()
Create a new instance of the IrDATransport. Also sets the portName internal field to IrDA:IrCOMM, this will be used as IrDA Service when connecting to Palm devices.
Method Detail

close

public void close()
           throws java.lang.Exception
Closes both the socket and the server socket if it is open.
Overrides:
close in class SLPTransportInterface
Throws:
java.lang.Exception - throws any required exception.

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalizes this object by closing it's connection.
Overrides:
finalize in class java.lang.Object

flush

public void flush()
           throws java.io.IOException
Flushes the input buffer of any remaining data.
Overrides:
flush in class SLPTransportInterface
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.

open

public void open()
          throws java.lang.Exception
Opens a connection to the IrDA Socket Library. This method opens an IrDAServerSocket using IrCOMM as an IrDA service. Later, the waitForAccept method will create the actual socket to the device for communication.
Overrides:
open in class SLPTransportInterface
Throws:
java.lang.Exception - any exception the underlying code may throw.

readByte

public byte readByte()
Read a single byte from the IrDA socket. If EOF encountered while reading, this method will close the actual client socket, causing the next call to this method will accept a new one. data connection stream to allow the SLP protocol to read a single byte from the stream.
Overrides:
readByte in class SLPTransportInterface

setSpeed

public void setSpeed(int speed)
              throws java.lang.Exception
This is a null implementation, because speed negotiation is not supported by IrDA Socket Library.
Overrides:
setSpeed in class SLPTransportInterface
Parameters:
speed - - The speed to set the transport to.
Throws:
java.lang.Exception - any exception the underlying code may throw.

writeBytes

public void writeBytes(byte[] data)
Write an array of bytes to the IrDA socket.
Overrides:
writeBytes in class SLPTransportInterface
Parameters:
data - the bytes to be written to the underlying stream.