Description
The ConnectLE command is responsible
for connecting to an LE device. This command returns zero if successful and a
negative value if an error occurred. This command calls the ConnectLEDevice
(unsigned in BluetoothStackID, BD_ADDR_t BD_ADDR, Boolean_t UseWhiteList) function
using ConnectLEDevice (BluetoothStackID, BD_ADDR, FALSE).
Parameters
The only parameter required is the
Bluetooth Address of the remote device. This can easily be found using the
StartScanning command if the advertising device is in proximity during the scan.
Command Call Examples
- “ConnectLE 001bdc05b617” Attempts
to send a connection request to the Bluetooth device with the BD_ADDR of
001bdc05b617.
- “ConnectLE 000275e126FF” Attempts
to send a connection request to the Bluetooth device with the BD_ADDR of
000275e126FF.
Possible Return Values
- (0) Successfully Set Pairability Mode
- (-4) FUNCTION_ERROR
- (-6) INVALID_PARAMETERS_ERROR
- (-8) INVALID_STACK_ID_ERROR
- (-116) BTPS_ERROR_RANDOM_ADDRESS_IN_USE
- (-111) BTPS_ERROR_CREATE_CONNECTION_OUTSTANDING
- (-66) BTPS_ERROR_INSUFFICIENT_RESOURCES
- (-2) BTPS_ERROR_INVALID_BLUETOOTH_STACK_ID
- (-1) BTPS_ERROR_INVALID_PARAMETER
- (-56) BTPS_ERROR_GAP_NOT_INITIALIZED
- (-104) BTPS_ERROR_LOCAL_CONTROLLER_DOES_NOT_SUPPORT_LE
- (-57) BTPS_ERROR_DEVICE_HCI_ERROR
- GAP_LE_ERROR_WHITE_LIST_IN_USE
API Calls
- GAP_LE_Create_Connection(BluetoothStackID, 100, 100,
Result?fpNoFilter:fpWhiteList, latPublic, Result?&BD_ADDR:NULL,
latPublic, &ConnectionParameters,GAP_LE_Event_Callback, 0)
- GAP_LE_Remove_Device_From_White_List(BluetoothStackID, 1,
&WhiteListEntry, &WhiteListChanged)
- GAP_LE_Add_Device_To_White_List(BluetoothStackID, 1,
&WhiteListEntry, &WhiteListChanged)
Note: These two APIs can generally be ignored unless the
WhiteList is enabled in the call to ConnectLEDevice.
API Prototypes
- int BTPSAPI
GAP_LE_Create_Connection(unsigned int BluetoothStackID, unsigned int
ScanInterval, unsigned int ScanWindow, GAP_LE_Filter_Policy_t
InitatorFilterPolicy,GAP_LE_Address_Type_t RemoteAddressType, BD_ADDR_t
*RemoteDevice, GAP_LE_Address_Type_t LocalAddressType,
GAP_LE_Connection_Parameters_t*ConnectionParameters, GAP_LE_Event_Callback_t
GAP_LE_Event_Callback, unsigned long CallbackParameter)
- int BTPSAPI
GAP_LE_Remove_Device_From_White_List( unsigned int BluetoothStackID,
unsigned int DeviceCount, GAP_LE_White_List_Entry_t *WhiteListEntries,
unsigned int*RemovedDeviceCount)
- int BTPSAPI
GAP_LE_Add_Device_To_White_List(unsigned int BluetoothStackID, unsigned int
DeviceCount, GAP_LE_White_List_Entry_t *WhiteListEntries, unsigned
int*AddedDeviceCount)
Description of API
The GAP_LE_Create_Connection function
is provided to allow the local host the ability to create a connection to a remote
device using the Bluetooth LE radio. The connection process is asynchronous in
nature and the caller is notified via the GAP LE event callback function (specified
in this function) when the connection completes. This function returns zero if
successful, or a negative return error code if there is an error condition. The
GAP_LE_Remove_Device_From_White_List function is provided to allow the local host
the ability to remove one (or more) devices from the white list maintained by the
local device. This function attempts to delete as many devices as possible (from the
specified list) and returns the number of devices deleted. The
GAP_LE_Read_White_List_Size function can be used to determine how many devices the
local device supports in the white list (simultaneously).