com.intel.bluetooth
Interface BluetoothStack


public interface BluetoothStack

New native stack support should ONLY implement this interface. No other classes should ideally be changed except BlueCoveImpl where the instance of new class should be created.

Your application should not use this class directly.


Nested Class Summary
static class BluetoothStack.LibraryInformation
           
 
Field Summary
static int FEATURE_L2CAP
           
static int FEATURE_SERVICE_ATTRIBUTES
           
static int FEATURE_SET_DEVICE_SERVICE_CLASSES
           
 
Method Summary
 boolean authenticateRemoteDevice(long address)
          Attempts to authenticate RemoteDevice.
 boolean authenticateRemoteDevice(long address, String passkey)
          Sends an authentication request to a remote Bluetooth device.
 boolean cancelInquiry(DiscoveryListener listener)
          called by JSR-82 code Device Inquiry
 boolean cancelServiceSearch(int transID)
          called by JSR-82 code Service search
 void connectionRfCloseClientConnection(long handle)
           
 void connectionRfCloseServerConnection(long handle)
           
 void connectionRfFlush(long handle)
           
 long connectionRfOpenClientConnection(com.intel.bluetooth.BluetoothConnectionParams params)
          Used to create handle for BluetoothRFCommClientConnection
 int connectionRfRead(long handle)
           
 int connectionRfRead(long handle, byte[] b, int off, int len)
           
 int connectionRfReadAvailable(long handle)
           
 void connectionRfWrite(long handle, byte[] b, int off, int len)
           
 void connectionRfWrite(long handle, int b)
           
 void destroy()
           
 int detectBluetoothStack()
          Used if OS Supports multiple Bluetooth stacks 0x01 winsock; 0x02 widcomm; 0x04 bluesoleil; 0x08 BlueZ; 0x10 OS X stack;
 void enableNativeDebug(Class nativeDebugCallback, boolean on)
           
 long getConnectionRfRemoteAddress(long handle)
           
 int getFeatureSet()
           
 int getLibraryVersion()
          Used to verify native library version.
 String getLocalDeviceBluetoothAddress()
          Retrieves the Bluetooth address of the local device.
 DeviceClass getLocalDeviceClass()
          Retrieves the class of the local device.
 int getLocalDeviceDiscoverable()
           
 String getLocalDeviceName()
          Retrieves the name of the local device.
 String getLocalDeviceProperty(String property)
           
 String getRemoteDeviceFriendlyName(long address)
          called by implementation when device name is unknown or alwaysAsk is true
 String getStackID()
           
 void initialize()
          Call is made when we want to use this stack.
 boolean isCurrentThreadInterruptedCallback()
          Called from long running native code to see if thread interrupted.
 boolean isLocalDevicePowerOn()
           
 boolean isNativeCodeLoaded()
          Used by library initialization to detect if shared library already loaded.
 Boolean isRemoteDeviceAuthenticated(long address)
           
 Boolean isRemoteDeviceTrusted(long address)
           
 void l2CloseClientConnection(long handle)
          Closing BluetoothL2CAPClientConnection
 void l2CloseServerConnection(long handle)
          Closing BluetoothL2CAPServerConnection
 boolean l2Encrypt(long address, long handle, boolean on)
           
 int l2GetReceiveMTU(long handle)
           
 int l2GetSecurityOpt(long handle, int expected)
           
 int l2GetTransmitMTU(long handle)
           
 long l2OpenClientConnection(com.intel.bluetooth.BluetoothConnectionParams params, int receiveMTU, int transmitMTU)
          Used to create handle for BluetoothL2CAPClientConnection
 boolean l2Ready(long handle)
           
 int l2Receive(long handle, byte[] inBuf)
           
 long l2RemoteAddress(long handle)
           
 void l2Send(long handle, byte[] data)
           
 long l2ServerAcceptAndOpenServerConnection(long handle)
          Used to create handle for BluetoothL2CAPServerConnection
 void l2ServerClose(long handle, com.intel.bluetooth.ServiceRecordImpl serviceRecord)
           
 long l2ServerOpen(com.intel.bluetooth.BluetoothConnectionNotifierParams params, int receiveMTU, int transmitMTU, com.intel.bluetooth.ServiceRecordImpl serviceRecord)
          Used to create handle for BluetoothL2CAPConnectionNotifier
 void l2ServerUpdateServiceRecord(long handle, com.intel.bluetooth.ServiceRecordImpl serviceRecord, boolean acceptAndOpen)
           
 boolean populateServicesRecordAttributeValues(com.intel.bluetooth.ServiceRecordImpl serviceRecord, int[] attrIDs)
          Called by ServiceRecord.populateRecord(int[] attrIDs) during Service search.
 void removeAuthenticationWithRemoteDevice(long address)
          Removes authentication between local and remote bluetooth devices.
 BluetoothStack.LibraryInformation[] requireNativeLibraries()
          List the native libraries that need to be loaded.
 RemoteDevice[] retrieveDevices(int option)
           
 boolean rfEncrypt(long address, long handle, boolean on)
           
 int rfGetSecurityOpt(long handle, int expected)
           
 long rfServerAcceptAndOpenRfServerConnection(long handle)
          Used to create handle for BluetoothRFCommServerConnection
 void rfServerClose(long handle, com.intel.bluetooth.ServiceRecordImpl serviceRecord)
           
 long rfServerOpen(com.intel.bluetooth.BluetoothConnectionNotifierParams params, com.intel.bluetooth.ServiceRecordImpl serviceRecord)
          Used to create handle for BluetoothRFCommConnectionNotifier
 void rfServerUpdateServiceRecord(long handle, com.intel.bluetooth.ServiceRecordImpl serviceRecord, boolean acceptAndOpen)
           
 int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice device, DiscoveryListener listener)
          called by JSR-82 code Service search
 boolean setLocalDeviceDiscoverable(int mode)
           
 void setLocalDeviceServiceClasses(int classOfDevice)
          Implementation for local device service class
 boolean startInquiry(int accessCode, DiscoveryListener listener)
          called by JSR-82 code Device Inquiry
 

