de.avetana.bluetooth.stack
Class BlueZ

java.lang.Object
  extended by de.avetana.bluetooth.stack.BlueZ

public class BlueZ
extends java.lang.Object

This class provides the methods to access the underlying BlueZ functions. All native methods defined in this class are implemented via the Java Native Interface (JNI) in C/C++. See the bluez.cpp file and associated comments for full details. All methods are static. This way of defining a common access to the stack avoids the user and the developper to repeatedly create a new instance of the BlueZ class.


Field Summary
static PooledExecutor executor
           
static int m_transactionId
           
static ConnectionFactory myFactory
           
 
Constructor Summary
BlueZ()
           
 
Method Summary
static void addService(int transID, ServiceRecord rec)
           
static void addService(int transID, ServiceRecord[] rec)
          Callback method, which notifies the discovering a new service.
static int authenticate(int handle, java.lang.String deviceAddr, java.lang.String pin)
          Authenticates the remote device
static int authenticate(java.lang.String deviceAddr, java.lang.String pin)
          Authenticates the remote device
static void cancelInquiry()
           
static boolean cancelServiceSearch(int transID)
           
static void closeConnectionS(int fid)
          Closes an existing connection.
static void connectionClosed(int fid)
          Called from the native side, when the connection is beeing closed
static boolean connectionEstablished(int fid, int channel, int protocol, java.lang.String jaddr)
          Method called by the C-Code in order to notify the establishment of a new connection.
static boolean connectionEstablished(int fid, int channel, int protocol, java.lang.String jaddr, int recMTU, int transMTU)
           
static boolean[] connectionOptions(int handle, java.lang.String deviceAddr)
          Retrieves the connection options
 java.lang.Class createClass(java.lang.String name)
           
static int createService(LocalServiceRecord service)
          Stores a new Service record in the BCC.
static void deviceDiscovered(RemoteDevice d)
          The following method is called by some Stacks to notify of RemoteDevices that have been found.
static void disposeLocalRecord(long recordHandle)
          Deletes the service record identified by the record handle given as parameter.
static int encrypt(int handle, java.lang.String deviceAddr, boolean enable)
          Turns on/off the encryption of an ACL link
static void flush(int fd)
          Used for Widcomm to wait for the RFCommBuffer to be drained
static int getAccessMode(int device)
          Gets the access mode of the local device
static int getDeviceClass(int dev_id)
          Gets the device class of the local device number "dev_id"
static int getLinkQuality(java.lang.String bdaddr)
          Retrieves the current quality of the physical bluetooth connection to the specified device.
static int getMaxConnectedDevices()
          Returns the maximum number of connected devices allowed by the stack This number may be greater than 7 if the implementation handles parked connections.
static int getRssi(java.lang.String adr)
          Provides an estimation of the strength of the signal received from another specified bluetooth-device.
protected static void hciCloseDevice(int dd)
          Close the HCI device.
static BTAddress hciDevBTAddress(int hciDevID)
          Gets the Bluetooth device address for a specified local HCI device.
static int hciDeviceID(BTAddress bdaddr)
          Gets the device ID for a specified local HCI device.
static int hciDeviceID(java.lang.String bdaddr)
          Gets the device ID for a specified local HCI device.
static boolean hciInquiry(int hciDevID, DiscoveryAgent agent)
          Performs an HCI inquiry to discover remote Bluetooth devices.
static boolean hciInquiry(int hciDevID, int len, int max_num_rsp, long flags, DiscoveryAgent agent)
          Performs an HCI inquiry to discover remote Bluetooth devices.
static java.lang.String hciLocalName(int dd)
          Gets the name of a local device.
static java.lang.String hciLocalName(int dd, int timeOut)
          Gets the name of a local device.
static int hciOpenDevice(int hciDevID, BlueZ ref)
          Opens the HCI device.
