mqttPendingCount (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

4.10 / 1.00.00


This function will return the number of messages that has not been sent yet.

This can be used to verify that all messages have been sent.

 

 

Input:

handle : INT

The handle to the MQTT connection.

 

Returns: SINT

The number of pending messages.

-1

- Invalid MQTT connection.

 

Declaration:

FUNCTION mqttPendingCount : SINT;
VAR_INPUT
  handle   : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  mqtt : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  // Clear any pending messages
  IF mqttPendingCount(handle:=mqtt) > 0 THEN
    mqttPendingClear(handle:=mqtt);
  END_IF;
  ...
END;
 
END_PROGRAM;