ist.palcom.base.networking
Class BluetoothSocket

java.lang.Object
  extended by ist.palcom.base.Object
      extended by ist.palcom.base.Channel
          extended by ist.palcom.base.networking.BluetoothSocket

public class BluetoothSocket
extends Channel

This class implements a JVM and Avetana version of core.BluetoothSocket. Notes: Since the implementation is based on rfcomm, the api only allows one connection to each host.


Field Summary
protected  javax.bluetooth.LocalDevice localDevice
           
 
Constructor Summary
BluetoothSocket()
           
BluetoothSocket(java.lang.String BTURL)
           
 
Method Summary
 void close()
           
 boolean dataAvailable()
          After a call to System's select or selectNow with this BluetoothSocket, returns true if data is available, false otherwise.
 java.lang.String getDeviceAddress()
           
static java.lang.String getLocalAddress()
           
 java.lang.String getURL()
           
 boolean isConnected()
           
 boolean receive(BluetoothPacket packet)
           
 void send(BluetoothPacket p)
           
 void startReceiving()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localDevice

protected javax.bluetooth.LocalDevice localDevice
Constructor Detail

BluetoothSocket

public BluetoothSocket(java.lang.String BTURL)
                throws java.io.IOException
Throws:
java.io.IOException

BluetoothSocket

public BluetoothSocket()
                throws javax.bluetooth.BluetoothStateException,
                       java.io.IOException
Throws:
javax.bluetooth.BluetoothStateException
java.io.IOException
Method Detail

send

public void send(BluetoothPacket p)
          throws java.io.IOException
Throws:
java.io.IOException

receive

public boolean receive(BluetoothPacket packet)
                throws java.io.IOException
Throws:
java.io.IOException - if no data is available, but only an error

close

public void close()

dataAvailable

public boolean dataAvailable()
After a call to System's select or selectNow with this BluetoothSocket, returns true if data is available, false otherwise. If no call to select or selctNow has been made, result is undefined.


startReceiving

public void startReceiving()

isConnected

public boolean isConnected()

getURL

public java.lang.String getURL()

getDeviceAddress

public java.lang.String getDeviceAddress()

getLocalAddress

public static java.lang.String getLocalAddress()
Returns:
The local host address (without port).
Throws:
java.lang.Exception