btDeviceProfileDisconnect (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.10.00

 


 

This function disconnects a Profile from a remote device.

 

Input:

dev : STRING

The address of the device to disconnect from.

 

UUID : STRING

The UUID of the profile to disconnect. If empty, the default SPP profile will be used.

 

 

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.

-12

-

_BT_ERR_BUSY


Profile already disconnected.

 

 

 

Declaration:

FUNCTION btDeviceProfileDisconnect : INT;
VAR_INPUT
   dev      : STRING;
   UUID     : 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 SPP on <address>.
   rc := btDeviceProfileDisconnect(dev:=address);
   DebugFmt(message:="btDeviceProfileDisconnect "+address+": \1", v1:=rc);
   ...
END;
 
END_PROGRAM;