btleDisconnect (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, NX-400, NX-900

Firmware version:

1.10.00

 


 

This function disconnects from a Bluetooth Low Energy(BLE) device.

 

Input:

dev : STRING

The address of the device to disconnect from.

 

 

Returns: INT

1

-

_BT_OK


Success.

0

-

_BT_ERR_NOT_SUPPORTED


The API is not supported.

-1

-

_BT_ERR_NOT_OPEN


The adapter is not powered(see btPower).

-4

-

_BT_ERR_NOT_FOUND


Could not find device.

 

 

 

Declaration:

FUNCTION btleDisconnect : INT;
VAR_INPUT
  dev      : STRING;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc      : INT;
  address : STRING;
END_VAR;
 
// Turn on the Bluetooth library
btPower();
 
BEGIN
  ...
  // Disconnect from BLE device.
  rc := btleDisconnect(dev:=address);
  DebugFmt(message:="btleDisconnect "+address+": \1", v1:=rc);
  ...
END;
 
END_PROGRAM;