MVI56E-LDM-MQTT ♦ MQ Telemetry Transport
ControlLogix® Platform
10.2 Main API Functions and Data Flow
10.2.1 Functions Implemented by the Library
The functions defined in the header file C:\Workspace\mqtt-ldm\mqtt-ldm-
lib\inc\mqtt-ldm-lib.h are shown in the following examples. They are expected
to be called from the user application:
int mqtt_ldm_initialize(const char* path_to_config_file);
This function should be called once at application start-up to initialize internal
structures and start its threads.
Its input argument is a path to the JSON configuration file.
If successful, the function returns 0.
int mqtt_ldm_connect(void);
This function connects to the MQTT Broker.
If successful, the function returns 0.
int mqtt_ldm_disconnect(void);
This function disconnects from the MQTT Broker.
int mqtt_ldm_is_connected(void);
Returns a non-zero value if a connection to the MQTT Broker is established.
int mqtt_ldm_is_connecting(void);
Returns a non-zero value if a connection to the MQTT Broker is in progress.
int mqtt_ldm_clean(void);
Frees resources used by the MQTT-LDM library and by the AWS IoT SDK, it
should be called before application exit.
uint32_t get_tick_count(void);
Helper function. Returns number of ticks since computer start, in milliseconds.
int mqtt_ldm_poll(void);
This function must be called by the user application in a continuous loop. It reads
the current value for each tag (by calling function mqtt_read_value) and if the
value is changed, it publishes it on the MQTT broker.
void ldm_log(enum ldm_log_level log_level, const char *format, ...);
Used by the user application to log messages into log file. Passed arguments are
log-level, C style format string, and optional data to log.
ProSoft Technology, Inc.
MQTT-LDM Library
Quick Start Guide
Page 49 of 55
Need help?
Do you have a question about the MVI56E-LDM-MQTT and is the answer not in the manual?