rfbcRemoteControlEventReceive (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 remote control event received.

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

 

Note: if configured to send an acknowledgment, then a switch on/off confirmation will be sent based on the button number ("off" for even numbers and "on" for odd numbers).

 

 

Input:

None.

 

Output:

button : SINT

The index of the button that is pressed. On some devices this may also be referred to as a channel number.

 

longPress : BOOL

TRUE

-

The button is pressed and held. The definition of a long press depends on the configuration of the sending remote control device.

FALSE

-

The button is pressed.

 

lowBattery : BOOL

TRUE

-

Battery level of the remote control is low/critical.

FALSE

-

Battery level of the remote control is normal.

 

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 rfbcRemoteControlEventReceive : INT;
VAR_INPUT
  button      : ACCESS SINT;
  longPress   : ACCESS BOOL;
  lowBattery  : ACCESS BOOL;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
//-----------------------------------------------------------------------------
// FUNCTION GetRemoteEvent
//-----------------------------------------------------------------------------
FUNCTION GetRemoteEvent;
VAR_INPUT
  id : DINT;
END_VAR;
VAR
  button   : SINT;
  long     : BOOL;
  low      : BOOL;
END_VAR;
 
rfbcRemoteControlEventReceive(
  button := button, longPress := long, lowBattery := low);
 
DebugFmt(message := "Remote event received from \4", v4 := id);
DebugFmt(message := "   Button  : \1", v1 := button);
IF long THEN
  DebugMsg(message := "   Long    : Yes");
ELSE
  DebugMsg(message := "   Long    : No");
END_IF;
IF low THEN
  DebugMsg(message := "   Battery : Low");
ELSE
  DebugMsg(message := "   Battery : Normal");
END_IF;
 
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
    ...
    4 : GetRemoteEvent(id := hisId);
    ...
  ELSE
    DebugFmt(message := "rfbcWaitEvent - event=\1", v1 := event);
  END_CASE;
END_WHILE;
END_THREAD_BLOCK;