BluetoothServer Component
Properties
available Returns true if Bluetooth is available on the device, false otherwise.
Data type: boolean |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = bluetoothserverName.available |
characterEncoding Returns the character encoding to use when sending and receiving text.
Data type: string |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" characterEncoding="UTF-8"> |
Code Writeable | true |
bluetoothserverName.characterEncoding = "UTF-8" |
Code Readable | true |
let variable = bluetoothserverName.characterEncoding |
delimiterByte Returns the delimiter byte to use when passing a negative number for the numberOfBytes parameter when calling ReceiveText, ReceiveSignedBytes, or ReceiveUnsignedBytes.
Data type: number |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" delimiterByte="0"> |
Code Writeable | true |
bluetoothserverName.delimiterByte = 0 |
Code Readable | true |
let variable = bluetoothserverName.delimiterByte |
enabled Returns true if Bluetooth is enabled, false otherwise.
Data type: boolean |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = bluetoothserverName.enabled |
highByteFirst Specifies whether numbers are sent and received with the most significant byte first.
Data type: boolean |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" highByteFirst="true"> |
Code Writeable | true |
bluetoothserverName.highByteFirst = true |
Code Readable | true |
let variable = bluetoothserverName.highByteFirst |
isAccepting Returns true if this BluetoothServer component is accepting an incoming connection.
Data type: boolean |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = bluetoothserverName.isAccepting |
isConnected Returns true if a connection to a Bluetooth device has been made.
Data type: boolean |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = bluetoothserverName.isConnected |
secure Specifies whether a secure connection should be used.
Data type: boolean |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" secure="true"> |
Code Writeable | true |
bluetoothserverName.secure = true |
Code Readable | true |
let variable = bluetoothserverName.secure |
class The styling class of the the component
Data type: string |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" class="Test class"> |
Code Writeable | false | |
Code Readable | false |
id The styling id of the the component
Data type: string |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" id="Test id"> |
Code Writeable | false | |
Code Readable | false |
name The name of the component that will be used to refer to it in code.
Data type: string |
||
Designer Writable | true |
<bluetoothserver name="bluetoothserverName" name="testComponent"> |
Code Writeable | false | |
Code Readable | false |
Methods
Method name | Description | Parameters | ||||
---|---|---|---|---|---|---|
acceptConnection |
Accept an incoming connection with the Serial Port Profile (SPP). bluetoothserverName.acceptConnection(serviceName) bluetoothserverName.acceptConnection("Test serviceName") |
|
||||
acceptConnectionWithUUID |
Accept an incoming connection with a specific UUID. bluetoothserverName.acceptConnectionWithUUID(serviceName, uuid) bluetoothserverName.acceptConnectionWithUUID("Test serviceName", "Test uuid") |
|
||||
bytesAvailableToReceive |
Returns number of bytes available from the input stream. bluetoothserverName.bytesAvailableToReceive() |
|
||||
disconnect |
Disconnects from the connected Bluetooth device. bluetoothserverName.disconnect() |
|
||||
receiveSigned1ByteNumber |
Reads a signed 1-byte number. bluetoothserverName.receiveSigned1ByteNumber() |
|
||||
receiveSigned2ByteNumber |
Reads a signed 2-byte number. bluetoothserverName.receiveSigned2ByteNumber() |
|
||||
receiveSigned4ByteNumber |
Reads a signed 4-byte number. bluetoothserverName.receiveSigned4ByteNumber() |
|
||||
receiveSignedBytes |
Reads a number of signed bytes from the input stream and returns them as a List. If numberOfBytes is negative, this method reads until a delimiter byte value is read. The delimiter byte value is included in the returned list. bluetoothserverName.receiveSignedBytes(numberOfBytes) bluetoothserverName.receiveSignedBytes(0) |
|
||||
receiveText |
Reads a number of bytes from the input stream and converts them to text. If numberOfBytes is negative, read until a delimiter byte value is read. bluetoothserverName.receiveText(numberOfBytes) bluetoothserverName.receiveText(0) |
|
||||
receiveUnsigned1ByteNumber |
Reads an unsigned 1-byte number. bluetoothserverName.receiveUnsigned1ByteNumber() |
|
||||
receiveUnsigned2ByteNumber |
Reads an unsigned 2-byte number. bluetoothserverName.receiveUnsigned2ByteNumber() |
|
||||
receiveUnsigned4ByteNumber |
Reads an unsigned 4-byte number. bluetoothserverName.receiveUnsigned4ByteNumber() |
|
||||
receiveUnsignedBytes |
Reads a number of unsigned bytes from the input stream and returns them as a List. If numberOfBytes is negative, this method reads until a delimiter byte value is read. The delimiter byte value is included in the returned list. bluetoothserverName.receiveUnsignedBytes(numberOfBytes) bluetoothserverName.receiveUnsignedBytes(0) |
|
||||
send1ByteNumber |
Decodes the given number String to an integer and writes it as one byte to the output stream. If the number could not be decoded to an integer, or the integer would not fit in one byte, then the Form's ErrorOccurred event is triggered and this method returns without writing any bytes to the output stream. bluetoothserverName.send1ByteNumber(number) bluetoothserverName.send1ByteNumber("Test number") |
|
||||
send2ByteNumber |
Decodes the given number String to an integer and writes it as two bytes to the output stream. If the number could not be decoded to an integer, or the integer would not fit in two bytes, then the Form's ErrorOccurred event is triggered and this method returns without writing any bytes to the output stream. bluetoothserverName.send2ByteNumber(number) bluetoothserverName.send2ByteNumber("Test number") |
|
||||
send4ByteNumber |
Decodes the given number String to an integer and writes it as four bytes to the output stream. If the number could not be decoded to an integer, or the integer would not fit in four bytes, then the Form's ErrorOccurred event is triggered and this method returns without writing any bytes to the output stream. bluetoothserverName.send4ByteNumber(number) bluetoothserverName.send4ByteNumber("Test number") |
|
||||
sendBytes |
Takes each element from the given list, converts it to a String, decodes the String to an integer, and writes it as one byte to the output stream. If an element could not be decoded to an integer, or the integer would not fit in one byte, then the Form's ErrorOccurred event is triggered and this method returns without writing any bytes to the output stream. bluetoothserverName.sendBytes(list) bluetoothserverName.sendBytes([1,2,3]) |
|
||||
sendText |
Converts the given text to bytes and writes them to the output stream. bluetoothserverName.sendText(text) bluetoothserverName.sendText("Test text") |
|
||||
stopAccepting |
Stop accepting an incoming connection. bluetoothserverName.stopAccepting() |
|
||||
addEventListener |
Method used to create event listeners. See Events below for samples. |
|
Events
Event name | Description | Parameters |
---|---|---|
connectionAccepted | Indicates that a bluetooth connection has been accepted.bluetoothserverName.addEventListener( "connectionAccepted", function () { //Your code here } ) |
|