Component: IoT Made Easy (Comms: IoT/Cloud)

From Flowcode Help
Revision as of 09:11, 12 October 2020 by BenR (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Comms: IoT/Cloud


Image IoT Made Easy component

A component designed to simplify MQTT comms allowing for multiple data streams to be dealt with in a simple manner. Deals with translating values to and from the broker from topic strings into message IDs and numeric values. Works with lots of different MQTT brokers.

Examples

No additional examples


Downloadable macro reference

ErrorAsString

No additional information


Parameters

BYTE Error


Return value

STRING


PublishString

Publishes data to the selected topic ID using a data string.

Returns none zero if successful

Parameters

BYTE TopicID
The topic ID to publish data to
<- STRING Data
Data string to publish
This parameter may be returned back to the caller


Return value

BYTE


GetTopicID

Compares the topic ID of the last received message with enabled IDs.

Returns the topic ID received.

Parameters

This macro has no parameters


Return value

BYTE


Connect

Connect to the MQTT Server.

Returns the connected state.

0 if not connected, 1 if successful connection, or already connected.

Parameters

This macro has no parameters


Return value

BYTE


GetPayloadInteger

Get the Payload of the last received (Read) packet as a signed long value

Parameters

This macro has no parameters


Return value

LONG


LastError

Returns the last error

Parameters

This macro has no parameters


Return value

BYTE


Read

Read incoming data.

Returns non-zero if packet received.

Use GetTopicID and GetPayloadXXX to read the contents.

Parameters

This macro has no parameters


Return value

UINT


Disconnect

Disconnects from the MQTT server and the network

Parameters

This macro has no parameters


Return value

BYTE


PublishFloat

Publishes data to the selected topic ID using a floating point value.

Returns none zero if successful

Parameters

BYTE TopicID
The topic ID to publish data to
FLOAT Data
Data to publish


Return value

BYTE


Ping

Ping packet is sent to the server and checks for a reply.


If nothing is sent or received within the keep alive period then a ping is required to keep the connection to the server active.

Returns non-zero value if successful

Parameters

This macro has no parameters


Return value

BYTE


PublishInteger

Publishes data to the selected topic ID using a signed long integer value.

Returns none zero if successful

Parameters

BYTE TopicID
The topic ID to publish data to
LONG Data
Data to publish


Return value

BYTE


GetPayloadFloat

Get the Payload of the last received (Read) packet as a floating point value

Parameters

This macro has no parameters


Return value

FLOAT


GetPayloadString

Get the Payload of the last received (Read) packet.

Returns the number of bytes for the Payload

Parameters

<- STRING Payload
This parameter may be returned back to the caller
BYTE Size
Byte count the Payload buffer


Return value

BYTE


Initialise

Starts up the MQTT component - call this after initialising the NetworkComms component.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Host

This property is of type Line of text and can be referenced with the variable name MQTT_Client1::HOST.

Address of MQTT Broker

Port

This property is of type Unsigned integer and can be referenced with the variable name MQTT_Client1::PORT.

Port used by MQTT Broker

Client identifier

This property is of type Line of text and can be referenced with the variable name MQTT_Client1::CLIENT.

Client identifier (Maximum length 20 characters)

Network Timeout

This property is of type Unsigned integer and can be referenced with the variable name MQTT_Client1::TIMEOUT.

Maximum time in mS to wait for network responses

Keep Alive

This property is of type Unsigned integer and can be referenced with the variable name MQTT_Client1::KEEP_ALIVE.

The Keep Alive is the maximum time interval that is permitted to elapse

between the point at which the Client finishes transmitting one Control Packet

and the point it starts sending the next, measured in seconds.

Network Component

This property is of type Panel object and can be referenced with the variable name MQTT_Client1::NETWORK_COMPONENT.

Pointer to the network communications component providing TCP simulation and abstraction for embedded

TCP modules.

Authentication

This property is of type Fixed list of ints and can be referenced with the variable name MQTT_Client1::AUTHENTICATION.

No additional information


Number of topics

This property is of type Fixed list of ints and can be referenced with the variable name NumTopics.

Sets the number of data topics that can be sent or received

Topic String

This property is of type Line of text and can be referenced with the variable name Topic0.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType0.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic1.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType1.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic2.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType2.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic3.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType3.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic4.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType4.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic5.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType5.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic6.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType6.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic7.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType7.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic8.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType8.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic9.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType9.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic10.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType10.

No additional information


Topic String

This property is of type Line of text and can be referenced with the variable name Topic11.

No additional information


Topic Type

This property is of type Fixed list of ints and can be referenced with the variable name TopicType11.

No additional information