Difference between revisions of "Component: Bluetooth (ESP32 SPP) (Wireless)"

From Flowcode Help
Jump to navigationJump to search
 
(6 intermediate revisions by one other user not shown)
Line 22: Line 22:
  
 
==Detailed description==
 
==Detailed description==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
''No detailed description exists yet for this component''
 
''No detailed description exists yet for this component''
  
 
==Examples==
 
==Examples==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
A simple example file showing how to send and receive data using the ESP32 Bluetooth Serial Port Profile.
 
A simple example file showing how to send and receive data using the ESP32 Bluetooth Serial Port Profile.
Line 70: Line 32:
  
  
The SPP legacy bluetooth mode must be enabled in the ESP32 config file to allow SSP to work. For details please see this [https://www.flowcode.co.uk/forums/viewtopic.php?p=3832#p3832 forum topic].  
+
The SPP legacy bluetooth mode must be enabled in the ESP32 config file to allow SSP to work. For details please see this [https://www.flowcode.co.uk/forums/viewtopic.php?p=12324#p12324 forum topic].  
  
  
 
For problems sending strings or missing data bytes, please see this [https://www.flowcode.co.uk/forums/viewtopic.php?p=4466#p4466 forum topic].
 
For problems sending strings or missing data bytes, please see this [https://www.flowcode.co.uk/forums/viewtopic.php?p=4466#p4466 forum topic].
 +
  
 
==Macro reference==
 
==Macro reference==
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===CheckConnectionStatus===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 
|-
 
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
 
|-
 
| colspan="2" | Sends a string to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveINTArray'''
 
|-
 
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Array to store the incoming data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Maximum number of values to try and receive 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Max amount of time in ms to wait between bytes 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendINTArray'''
 
|-
 
| colspan="2" | Transmits an array of 16-bit INT/UINT values via the Bluetooth peripheral 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Number of 16-bit values to send from the array 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 187: Line 54:
  
  
 +
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
|-
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
+
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===ReceiveArray===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 228: Line 97:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===ReceiveByte===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | Number of bytes to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Device Name
 
|-
 
| colspan="2" | Sets the Bluetooth device friendly name 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Receive Buffer
 
|-
 
| colspan="2" | Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Data Receive Interrupt
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Verbose Debug
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | COM Port
 
|-
 
| colspan="2" | Selects which port to communicate with, only lists ports which are currently available.  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Refresh COM Ports
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Baud
 
|-
 
| colspan="2" | Baud rate passed to the COM port to control the rate of data. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" |  
 
|}==Macro reference==
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 378: Line 116:
  
  
 +
===ReceiveCount===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 
|-
 
|-
| colspan="2" | Sends a string to the Bluetooth serial connection 
+
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===ReceiveINTArray===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 429: Line 164:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===ReceiveString===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendINTArray'''
 
|-
 
| colspan="2" | Transmits an array of 16-bit INT/UINT values via the Bluetooth peripheral 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Number of 16-bit values to send from the array 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckConnectionStatus'''
 
|-
 
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 
|-
 
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
 
|-
 
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Buffer to place received data into 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | Number of bytes to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 575: Line 188:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===SendArray===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Device Name
 
|-
 
| colspan="2" | Sets the Bluetooth device friendly name 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Receive Buffer
 
|-
 
| colspan="2" | Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Data Receive Interrupt
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Verbose Debug
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | COM Port
 
|-
 
| colspan="2" | Selects which port to communicate with, only lists ports which are currently available.  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Refresh COM Ports
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Baud
 
|-
 
| colspan="2" | Baud rate passed to the COM port to control the rate of data. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" |  
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 
|-
 
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
 
|-
 
| colspan="2" | Sends a string to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveINTArray'''
 
|-
 
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Array to store the incoming data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Maximum number of values to try and receive 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Max amount of time in ms to wait between bytes 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendINTArray'''
 
|-
 
| colspan="2" | Transmits an array of 16-bit INT/UINT values via the Bluetooth peripheral 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Number of 16-bit values to send from the array 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckConnectionStatus'''
 
|-
 
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 
|-
 
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
 
|-
 
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Buffer to place received data into 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 817: Line 212:
  
  
 +
===SendByte===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 835: Line 231:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===SendINTArray===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Device Name
 
|-
 
| colspan="2" | Sets the Bluetooth device friendly name 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Receive Buffer
 
|-
 
| colspan="2" | Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Data Receive Interrupt
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Verbose Debug
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | COM Port
 
|-
 
| colspan="2" | Selects which port to communicate with, only lists ports which are currently available.  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Refresh COM Ports
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Baud
 
|-
 
| colspan="2" | Baud rate passed to the COM port to control the rate of data. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" |  
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 
|-
 
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
 
|-
 
| colspan="2" | Sends a string to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveINTArray'''
 
|-
 
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Array to store the incoming data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Maximum number of values to try and receive 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Max amount of time in ms to wait between bytes 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 1,023: Line 260:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===SendString===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckConnectionStatus'''
 
|-
 
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 
|-
 
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
 
|-
 
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Buffer to place received data into 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | Number of bytes to send 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Device Name
 
|-
 
| colspan="2" | Sets the Bluetooth device friendly name 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Receive Buffer
 
|-
 
| colspan="2" | Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Data Receive Interrupt
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Verbose Debug
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | COM Port
 
|-
 
| colspan="2" | Selects which port to communicate with, only lists ports which are currently available.  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Refresh COM Ports
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Baud
 
|-
 
| colspan="2" | Baud rate passed to the COM port to control the rate of data. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" |  
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 
|-
 
| colspan="2" | Attempts to receive a byte from the bluetooth serial port. 0-255 = a valid received value 256 = a timeout has occured 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 1,245: Line 279:
  
  
 +
===SetBTName===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveINTArray'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBTName'''
 
|-
 
|-
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
+
| colspan="2" | Overrides the current friendly name 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
+
| width="90%" | Name
|-
 
| colspan="2" | Array to store the incoming data 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Maximum number of values to try and receive 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Max amount of time in ms to wait between bytes 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendINTArray'''
 
|-
 
| colspan="2" | Transmits an array of 16-bit INT/UINT values via the Bluetooth peripheral 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
+
| colspan="2" | Name you want to use 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Number of 16-bit values to send from the array 
 
|-
 
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" | MSBfirst
 
|-
 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,306: Line 298:
  
  
 +
===Uninitialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckConnectionStatus'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninitialise'''
|-
 
| colspan="2" | Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 
|-
 
| colspan="2" | Collects the number of bytes currently stored in the receive buffer. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
 
 
|-
 
|-
| colspan="2" | Attempts to receive an array of bytes from the bluetooth serial port. Returns the number of bytes received. 
+
| colspan="2" | Shots down the Bluetooth communications SPP service. 
 
|-
 
|-
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Buffer to place received data into 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | Data Array to send 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | Number of bytes to send 
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
 
|-
 
| colspan="2" | Sends a byte to the Bluetooth serial connection 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | MaxBytes
 
|-
 
| colspan="2" | Max number of bytes to try and read within the time 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Number of ms to wait for incoming data 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the Bluetooth communications SPP service. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
  

Latest revision as of 14:48, 20 September 2023

Author Matrix TSL
Version 1.0
Category Wireless


Bluetooth (ESP32 SPP) component

Bluetooth slave component designed to run on a ESP32 providing legacy SPP functionality. BT Legacy functionality must be switched on via the sdkconfig file.

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

A simple example file showing how to send and receive data using the ESP32 Bluetooth Serial Port Profile.

FC6 Icon.png ESP_BT


The SPP legacy bluetooth mode must be enabled in the ESP32 config file to allow SSP to work. For details please see this forum topic.


For problems sending strings or missing data bytes, please see this forum topic.


Macro reference

CheckConnectionStatus

Fc9-comp-macro.png CheckConnectionStatus
Checks to see if the Bluetooth device is connected. Returns 1 if connected. 
Fc9-bool-icon.png - BOOL Return


Initialise

Fc9-comp-macro.png Initialise
Starts up the Bluetooth communications SPP service. 
Fc9-void-icon.png - VOID Return


ReceiveArray

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


ReceiveByte

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


ReceiveCount

Fc9-comp-macro.png ReceiveCount
Collects the number of bytes currently stored in the receive buffer. 
Fc9-u16-icon.png - UINT Return


ReceiveINTArray

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


ReceiveString

Fc9-comp-macro.png ReceiveString
 
Fc9-u16-icon.png - UINT MaxBytes
Max number of bytes to try and read within the time 
Fc9-u16-icon.png - UINT Timeout
Number of ms to wait for incoming data 
Fc9-string-icon.png - STRING Return


SendArray

Fc9-comp-macro.png SendArray
Sends a byte to the Bluetooth serial connection 
Fc9-u8-icon.png - BYTE Data
Data Array to send 
Fc9-u16-icon.png - UINT NumBytes
Number of bytes to send 
Fc9-void-icon.png - VOID Return


SendByte

Fc9-comp-macro.png SendByte
Sends a byte to the Bluetooth serial connection 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


SendINTArray

Fc9-comp-macro.png SendINTArray
Transmits an array of 16-bit INT/UINT values via the Bluetooth peripheral 
Fc9-u16-icon.png - UINT Data
Data Array to send 
Fc9-u8-icon.png - BYTE NumValues
Number of 16-bit values to send from the array 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendString

Fc9-comp-macro.png SendString
Sends a string to the Bluetooth serial connection 
Fc9-string-icon.png - STRING Data
Data Array to send 
Fc9-void-icon.png - VOID Return


SetBTName

Fc9-comp-macro.png SetBTName
Overrides the current friendly name 
Fc9-string-icon.png - STRING Name
Name you want to use 
Fc9-void-icon.png - VOID Return


Uninitialise

Fc9-comp-macro.png Uninitialise
Shots down the Bluetooth communications SPP service. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-10-icon.png Device Name
Sets the Bluetooth device friendly name 
Fc9-type-21-icon.png Receive Buffer
Configures the size of the receive buffer in bytes to store incoming data until we are ready to receive it. 
Fc9-type-7-icon.png Data Receive Interrupt
 
Fc9-type-16-icon.png 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. 
Fc9-conn-icon.png Simulation
Fc9-type-16-icon.png COM Port
Selects which port to communicate with, only lists ports which are currently available.  
Fc9-type-7-icon.png 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. 
Fc9-type-14-icon.png Baud
Baud rate passed to the COM port to control the rate of data. 
Fc9-type-7-icon.png Console Data