rchReceivePacketDone (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

2.10 / 1.00.00


This function works differently depending on the mode (see rchPacketMode).

This function works similarly to gwReceivePacketDone.

 

When in unbuffered mode, this function releases the data packet and sends a reply to the sender. In buffered mode, this function has no effect as the reply was already sent by the firmware.

 

It is very important to use this function after calling the rchReceivePacket function block. Otherwise no further data packets will be received.

 

 

Input:

reply : INT (0,128..255)

Reply code returned to the sender.

Returning 0 (zero) indicates success and values 128..255 are reserved for user-defined return codes.

Other values will result in packet rejection (return code 4).

 

 

Returns: INT

0

- Success.

1

- Not ready to receive data packets.

2

- No data packet received.

 

Declaration:

FUNCTION rchReceivePacketDone : INT;
VAR_INPUT
   reply : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
   incoming : rchReceivePacket;
   buffer   : ARRAY [1..480] OF SINT;
END_VAR;
 
// Set address BEFORE the 'incoming' is called the first time!
incoming.buffer    := ADDR(buffer);
incoming.maxlength := SIZEOF(buffer);
 
gsmPower(power := TRUE);
netOpen(iface:=1);
rchPacketMode(mode := 1);
 
BEGIN
   ...
   // Check for incoming packets
   incoming();
   IF incoming.sender > 0 THEN
      // A packet is received
      ...
      rchReceivePacketDone(reply := 128);
   END_IF;
   ...
END;
END_PROGRAM;