rfbcPairRequestReceive (Function)

Top  Previous  Next

Architecture:

X32 / NX32L

Device support:

AX9 pro, CX1 pro/pro-c/warp/warp-c, SX1, AX9 turbo, NX-900, LX5

Firmware version:

2.60 / 1.51.00


This function will return details about the last pair request event received.

To get the ID of the sender related to the event, please call rfbcWaitEvent before this function.

 

As incoming messages are filtered on the receiver address ("0" or our ID), the actual pair data is not stored automatically by the firmware.

Note: the actual pairing is dependent on the current configuration (see rfbcGetConfig/rfbcSetConfig).

 

Note: when pairing with the eQ-3 HM-WDS30-T-O, the actual pair has not taken place no matter the configuration. This device will continuously transmit the current temperature.

 

 

Input:

None.

 

Output:

serialNumber : STRING

The serial number of the device requesting the pairing.

 

Returns: INT

0

-

Ok. Event cleared.

-1

-

Interface is not open (see rfbcOpen).

-4

-

RF communication is not available.

-5

-

Event is not present.

 

Declaration:

FUNCTION rfbcPairRequestReceive : INT;
VAR_INPUT
  serialNumber : ACCESS STRING;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
//-----------------------------------------------------------------------------
// FUNCTION GetPairEvent
//-----------------------------------------------------------------------------
FUNCTION GetPairEvent;
VAR_INPUT
  id : DINT;
END_VAR;
VAR
  serial : STRING;
END_VAR;
  rfbcPairRequestReceive(serialnumber := serial);
  DebugFmt(message := "Device id \4 serial number '" + serial +
                      "' has sent a pairing request.", v4 := id);  
END_FUNCTION;
 
//-----------------------------------------------------------------------------
// THREAD_BLOCK rfbcMonitor
//-----------------------------------------------------------------------------
THREAD_BLOCK rfbcMonitor;
VAR
  event       : INT := 0;
  hisId       : DINT;
  broadcast   : BOOL;
END_VAR;
 
WHILE event <> -1 DO
  event := rfbcWaitEvent(timeout := -1, id := hisId, broadcast := broadcast);
  CASE event OF
    ...
    2 : GetPairEvent(id := hisId);
    ...
  ELSE
    DebugFmt(message := "rfbcWaitEvent - event=\1", v1 := event);
  END_CASE;
END_WHILE;
END_THREAD_BLOCK;