Field Detail

FEATURE_L2CAP

static final int FEATURE_L2CAP
See Also:
Constant Field Values

FEATURE_SERVICE_ATTRIBUTES

static final int FEATURE_SERVICE_ATTRIBUTES
See Also:
Constant Field Values

FEATURE_SET_DEVICE_SERVICE_CLASSES

static final int FEATURE_SET_DEVICE_SERVICE_CLASSES
See Also:
Constant Field Values
Method Detail

isNativeCodeLoaded

boolean isNativeCodeLoaded()
Used by library initialization to detect if shared library already loaded. The caller with catch UnsatisfiedLinkError and will load libraries returned by requireNativeLibraries().


requireNativeLibraries

BluetoothStack.LibraryInformation[] requireNativeLibraries()
List the native libraries that need to be loaded.

Returns:
array of library names used by implementation.
See Also:
System.loadLibrary(java.lang.String)

getLibraryVersion

int getLibraryVersion()
                      throws BluetoothStateException
Used to verify native library version. versionMajor1 * 1000000 + versionMajor2 * 10000 + versionMinor * 100 + versionBuild

Returns:
Version number in decimal presentation. e.g. 2030407 for version 2.3.4 build 7
Throws:
BluetoothStateException

detectBluetoothStack

int detectBluetoothStack()
Used if OS Supports multiple Bluetooth stacks 0x01 winsock; 0x02 widcomm; 0x04 bluesoleil; 0x08 BlueZ; 0x10 OS X stack;

Returns:
stackID

enableNativeDebug

void enableNativeDebug(Class nativeDebugCallback,
                       boolean on)
Parameters:
nativeDebugCallback - DebugLog.class
on -

initialize

void initialize()
                throws BluetoothStateException
Call is made when we want to use this stack.

Throws:
BluetoothStateException

destroy

void destroy()

getStackID

String getStackID()

isCurrentThreadInterruptedCallback

boolean isCurrentThreadInterruptedCallback()
Called from long running native code to see if thread interrupted. If yes InterruptedIOException would be thrown.

Returns:
true if interrupted

getFeatureSet

int getFeatureSet()
Returns:
implemented features, see FEATURE_* constants

getLocalDeviceBluetoothAddress

