btMakeDiscoverable (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, NX-400, NX-900

Firmware version:

1.10.00

 


 

This function can make the device discoverable, i.e. visible for other devices.

With this function, it is possible to make the device visible for a period of time when e.g. a DIP switch is toggled, an SMS is received or a button is pushed on a menu.

Alternatively the device can be kept visible at all times.

 

Input:

discoverable : BOOL (default TRUE)

Set to TRUE to make the device visible, set to FALSE to make the device stop being visible immediately.

 

timeout : DINT (default 60)

The timeout in seconds before turning invisible again. If set to 0, it will stay visible until btMakeDiscoverable is called with discoverable set to FALSE.

 

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).

-5

-

_BT_ERR_NO_ADAP


Could not find adapter.

-17

-

_BT_ERR_TIMEOUT


Timeout.

 

 

Declaration:

FUNCTION btMakeDiscoverable : INT;
VAR_INPUT
  timeout         : DINT := 60;
  discoverable    : BOOL := TRUE;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
// Turn on the Bluetooth library
btPower();
 
BEGIN
  ...
  // Make device visible for 30 seconds
  btMakeDiscoverable(timeout := 30);
  ...
END;
 
END_PROGRAM;