Difference between revisions of "Unit Bluetooth"

From Ultibo.org
Jump to: navigation, search
Line 237: Line 237:
 
----
 
----
  
''To be documented''
+
 
 +
'''Bluetooth device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PBluetoothDevice = ^TBluetoothDevice;</code>
 +
 
 +
<code>TBluetoothDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Bluetooth device
 +
|-
 +
|colspan="2"|''Bluetooth Properties''
 +
|-
 +
| <code>BluetoothId:LongWord;</code>
 +
| Unique Id of this Bluetooth in the Bluetooth device table
 +
|-
 +
| <code>BluetoothState:LongWord;</code>
 +
| Bluetooth device state (eg BLUETOOTH_STATE_ATTACHED)
 +
|-
 +
| <code>BluetoothStatus:LongWord;</code>
 +
| Bluetooth device status (eg BLUETOOTH_STATUS_BOUND)
 +
|-
 +
| <code>Host:PBluetoothHost;</code>
 +
| Host controller this Bluetooth device is connected to (Set by Bluetooth core)
 +
|-
 +
| <code>Driver:PBluetoothDriver;</code>
 +
| Driver this Bluetooth device is bound to, if any (Set by Bluetooth core)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Bluetooth device lock
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PBluetoothDevice;</code>
 +
| Previous entry in Bluetooth device table
 +
|-
 +
| <code>Next:PBluetoothDevice;</code>
 +
| Next entry in Bluetooth device table
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Bluetooth device bind callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDeviceBind = function(Device:PBluetoothDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth device unbind callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDeviceUnbind = function(Device:PBluetoothDevice; Driver:PBluetoothDriver):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth device enumeration callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDeviceEnumerate = function(Device:PBluetoothDevice; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|} 
 +
 +
'''Bluetooth device notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth driver enumeration callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDriverEnumerate = function(Driver:PBluetoothDriver; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth driver bind callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDriverBind = function(Device:PBluetoothDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth driver unbind callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothDriverUnbind = function(Device:PBluetoothDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth driver'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PBluetoothDriver = ^TBluetoothDriver;</code>
 +
 
 +
<code>TBluetoothDriver = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Driver:TDriver;</code>
 +
| The Driver entry for this Bluetooth Driver
 +
|-
 +
|colspan="2"|''Bluetooth Properties''
 +
|-
 +
| <code>DriverBind:TBluetoothDriverBind;</code>
 +
| A Driver specific DriverBind method implementing the standard Bluetooth driver interface
 +
|-
 +
| <code>DriverUnbind:TBluetoothDriverUnbind;</code>
 +
| A Driver specific DriverUnbind method implementing the standard Bluetooth driver interface
 +
|-
 +
|colspan="2"|''Interface Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Driver lock
 +
|-
 +
| <code>Properties:TAudioProperties;</code>
 +
| Device properties
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PBluetoothDriver;</code>
 +
| Previous entry in Driver table
 +
|-
 +
| <code>Next:PBluetoothDriver;</code>
 +
| Next entry in Driver table
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
'''Bluetooth host enumeration callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothHostEnumerate = function(Host:PBluetoothHost; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth host notification callback'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothHostNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth host start'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothHostStart = function(Host:PBluetoothHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''Bluetooth host stop'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothHostStop = function(Host:PBluetoothHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''Bluetooth host reset'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothHostReset = function(Host:PBluetoothHost):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Bluetooth host'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PBluetoothHost = ^TBluetoothHost;</code>
 +
 
 +
<code>TBluetoothHost = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Bluetooth Host
 +
|-
 +
|colspan="2"|''Bluetooth Properties''
 +
|-
 +
| <code>HostId:LongWord;</code>
 +
| Unique Id of this Host in the Host table
 +
|-
 +
| <code>HostState:LongWord;</code>
 +
| Host state (eg BLUETOOTHHOST_STATE_ENABLED)
 +
|-
 +
| <code>HostStart:TBluetoothHostStart;</code>
 +
| A Host specific HostStart method implementing the standard Bluetooth host interface
 +
|-
 +
| <code>HostStop:TBluetoothHostStop;</code>
 +
| A Host specific HostStop method implementing the standard Bluetooth host interface
 +
|-
 +
| <code>HostReset:TBluetoothHostReset;</code>
 +
| A Host specific HostReset method implementing the standard Bluetooth host interface
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Host lock
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PBluetoothHost;</code>
 +
| Previous entry in Host table
 +
|-
 +
| <code>Next:PBluetoothHost;</code>
 +
| Next entry in Host table
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
'''Bluetooth log output'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TBluetoothLogOutput = procedure(const AText:String; Data:Pointer);</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===

Revision as of 04:21, 10 November 2025

Return to Unit Reference


Description


Ultibo Bluetooth interface unit

Constants



Bluetooth device, driver and host specific constants BLUETOOTH_*
BLUETOOTH_DEVICE_PREFIX = 'Bluetooth'; Name prefix for Bluetooth Devices
BLUETOOTH_DRIVER_PREFIX = 'Bluetooth'; Name prefix for Bluetooth Drivers
BLUETOOTH_HOST_PREFIX = 'BluetoothHost'; Name prefix for Bluetooth Hosts
BLUETOOTH_DRIVER_NAME = 'Bluetooth USB HCI Driver'; Name of Bluetooth USB driver


Bluetooth device types BLUETOOTH_TYPE_*
BLUETOOTH_TYPE_NONE = 0;  
BLUETOOTH_TYPE_MAX = 0;  
 
BLUETOOTH_TYPE_NAMES:array[BLUETOOTH_TYPE_NONE..BLUETOOTH_TYPE_MAX] of String = ('BLUETOOTH_TYPE_NONE');


Bluetooth device states BLUETOOTH_STATE_*
BLUETOOTH_STATE_DETACHED = 0;  
BLUETOOTH_STATE_DETACHING = 1;  
BLUETOOTH_STATE_ATTACHING = 2;  
BLUETOOTH_STATE_ATTACHED = 3;  
 
BLUETOOTH_STATE_MAX = 3;  
 
BLUETOOTH_STATE_NAMES:array[BLUETOOTH_STATE_DETACHED..BLUETOOTH_STATE_MAX] of String = ('BLUETOOTH_STATE_DETACHED', 'BLUETOOTH_STATE_DETACHING', 'BLUETOOTH_STATE_ATTACHING', 'BLUETOOTH_STATE_ATTACHED');


Bluetooth device status BLUETOOTH_STATUS_*
BLUETOOTH_STATUS_UNBOUND = 0;  
BLUETOOTH_STATUS_BOUND = 1;  
 
BLUETOOTH_STATUS_MAX = 1;  
 
BLUETOOTH_STATUS_NAMES:array[BLUETOOTH_STATUS_UNBOUND..BLUETOOTH_STATUS_MAX] of String = ('BLUETOOTH_STATUS_UNBOUND', 'BLUETOOTH_STATUS_BOUND');


Bluetooth device flags BLUETOOTH_FLAG_*
BLUETOOTH_FLAG_NONE = $00000000;  


Bluetooth host types BLUETOOTHHOST_TYPE_*
BLUETOOTHHOST_TYPE_NONE = 0;  
BLUETOOTHHOST_TYPE_UART = 1; Bluetooth HCI over RS232 with RTS/CTS flow control for reliable delivery
BLUETOOTHHOST_TYPE_USB = 2; Bluetooth HCI over USB
BLUETOOTHHOST_TYPE_SDIO = 3; Bluetooth HCI over SDIO
BLUETOOTHHOST_TYPE_3WIRE = 4; Bluetooth HCI over 3 wire UART (TX/RX/GND only with RTS/CTS optional)
 
BLUETOOTHHOST_TYPE_MAX = 4;  
 
BLUETOOTHHOST_TYPE_NAMES:array[BLUETOOTHHOST_TYPE_NONE..BLUETOOTHHOST_TYPE_MAX] of String = ('BLUETOOTHHOST_TYPE_NONE', 'BLUETOOTHHOST_TYPE_UART', 'BLUETOOTHHOST_TYPE_USB', 'BLUETOOTHHOST_TYPE_SDIO', 'BLUETOOTHHOST_TYPE_3WIRE');


Bluetooth host states BLUETOOTHHOST_STATE_*
BLUETOOTHHOST_STATE_DISABLED = 0;  
BLUETOOTHHOST_STATE_ENABLED = 1;  
 
BLUETOOTHHOST_STATE_MAX = 1;  
 
BLUETOOTHHOST_STATE_NAMES:array[BLUETOOTHHOST_STATE_DISABLED..BLUETOOTHHOST_STATE_MAX] of String = ('BLUETOOTHHOST_STATE_DISABLED', 'BLUETOOTHHOST_STATE_ENABLED');


Bluetooth host flags BLUETOOTHHOST_FLAG_*
BLUETOOTHHOST_FLAG_NONE = $00000000;  
BLUETOOTHHOST_FLAG_SHARED = $00000001;  
BLUETOOTHHOST_FLAG_NOCACHE = $00000002;  


Bluetooth status codes BLUETOOTH_STATUS_*
BLUETOOTH_STATUS_SUCCESS = 0; Function successful
BLUETOOTH_STATUS_DEVICE_DETACHED = 1; Bluetooth device was detached
BLUETOOTH_STATUS_DEVICE_UNSUPPORTED = 2; Bluetooth device is unsupported by the driver
BLUETOOTH_STATUS_HARDWARE_ERROR = 3; Hardware error of some form occurred
BLUETOOTH_STATUS_INVALID_DATA = 4; Invalid data was received
BLUETOOTH_STATUS_INVALID_PARAMETER = 5; An invalid parameter was passed to the function


Bluetooth logging BLUETOOTH_LOG_*
BLUETOOTH_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; Bluetooth debugging messages
BLUETOOTH_LOG_LEVEL_INFO = LOG_LEVEL_INFO; Bluetooth informational messages, such as a device being attached or detached
BLUETOOTH_LOG_LEVEL_WARN = LOG_LEVEL_WARN; Bluetooth warning messages
BLUETOOTH_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; Bluetooth error messages
BLUETOOTH_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No Bluetooth messages


Type definitions



Bluetooth device

PBluetoothDevice = ^TBluetoothDevice;

TBluetoothDevice = record

Device Properties
Device:TDevice; The Device entry for this Bluetooth device
Bluetooth Properties
BluetoothId:LongWord; Unique Id of this Bluetooth in the Bluetooth device table
BluetoothState:LongWord; Bluetooth device state (eg BLUETOOTH_STATE_ATTACHED)
BluetoothStatus:LongWord; Bluetooth device status (eg BLUETOOTH_STATUS_BOUND)
Host:PBluetoothHost; Host controller this Bluetooth device is connected to (Set by Bluetooth core)
Driver:PBluetoothDriver; Driver this Bluetooth device is bound to, if any (Set by Bluetooth core)
Driver Properties
Lock:TMutexHandle; Bluetooth device lock
Internal Properties
Prev:PBluetoothDevice; Previous entry in Bluetooth device table
Next:PBluetoothDevice; Next entry in Bluetooth device table

Bluetooth device bind callback

TBluetoothDeviceBind = function(Device:PBluetoothDevice):LongWord;

Bluetooth device unbind callback

TBluetoothDeviceUnbind = function(Device:PBluetoothDevice; Driver:PBluetoothDriver):LongWord;

Bluetooth device enumeration callback

TBluetoothDeviceEnumerate = function(Device:PBluetoothDevice; Data:Pointer):LongWord;

Bluetooth device notification callback

TBluetoothDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Bluetooth driver enumeration callback

TBluetoothDriverEnumerate = function(Driver:PBluetoothDriver; Data:Pointer):LongWord;

Bluetooth driver bind callback

TBluetoothDriverBind = function(Device:PBluetoothDevice):LongWord;

Bluetooth driver unbind callback

TBluetoothDriverUnbind = function(Device:PBluetoothDevice):LongWord;

Bluetooth driver

PBluetoothDriver = ^TBluetoothDriver;

TBluetoothDriver = record

Driver Properties
Driver:TDriver; The Driver entry for this Bluetooth Driver
Bluetooth Properties
DriverBind:TBluetoothDriverBind; A Driver specific DriverBind method implementing the standard Bluetooth driver interface
DriverUnbind:TBluetoothDriverUnbind; A Driver specific DriverUnbind method implementing the standard Bluetooth driver interface
Interface Properties
Lock:TMutexHandle; Driver lock
Properties:TAudioProperties; Device properties
Internal Properties
Prev:PBluetoothDriver; Previous entry in Driver table
Next:PBluetoothDriver; Next entry in Driver table


Bluetooth host enumeration callback

TBluetoothHostEnumerate = function(Host:PBluetoothHost; Data:Pointer):LongWord;

Bluetooth host notification callback

TBluetoothHostNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Bluetooth host start

TBluetoothHostStart = function(Host:PBluetoothHost):LongWord;

Bluetooth host stop

TBluetoothHostStop = function(Host:PBluetoothHost):LongWord;

Bluetooth host reset

TBluetoothHostReset = function(Host:PBluetoothHost):LongWord;

Bluetooth host

PBluetoothHost = ^TBluetoothHost;

TBluetoothHost = record

Device Properties
Device:TDevice; The Device entry for this Bluetooth Host
Bluetooth Properties
HostId:LongWord; Unique Id of this Host in the Host table
HostState:LongWord; Host state (eg BLUETOOTHHOST_STATE_ENABLED)
HostStart:TBluetoothHostStart; A Host specific HostStart method implementing the standard Bluetooth host interface
HostStop:TBluetoothHostStop; A Host specific HostStop method implementing the standard Bluetooth host interface
HostReset:TBluetoothHostReset; A Host specific HostReset method implementing the standard Bluetooth host interface
Driver Properties
Lock:TMutexHandle; Host lock
Internal Properties
Prev:PBluetoothHost; Previous entry in Host table
Next:PBluetoothHost; Next entry in Host table


Bluetooth log output

TBluetoothLogOutput = procedure(const AText:String; Data:Pointer);


Public variables


To be documented

Function declarations


To be documented


Return to Unit Reference