# Modules.Bluetooth.BluetoothDevice

Represents a remote bluetooth device.

Availability
1.0.0

# Overview

A BluetoothDevice object lets you create a connection with the remote device or query information about it, such as the name, address, UUID and type.

# Properties

# address READONLY

Availability
1.0.0
address :String

Address of the remote Bluetooth device.

This property returns the Bluetooth hardware address as string. For example, "00:11:22:AA:BB:CC".

# name READONLY

Availability
1.0.0
name :String

Name of the remote Bluetooth device.

This property returns the Bluetooth name or null if there was a problem.


# type READONLY

Availability
1.0.0
type :Number

Type of the remote Bluetooth device.

Possible values are DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_CLASSIC, DEVICE_TYPE_DUAL and DEVICE_TYPE_LE.


# uUIDs READONLY

Availability
1.0.0
uUIDs :Array<String>

The supported UUIDs of the remote device.

This property does not start a service discovery procedure to retrieve the UUIDs from the remote device. Rather, the local cached copy of the service UUIDs are returned. Can be null on error.

# Methods

# createSocket

Availability
1.0.0
createSocket(uuid[, secure]) Modules.Bluetooth.BluetoothSocket

Creates an RFCOMM Bluetooth socket.

This method, when called, creates an RFCOMM Bluetooth socket ready to start an outgoing connection to the remote device using SDP lookup of UUID.

Parameters

Name Type Description
uuid String

UUID of the service this socket will connect to.

secure Boolean

Determines whether the connection will be secure or insecure.

Returns

created socket for the device


# fetchUUIDs

Availability
1.0.0
fetchUUIDs() Boolean

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

The outcome of the discovery is reported via the fetchedUUIDs event.

Returns

Returns true if service discovery started successfully.

Type
Boolean

# Events

# fetchedUUIDs

Availability
1.0.0

Fired when the UUIDs of the remote device are received using SDP.

Properties

Name Type Description
device Modules.Bluetooth.BluetoothDevice

The Bluetooth device in question.

UUIDs Array<String>

The service UUIDs of the device.

source Object

Source object that fired the event.

type String

Name of the event fired.

bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.