使用BG96和MQTT协议将数据发布到AWS IoT时连接断开

时间:2019-06-18 07:43:14

标签: amazon-web-services ssl mqtt aws-iot quectel

我试图将BG96连接到亚马逊服务器,但是一旦通信打开(AT + QMTOPEN = ... return + QMTOPEN:1.0),如果我尝试与对象连接(AT + QMTCONN = 1, “ thingname”)回答“确定”,然后回复+ QMTSTAT:1,1(连接断开)。

与其他设备(树莓派或arduino)的连接没有问题,因此对于该主题,我将排除服务器端配置问题: error when publish data to aws IoT using BG96 and MQTT protocol

这些是AT-命令:

AT+QSSLCFG="ciphersuite",1,0x0035
OK
AT+QSSLCFG="cacert",1,"ufs:cacert.pem"
OK
AT+QSSLCFG="clientcert",1,"ufs:clientcert.pem"
OK
AT+QSSLCFG="clientkey",1,"ufs:clientkey.pem"
OK
AT+QSSLCFG="sslversion",1,4
OK
AT+QSSLCFG="seclevel",1,2
OK
AT+QSSLCFG="negotiatetime",1,300
OK
AT+QSSLCFG="ignorelocaltime",1,0
OK
AT+QICSGP=1,1,"wap.tim.it"
OK
AT+QICSGP=1
+QICSGP: 1,"wap.tim.it","","",1
OK
AT+QIACT?
+QIACT: 1,1,1,"***.**.**.***"
OK
AT+QMTOPEN=1,"**************.iot.us-east-2.amazonaws.com",8443
OK
+QMTOPEN: 1,0
AT+QMTCONN=1,"thingName"
OK
+QMTSTAT: 1,1

1 个答案:

答案 0 :(得分:0)

我发现了问题,这是将MQT和TLS BG96模块连接到Amazon AWS的正确代码:

AT+QICSGP=1,1,"Your APN"
OK
AT+QICSGP=1
+QICSGP: 1,"wap.tim.it","","",1
OK
AT+QIACT=1
OK
AT+QIACT?
+QIACT: 1,1,1,"***.***.***.***"
OK
AT+QMTCFG="SSL", 1, 1, 1
OK
AT+QSSLCFG="cacert",1,"ufs:cacert.pem"
OK
AT+QSSLCFG="clientcert",1,"ufs:clientcert.pem"
OK
AT+QSSLCFG="clientkey",1,"ufs:clientkey.pem"
OK
AT+QSSLCFG="sslversion",1,4
OK
AT+QSSLCFG="seclevel",1,2
OK
AT+QSSLCFG="ciphersuite",1,0xFFFF
OK
AT+QSSLCFG="ignorelocaltime",1
+QSSLCFG: "ignorelocaltime",1,1
AT+QMTOPEN=1,"*********.iot.us-east-2.amazonaws.com",8883
OK
+QMTOPEN: 1,0
AT+QMTCONN=1,"YOUR_THING_NAME"
OK
+QMTCONN: 1,0,0
AT+QMTSUB=1,1,"YOUR_TOPIC",1
OK    
+QMTSUB: 1,1,0,1
AT+QMTPUBEX=1,1,1,0,"YOUR_TOPIC","TEXT_TO_PUBLISH"
OK
+QMTPUB: 1,1,0