peer2me.network.bluetooth
Class BluetoothPingConnectionHandler

java.lang.Object
  extended by javax.obex.ServerRequestHandler
      extended by peer2me.network.bluetooth.BluetoothPingConnectionHandler

public class BluetoothPingConnectionHandler
extends javax.obex.ServerRequestHandler

This class is responsible for handling incomming ping-connections. It will accept all incoming connections, but a connection will be closed at the remote end as soon as it has been established. The whole purpose is just to check to see if the local node is alive. This class extends javax.obex.ServerRequestHandler

Author:
Kim Saxlund

Constructor Summary
BluetoothPingConnectionHandler(javax.microedition.io.Connection connection, java.lang.Thread parentThread)
          Constructor.
 
Method Summary
 boolean isFinished()
          If this class has successfully established an incoming connection, this method will return true.
 int onConnect(javax.obex.HeaderSet request, javax.obex.HeaderSet reply)
          Inherited method from javax.obex.ServerRequestHandler.
 void setConnection(javax.microedition.io.Connection connection)
          Sets a reference to the connection that is assosiated with this handler.
 
Methods inherited from class javax.obex.ServerRequestHandler
createHeaderSet, getConnectionID, onAuthenticationFailure, onDelete, onDisconnect, onGet, onPut, onSetPath, setConnectionID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothPingConnectionHandler

public BluetoothPingConnectionHandler(javax.microedition.io.Connection connection,
                                      java.lang.Thread parentThread)
Constructor. Sets local references to the paramteres given.

Parameters:
connection - The connection that is associated with this handler
parentThread - The parent thread
Method Detail

onConnect

public int onConnect(javax.obex.HeaderSet request,
                     javax.obex.HeaderSet reply)
Inherited method from javax.obex.ServerRequestHandler. Is invoked when a remote device tries to establish a connection. This implementation accepts all connections.

Overrides:
onConnect in class javax.obex.ServerRequestHandler
Parameters:
reply - A HeaderSet that can be used to send a reply
request - The HeaderSet that is sent from the remote device

setConnection

public void setConnection(javax.microedition.io.Connection connection)
Sets a reference to the connection that is assosiated with this handler. This method is called by BluetoothPingListener.

Parameters:
connection - The connection

isFinished

public boolean isFinished()
If this class has successfully established an incoming connection, this method will return true.

Returns:
True if a connection was established, false if the connection has not been established yet