com.intel.bluetooth
Class RemoteDeviceHelper

java.lang.Object
  extended by com.intel.bluetooth.RemoteDeviceHelper

public abstract class RemoteDeviceHelper
extends Object

Implementation of RemoteDevice. Instance of RemoteDevice can be created by User. BlueCove internaly should use only RemoteDeviceHelper class to create RemoteDevice instances.

Your application should not use this class directly to be JSR-82 compatible. The exceptions are authenticate(RemoteDevice device, String passkey) and removeAuthentication(RemoteDevice device).


Method Summary
static boolean authenticate(RemoteDevice device)
          Attempts to authenticate RemoteDevice.
static boolean authenticate(RemoteDevice device, String passkey)
          Sends an authentication request to a remote Bluetooth device.
static int connectedDevices()
          Count number of device that have open connections to or from them.
static String formatBluetoothAddress(String address)
           
static long getAddress(String bluetoothAddress)
          Convert Bluetooth address String representation to long.
static String getBluetoothAddress(long address)
          Convert Bluetooth address long representation to String presentation.
static boolean implAuthorize(RemoteDevice device, Connection conn)
          Determines if this RemoteDevice should be allowed to continue to access the local service provided by the Connection.
static boolean implEncrypt(RemoteDevice device, Connection conn, boolean on)
          Attempts to turn encryption on or off for an existing connection.
static String implGetFriendlyName(RemoteDevice device, long address, boolean alwaysAsk)
          Returns the name of the device.
static RemoteDevice implGetRemoteDevice(Connection conn)
          Retrieves the Bluetooth device that is at the other end of the Bluetooth connection.
static boolean implIsAuthenticated(RemoteDevice device)
          Determines if this RemoteDevice has been authenticated.
static boolean implIsAuthorized(RemoteDevice device, Connection conn)
          Determines if this RemoteDevice has been authorized.
static boolean implIsEncrypted(RemoteDevice device)
          Determines if data exchanges with this RemoteDevice are currently being encrypted.
static boolean implIsTrustedDevice(RemoteDevice device)
          Determines if this is a trusted device according to the BCC.
static RemoteDevice[] implRetrieveDevices(BluetoothStack bluetoothStack, int option)
          Returns an array of Bluetooth devices.
static int openConnections()
          Count total number of open connections to all devices.
static int openConnections(long address)
          Count number of open connections to or from specific device.
static int readRSSI(RemoteDevice device)
          Gets the RSSI (Receive Signal Strength Indicator) value for a remote Bluetooth device.
static void removeAuthentication(RemoteDevice device)
          Removes authentication between local and remote bluetooth devices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

openConnections

public static int openConnections()
Count total number of open connections to all devices.

Returns:
number of connections

openConnections

public static int openConnections(long address)
Count number of open connections to or from specific device.

Returns:
number of connections

connectedDevices

public static int connectedDevices()
Count number of device that have open connections to or from them.

Returns:
number of connections

formatBluetoothAddress

public static String formatBluetoothAddress(String address)

getBluetoothAddress

public static String getBluetoothAddress(long address)
Convert Bluetooth address long representation to String presentation.

Parameters:
address -
Returns:
the Bluetooth address of the device 12 characters long.

getAddress

public static long getAddress(String bluetoothAddress)
Convert Bluetooth address String representation to long.

Parameters:
bluetoothAddress -
Returns:
long value of the address

readRSSI

public static int readRSSI(RemoteDevice device)
                    throws IOException
Gets the RSSI (Receive Signal Strength Indicator) value for a remote Bluetooth device. Non JSR-82.

PUBLIC JSR-82 extension

Bluetooth connection with the peer device should exist to receive a value.

Value 0 indicates that the connected Bluetooth devices are at optimal separation, the golden zone.

Increasingly positive values are reported as the devices are moved closer to each other. Increasingly negative values are reported as the devices are moved apart.

RSSI ranges from -128 to 127.

Parameters:
device - Remote Device
Returns:
RSSI value
Throws:
IOException - if there are error reading value.

authenticate

public static boolean authenticate(RemoteDevice device)
                            throws IOException
