public class BluetoothClient
extends java.lang.Object
Constructor and Description |
---|
BluetoothClient(long serverAddress)
Creates a BluetoothClient instance with given Bluetooth address
that will connect to channel 1.
|
BluetoothClient(long serverAddress,
int channel)
Creates a BluetoothClient instance with given Bluetooth address
that will connect using the given given channel.
|
BluetoothClient(javax.bluetooth.RemoteDevice remoteDevice,
java.lang.String serviceName)
Creates a BluetoothClient instance for the given remote device
that will connect using the given service name.
|
BluetoothClient(java.lang.String serverName)
Creates a BluetoothClient instance for the given server's Bluetooth name
that will connect to Bluetooth channel 1.
|
BluetoothClient(java.lang.String serverName,
int channel)
Creates a BluetoothClient instance for the given server's Bluetooth name
that will connect using the given given channel.
|
BluetoothClient(java.lang.String serverName,
java.lang.String serviceName)
Creates a BluetoothClient instance for the given server's Bluetooth name
that will connect using the given service name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
connect()
Attemps to connect the client to the host.
|
boolean |
connect(int timeout)
Attemps to connect the client to the host with given timeout.
|
void |
disconnect()
Closes the opened input and output stream and releases the Bluetooth connection.
|
java.lang.String |
getBtAddress()
Returns the Bluetooth address (hex).
|
long |
getBtAddressLong()
Returns the Bluetooth address (long).
|
int |
getDetectedServerChannel()
Returns the channel number returned by the server after a service search.
|
java.io.InputStream |
getInputStream()
Returns the InputStream reference of the Bluetooth connection.
|
java.io.OutputStream |
getOutputStream()
Returns the OutputStream reference of the Bluetooth connection.
|
java.lang.String |
getServerName()
Returns the server's Bluetooth friendly name.
|
javax.microedition.io.StreamConnection |
getStreamConnection()
Returns the StreamConnection reference of the Bluetooth connection.
|
boolean |
isConnected()
Returns the connection state.
|
void |
setVerbose(boolean isVerbose)
Set the verbose mode on/off.
|
public BluetoothClient(java.lang.String serverName)
public BluetoothClient(java.lang.String serverName, int channel)
public BluetoothClient(java.lang.String serverName, java.lang.String serviceName)
public BluetoothClient(long serverAddress)
public BluetoothClient(long serverAddress, int channel)
public BluetoothClient(javax.bluetooth.RemoteDevice remoteDevice, java.lang.String serviceName)
public boolean connect(int timeout)
timeout
- in secondspublic boolean connect()
public void disconnect()
public javax.microedition.io.StreamConnection getStreamConnection()
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public boolean isConnected()
public java.lang.String getBtAddress()
public java.lang.String getServerName()
public long getBtAddressLong()
public int getDetectedServerChannel()
public void setVerbose(boolean isVerbose)
isVerbose
- if true, the verbose mode is on, otherwise offVerboseWriter