|
|
|
|
BTLEConnect (Function) In french: BTLEConnecte Used to connect to a Bluetooth Low Energy device. Two syntaxes are available: - Syntax 1: Locking connection.
- Syntax 2: Non-locking connection. This syntax is used to connect to a Bluetooth device from its physical address. You can for example connect the application to a device whose physical address was stored during a previous detection (with BTLEListDevice) as soon as this device is switched on and/or enters in the detection area of device.
In Windows, this function has no effect. The system automatically determines whether a connection should be opened or not when a request is made. However, you must use BTLEInitialize to set the btleDevice type to a valid status. myDevice is btleDevice BTLEConnect(myDevice)
Syntax
Connecting to a Bluetooth Low Energy device (locking connection) Hide the details
<Result> = BTLEConnect(<Device> [, <Timeout>])
<Result>: Boolean - True if the connection was established,
- False otherwise. ErrorInfo returns more information on the error.
<Device>: btleDevice variable Name of the btleDevice variable that represents the Bluetooth Low Energy device with which the connection will be established. This device was detected by BTLEListDevice. <Timeout>: Optional integer or optional Duration Connection timeout (in milliseconds). If the connection was not established during this timeout, <Result> is set to False. If this parameter is not specified, the default connection timeout is set to 5 seconds. This parameter can be: - an integer corresponding to the number of milliseconds,
- a Duration variable,
- the duration in a readable format (e.g., 1 s or 10 ms).
Connecting to a Bluetooth Low Energy device (non-locking connection) Hide the details
BTLEConnect(<Device> , <WLanguage procedure>)
<Device>: btleDevice variable or character string - Name of the btleDevice variable that represents the Bluetooth Low Energy device with which the connection will be established.
- Identifier of Bluetooth Low Energy device with which the connection will be established (Identifier property of btleDevice type).
Caution: The device must have been identified by BTLEListDevice since the start of application. There is no need for the device to be accessible during the call: the connection will be established as soon as the device is accessible. The procedure will be called whenever the device is switched on and/or whenever it enters in the detection area of device.
<WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback" procedure) that will be called when connecting to the Bluetooth Low Energy device. This procedure has the following format:
PROCEDURE <Procedure name> (<Device>, <Result>) where: - <Device> is a variable of type btleDevice that corresponds to the connected Bluetooth device.
- <Result> is a boolean variable:
- True if the connection was established,
- False otherwise. ErrorInfo returns more information on the error.
Related Examples:
|
Cross-platform examples (WINDEV Mobile): WM Bluetooth 4
[ + ] This example explains how to use the Bluetooth Low Energy functions (Bluetooth LE): BTLExxx. It is an application allowing you to find the nearby BTLE devices, to connect to them and to interact with the proposed services.
|
Business / UI classification: Business Logic Component: wd290android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|