Attempts to authenticate RemoteDevice. Return false if the stack does not support authentication.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.authenticate().

Throws:
IOException
See Also:
RemoteDevice.authenticate()

authenticate

public static boolean authenticate(RemoteDevice device,
                                   String passkey)
                            throws IOException
Sends an authentication request to a remote Bluetooth device. Non JSR-82, Return false if the stack does not support authentication.

PUBLIC JSR-82 extension On BlueZ will throw exception when authentication already exists.

Parameters:
device - Remote Device
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.

removeAuthentication

public static void removeAuthentication(RemoteDevice device)
                                 throws IOException
Removes authentication between local and remote bluetooth devices. Non JSR-82.

PUBLIC JSR-82 extension

Parameters:
device - Remote Device
Throws:
IOException - if there are errors or not implemented.

implGetFriendlyName

public static String implGetFriendlyName(RemoteDevice device,
                                         long address,
                                         boolean alwaysAsk)
                                  throws IOException
Returns the name of the device. Returns null if the Bluetooth system does not support this feature; If the remote device does not have a name then an empty string.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.getFriendlyName(...).

Throws:
IOException

implGetRemoteDevice

public static RemoteDevice implGetRemoteDevice(Connection conn)
                                        throws IOException
Retrieves the Bluetooth device that is at the other end of the Bluetooth connection.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.getRemoteDevice(...).

Throws:
IOException
See Also:
RemoteDevice.getRemoteDevice(Connection)

implRetrieveDevices

public static RemoteDevice[] implRetrieveDevices(BluetoothStack bluetoothStack,
                                                 int option)
Returns an array of Bluetooth devices.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.retrieveDevices(...).

See Also:
DiscoveryAgent.retrieveDevices(int)

implAuthorize

public static boolean implAuthorize(RemoteDevice device,
                                    Connection conn)
                             throws IOException
Determines if this RemoteDevice should be allowed to continue to access the local service provided by the Connection.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.authorize(...).

Throws:
IOException
See Also:
RemoteDevice.authorize(javax.microedition.io.Connection)

implEncrypt

public static boolean implEncrypt(RemoteDevice device,
                                  Connection conn,
                                  boolean on)
                           throws IOException
Attempts to turn encryption on or off for an existing connection.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.encrypt(...).

Throws:
IOException
See Also:
RemoteDevice.encrypt(javax.microedition.io.Connection, boolean)

implIsAuthenticated

public static boolean implIsAuthenticated(RemoteDevice device)
Determines if this RemoteDevice has been authenticated.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.isAuthenticated().

A device may have been authenticated by this application or another application. Authentication applies to an ACL link between devices and not on a specific L2CAP, RFCOMM, or OBEX connection. Therefore, if authenticate() is performed when an L2CAP connection is made to device A, then isAuthenticated() may return true when tested as part of making an RFCOMM connection to device A.

Returns:
true if this RemoteDevice has previously been authenticated; false if it has not been authenticated or there are no open connections between the local device and this RemoteDevice

implIsAuthorized

public static boolean implIsAuthorized(RemoteDevice device,
                                       Connection conn)
                                throws IOException
Determines if this RemoteDevice has been authorized.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.isAuthorized( javax.microedition.io.Connection).

Throws:
IOException

implIsEncrypted

public static boolean implIsEncrypted(RemoteDevice device)
Determines if data exchanges with this RemoteDevice are currently being encrypted.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.isEncrypted().

Encryption may have been previously turned on by this or another application. Encryption applies to an ACL link between devices and not on a specific L2CAP, RFCOMM, or OBEX connection. Therefore, if encrypt() is performed with the on parameter set to true when an L2CAP connection is made to device A, then isEncrypted() may return true when tested as part of making an RFCOMM connection to device A.

Returns:
true if data exchanges with this RemoteDevice are being encrypted; false if they are not being encrypted, or there are no open connections between the local device and this RemoteDevice

implIsTrustedDevice

public static boolean implIsTrustedDevice(RemoteDevice device)
Determines if this is a trusted device according to the BCC.

Internal BlueCove function. Use javax.bluetooth.RemoteDevice.isTrustedDevice().



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.