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 should use only RemoteDeviceHelper class to create RemoteDevice instances.

Your application should not use this class directly. 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 boolean authorize(RemoteDevice device, Connection conn)
          Determines if this RemoteDevice should be allowed to continue to access the local service provided by the Connection.
static int connectedDevices()
          Count number of device that have open connections to or from them.
static boolean encrypt(RemoteDevice device, Connection conn, boolean on)
          Attempts to turn encryption on or off for an existing connection.
static String formatBluetoothAddress(String address)
           
static long getAddress(String bluetoothAddress)
           
static String getBluetoothAddress(long address)
           
static String getFriendlyName(RemoteDevice device, long address, boolean alwaysAsk)
           
static RemoteDevice getRemoteDevice(Connection conn)
           
static boolean isAuthenticated(RemoteDevice device)
          Determines if this RemoteDevice has been authenticated.
static boolean isAuthorized(RemoteDevice device, Connection conn)
           
static boolean isEncrypted(RemoteDevice device)
          Determines if data exchanges with this RemoteDevice are currently being encrypted.
static boolean isTrustedDevice(RemoteDevice device)
           
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 void removeAuthentication(RemoteDevice device)
          Removes authentication between local and remote bluetooth devices.
static RemoteDevice[] retrieveDevices(BluetoothStack bluetoothStack, int option)
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFriendlyName

public static String getFriendlyName(RemoteDevice device,
                                     long address,
                                     boolean alwaysAsk)
                              throws IOException
Throws:
IOException

getRemoteDevice

public static RemoteDevice getRemoteDevice(Connection conn)
                                    throws IOException
Throws:
IOException
See Also:
RemoteDevice.getRemoteDevice(Connection)

retrieveDevices

public static RemoteDevice[] retrieveDevices(BluetoothStack bluetoothStack,
                                             int option)
(non-Javadoc)

See Also:
DiscoveryAgent.retrieveDevices(int)

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)

getAddress

public static long getAddress(String bluetoothAddress)

authenticate

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

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

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.

authorize

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

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

encrypt

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

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

isAuthenticated

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

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

isAuthorized

public static boolean isAuthorized(RemoteDevice device,
                                   Connection conn)
                            throws IOException
Throws:
IOException

isEncrypted

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

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

isTrustedDevice

public static boolean isTrustedDevice(RemoteDevice device)


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.