rfbcSendAck (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

2.86 / 1.51.00


This function will send a default acknowledgment packet based on the last received event.

Acknowledgments are always sent even if the last message was a broadcast or the interface is configured not to send acknowledgments (see rfbcSetConfig).

 

Note: acknowledgments should be sent as soon as possible to avoid the sender repeating the message.

 

Input:

None.

 

Output:

None.

 

Returns: INT

0

-

Success

-1

-

Interface is not open (see rfbcOpen).

-4

-

RF communication is not available.

 

Declaration:

FUNCTION rfbcSendAck : INT;
 

Example:

INCLUDE rtcu.inc
 
//-----------------------------------------------------------------------------
// THREAD_BLOCK rfbcMonitor
//-----------------------------------------------------------------------------
THREAD_BLOCK rfbcMonitor;
VAR
   event       : INT := 0;
   hisId       : DINT;
   broadcast   : BOOL;
END_VAR;
 
WHILE event <> -1 DO
   event := rfbcWaitEvent(timeout := -1id := hisIdbroadcast := broadcast);
   CASE event OF
      ...
      100 :
         IF NOT broadcast THEN rfbcSendAck(); END_IF;
         GetRawEvent(id := hisId);
      ...
   ELSE
      DebugFmt(message := "rfbcWaitEvent - event=\1", v1 := event);
   END_CASE;
END_WHILE;
END_THREAD_BLOCK;