Component: MQTT Client (Comms: System)
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | Comms: System |
Contents
MQTT Client component
A component providing access to MQTT IoT client. The client can connect to a MQTT server such as ThingSpeak. Allowing IoT type data to be published and read back.
Examples
No additional examples
Downloadable macro reference
GetTopic
Get the Topic of the last received (Read) packet.
Returns the number of bytes for the Topic
Parameters
- <- STRING Topic
- This parameter may be returned back to the caller
- BYTE Size
- Byte count the Topic buffer
Return value
ErrorAsString
No additional information
Parameters
- BYTE Error
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
Publish
Publish data to the server (broker)
Returns non-zero if successful
Parameters
- <- STRING Topic
- This parameter may be returned back to the caller
- <- STRING Payload
- This parameter may be returned back to the caller
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 GetTopic and GetPayload 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
Ping
Ping packet is sent to the Server and checks for a reply.
Returns non-zero value if successful
Parameters
- This macro has no parameters
Return value
GetPayload
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
Subscribe
Subscribe to a Topic.
Must be Connected first
Returns non-zero if successful
Parameters
- <- STRING Topic
- This parameter may be returned back to the caller
Return value
Unsubscribe
Unsubscribe from a Topic.
Must be Connected first
Returns non-zero if successful
Parameters
- <- STRING Topic
- This parameter may be returned back to the caller
Return value
Initialise
No additional information
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 HOST.
Address of MQTT Broker
Port
This property is of type Unsigned integer and can be referenced with the variable name PORT.
Port used by MQTT Broker
Client identifier
This property is of type Line of text and can be referenced with the variable name CLIENT.
Client identifier
Network Timeout
This property is of type Unsigned integer and can be referenced with the variable name 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 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 NETWORK_COMPONENT.
Pointer to the network communications component providing TCP simulation and abstraction for embedded
TCP modules.