com.intel.bluetooth.btspp
Class Connection

java.lang.Object
  extended by com.intel.bluetooth.BluetoothConnectionAccessAdapter
      extended by com.intel.bluetooth.btspp.Connection
All Implemented Interfaces:
CreateConnection, BluetoothConnectionAccess, BluetoothConnectionNotifierServiceRecordAccess, Connection, InputConnection, OutputConnection, StreamConnection, StreamConnectionNotifier
Direct Known Subclasses:
Connection

public class Connection
extends BluetoothConnectionAccessAdapter
implements CreateConnection, StreamConnection, StreamConnectionNotifier, BluetoothConnectionNotifierServiceRecordAccess

This class is Proxy for btspp (RFCOMM) Connection implementations for IBM J9 support

You need to configure -Dmicroedition.connection.pkgs=com.intel.bluetooth if not installing bluecove.jar to "%J9_HOME%\lib\jclMidp20\ext\

Your application should not use this class directly.

Rating red

Constructor Summary
Connection()
           
 
Method Summary
 StreamConnection acceptAndOpen()
           
 void close()
           
protected  BluetoothConnectionAccess getImpl()
           
 ServiceRecord getServiceRecord()
           
 DataInputStream openDataInputStream()
          Open and return a data input stream for a connection.
 DataOutputStream openDataOutputStream()
          Open and return a data output stream for a connection.
 InputStream openInputStream()
          Open and return an input stream for a connection.
 OutputStream openOutputStream()
          Open and return an output stream for a connection.
 void setParameters(String spec, int access, boolean timeout)
          Passes the parameters from the Connector.open() method to this object.
 Connection setParameters2(String spec, int access, boolean timeout)
          Passes the parameters from the Connector.open() method to this object.
 void updateServiceRecord(boolean acceptAndOpen)
           
 
Methods inherited from class com.intel.bluetooth.BluetoothConnectionAccessAdapter
encrypt, getBluetoothStack, getRemoteAddress, getRemoteDevice, getSecurityOpt, isClosed, markAuthenticated, setRemoteDevice, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection()
Method Detail

getImpl

protected BluetoothConnectionAccess getImpl()
Specified by:
getImpl in class BluetoothConnectionAccessAdapter

setParameters

public void setParameters(String spec,
                          int access,
                          boolean timeout)
                   throws IOException
Description copied from interface: CreateConnection
Passes the parameters from the Connector.open() method to this object. Protocol used by MIDP 1.0

Specified by:
setParameters in interface CreateConnection
Parameters:
spec - String The address passed to Connector.open()
access - int The type of access this Connection is granted (READ, WRITE, READ_WRITE)
timeout - boolean A boolean indicating wether or not the caller to Connector.open() wants timeout exceptions or not
Throws:
IOException - If an error occured opening and configuring serial port.
See Also:
Connector

setParameters2

public Connection setParameters2(String spec,
                                 int access,
                                 boolean timeout)
                          throws IOException
Description copied from interface: CreateConnection
Passes the parameters from the Connector.open() method to this object. Protocol used by MIDP 2.0

Specified by:
setParameters2 in interface CreateConnection
Parameters:
spec - String The address passed to Connector.open()
access - int The type of access this Connection is granted (READ, WRITE, READ_WRITE)
timeout - boolean A boolean indicating wether or not the caller to Connector.open() wants timeout exceptions or not
Throws:
IOException - If an error occured opening and configuring serial port.
See Also:
Connector

close

public void close()
           throws IOException
Specified by:
close in interface Connection
Throws:
IOException

openDataInputStream

public DataInputStream openDataInputStream()
                                    throws IOException
Description copied from interface: InputConnection
Open and return a data input stream for a connection.

Specified by:
openDataInputStream in interface InputConnection
Returns:
An input stream
Throws:
IOException - If an I/O error occur

openInputStream

public InputStream openInputStream()
                            throws IOException
Description copied from interface: InputConnection
Open and return an input stream for a connection.

Specified by:
openInputStream in interface InputConnection
Returns:
An input stream
Throws:
IOException - If an I/O error occur

openDataOutputStream

public DataOutputStream openDataOutputStream()
                                      throws IOException
Description copied from interface: OutputConnection
Open and return a data output stream for a connection.

Specified by:
openDataOutputStream in interface OutputConnection
Returns:
An output stream
Throws:
IOException - If an I/O error occur

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Description copied from interface: OutputConnection
Open and return an output stream for a connection.

Specified by:
openOutputStream in interface OutputConnection
Returns:
An output stream
Throws:
IOException - If an I/O error occur

acceptAndOpen

public StreamConnection acceptAndOpen()
                               throws IOException
Specified by:
acceptAndOpen in interface StreamConnectionNotifier
Throws:
IOException

getServiceRecord

public ServiceRecord getServiceRecord()
Specified by:
getServiceRecord in interface BluetoothConnectionNotifierServiceRecordAccess

updateServiceRecord

public void updateServiceRecord(boolean acceptAndOpen)
                         throws ServiceRegistrationException
Specified by:
updateServiceRecord in interface BluetoothConnectionNotifierServiceRecordAccess
Parameters:
acceptAndOpen - wrap validation in ServiceRegistrationException
Throws:
ServiceRegistrationException