Jump to content

Component: Bluetooth BLE (ESP32 SPP Client) (Wireless): Difference between revisions

From Flowcode Help
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead""
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
Line 67: Line 67:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckConnectionStatus'''
| width="90%" class="mtx-class-macrohead" | '''CheckConnectionStatus'''
|-
|-
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
Line 81: Line 81:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ConnectToDevice'''
| width="90%" class="mtx-class-macrohead" | '''ConnectToDevice'''
|-
|-
| colspan="2" | Manually connect to the specified discovered device. Returns true if the device connected successfully. 
| colspan="2" | Manually connect to the specified discovered device. Returns true if the device connected successfully. 
Line 100: Line 100:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisconnectFromDevice'''
| width="90%" class="mtx-class-macrohead" | '''DisconnectFromDevice'''
|-
|-
| colspan="2" | Manually disconnect from the connected device 
| colspan="2" | Manually disconnect from the connected device 
Line 114: Line 114:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDiscoveredDeviceCount'''
| width="90%" class="mtx-class-macrohead" | '''GetDiscoveredDeviceCount'''
|-
|-
| colspan="2" | Returns the number of discovered devices. 
| colspan="2" | Returns the number of discovered devices. 
Line 128: Line 128:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDiscoveredDeviceMAC'''
| width="90%" class="mtx-class-macrohead" | '''GetDiscoveredDeviceMAC'''
|-
|-
| colspan="2" | Gets the 6 Byte MAC address of the discovered device at the selected index 
| colspan="2" | Gets the 6 Byte MAC address of the discovered device at the selected index 
Line 152: Line 152:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDiscoveredDeviceName'''
| width="90%" class="mtx-class-macrohead" | '''GetDiscoveredDeviceName'''
|-
|-
| colspan="2" | Gets the friendly name of the discovered device at the selected index 
| colspan="2" | Gets the friendly name of the discovered device at the selected index 
Line 171: Line 171:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Starts up the Bluetooth communications SPP service. 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
Line 185: Line 185:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveArray'''
|-
|-
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
Line 214: Line 214:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveByte'''
|-
|-
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
Line 233: Line 233:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveCount'''
|-
|-
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
Line 247: Line 247:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveINTArray'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveINTArray'''
|-
|-
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
Line 281: Line 281:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveString'''
|-
|-
| colspan="2" | Attempts to receive a string of characters from the Bluetooth SPP. Terminates on timeout, on receiving the MaxBytes or on receiving a '\n' character 
| colspan="2" | Attempts to receive a string of characters from the Bluetooth SPP. Terminates on timeout, on receiving the MaxBytes or on receiving a '\n' character 
Line 305: Line 305:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
| width="90%" class="mtx-class-macrohead" | '''SendArray'''
|-
|-
| colspan="2" | Sends a byte to the Bluetooth serial connection 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
Line 329: Line 329:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
| width="90%" class="mtx-class-macrohead" | '''SendByte'''
|-
|-
| colspan="2" | Sends a byte to the Bluetooth serial connection 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
Line 348: Line 348:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendINTArray'''
| width="90%" class="mtx-class-macrohead" | '''SendINTArray'''
|-
|-
| colspan="2" | Sends an array of 16-bit integers to the Bluetooth serial connection 
| colspan="2" | Sends an array of 16-bit integers to the Bluetooth serial connection 
Line 377: Line 377:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
| width="90%" class="mtx-class-macrohead" | '''SendString'''
|-
|-
| colspan="2" | Sends a string to the Bluetooth serial connection 
| colspan="2" | Sends a string to the Bluetooth serial connection 
Line 396: Line 396:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninitialise'''
| width="90%" class="mtx-class-macrohead" | '''Uninitialise'''
|-
|-
| colspan="2" | Shots down the Bluetooth communications SPP service. 
| colspan="2" | Shots down the Bluetooth communications SPP service. 
Line 411: Line 411:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Revision as of 14:22, 13 July 2026

Author Matrix TSL
Version 1.0
Category Wireless


Bluetooth BLE (ESP32 SPP Client) component

Bluetooth BLE client component designed to run on a ESP32 providing GATT SPP functionality. Designed to scan for and connect to an existing Bluetooth BLE GATT SPP server. BT BLE functionality must be switched on via the sdkconfig file.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples






Macro reference

CheckConnectionStatus

CheckConnectionStatus
Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
- BOOL Return


ConnectToDevice

ConnectToDevice
Manually connect to the specified discovered device. Returns true if the device connected successfully. 
- BYTE index
 
- BOOL Return


DisconnectFromDevice

DisconnectFromDevice
Manually disconnect from the connected device 
- VOID Return


GetDiscoveredDeviceCount

GetDiscoveredDeviceCount
Returns the number of discovered devices. 
- BYTE Return


GetDiscoveredDeviceMAC

GetDiscoveredDeviceMAC
Gets the 6 Byte MAC address of the discovered device at the selected index 
- BYTE index
 
- BYTE MAC
6-byte Array to return the MAC address into 
- VOID Return


GetDiscoveredDeviceName

GetDiscoveredDeviceName
Gets the friendly name of the discovered device at the selected index 
- BYTE index
 
- STRING Return


Initialise

Initialise
Starts up the Bluetooth communications SPP service. 
- VOID Return


ReceiveArray

ReceiveArray
Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
- BYTE Data
Buffer to place received data into 
- UINT MaxBytes
Max number of bytes to try and read within the time 
- UINT Timeout
Number of ms to wait for incoming data 
- UINT Return


ReceiveByte

ReceiveByte
Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
- UINT Timeout
Number of ms to wait for incoming data 
- UINT Return


ReceiveCount

ReceiveCount
Collects the number of bytes currently stored in the receive buffer. 
- UINT Return


ReceiveINTArray

ReceiveINTArray
Receives an array of 16-bit INT/UINT values and returns the number of values received. 
- UINT Data
Array to store the incoming data 
- BYTE NumValues
Maximum number of values to try and receive 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- BYTE Timeout
Max amount of time in ms to wait between bytes 
- BYTE Return


ReceiveString

ReceiveString
Attempts to receive a string of characters from the Bluetooth SPP. Terminates on timeout, on receiving the MaxBytes or on receiving a '\n' character 
- UINT MaxBytes
Max number of bytes to try and read within the time 
- UINT Timeout
Number of ms to wait for incoming data 
- STRING Return


SendArray

SendArray
Sends a byte to the Bluetooth serial connection 
- BYTE Data
Data Array to send 
- UINT NumBytes
Number of bytes to send 
- VOID Return


SendByte

SendByte
Sends a byte to the Bluetooth serial connection 
- BYTE Data
 
- VOID Return


SendINTArray

SendINTArray
Sends an array of 16-bit integers to the Bluetooth serial connection 
- UINT Data
Data Array to send 
- BYTE NumValues
Number of bytes to send 
- BOOL MSBFirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendString

SendString
Sends a string to the Bluetooth serial connection 
- STRING Data
Data Array to send 
- VOID Return


Uninitialise

Uninitialise
Shots down the Bluetooth communications SPP service. 
- VOID Return


Property reference

Properties
Receive Buffer
Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
Max Discovered Devices
Maximum number of devices that can be detected. 
Filter By UUID
Allows the scan results to be filtered to a specific UUID in the advertisement data 
Service UUID
16-bit value that identifies the custom “Simple SPP” service so scanners know the device supports that feature. 
Characteristic UUID
16-bit value that describes the single characteristic that carries the serial-like data flow (reads, writes, notifications). 
Auto Connect On Match
Auto connect to the first device we find with a matching UUID 
Data Receive Interrupt
 
Verbose Debug
When enabled debug messages will be placed onto UART CH1 which is generally connected to via a Serial to USB IC to pipe messages back to the host PC. 
Simulation
COM Port
Selects which port to communicate with, only lists ports which are currently available.  
Refresh COM Ports
When set to yes the COM port list is rescanned for newly connected or available ports. Note that refreshing the ports list may take a few seconds depending on the number of connected ports. 
Baud
Baud rate passed to the COM port to control the rate of data. 
Console Data
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Bluetooth_ESP32_BLE_GATT_SPP_Client.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Bluetooth_ESP32_BLE_GATT_SPP_Client.fcfx