peer2me.network.bluetooth
Class BluetoothConnectionHandler

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

public class BluetoothConnectionHandler
extends javax.obex.ServerRequestHandler

This class is responsible for handling all incomming connections and messages except for pings. This class extends javax.obex.ServerRequestHandler

Author:
Kim Saxlund

Constructor Summary
BluetoothConnectionHandler(javax.microedition.io.Connection connection, BluetoothListener bluetoothListener, Bluetooth bluetooth)
          Constructor that sets local references to the parameters given
 
Method Summary
 boolean isFinished()
          If this class has received all the data that the remote device has sent, this class has fulfilled its purpose and is finished.
 int onConnect(javax.obex.HeaderSet request, javax.obex.HeaderSet reply)
          Inherited method from javax.obex.ServerRequestHandler.
 void onDisconnect(javax.obex.HeaderSet req, javax.obex.HeaderSet resp)
          Inherited method from javax.obex.ServerRequestHandler.
 int onPut(javax.obex.Operation operation)
          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, onGet, onSetPath, setConnectionID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothConnectionHandler

public BluetoothConnectionHandler(javax.microedition.io.Connection connection,
                                  BluetoothListener bluetoothListener,
                                  Bluetooth bluetooth)
Constructor that sets local references to the parameters given

Parameters:
connection -
bluetoothListener -
bluetooth -
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

onPut

public int onPut(javax.obex.Operation operation)
Inherited method from javax.obex.ServerRequestHandler. This method is invoked whenever the application receives an incoming message. This method is quite large because there are several types of messages that exists in the Peer2Me framework. The messages can be of the types that are definde as public variables in Message.

Overrides:
onPut in class javax.obex.ServerRequestHandler
Parameters:
operation - Contains HeaderSet and bytestream

onDisconnect

public void onDisconnect(javax.obex.HeaderSet req,
                         javax.obex.HeaderSet resp)
Inherited method from javax.obex.ServerRequestHandler. Invoked when a remote device disconnects

Overrides:
onDisconnect in class javax.obex.ServerRequestHandler
Parameters:
req - The HeaderSet that is received upon disconnection
resp - The HeaderSet that can be sent upon disconnection

isFinished

public boolean isFinished()
If this class has received all the data that the remote device has sent, this class has fulfilled its purpose and is finished.

Returns:
True if finished, false otherwise

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 BluetoothListener.

Parameters:
connection - The connection that the data is being received on