Component: IoT Made Easy (Comms: IoT/Cloud)
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | Comms: IoT/Cloud |
Contents
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
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
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
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
GetPayloadInteger
Get the Payload of the last received (Read) packet as a signed long value
Parameters
- This macro has no parameters
Return value
LastError
Returns the last error
Parameters
- This macro has no parameters
Return value
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
Disconnect
Disconnects from the MQTT server and the network
Parameters
- This macro has no parameters
Return value
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
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
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
GetPayloadFloat
Get the Payload of the last received (Read) packet as a floating point value
Parameters
- This macro has no parameters
Return value
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
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