String getLocalDeviceBluetoothAddress()
                                      throws BluetoothStateException
Retrieves the Bluetooth address of the local device.

Throws:
BluetoothStateException
See Also:
LocalDevice.getBluetoothAddress()

getLocalDeviceName

String getLocalDeviceName()
Retrieves the name of the local device.

See Also:
LocalDevice.getFriendlyName()

getLocalDeviceClass

DeviceClass getLocalDeviceClass()
Retrieves the class of the local device.

See Also:
LocalDevice.getDeviceClass()

setLocalDeviceServiceClasses

void setLocalDeviceServiceClasses(int classOfDevice)
Implementation for local device service class

Parameters:
classOfDevice -
See Also:
and, LocalDevice.updateRecord(javax.bluetooth.ServiceRecord)

setLocalDeviceDiscoverable

boolean setLocalDeviceDiscoverable(int mode)
                                   throws BluetoothStateException
Throws:
BluetoothStateException
See Also:
LocalDevice.setDiscoverable(int)

getLocalDeviceDiscoverable

int getLocalDeviceDiscoverable()
See Also:
LocalDevice.getDiscoverable()

isLocalDevicePowerOn

boolean isLocalDevicePowerOn()
See Also:
LocalDevice.isPowerOn()

getLocalDeviceProperty

String getLocalDeviceProperty(String property)
See Also:
LocalDevice.getProperty(String)

authenticateRemoteDevice

boolean authenticateRemoteDevice(long address)
                                 throws IOException
Attempts to authenticate RemoteDevice. Return false if the stack does not support authentication.

Throws:
IOException
See Also:
RemoteDevice.authenticate()

authenticateRemoteDevice

boolean authenticateRemoteDevice(long address,
                                 String passkey)
                                 throws IOException
Sends an authentication request to a remote Bluetooth device. Non JSR-82,

Parameters:
address - Remote Device address
passkey - A Personal Identification Number (PIN) to be used for device authentication.
Returns:
true if authentication is successful; otherwise false
Throws:
IOException - if there are error during authentication.

removeAuthenticationWithRemoteDevice

void removeAuthenticationWithRemoteDevice(long address)
                                          throws IOException
Removes authentication between local and remote bluetooth devices. Non JSR-82,

Parameters:
address - Remote Device address authentication.
Throws:
IOException - if there are error during authentication.

startInquiry

boolean startInquiry(int accessCode,
                     DiscoveryListener listener)
                     throws BluetoothStateException
called by JSR-82 code Device Inquiry

Throws:
BluetoothStateException
See Also:
DiscoveryAgent.startInquiry(int, javax.bluetooth.DiscoveryListener)

cancelInquiry

boolean cancelInquiry(DiscoveryListener listener)
called by JSR-82 code Device Inquiry

See Also:
DiscoveryAgent.cancelInquiry(javax.bluetooth.DiscoveryListener)

getRemoteDeviceFriendlyName

String getRemoteDeviceFriendlyName(long address)
                                   throws IOException
called by implementation when device name is unknown or alwaysAsk is true

Throws:
IOException
See Also:
RemoteDevice.getFriendlyName(boolean)

retrieveDevices

RemoteDevice[] retrieveDevices(int option)
Returns:
null if not implemented
See Also:
DiscoveryAgent.retrieveDevices(int)

isRemoteDeviceTrusted

Boolean isRemoteDeviceTrusted(long address)
Returns:
null if not implemented
See Also:
RemoteDevice.isTrustedDevice()

isRemoteDeviceAuthenticated

Boolean isRemoteDeviceAuthenticated(long address)
Returns:
null if not implemented
See Also:
RemoteDevice.isAuthenticated()

searchServices

int searchServices(int[] attrSet,
                   UUID[] uuidSet,
                   RemoteDevice device,
                   DiscoveryListener listener)
                   throws BluetoothStateException
called by JSR-82 code Service search

Throws:
BluetoothStateException
See Also:
DiscoveryAgent.searchServices(int[],UUID[],javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)

cancelServiceSearch

boolean cancelServiceSearch(int transID)
called by JSR-82 code Service search

See Also:
DiscoveryAgent.cancelServiceSearch(int)

populateServicesRecordAttributeValues