static java.lang.String hciRemoteName(int dd, BTAddress bdaddr)
          Gets the name of a remote device, as specified by its Bluetooth device address.
static java.lang.String hciRemoteName(int dd, BTAddress bdaddr, int timeOut)
          Gets the name of a remote device, as specified by its Bluetooth device address.
static java.lang.String hciRemoteName(int dd, java.lang.String bdaddr)
          Gets the name of a remote device, as specified by its Bluetooth device address.
static java.lang.String hciRemoteName(int dd, java.lang.String bdaddr, int timeOut)
          Gets the name of a remote device, as specified by its Bluetooth device address.
static boolean inquiryAndConAllowed()
          Is Inquiry allowed during a connection?
static boolean inquiryScanAndConAllowed()
          Inquiry scanning allowed during connection?
static boolean isMasterSwitchAllowed()
          Is master/slave switch allowed?
static void listService(java.lang.String bdaddr_jstr, byte[][] uuid, int[] attrIds, int transID)
          Lists all SDP services, which match a desired list of UUIDs.
static byte[] newByteArray(int size)
          Method called from the Windows native library to reserve storage space.
static int newData(byte[] data, int fid)
          Method is called from native implementations when new Data has arrived for a connection listening for data.
static L2CAPConnParam openL2CAP(JSR82URL url, int timeout)
          Opens an L2CAP connection with a remote BT device.
static int openRFComm(JSR82URL url, int timeout)
          Opens an RFCOMM connection with a remote BT device.
static boolean pageAndConnAllowed()
          Is paging allowed during a connection? In other words, can a connection be established to one device if it is already connected to another device.
static boolean pageScanAndConAllowed()
          Page scanning allowed during connection?
static int registerL2CAPService(int serviceHandle, int channel, boolean master, boolean auth, boolean encrypt, int omtu, int imtu)
          Registers the service record identified by the variable "serviceHandle" and listens for an incoming L2CAP Connection
static void registerNotifier(ConnectionNotifier a_notifier)
          Registers a service and waits for incoming connections
static int registerService(int serviceHandle, int channel, boolean master, boolean auth, boolean encrypt)
          Registers the service record identified by the variable "serviceHandle" and listens for an incoming RFCOMM Connection
static void removeNotifier(ConnectionNotifier a_notifier)
          Remove the Notifier when creating a service has failed
static void removeServiceByID(long id)
          MacOS X only function to remove a service record by its ID.
static int searchServices(java.lang.String bdaddr_jstr, byte[][] uuid, int[] attrIds, DiscoveryListener flistener)
          Starts a service search.
static int[] sendHCI(int command, int[] params)
          Sends a native HCI command to the BT-Dongle.
static void serviceSearchComplete(int transID, int respCode)
          Callback method which notifies the end of a service search.
static int setAccessMode(int device, int mode)
          Sets the access mode of the local device
static boolean setDeviceClass(int dev_id, int cls)
          sets the device class to "cls" of the local device number "dev_id"
static boolean setDeviceName(java.lang.String name)
          Change the local device name
static void stackDown()
          Method called from the Windows native DLL when the stack has gone down.
static void startReaderThread(int fid, int mtu)
          For Windows and PocketPC, where reading should be started from the JavaVM.
static void startTimeoutThread(int fid, int timeout)
           
static int unPair(java.lang.String deviceAddr)
           
