LogicalLabs Bluetooth Module

API Docs for: 1.0.3
Show:

BluetoothDevice Class

Module: Readme

BluetoothDevice objects can be returned in deviceFound events, by the getRemoteDevice method, the getPairedDevices method, and the pairedDevices property of the Bluetooth module object.

Methods

createSocket

(
  • params
)
BluetoothSocket

Available since 1.0.0

Creates an RFCOMM Bluetooth socket ready to start an outgoing connection to this remote device using SDP lookup of UUID.

Note: This method requires that the app be built with Titanium version 3.1.1.GA or later due to TIMOB-13097. See also TIMOB-13620.

Parameters:

  • params Object

    An object with the following properties:

    • uuid String

      UUID of the service this socket will connect to.

    • [secure=false] Boolean optional

      Defines whether the connection will be secure or insecure.

Returns:

equals

() Boolean

Available since 1.0.0

Compares one BluetoothDevice object to another.

Returns:

Boolean:

True iff the two objects are the same.

fetchUUIDs

() Boolean

Available since 1.0.1

Perform a service discovery on the remote device to get the UUIDs supported.

The result of the discovery is reported via the fetchedUUIDs event. See also the getUUIDs method and UUIDs property.

This function requires API level 15 or higher.

Returns:

Boolean:

True if service discovery was started successfully.

getAddress

() String

Available since 1.0.0

Returns the address of the remote Bluetooth device.

Returns:

String:

getBondState

() Number

Available since 1.0.0

Returns the bond state of the remote device. See the DEVICE_BONDED, DEVICE_BONDING, and DEVICE_NOT_BONDED constants on the Bluetooth module object.

Use the createBluetoothSocket method until then.

Returns:

Number:

getName

() String

Available since 1.0.0

Returns the name of the remote Bluetooth device.

Returns:

String:

getType

() Number

Available since 1.0.1

Returns the type of the remote device.

Possible values are
DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_CLASSIC, DEVICE_TYPE_DUAL, and DEVICE_TYPE_LE.

This function requires API level 18 or higher.

Returns:

Number:

getUUIDs

() Array of Strings

Available since 1.0.1

Returns the supported features (UUIDs) of the remote device.

This method does not start a service discovery procedure to retrieve the UUIDs from the remote device. Instead, the local cached copy of the service UUIDs are returned.

Use the fetchUUIDs method to start service discover.

This function requires API level 15 or higher.

Returns:

Array of Strings:

toString

() String

Available since 1.0.0

Returns a string representation of this BluetoothDevice. Currently this is the Bluetooth hardware address, for example "00:11:22:AA:BB:CC". However, you should always use getAddress() if you explicitly require the Bluetooth hardware address in case the toString() representation changes in the future.

Returns:

String:

A string representation of this BluetoothDevice.

Properties

address

String read-only

Available since 1.0.0

The address of the remote Bluetooth device.

bondState

Number read-only

Available since 1.0.0

The bond state of the remote device. See the DEVICE_BONDED, DEVICE_BONDING, and DEVICE_NOT_BONDED constants on the Bluetooth module object.

name

String read-only

Available since 1.0.0

The name of the remote Bluetooth device.

type

Unknown

Available since 1.0.1

Returns the type of the remote device.

Possible values are
DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_CLASSIC, DEVICE_TYPE_DUAL, and DEVICE_TYPE_LE.

This function requires API level 18 or higher.

UUIDs

Unknown

Available since 1.0.1

The supported features (UUIDs) of the remote device.

Querying this property does not start a service discovery procedure to retrieve the UUIDs from the remote device. Instead, the local cached copy of the service UUIDs are returned.

Use the fetchUUIDs method to start service discover.

This function requires API level 15 or higher.