gwReceivePacketDone (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

2.10 / 1.00.00


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

 

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 gwReceivePacket 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 gwReceivePacketDone : INT;
VAR_INPUT
  reply : INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  incoming : gwReceivePacket;
  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);
gprsOpen();
gwPacketMode(mode := 1);
 
BEGIN
  ...
  // Check for incoming packets
  incoming();
  IF incoming.sender > 0 THEN
     // A packet is received
     ...
    gwReceivePacketDone(reply := 128);
  END_IF;
  ...
END;
END_PROGRAM;