boolean populateServicesRecordAttributeValues(com.intel.bluetooth.ServiceRecordImpl serviceRecord,
                                              int[] attrIDs)
                                              throws IOException
Called by ServiceRecord.populateRecord(int[] attrIDs) during Service search.

Throws:
IOException
See Also:
ServiceRecord.populateRecord(int[])

connectionRfOpenClientConnection

long connectionRfOpenClientConnection(com.intel.bluetooth.BluetoothConnectionParams params)
                                      throws IOException
Used to create handle for BluetoothRFCommClientConnection

Throws:
IOException
See Also:
Connector.open(String, int, boolean)

rfGetSecurityOpt

int rfGetSecurityOpt(long handle,
                     int expected)
                     throws IOException
Parameters:
handle -
expected - Value specified when connection was open ServiceRecord.xxAUTHENTICATE_xxENCRYPT
Returns:
expected if not implemented by stack
Throws:
IOException
See Also:
RemoteDevice.isAuthenticated(), RemoteDevice.isEncrypted()

connectionRfCloseClientConnection

void connectionRfCloseClientConnection(long handle)
                                       throws IOException
Throws:
IOException
See Also:
BluetoothRFCommClientConnection, BluetoothRFCommConnection.close(), BluetoothRFCommConnection.closeConnectionHandle(long)

connectionRfCloseServerConnection

void connectionRfCloseServerConnection(long handle)
                                       throws IOException
Throws:
IOException
See Also:
BluetoothRFCommServerConnection, connectionRfCloseClientConnection(long), Connection.close()

rfServerOpen

long rfServerOpen(com.intel.bluetooth.BluetoothConnectionNotifierParams params,
                  com.intel.bluetooth.ServiceRecordImpl serviceRecord)
                  throws IOException
Used to create handle for BluetoothRFCommConnectionNotifier

Throws:
IOException
See Also:
Connector.open(String, int, boolean)

rfServerUpdateServiceRecord

void rfServerUpdateServiceRecord(long handle,
                                 com.intel.bluetooth.ServiceRecordImpl serviceRecord,
                                 boolean acceptAndOpen)
                                 throws ServiceRegistrationException
Throws:
ServiceRegistrationException
See Also:
LocalDevice.updateRecord(javax.bluetooth.ServiceRecord)

rfServerAcceptAndOpenRfServerConnection

long rfServerAcceptAndOpenRfServerConnection(long handle)
                                             throws IOException
Used to create handle for BluetoothRFCommServerConnection

Throws:
IOException
See Also:
BluetoothRFCommConnectionNotifier.acceptAndOpen(), StreamConnectionNotifier.acceptAndOpen()

rfServerClose

void rfServerClose(long handle,
                   com.intel.bluetooth.ServiceRecordImpl serviceRecord)
                   throws IOException
Throws:
IOException
See Also:
BluetoothConnectionNotifierBase.close(), Connection.close()

getConnectionRfRemoteAddress

long getConnectionRfRemoteAddress(long handle)
                                  throws IOException
Throws:
IOException
See Also:
RemoteDevice.getRemoteDevice(javax.microedition.io.Connection)

rfEncrypt

boolean rfEncrypt(long address,
                  long handle,
                  boolean on)
                  throws IOException
Throws:
IOException
See Also:
RemoteDevice.encrypt(javax.microedition.io.Connection, boolean)

connectionRfRead

int connectionRfRead(long handle)
                     throws IOException
Throws:
IOException
See Also:
InputStream.read(), BluetoothRFCommInputStream.read()

connectionRfRead

int connectionRfRead(long handle,
                     byte[] b,
                     int off,
                     int len)
                     throws IOException
Throws:
IOException
See Also:
InputStream.read(byte[],int,int), BluetoothRFCommInputStream.read(byte[],int,int)

connectionRfReadAvailable

int connectionRfReadAvailable(long handle)
                              throws IOException
Throws:
IOException
See Also:
InputStream.available(), BluetoothRFCommInputStream.available()

connectionRfWrite

void connectionRfWrite(long handle,
                       int b)
                       throws IOException
Throws:
IOException
See Also:
BluetoothRFCommOutputStream.write(int)

connectionRfWrite

