rfbcTemperatureEventReceive (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 temperature notification event received.

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

 

 

Input:

None.

 

Output:

temperature : INT

The measured temperature in 1/10 deg. Celsius.

 

humidity : INT

Humidity reported by remote device if supported.

Note: not all temperature sensors report humidity, and in these cases, it will be -9999.

 

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 rfbcTemperatureEventReceive : INT;
VAR_INPUT
  temperature  : ACCESS INT;
  humidity     : ACCESS INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
//-----------------------------------------------------------------------------
// FUNCTION GetTemperatureEvent
//-----------------------------------------------------------------------------
FUNCTION GetTemperatureEvent;
VAR_INPUT
  id : DINT;
END_VAR;
VAR
  temperature : INT;
  humidity    : INT;
END_VAR;
 
rfbcTemperatureEventReceive(temperature := temperature, humidity := humidity);
IF humidity >= 0 THEN
  DebugFmt(message := "Temperature received from \4 : \1/10 (\2)",
          v1 := temperature, v2 := humidity, v4 := id);
ELSE
  DebugFmt(message := "Temperature received from \4 : \1/10",
          v1 := temperature, v4 := id);
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
    ...
    7 : GetTemperatureEvent(id := hisId);
    ...
  ELSE
    DebugFmt(message := "rfbcWaitEvent - event=\1", v1 := event);
  END_CASE;
END_WHILE;
END_THREAD_BLOCK;