Skip to content

Bluetooth Server

Non-Visible component
Category Requires Version
Connectivity API 19, Android 4.4 - 4.4.4 KitKat 5

Overview

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

Permissions

Events

BluetoothError

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

Params
function Name Text
message Text

Connection Accepted

Indicates that a bluetooth connection has been accepted.

Methods

Accept Connection

Accept an incoming connection with the Serial Port Profile (SPP).

Params
service Name Text

Accept Connection With UUID

Accept an incoming connection with a specific UUID.

Params
service Name Text
uuid Text

Bytes Available To Receive

Returns: Number

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

Disconnect

Disconnect from the connected Bluetooth device.

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

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

Stop Accepting

Stop accepting an incoming connection.

Properties

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 Accepting

Boolean ➖ Read - Blocks

Returns true if this BluetoothServer component is accepting anincoming connection.

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: January 27, 2020