Product
News
Current position:Home > News > Company news
How to Install and Use Mosquitto for Blueone MQTT Gateway Secondary Development
Release time:2018-07-03 09:50:42 Clicks:
MQTT (Message Queuing Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922) publish-subscribe-based messaging protocol. It works on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker.
 
Andy Stanford-Clark of IBM and Arlen Nipper of Cirrus Link authored the first version of the protocol in 1999.
 
Connect
Waits for a connection to be established with the server and creates a link between the nodes.
 
Disconnect
Waits for the MQTT client to finish any work it must do, and for the TCP/IP session to disconnect.
 
Publish
Returns immediately to the application thread after passing the request to the MQTT client.

\ 
Blueone HJ8300 MQTT gateway is an industrial 4G router with SDK compiling software. It provides wireless data transmission for RTU via cellular network.

It supports installing MQTT Mosquitto, SDK secondary development, ROOT authority, integrated cross compiler. Integrated with GCC, GDB, GLIBC lib, it supports C/C++, Python, PHP. It also supports MQTT, SSH, FTP, MySQL. The user can directly access HJ8300 via SSH and compile software and run it on the router. HJ8300 MQTT 4G router supports 4G, WiFi,Ethernet, switch, router DTU, RS232, RS485. It can support RTU remote control, such as PLC, HMI, instruments remote upgrading/debugging.

HJ8300 MQTT gateway secondary develop instructions

Install software mosquitto-1.4.15 and json-c-0.12
Mosquitto provides Windows, Linux and qnx OS version. HJ8300 is Linux OS, so we choose mosquitto linux source code installation.  

HJ8300 MQTT demo adopts json code. Gateway mode used as MQTT client, it can publish and subscribe MQTT message. Programs are compiled with C.

demo program file instructions:
main.c -- main program file
base.h --- header file
Makefile  -- compiled Make file
poll_rftcm_s.txt -- config file, including MQTT server address and port configuration information
MQTT message format:
TOPIC of Gateway publishing message: /ge/MQTT account/gateway MAC/acquisition device address
TOPIC of gateway subscribing message: /gc/MQTT account/gateway MAC/acquisition device address
For example the format is as below when server publish a time message to gateway device:
/ge/bluegw/C2-48-00-00-32-47/82
{ "h":{/* message header */
"T":85,
"ID:1
},
"b":{/* message body */
"cf":3,
"cc":1,/* message command */
"dl":{/* message parameter list */
"week":1,
"hour":12,
"minites":35,
"second":21,
}
}
}
Gateway subscribes a MQTT message: /ge/bluegw/C2-48-00-00-32-47/82, and then once the server or other client-side send this message subject content, the gateway will receive and handle it according to actual situation.
 
Real-world applications
There are several projects that implement MQTT. Examples are:
 
Facebook Messenger. Facebook has used aspects of MQTT in Facebook Messenger for online chat. However, it is unclear how much of MQTT is used or for what.
IECC Scalable, DeltaRail's latest version of their IECC Signaling Control System uses MQTT for communications within the various parts of the system and other components of the signaling system. It provides the underlying communications framework for a system that is compliant with the CENELEC standards for safety-critical communications.
The EVRYTHNG IoT platform uses MQTT as an M2M protocol for millions of connected products.
Amazon Web Services announced Amazon IoT based on MQTT in 2015.
The Open Geospatial Consortium SensorThings API standard specification has a MQTT extension in the standard as an additional message protocol binding. It was demonstrated in a US Department of Homeland Security IoT Pilot.
The OpenStack Upstream Infrastructure's services are connected by an MQTT unified message bus with Mosquitto as the MQTT broker.
Adafruit launched a free MQTT cloud service for IoT experimenters and learners called Adafruit IO in 2015.
Microsoft Azure IoT Hub uses MQTT as its main protocol for telemetry messages.
XIM, Inc. launched an MQTT client called MQTT Buddy in 2017. It's a MQTT app for Android and iOS, but not F-Droid, users available in English, Russian and Chinese languages.
Node-RED supports MQTT nodes as of version 0.14, in order to properly configure TLS connections.
Open-source software home automation platform Home Assistant is MQTT enabled and offers four options for MQTT brokers.
Pimatic home automation framework for Raspberry Pi and based on Node.js offers MQTT plugin providing full support for MQTT protocol.
McAfee OpenDXL is based on MQTT with enhancements to the messaging brokers themselves so that they can intrinsically understand the DXL message format in support of advanced features such as services, request/response (point-to-point) messaging, service fail over, and service zones.

Need further information? Contact us by email: sharleen@industrial4grouter.com or skype: blueonesales.
 

Prev:
Next: