Build 1.0_r1(from source)

android.bluetooth
Class Database

java.lang.Object
  extended by android.bluetooth.Database

public final class Database
extends Object

The Android Bluetooth API is not finalized, and *will* change. Use at your own risk. A low-level API to the Service Discovery Protocol (SDP) Database. Allows service records to be added to the local SDP database. Once added, these services will be advertised to remote devices when they make SDP queries on this device. Currently this API is a thin wrapper to the bluez SDP Database API. See: http://wiki.bluez.org/wiki/Database http://wiki.bluez.org/wiki/HOWTO/ManagingServiceRecords


Method Summary
 int addServiceRecord(byte[] record)
          Add a new service record.
 int addServiceRecordFromXml(String record)
          Add a new service record, using XML.
 int advertiseRfcommService(RfcommSocket socket, String serviceName, UUID uuid)
          Advertise a service with an RfcommSocket.
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
static Database getInstance()
          Singelton accessor
 void removeServiceRecord(int handle)
          Remove a service record.
 void updateServiceRecord(int handle, byte[] record)
          Update an exisiting service record.
 void updateServiceRecordFromXml(int handle, String record)
          Update an exisiting record, using XML.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class Object
Throws:
Throwable - The virtual machine ignores any exceptions which are thrown during finalization.

getInstance

public static Database getInstance()
Singelton accessor

Returns:
The singleton instance of Database

advertiseRfcommService

public int advertiseRfcommService(RfcommSocket socket,
                                  String serviceName,
                                  UUID uuid)
                           throws IOException
Advertise a service with an RfcommSocket. This adds the service the SDP Database with the following attributes set: Service Name, Protocol Descriptor List, Service Class ID List TODO: Construct a byte[] record directly, rather than via XML.

Parameters:
socket - The rfcomm socket to advertise (by channel).
serviceName - A short name for this service
uuid - Unique identifier for this service, by which clients can search for your service
Returns:
Handle to the new service record
Throws:
IOException

addServiceRecord

public int addServiceRecord(byte[] record)
                     throws IOException
Add a new service record.

Parameters:
record - The byte[] record
Returns:
A handle to the new record
Throws:
IOException

addServiceRecordFromXml

public int addServiceRecordFromXml(String record)
                            throws IOException
Add a new service record, using XML.

Parameters:
record - The record as an XML string
Returns:
A handle to the new record
Throws:
IOException

updateServiceRecord

public void updateServiceRecord(int handle,
                                byte[] record)
Update an exisiting service record.

Parameters:
handle - Handle to exisiting record
record - The updated byte[] record

updateServiceRecordFromXml

public void updateServiceRecordFromXml(int handle,
                                       String record)
Update an exisiting record, using XML.

Parameters:
handle - Handle to exisiting record
record - The record as an XML string.

removeServiceRecord

public void removeServiceRecord(int handle)
Remove a service record. It is only possible to remove service records that were added by the current connection.

Parameters:
handle - Handle to exisiting record to be removed

Build 1.0_r1(from source)

Please submit a feedback, bug or feature