static int updateService(ServiceRecord service, long recordHandle)
          Updates an existing service record (the old
static void writeBytesS(int fid, byte[] b, int off, int len)
          Writes byte to an existing connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myFactory

public static ConnectionFactory myFactory

m_transactionId

public static int m_transactionId

executor

public static final PooledExecutor executor
Constructor Detail

BlueZ

public BlueZ()
Method Detail

getLinkQuality

public static int getLinkQuality(java.lang.String bdaddr)
                          throws BlueZException
Retrieves the current quality of the physical bluetooth connection to the specified device. See HCI_Link_Quality in the Bluetooth Specification for further details of the returned values.

Parameters:
bdaddr - Bluetooth address String in the form "00:12:34:56:78:9A".
Returns:
An estimation of the link quality.
Throws:
BlueZException

hciOpenDevice

public static int hciOpenDevice(int hciDevID,
                                BlueZ ref)
                         throws BlueZException
Opens the HCI device.

Parameters:
hciDevID - The local HCI device ID (see the hciconfig tool provided by BlueZ for further information).
Returns:
A device descriptor (often named dd) for the HCI device.
Throws:
BlueZException - Unable to open the HCI device.

hciCloseDevice

protected static void hciCloseDevice(int dd)
Close the HCI device.

Parameters:
dd - The HCI device descriptor (as returned from hciOpenDevice)

cancelInquiry

public static void cancelInquiry()

hciInquiry

public static boolean hciInquiry(int hciDevID,
                                 int len,
                                 int max_num_rsp,
                                 long flags,
                                 DiscoveryAgent agent)
                          throws BlueZException
Performs an HCI inquiry to discover remote Bluetooth devices. See HCI_Inquiry in the Bluetooth Specification for further details of the various arguments.

Parameters:
hciDevID - The local HCI device ID (see the hciconfig tool provided by BlueZ for further information).
len - Maximum amount of time before inquiry is halted. Time = len x 1.28 secs.
max_num_rsp - Maximum number of responses allowed before inquiry is halted. For an unlimited number, set to 0.
flags - Additional flags. See BlueZ documentation and source code for details.
Returns:
An InquiryInfo object containing the results of the inquiry.
Throws:
BlueZException - If the inquiry failed.
See Also:
#hciInquiry(int hciDevID)

hciInquiry

public static boolean hciInquiry(int hciDevID,
                                 DiscoveryAgent agent)
                          throws BlueZException
Performs an HCI inquiry to discover remote Bluetooth devices. This is the same as hciInquiry(int hciDevID, int len, int max_num_rsp, long flags), except that the len, max_num_rsp and flags fields are preset to 'default' values. These values are 8, 10 and 0, respectively.

Parameters:
hciDevID - The local HCI device ID (see the hciconfig tool provided by BlueZ for further information)
Returns:
An InquiryInfo object containing the results of the inquiry.
Throws:
BlueZException - If the inquiry failed.

hciDevBTAddress

public static BTAddress hciDevBTAddress(int hciDevID)
                                 throws BlueZException
Gets the Bluetooth device address for a specified local HCI device.

Parameters:
hciDevID - The local HCI device ID (see the hciconfig tool provided by BlueZ for further information)
Returns:
A BTAddress object representing the Bluetooth device address.
Throws:
BlueZException - If unable to get the Bluetooth device address.

hciDeviceID

public static int hciDeviceID(java.lang.String bdaddr)
                       throws BlueZException
Gets the device ID for a specified local HCI device.

Parameters:
bdaddr - Bluetooth address String in the form "00:12:34:56:78:9A".
Returns:
The device ID for the local device.
Throws:
BlueZException - If unable to get the device ID.

hciDeviceID

public static int hciDeviceID(BTAddress bdaddr)
                       throws BlueZException
Gets the device ID for a specified local HCI device.

Parameters:
bdaddr - Bluetooth address as a BTAddress object.
Returns:
The device ID for the local device.
Throws:
BlueZException - If unable to get the device ID.

hciLocalName

public static java.lang.String hciLocalName(int dd,
                                            int timeOut)
                                     throws BlueZException
Gets the name of a local device. The device must be opened using hciOpenDevice before calling this method.

Parameters:
dd - HCI device descriptor.
timeOut - Timeout, in milliseconds.
Returns:
A String containing the name of the specified local device.
Throws:
BlueZException - If unable to get the local device name.

hciLocalName

public static java.lang.String hciLocalName(int dd)
                                     throws BlueZException
Gets the name of a local device. The device must be opened using hciOpenDevice before calling this method. This is the same as hciLocalName(int dd, int timeOut) with the timeOut argument set to 10000 (i.e. 10 seconds).

Parameters:
dd - HCI device descriptor.
Returns:
A String containing the name of the specified local device.
Throws:
BlueZException - If unable to get the local device name.

hciRemoteName

public static java.lang.String hciRemoteName(int dd,
                                             java.lang.String bdaddr,
                                             int timeOut)
                                      throws BlueZException
Gets the name of a remote device, as specified by its Bluetooth device address. The local device must be opened using hciOpenDevice before calling this method.

Parameters:
dd - HCI device descriptor.
bdaddr - Bluetooth address String in the form "00:12:34:56:78:9A".
timeOut - Timeout, in milliseconds.
Returns:
A String containing the name of the specified remote device.
Throws:
BlueZException - If unable to get the remote device name.

hciRemoteName

public static java.lang.String hciRemoteName(int dd,
                                             java.lang.String bdaddr)
                                      throws BlueZException
Gets the name of a remote device, as specified by its Bluetooth device address. The local device must be opened using hciOpenDevice before calling this method. This is the same as hciRemoteName(int dd, String bdaddr, int timeOut) with the timeOut argument set to 10000 (i.e. 10 seconds).

Parameters:
dd - HCI device descriptor.
bdaddr - Bluetooth address String in the form "00:12:34:56:78:9A".
Returns:
A String containing the name of the specified remote device.
Throws:
BlueZException - If unable to get the remote device name.

hciRemoteName

public static java.lang.String hciRemoteName(int dd,
                                             BTAddress bdaddr,
                                             int timeOut)
                                      throws BlueZException
Gets the name of a remote device, as specified by its Bluetooth device address. The local device must be opened using hciOpenDevice before calling this method.

Parameters:
dd - HCI device descriptor.
bdaddr - Bluetooth address as a BTAddress object.
timeOut - Timeout, in milliseconds.
Returns:
A String containing the name of the specified remote device.
Throws:
BlueZException - If unable to get the remote device name.

hciRemoteName

public static java.lang.String hciRemoteName(int dd,
                                             BTAddress bdaddr)
                                      throws BlueZException
Gets the name of a remote device, as specified by its Bluetooth device address. The local device must be opened using hciOpenDevice before calling this method. This is the same as hciRemoteName(int dd, BTAddress bdaddr, int timeOut) with the timeOut argument set to 10000 (i.e. 10 seconds).

Parameters:
dd - HCI device descriptor.
bdaddr - Bluetooth address as a BTAddress object.
Returns:
A String containing the name of the specified remote device.
Throws:
BlueZException - If unable to get the remote device name.

openL2CAP

public static L2CAPConnParam openL2CAP(JSR82URL url,
                                       int timeout)
                                throws BlueZException,
                                       java.lang.Exception
Opens an L2CAP connection with a remote BT device.

Parameters:
url - The JSR82URL object describing the remote BT device (BT address and PSM), the desired security options (master, authenticate, encrypt) and the desired connection options (imtu, omtu)
Returns:
An L2CAPConnParam object encapsulating the integer, which uniquely identifies the connection.
Throws:
BlueZException - If an error occured in the C part of the Code
java.lang.Exception - If the URL is not a valid L2CAP URL.

openRFComm

public static int openRFComm(JSR82URL url,
                             int timeout)
                      throws BlueZException,
                             java.lang.Exception
Opens an RFCOMM connection with a remote BT device.

Parameters:
url - The JSR82URL object describing the remote BT device (BT address and channel number), the desired security options (master, authenticate, encrypt).
Returns:
The integer, which uniquely identifies the connection.
Throws:
BlueZException - If an error occured in the C part of the Code
java.lang.Exception - If the URL is not a valid L2CAP URL.

closeConnectionS

public static void closeConnectionS(int fid)
Closes an existing connection.

Parameters:
fid - The integer, which uniquely identifies the connection (the file descriptor under linux).

sendHCI

public static int[] sendHCI(int command,
                            int[] params)
                     throws BlueZException
Sends a native HCI command to the BT-Dongle. THis works with the Widcomm Stack right now.

Parameters:
command -
params -
Returns:
Throws:
BlueZException

writeBytesS

public static void writeBytesS(int fid,
                               byte[] b,
                               int off,
                               int len)
                        throws java.io.IOException
Writes byte to an existing connection

Parameters:
fid - The integer, which uniquely identifies the connection.
b - The byte array storing the bytes to be written
len - The length of b
off - The offset into b at which to start
Throws:
java.io.IOException

listService

public static void listService(java.lang.String bdaddr_jstr,
                               byte[][] uuid,
                               int[] attrIds,
                               int transID)
                        throws BlueZException
Lists all SDP services, which match a desired list of UUIDs. Only the attributes contained in attrIds will populate the returned service records.

Parameters:
bdaddr_jstr - The address of the remote BT device
uuid - The list of UUIDs the service record must contain.
attrIds - The list of Attributes which will populate the Service record.
Throws:
BlueZException

createService

public static int createService(LocalServiceRecord service)
                         throws BlueZException
Stores a new Service record in the BCC.

Parameters:
service - The service record
Returns:
a positive integer is the process succeeds.
Throws:
BlueZException

updateService

public static int updateService(ServiceRecord service,
                                long recordHandle)
                         throws BlueZException
Updates an existing service record (the old
Parameters:
newService - The byte representation of this new service record
length - The length of this byte representation
recordHandle - The record handle of the old service record
Returns:
a positive integer is the process succeeds.
Throws:
BlueZException

registerService

public static int registerService(int serviceHandle,
                                  int channel,
                                  boolean master,
                                  boolean auth,
                                  boolean encrypt)
                           throws BlueZException
Registers the service record identified by the variable "serviceHandle" and listens for an incoming RFCOMM Connection

Parameters:
serviceHandle - The integer, which uniquely identifies the service record
channel - The channel number (Incoming connections linked with a channel number
master - Is the local device master for this connection?
auth - Must the remote device be authenticated during the establishment of the connection
encrypt - Must the ACL linkbe encrpyted during the establishment of the connection
Returns:
a positive integer is the process succeeds.
Throws:
BlueZException

registerL2CAPService

public static int registerL2CAPService(int serviceHandle,
                                       int channel,
                                       boolean master,
                                       boolean auth,
                                       boolean encrypt,
                                       int omtu,
                                       int imtu)
                                throws BlueZException
Registers the service record identified by the variable "serviceHandle" and listens for an incoming L2CAP Connection

Parameters:
serviceHandle - The integer, which uniquely identifies the service record
channel - The channel number (Incoming connections linked with a channel number
master - Is the local device master for this connection?
auth - Must the remote device be authenticated during the establishment of the connection
encrypt - Must the ACL linkbe encrpyted during the establishment of the connection
omtu - Set the size of the Output MTU
imtu - Set the size of the Input MTU
Returns:
a positive integer is the process succeeds.
Throws:
BlueZException

disposeLocalRecord

public static void disposeLocalRecord(long recordHandle)
                               throws BlueZException
Deletes the service record identified by the record handle given as parameter.

Parameters:
recordHandle -
Throws:
BlueZException

getAccessMode

public static int getAccessMode(int device)
                         throws BlueZException
Gets the access mode of the local device

Parameters:
device - The integer which identifies the local device
Returns:
The access mode if this device
Throws:
BlueZException

setAccessMode

public static int setAccessMode(int device,
                                int mode)
                         throws BlueZException
Sets the access mode of the local device

Parameters:
device - The integer which identifies the local device
mode - The new access mode
Returns:
Throws:
BlueZException

getDeviceClass

public static int getDeviceClass(int dev_id)
                          throws BlueZException
Gets the device class of the local device number "dev_id"

Parameters:
dev_id - The number which identifies the local device
Returns:
The current device class
Throws:
BlueZException

setDeviceClass

public static boolean setDeviceClass(int dev_id,
                                     int cls)
                              throws BlueZException
sets the device class to "cls" of the local device number "dev_id"

Parameters:
dev_id - The number which identifies the local device
cls - The new device class of the device
Returns:
true/false
Throws:
BlueZException
See Also:
Assigned Numbers - Bluetooth Baseband for the correct format of cls

isMasterSwitchAllowed

public static boolean isMasterSwitchAllowed()
                                     throws BlueZException
Is master/slave switch allowed?

Returns:
true If master/slave switch is allowed
false Otherwise
Throws:
BlueZException

getMaxConnectedDevices

public static int getMaxConnectedDevices()
                                  throws BlueZException
Returns the maximum number of connected devices allowed by the stack This number may be greater than 7 if the implementation handles parked connections. The string will be in Base 10 digits.

Returns:
The maximum number of connected devices allowed by the stack
Throws:
BlueZException

inquiryScanAndConAllowed

public static boolean inquiryScanAndConAllowed()
                                        throws BlueZException
Inquiry scanning allowed during connection?

Returns:
true If the inquiry scanning is allowed during a connection
false Otherwise
Throws:
BlueZException

inquiryAndConAllowed

public static boolean inquiryAndConAllowed()
                                    throws BlueZException
Is Inquiry allowed during a connection?

Returns:
true If the inquiry is allowed during a connection
false Otherwise
Throws:
BlueZException

pageScanAndConAllowed

public static boolean pageScanAndConAllowed()
                                     throws BlueZException
Page scanning allowed during connection?

Returns:
true If page scanning during a connection is allowed
false Otherwise
Throws:
BlueZException

pageAndConnAllowed

public static boolean pageAndConnAllowed()
                                  throws BlueZException
Is paging allowed during a connection? In other words, can a connection be established to one device if it is already connected to another device.

Returns:
true If paging during a connection is allowed
false Otherwise
Throws:
BlueZException

setDeviceName

public static boolean setDeviceName(java.lang.String name)
Change the local device name

Parameters:
name -
Returns:
true if successful

authenticate

public static int authenticate(int handle,
                               java.lang.String deviceAddr,
                               java.lang.String pin)
                        throws BlueZException
Authenticates the remote device

Parameters:
hci - number (0)
deviceAddr - The BT address of the remote device (00-0d-93-05-17-0e)
pin - in Windows, one can specify a given PIN number to use
Returns:
1 if successful 0 if not
Throws:
BlueZException

authenticate

public static int authenticate(java.lang.String deviceAddr,
                               java.lang.String pin)
                        throws BlueZException
Authenticates the remote device

Parameters:
deviceAddr - The BT address of the remote device
pin - in Windows, one can specify a given PIN number to use
Returns:
1 if successful 0 if not
Throws:
BlueZException

unPair

public static int unPair(java.lang.String deviceAddr)
                  throws BlueZException
Throws:
BlueZException

encrypt

public static int encrypt(int handle,
                          java.lang.String deviceAddr,
                          boolean enable)
                   throws BlueZException
Turns on/off the encryption of an ACL link

Parameters:
handle - The number, which uniquely identifies the connection
deviceAddr - The BT address of the remote device
enable - If true, turn on the encryption of the ACL link
Returns:
Throws:
BlueZException

connectionOptions

public static boolean[] connectionOptions(int handle,
                                          java.lang.String deviceAddr)
                                   throws BlueZException
Retrieves the connection options

Parameters:
handle - The number, which uniquely identifies the connection
deviceAddr - The BT address of the remote device
Returns:
Throws:
BlueZException

searchServices

public static int searchServices(java.lang.String bdaddr_jstr,
                                 byte[][] uuid,
                                 int[] attrIds,
                                 DiscoveryListener flistener)
Starts a service search.

Parameters:
bdaddr_jstr - The BT address of the remote device
uuid - The list of UUIDs the services must match
attrIds - The list of attributes the services should contain
listener - The discovery listener, which handles the callback methods.
Throws:
BlueZException

registerNotifier

public static void registerNotifier(ConnectionNotifier a_notifier)
                             throws java.lang.Exception
Registers a service and waits for incoming connections

Parameters:
a_notifier - The connection notifier created by the user.
Throws:
java.lang.Exception

removeNotifier

public static void removeNotifier(ConnectionNotifier a_notifier)
Remove the Notifier when creating a service has failed


connectionEstablished

public static boolean connectionEstablished(int fid,
                                            int channel,
                                            int protocol,
                                            java.lang.String jaddr)
Method called by the C-Code in order to notify the establishment of a new connection. This method is always called after the call of registerNotifier.

Parameters:
fid - The number which uniquely identifies the connection
channel - The channel or PSM number
protocol - The protocol (see the class JSR82URL)
jaddr - The BT address of the remote device
Returns:

connectionEstablished

public static boolean connectionEstablished(int fid,
                                            int channel,
                                            int protocol,
                                            java.lang.String jaddr,
                                            int recMTU,
                                            int transMTU)

cancelServiceSearch

public static boolean cancelServiceSearch(int transID)

addService

public static void addService(int transID,
                              ServiceRecord[] rec)
Callback method, which notifies the discovering a new service.

Parameters:
transID - SDP transaction ID
rec - The service record discovered

addService

public static void addService(int transID,
                              ServiceRecord rec)

serviceSearchComplete

public static void serviceSearchComplete(int transID,
                                         int respCode)
Callback method which notifies the end of a service search.

Parameters:
transID - SDP transaction code
respCode - The responde code of the C-implementation
jBTAddr - The BT address of the remote device

createClass

public java.lang.Class createClass(java.lang.String name)

newByteArray

public static byte[] newByteArray(int size)
Method called from the Windows native library to reserve storage space. This is used because of some JNI troubles.

Parameters:
size -
Returns:

stackDown

public static void stackDown()
Method called from the Windows native DLL when the stack has gone down. This is used to remove all Notifiers and close all connections.


getRssi

public static int getRssi(java.lang.String adr)
                   throws BlueZException
Provides an estimation of the strength of the signal received from another specified bluetooth-device. See HCI_Get_RSSI in the Bluetooth Specification for further details of the returned values.

Parameters:
bdaddr - Bluetooth address String in the form "00:12:34:56:78:9A".
Returns:
An estimation of the Received Signal Strength Indicator.
Throws:
BlueZException

newData

public static int newData(byte[] data,
                          int fid)
Method is called from native implementations when new Data has arrived for a connection listening for data.

Parameters:
data -
fid -
Returns:
0 if connection is not known on java side else 1

flush

public static void flush(int fd)
                  throws java.io.IOException
Used for Widcomm to wait for the RFCommBuffer to be drained

Parameters:
fd -
Throws:
java.io.IOException

connectionClosed

public static void connectionClosed(int fid)
Called from the native side, when the connection is beeing closed

Parameters:
fid -

startReaderThread

public static void startReaderThread(int fid,
                                     int mtu)
For Windows and PocketPC, where reading should be started from the JavaVM. Also interrupts the timeout thread

Parameters:
fid -
mtu -

startTimeoutThread

public static void startTimeoutThread(int fid,
                                      int timeout)

deviceDiscovered

public static void deviceDiscovered(RemoteDevice d)
The following method is called by some Stacks to notify of RemoteDevices that have been found.


removeServiceByID

public static void removeServiceByID(long id)
MacOS X only function to remove a service record by its ID.

Parameters:
id - 0x00010004 for PDA-SyncService