logo资料库

SIM7020 Series_MQTT(S)_Application Note_V1.05.pdf

第1页 / 共19页
第2页 / 共19页
第3页 / 共19页
第4页 / 共19页
第5页 / 共19页
第6页 / 共19页
第7页 / 共19页
第8页 / 共19页
资料共19页,剩余部分请下载后查看
About Document
Version History
Scope
Contents
1 Introduction
1.1 Purpose of the document
1.2 Related documents
1.3 Conventions and abbreviations
2 MQTT Introduction
3 AT Commands for MQTT
4 Bearer Configuration
4.1 PDN Auto-activation
4.2 APN Manual configuration
5 MQTT Synchronization Mode
6 MQTT Examples
6.1 MQTT Connect to a general MQTT server
6.2 MQTT Connect to Alibaba Cloud
7 MQTTS Examples
7.1 MQTTS Connect with AT+CSETCA
7.2 MQTTS Connect to Azure IoT
SIM7020 Series_MQTT(S) _Application Note LPWA Module SIMCom Wireless Solutions Limited Building B, SIM Technology Building, No.633, Jinzhong Road Changning District, Shanghai P.R. China Tel: 86-21-31575100 support@simcom.com www.simcom.com
SIM7020 Series_MQTT(S)_Application Note_V1.05 SIM7020 Series_MQTT(S)_Application Note 1.05 2020.6.10 Release Document Title: Version: Date: Status: GENERAL NOTES SIMCOM OFFERS THIS INFORMATION AS A SERVICE TO ITS CUSTOMERS, TO SUPPORT APPLICATION AND ENGINEERING EFFORTS THAT USE THE PRODUCTS DESIGNED BY SIMCOM. THE INFORMATION PROVIDED IS BASED UPON REQUIREMENTS SPECIFICALLY PROVIDED TO SIMCOM BY THE CUSTOMERS. SIMCOM HAS NOT UNDERTAKEN ANY INDEPENDENT SEARCH FOR ADDITIONAL RELEVANT INFORMATION, INCLUDING ANY INFORMATION THAT MAY BE IN THE CUSTOMER’S POSSESSION. FURTHERMORE, SYSTEM VALIDATION OF THIS PRODUCT DESIGNED BY SIMCOM WITHIN A LARGER ELECTRONIC SYSTEM REMAINS THE RESPONSIBILITY OF THE CUSTOMER OR THE CUSTOMER’S SYSTEM INTEGRATOR. ALL SPECIFICATIONS SUPPLIED HEREIN ARE SUBJECT TO CHANGE. COPYRIGHT THIS DOCUMENT CONTAINS PROPRIETARY TECHNICAL INFORMATION WHICH IS THE PROPERTY OF SIMCOM WIRELESS SOLUTIONS LIMITED COPYING, TO OTHERS AND USING THIS DOCUMENT, ARE FORBIDDEN WITHOUT EXPRESS AUTHORITY BY SIMCOM. OFFENDERS ARE LIABLE TO THE PAYMENT OF INDEMNIFICATIONS. ALL RIGHTS RESERVED BY SIMCOM IN THE PROPRIETARY TECHNICAL INFORMATION ,INCLUDING BUT NOT LIMITED TO REGISTRATION GRANTING OF A PATENT , A UTILITY MODEL OR DESIGN. ALL SPECIFICATION SUPPLIED HEREIN ARE SUBJECT TO CHANGE WITHOUT NOTICE AT ANY TIME. SIMCom Wireless Solutions Limited Building B, SIM Technology Building, No.633 Jinzhong Road, Changning District, Shanghai P.R. China Tel: +86 21 31575100 Email: simcom@simcom.com For more information, please visit: https://www.simcom.com/download/list-863-en.html For technical support, or to report documentation errors, please visit: https://www.simcom.com/ask/ or email to: support@simcom.com Copyright © 2020 SIMCom Wireless Solutions Limited All Rights Reserved. www.simcom.com 2 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 About Document Version History Date 2018.04.10 2018.06.07 2019.05.10 2019.09.09 2020.06.10 Owner Xiaohui.Xu Albert Meng Xiaohui.Xu/Wenjie.lai Xiaohui.Xu Xiaohui.Xu What is new First Release. Revised Add MQTT introduction and SSL sample Add MQTTS connect to Azure IoT All Version V1.00 V1.01 V1.03 V1.04 V1.05 Scope This document applies to the following products Size(mm) Comments Name Type 17.6*15.7 Band 1/3/5/8 SIM7020C NB1 Band 1/3/5/8/20/28 17.6*15.7 SIM7020E NB1 Band 1/3/5/8 NB1 SIM7030 16*18 NB1+GNSS 24*24 SIM7060 Band 5/8 Band 1/2/3/4/5/8/12/13/17/18/19/20/25/26/28/66/70/71/85 SIM7020G NB2 SIM7060G NB2+GNSS 24*24 Band 1/2/3/4/5/8/12/13/17/18/19/20/25/26/28/66/70/71/85 17.6*15.7 www.simcom.com 3 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 Contents About Document .................................................................................................................... 3 Version History ...................................................................................................................................... 3 Scope .................................................................................................................................................... 3 Contents ................................................................................................................................. 4 Introduction ...................................................................................................................... 5 1 1.1 Purpose of the document ............................................................................................................ 5 1.2 Related documents ..................................................................................................................... 5 1.3 Conventions and abbreviations ................................................................................................... 5 2 MQTT Introduction ........................................................................................................... 6 3 AT Commands for MQTT ................................................................................................. 7 4 Bearer Configuration ....................................................................................................... 8 4.1 PDN Auto-activation .................................................................................................................... 8 4.2 APN Manual configuration .......................................................................................................... 9 5 MQTT Synchronization Mode ....................................................................................... 10 6 MQTT Examples ............................................................................................................. 11 6.1 MQTT Connect to a general MQTT server ................................................................................ 11 6.2 MQTT Connect to Alibaba Cloud .............................................................................................. 11 7 MQTTS Examples .......................................................................................................... 13 7.1 MQTTS Connect with AT+CSETCA .......................................................................................... 13 7.2 MQTTS Connect to Azure IoT ................................................................................................... 16 www.simcom.com 4 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 1 Introduction 1.1 Purpose of the document Based on module AT command manual, this document will introduce MQTT(S) application process. Developers could understand and develop application quickly and efficiently based on this document. 1.2 Related documents [1] SIM7020 Series_AT Command Manual 1.3 Conventions and abbreviations In this document, the GSM engines are referred to as following term: ME (Mobile Equipment); MS (Mobile Station); TA (Terminal Adapter); DCE (Data Communication Equipment) or facsimile DCE (FAX modem, FAX board); In application, controlling device controls the GSM engine by sending AT Command via its serial interface. The controlling device at the other end of the serial line is referred to as following term: TE (Terminal Equipment); DTE (Data Terminal Equipment) or plainly "the application" which is running on an embedded system; www.simcom.com 5 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 2 MQTT Introduction MQTT (Message Queue Telemetry Transport) is a messaging protocol based on the publish/subscribe paradigm under the ISO standard (ISO/IEC PRF 20922). It works on the TCP/IP protocol suite and is a publish/subscribe messaging protocol designed for remote devices with poor hardware performance and poor network conditions. The MQTT protocol is a protocol designed for the communication of remote sensors and control devices with limited computing power and working on low-bandwidth, unreliable networks. It has the following main features: 1) Use the publish/subscribe message mode to provide one-to-many message publishing and uncouple the application; 2) Message transmission for shielding the payload content; 3) Provide network connection using TCP/IP; 4) There are three types of message publishing service quality: "At most once," message publishing relies entirely on the underlying TCP/IP network. Message loss or duplication can occur. This level can be used in the following situations, environmental sensor data, loss of a read record does not matter, because there will be a second transmission in the near future. "At least once" to ensure that the message arrives, but message duplication may occur. "Only once" to ensure that the message arrives once. This level can be used in situations where repeated or missing messages can result in incorrect results.    5) Small transmission, low overhead (fixed length of the head is 2 bytes), protocol exchange is minimized to reduce network traffic; 6) Use the Last Will and Testament features to notify the parties about the mechanism of client abort. www.simcom.com 6 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 3 AT Commands for MQTT Command AT+CMQNEW AT+CMQCON AT+CMQDISCON AT+CMQSUB AT+CMQUNSUB AT+CMQPUB +CMQDISCON AT+CMQALICFG AT+CMQALICON AT+CMQTTSNEW AT+CMQTTSNEWEXT AT+CMQAZURECFG AT+CMQAZURECON AT+CMQTSYNC Description New MQTT Send MQTT Connection Packet Disconnect MQTT Send MQTT Subscribe Packet Send MQTT Unsubscribe Packet Send MQTT Publish Packet MQTT Disconnect Indication Configure Alibaba Clound Parameters Send MQTT Connection Packet to Alibaba Cloud New MQTTS New a MQTTS Instance by Multi Packages for a Long Size Command Configure Microsoft Azure IoT Parameters Send MQTT Connection Packet to Azure IoT Configure MQTT Synchronization Mode For detail information, please refer to “SIM7020 Series_AT Command Manual”. www.simcom.com 7 / 19
SIM7020 Series_MQTT(S)_Application Note_V1.05 4 Bearer Configuration Usually module will register PS service automatically. 4.1 PDN Auto-activation //Check RF signal //Check PS service //Example of PDN Auto-activation. //Check SIM card status AT+CPIN? +CPIN: READY OK AT+CSQ +CSQ: 20,0 OK AT+CGREG? +CGREG: 0,1 OK AT+CGACT? +CGACT: 1,1 OK AT+COPS? +COPS: 0,2,"46000",9 OK AT+CGCONTRDP +CGCONTRDP: 1,5,"cmnbiot","100.80.73.123.255.255.255.0" OK //Activated automatically. //Query Network information, operator and network mode 9, NB-IOT network //Attached PS domain and got IP address automatically. www.simcom.com 8 / 19
分享到:
收藏