|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.appliancestudio.jbluez.BlueZ
This class provides the methods to access the underlying BlueZ functions.
All of the native methods defined in this class are implemented, via the
Java Native Interface (JNI) in C. See the bluez.c file and associated
comments for full details.
If you wish to incorporate Bluetooth functionality (using the BlueZ stack)
into your Java application, create a new instance of this BlueZ class.
Calling the methods provided here will call the functions defined by the
BlueZ libraries, primarily those defined in the files hci.c
and hci_lib.h
.
Constructor Summary | |
BlueZ()
|
Method Summary | |
void |
hciCloseDevice(int dd)
Close the HCI device. |
int |
hciCreateConnection(int dd,
com.appliancestudio.jbluez.BTAddress bdaddr,
int ptype,
int clkoffset,
short rswitch,
int timeOut)
Create an HCI connection. |
int |
hciCreateConnection(int dd,
java.lang.String bdaddr,
int ptype,
int clkoffset,
short rswitch,
int timeOut)
Create an HCI connection. |
com.appliancestudio.jbluez.BTAddress |
hciDevBTAddress(int hciDevID)
Gets the Bluetooth device address for a specified local HCI device. |
int |
hciDeviceID(com.appliancestudio.jbluez.BTAddress bdaddr)
Gets the device ID for a specified local HCI device. |
int |
hciDeviceID(java.lang.String bdaddr)
Gets the device ID for a specified local HCI device. |
com.appliancestudio.jbluez.HCIDeviceInfo |
hciDevInfo(int hciDevID)
Gets the device information for a specified local HCI device. |
void |
hciDisconnect(int dd,
int handle,
short reason,
int timeOut)
Disconnect an established HCI connection. |
com.appliancestudio.jbluez.InquiryInfo |
hciInquiry(int hciDevID)
Perform an HCI inquiry to discover remote Bluetooth devices. |
com.appliancestudio.jbluez.InquiryInfo |
hciInquiry(int hciDevID,
int len,
int max_num_rsp,
long flags)
Perform an HCI inquiry to discover remote Bluetooth devices. |
java.lang.String |
hciLocalName(int dd)
Get the name of a local device. |
java.lang.String |
hciLocalName(int dd,
int timeOut)
Get the name of a local device. |
int |
hciOpenDevice(int hciDevID)
Opens the HCI device. |
com.appliancestudio.jbluez.HCIVersion |
hciReadLocalVersion(int dd,
int timeOut)
Get the version information of a local Bluetooth device. |
com.appliancestudio.jbluez.HCIFeatures |
hciReadRemoteFeatures(int dd,
int handle,
int timeOut)
Get the features of a remote Bluetooth device. |
com.appliancestudio.jbluez.HCIVersion |
hciReadRemoteVersion(int dd,
int handle,
int timeOut)
Get the version information of a remote Bluetooth device. |
java.lang.String |
hciRemoteName(int dd,
com.appliancestudio.jbluez.BTAddress bdaddr)
Get the name of a remote device, as specified by its Bluetooth device address. |
java.lang.String |
hciRemoteName(int dd,
com.appliancestudio.jbluez.BTAddress bdaddr,
int timeOut)
Get the name of a remote device, as specified by its Bluetooth device address. |
java.lang.String |
hciRemoteName(int dd,
java.lang.String bdaddr)
Get the name of a remote device, as specified by its Bluetooth device address. |
java.lang.String |
hciRemoteName(int dd,
java.lang.String bdaddr,
int timeOut)
Get the name of a remote device, as specified by its Bluetooth device address. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BlueZ()
Method Detail |
public int hciOpenDevice(int hciDevID) throws BlueZException
hciDevID
- The local HCI device ID (see the hciconfig tool provided
by BlueZ for further information).
dd
) for the HCI
device.
BlueZException
- Unable to open the HCI device.public void hciCloseDevice(int dd)
dd
- The HCI device descriptor (as returned from
hciOpenDevice
)public int hciCreateConnection(int dd, java.lang.String bdaddr, int ptype, int clkoffset, short rswitch, int timeOut) throws BlueZException
dd
- HCI device descriptor.bdaddr
- Bluetooth address String in the form
"00:12:34:56:78:9A"
.ptype
- Packet type, for example 0x0008 for DM1.clkoffset
- Clock offset (usually set to 0).rswitch
- Role switch (usually set to 0 or 1).timeOut
- Timeout, in milliseconds.
BlueZException
- Unable to create the connection.public int hciCreateConnection(int dd, com.appliancestudio.jbluez.BTAddress bdaddr, int ptype, int clkoffset, short rswitch, int timeOut) throws BlueZException
dd
- HCI device descriptor.bdaddr
- Bluetooth address as a BTAddress object.ptype
- Packet type, for example 0x0008 for DM1.clkoffset
- Clock offset (usually set to 0).rswitch
- Role switch (usually set to 0 or 1).timeOut
- Timeout, in milliseconds.
BlueZException
- Unable to create the connection.public void hciDisconnect(int dd, int handle, short reason, int timeOut) throws BlueZException
dd
- HCI device descriptor.handle
- HCI connection handle.reason
- Code detailing reason for disconnection (often 0x13).timeOut
- Timeout, in milliseconds.
BlueZException
- Unable to disconnect.public com.appliancestudio.jbluez.InquiryInfo hciInquiry(int hciDevID, int len, int max_num_rsp, long flags) throws BlueZException
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.
BlueZException
- If the inquiry failed.hciInquiry(int hciDevID)
public com.appliancestudio.jbluez.InquiryInfo hciInquiry(int hciDevID) throws BlueZException
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.
hciDevID
- The local HCI device ID (see the hciconfig tool provided
by BlueZ for further information)
BlueZException
- If the inquiry failed.public com.appliancestudio.jbluez.HCIDeviceInfo hciDevInfo(int hciDevID) throws BlueZException
hciDevID
- The local HCI device ID (see the hciconfig tool provided
by BlueZ for further information)
BlueZException
- If unable to get the device information.public com.appliancestudio.jbluez.BTAddress hciDevBTAddress(int hciDevID) throws BlueZException
hciDevID
- The local HCI device ID (see the hciconfig tool provided
by BlueZ for further information)
BlueZException
- If unable to get the Bluetooth device address.public int hciDeviceID(java.lang.String bdaddr) throws BlueZException
bdaddr
- Bluetooth address String in the form
"00:12:34:56:78:9A"
.
BlueZException
- If unable to get the device ID.public int hciDeviceID(com.appliancestudio.jbluez.BTAddress bdaddr) throws BlueZException
bdaddr
- Bluetooth address as a BTAddress object.
BlueZException
- If unable to get the device ID.public java.lang.String hciLocalName(int dd, int timeOut) throws BlueZException
hciOpenDevice
before calling this method.
dd
- HCI device descriptor.timeOut
- Timeout, in milliseconds.
BlueZException
- If unable to get the local device name.public java.lang.String hciLocalName(int dd) throws BlueZException
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).
dd
- HCI device descriptor.
BlueZException
- If unable to get the local device name.public java.lang.String hciRemoteName(int dd, java.lang.String bdaddr, int timeOut) throws BlueZException
hciOpenDevice
before calling this method.
dd
- HCI device descriptor.bdaddr
- Bluetooth address String in the form
"00:12:34:56:78:9A"
.timeOut
- Timeout, in milliseconds.
BlueZException
- If unable to get the remote device name.public java.lang.String hciRemoteName(int dd, java.lang.String bdaddr) throws BlueZException
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).
dd
- HCI device descriptor.bdaddr
- Bluetooth address String in the form
"00:12:34:56:78:9A"
.
BlueZException
- If unable to get the remote device name.public java.lang.String hciRemoteName(int dd, com.appliancestudio.jbluez.BTAddress bdaddr, int timeOut) throws BlueZException
hciOpenDevice
before calling this method.
dd
- HCI device descriptor.bdaddr
- Bluetooth address as a BTAddress object.timeOut
- Timeout, in milliseconds.
BlueZException
- If unable to get the remote device name.public java.lang.String hciRemoteName(int dd, com.appliancestudio.jbluez.BTAddress bdaddr) throws BlueZException
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).
dd
- HCI device descriptor.bdaddr
- Bluetooth address as a BTAddress object.
BlueZException
- If unable to get the remote device name.public com.appliancestudio.jbluez.HCIFeatures hciReadRemoteFeatures(int dd, int handle, int timeOut) throws BlueZException
hciOpenDevice
and an HCI connection created to the remote
device using hciCreateConnection
.
dd
- HCI device descriptor.handle
- HCI connection handle.timeOut
- Timeout, in milliseconds.
HCIFeatures
object.
BlueZException
- If unable to read the features of the remote
device.public com.appliancestudio.jbluez.HCIVersion hciReadRemoteVersion(int dd, int handle, int timeOut) throws BlueZException
hciOpenDevice
and an HCI connection created to the remote
device using hciCreateConnection
.
dd
- HCI device descriptor.handle
- HCI connection handle.timeOut
- Timeout, in milliseconds.
HCIVersion
object representing the remote version
information.
BlueZException
- If unable to read the remote version
information.public com.appliancestudio.jbluez.HCIVersion hciReadLocalVersion(int dd, int timeOut) throws BlueZException
hciOpenDevice
.
dd
- HCI device descriptor.timeOut
- Timeout, in milliseconds.
HCIVersion
object representing the local version
information.
BlueZException
- If unable to read the features of the local
device.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |