Skip to content

Bluetooth Client

Non-Visible component
Category Requires Version
Connectivity API 21, Android 5.0 Lollipop 6

Overview

A non-visible component that acts as a bluetooth client.

Permissions

Events

BluetoothError

The BluetoothError event is no longer used. Please use the Screen.ErrorOccurred event instead.

Params
function Name Text
message Text

Methods

Bytes Available To Receive

Returns: Number

Returns an estimate of the number of bytes that can be received without blocking

Connect

Returns: Boolean

Connect to the Bluetooth device with the specified address and the Serial Port Profile (SPP). Returns true if the connection was successful.

Params
address Text

Connect With UUID

Returns: Boolean

Connect to the Bluetooth device with the specified address and UUID. Returns true if the connection was successful.

Params
address Text
uuid Text

Disconnect

Disconnect from the connected Bluetooth device.

Is Device Paired

Returns: Boolean

Checks whether the Bluetooth device with the specified address is paired.

Params
address Text

Receive Signed 1 Byte Number

Returns: Number

Receive a signed 1-byte number from the connected Bluetooth device.

Receive Signed 2 Byte Number

Returns: Number

Receive a signed 2-byte number from the connected Bluetooth device.

Receive Signed 4 Byte Number

Returns: Number

Receive a signed 4-byte number from the connected Bluetooth device.

Receive Signed Bytes

Returns: List

Receive multiple signed byte values from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

Params
number Of Bytes Number

Receive Text

Returns: Text

Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

Params
number Of Bytes Number

Receive Unsigned 1 Byte Number

Returns: Number

Receive an unsigned 1-byte number from the connected Bluetooth device.

Receive Unsigned 2 Byte Number

Returns: Number

Receive a unsigned 2-byte number from the connected Bluetooth device.

Receive Unsigned 4 Byte Number

Returns: Number

Receive a unsigned 4-byte number from the connected Bluetooth device.

Receive Unsigned Bytes

Returns: List

Receive multiple unsigned byte values from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

Params
number Of Bytes Number

Remove Name From Address

Returns: Text

Remove the Name from a Bluetooth Address and Name String.

Params
address And Name Text

Send 1 Byte Number

Send a 1-byte number to the connected Bluetooth device.

Params
number Text

Send 2 Byte Number

Send a 2-byte number to the connected Bluetooth device.

Params
number Text

Send 4 Byte Number

Send a 4-byte number to the connected Bluetooth device.

Params
number Text

Send Bytes

Send a list of byte values to the connected Bluetooth device.

Params
list List

Send Text

Send text to the connected Bluetooth device.

Params
text Text

Properties

Addresses And Names

List ➖ Read - Blocks

The addresses and names of paired Bluetooth devices

Available

Boolean ➖ Read - Blocks

Whether Bluetooth is available on the device

Character Encoding

Text Default: UTF-8 ➖ Read Write - Designer Blocks

Sets the character encoding to use when sending and receiving text.

Delimiter Byte

Number Default: 0 ➖ Read Write - Designer Blocks

Sets the delimiter byte to use when passing a negative number for thenumberOfBytes parameter when calling ReceiveText, ReceiveSignedBytes, orReceiveUnsignedBytes.

Enabled

Boolean ➖ Read - Blocks

Whether Bluetooth is enabled

High Byte First

Boolean Default: False ➖ Read Write - Designer Blocks

Returns true if numbers are sent and received with the most significantbyte first.

Is Connected

Boolean ➖ Read - Blocks

Returns true if a connection to a Bluetooth device has been made.

Secure

Boolean Default: True ➖ Read Write - Designer Blocks

Whether to invoke SSP (Simple Secure Pairing), which is supported on devices with Bluetooth v2.1 or higher. When working with embedded Bluetooth devices, this property may need to be set to False. For Android 2.0-2.2, this property setting will be ignored.


Last update: November 9, 2022