void connectionRfWrite(long handle,
                       byte[] b,
                       int off,
                       int len)
                       throws IOException
Throws:
IOException
See Also:
BluetoothRFCommOutputStream.write(byte[], int, int)

connectionRfFlush

void connectionRfFlush(long handle)
                       throws IOException
Throws:
IOException
See Also:
BluetoothRFCommOutputStream.flush()

l2OpenClientConnection

long l2OpenClientConnection(com.intel.bluetooth.BluetoothConnectionParams params,
                            int receiveMTU,
                            int transmitMTU)
                            throws IOException
Used to create handle for BluetoothL2CAPClientConnection

Throws:
IOException

l2CloseClientConnection

void l2CloseClientConnection(long handle)
                             throws IOException
Closing BluetoothL2CAPClientConnection

Throws:
IOException
See Also:
Connection.close()

l2ServerOpen

long l2ServerOpen(com.intel.bluetooth.BluetoothConnectionNotifierParams params,
                  int receiveMTU,
                  int transmitMTU,
                  com.intel.bluetooth.ServiceRecordImpl serviceRecord)
                  throws IOException
Used to create handle for BluetoothL2CAPConnectionNotifier

Throws:
IOException
See Also:
Connector.open(String, int, boolean)

l2ServerUpdateServiceRecord

void l2ServerUpdateServiceRecord(long handle,
                                 com.intel.bluetooth.ServiceRecordImpl serviceRecord,
                                 boolean acceptAndOpen)
                                 throws ServiceRegistrationException
Throws:
ServiceRegistrationException
See Also:
LocalDevice.updateRecord(javax.bluetooth.ServiceRecord)

l2ServerAcceptAndOpenServerConnection

long l2ServerAcceptAndOpenServerConnection(long handle)
                                           throws IOException
Used to create handle for BluetoothL2CAPServerConnection

Throws:
IOException
See Also:
BluetoothL2CAPConnectionNotifier.acceptAndOpen(), L2CAPConnectionNotifier.acceptAndOpen()

l2CloseServerConnection

void l2CloseServerConnection(long handle)
                             throws IOException
Closing BluetoothL2CAPServerConnection

Throws:
IOException
See Also:
l2CloseClientConnection(long)

l2ServerClose

void l2ServerClose(long handle,
                   com.intel.bluetooth.ServiceRecordImpl serviceRecord)
                   throws IOException
Throws:
IOException
See Also:
BluetoothConnectionNotifierBase.close(), Connection.close()

l2GetSecurityOpt

int l2GetSecurityOpt(long handle,
                     int expected)
                     throws IOException
Throws:
IOException
See Also:
rfGetSecurityOpt(long, int)

l2GetTransmitMTU

int l2GetTransmitMTU(long handle)
                     throws IOException
Throws:
IOException
See Also:
L2CAPConnection.getTransmitMTU()

l2GetReceiveMTU

int l2GetReceiveMTU(long handle)
                    throws IOException
Throws:
IOException
See Also:
L2CAPConnection.getReceiveMTU()

l2Ready

boolean l2Ready(long handle)
                throws IOException
Throws:
IOException
See Also:
L2CAPConnection.ready()

l2Receive

int l2Receive(long handle,
              byte[] inBuf)
              throws IOException
Throws:
IOException
See Also:
L2CAPConnection.receive(byte[])

l2Send

void l2Send(long handle,
            byte[] data)
            throws IOException
Throws:
IOException
See Also:
L2CAPConnection.send(byte[])

l2RemoteAddress

long l2RemoteAddress(long handle)
                     throws IOException
Throws:
IOException
See Also:
RemoteDevice.getRemoteDevice(javax.microedition.io.Connection)

l2Encrypt

boolean l2Encrypt(long address,
                  long handle,
                  boolean on)
                  throws IOException
Throws:
IOException
See Also:
RemoteDevice.encrypt(javax.microedition.io.Connection, boolean)


JSR-82 Javadocs Apache License, Version 2.0 Copyright © 2001-2008 Motorola, Inc. ALL RIGHTS RESERVED.
BlueCove Javadocs
Apache License, Version 2.0 Copyright © 2004-2008 BlueCove Team.