我正在尝试使用 Quectel M95 GPRS 硬件将设备连接到具有 TLS1.2 安全性的 IBM Bluemix。
有人能帮我解决为什么我无法打开 SSL 连接吗?我得到的 QSSLOPEN 命令响应为“-1”。
命令触发顺序是:
{ "ate0", "OK", 20, 2500, 0 },
{ "at+cpin=?", "OK", 6, 6000, 0 },
{ "at+qinistat", "+QINISTAT: 3", 25, 350, 0 },
{ "at+creg?", "+CREG:", SIM_MAX_REG, 350, 0 },
{ "at+clip=1","OK",5,350, 0 },
{ "at+qaudch=2", "OK", 5, 350, 0 },
{ "at+clvl=50", "OK", 5, 350, 0 },
{ "at+qmic=0,14", "OK", 5, 350, 0 },
{ "ats0=0", "OK", 5, 350, 0 },
{ "at+qspn?", "+QSPN:", 3, 350, 0 },
{ "at+cmgf=1", "OK", 5, 350, 0 },
{ "at+cscs=\"ira\"", "OK", 5, 350, 0 },
{ "at+csmp=49,167,0,241", "OK", 5, 350, 0 },
{ "at+cnmi=2,1,0,1,0", "OK", 5, 350, 0 },
{ "at+qifgcnt=0", "OK", 5, 350, 0 },
{ "at+qimux=1", "OK", 5, 350, 0 },
{ "at+qidnsip=", "OK", 5, 350, 5 },
{ "at+qicsgp=1,", "OK", 5, 350, 2 },
{ "at+qimode=0", "OK", 5, 350, 0 },
{ "at+cgreg?", "+CGREG:", GPRS_MAX_REG, 350, 0 },
{ "at+qiregapp", "OK", 5, 350, 0 },
{ "at+qiact", "OK", 15, 2000, 0 },
{ "at+qindi=1", "OK", 5, 350, 0 }, handle
{ "at+qisde=0", "OK", 5, 350, 0 }, //21 Control
{ "AT+QSSLCFG=\"ignorertctime\",1","OK",5,350, 0 }, //22
{ "AT+QSSLCFG=\"sslversion\",0,4","OK",5,350, 0 }, //22
{ "AT+QSSLCFG=\"ciphersuite\",0,\"0X009C,0X009D\"","OK",5,350, 0 }, //23
{ "AT+QSSLCFG=\"seclevel\",0,1","OK",5,350, 0 }, //24
{ "AT+QSSLCFG=\"seclevel\",0,2","OK",5,350, 0 }, //24
{ "AT+QSSLCFG=\"ctxindex\",0","OK",5,350, 0 }, //24
{ "AT+QSSLCFG=\"cacert\",0,\"RAM:cacert.pem\"","OK",5,350, 0 }, //25
{ "AT+QSSLCFG=\"clientcert\",0,\"RAM:client.pem\"","OK",5,350, 0 }, //26
{ "AT+QSSLCFG=\"clientkey\",0,\"RAM:userkey.pem\"","OK",5,350, 0 }, //26
{ "at+qsslopen=0,0,","+QSSLOPEN:",5, 35000, 3 }, //28 Start
{ "at+qiopen=1,\"tcp\",","CONNECT",3, 1000, 4 }, //29 Start
{ "at+qsslstate", "+QSSLSTATE:", 10, 2500, 0 }, //30
{ "at+qsslsend", ">", 3, 1000, 1 }, //31 Send
{ "at+qisend", ">", 3, 1000, 1 }, //25 Send d
{ "at+qsslrecv=0,0,512", "+QSSLRECV:", 2, 750, 0 }, //32 Read
{ "at+qird=0,1,1,512", "+QIRD:", 2, 750, 0 }, //33 Read
{ "at+qiopen=0,\"tcp\",","CONNECT",5, 5000, 3 }, //22 Start
{ "at+qiopen=1,\"tcp\",","CONNECT",3, 5000, 4 }, //23 Start
{ "at+qistate", "STATE:", 10, 2500, 0 }, //24
{ "at+qisend", ">", 3, 1000, 1 }, //25 Send
{ "at+qisend", ">", 3, 1000, 1 }, //25 Send
{ "at+qird=0,1,0,512", "+QIRD:", 2, 750, 0 }, //26 Read
{ "at+qird=0,1,1,512", "+QIRD:", 2, 750, 0 }, //27 Read
{ "at+qisack","+QISACK",2,1000, 0 }, //34
{ "at+qsslclose=0","CLOSE",8,350, 0 }, //35 Close
{ "at+qiclose=0","CLOSE",8,350, 0 }, //29 Close
{ "at+qiclose=1","CLOSE",8,350, 0 }, //36 Close
{ "at+qccid"," ",5,350, 0 }, //37 Show
{ "at+cnum","+CNUM:",3,350, 0 }, //38
{ "at+qilocip"," ",5,350, 0 }, //39 Get
{ "ata", "OK", 5, 350, 0 }, //40 Answer
{ "ath", "OK", 3, 350, 0 }, //41
{ "atd", "OK", 5, 350, 0 }, //42
{ "at+qcellloc=1", "+QCELLLOC", 3, 2000, 0 }, //43
{ "at+qhttpurl=","CONNECT",10, 500, 0 }, //44 Set
{ "http:// ","OK",6, 500, 0 }, //45 Set
{ "at+qhttpget=60","OK",3, 61000, 0 }, //46 HTTP
{ "at+qhttpread=60","CONNECT",3, 61000, 0 }, //47 Read
{ "at+ctzu=3","OK",3,350, 0 }, //48 Network
{ "at+qnitz=1","OK",3,350, 0 }, //49 Network
{ "at+cclk?","+CCLK:",3,350, 0 }, //50 Clock
{ "at+qmgda=\"del all\"","OK",4,750, 0 }, //51 Delete
{ "at+csq","CSQ:",3,350, 0 }, //52 Read
{ "at+gsn"," ",3,350, 0 }, //53 Read
{ "at+qpowd=0","OK",3,350, 0 }, //54 Power
{ "at+cfun=4","OK",5,350, 0 }, //55 Power
/********** SSL Connection *********/
{ "at+qsslrecv=","+QSSLRECV:",5,350, 0 }, //56 AT+QSSLRECV Retrieve
{ "at+qsslstate","+QSSLSTATE:",5,350, 0 }, //57 AT+QSSLSTATE Query
{ "at+qsecwrite=","CONNECT",3,500, 0 }, //58 AT+QSECWRITE Add a
{ "at+qsecread=","+QSECREAD:",3,500, 0 }, //59 AT+QSECREAD Query
{ "at+qsecdel=","OK",5,350, 0 }, //60 AT+QSECDEL Delete a
我在每个命令的枚举的帮助下触发命令,并尝试以两种模式触发命令:
- 安全性将触发 QSSL CFG 命令。
- 如果没有 TLS1.2 安全性,则将建立没有密码套件的正常 TCPIP 连接。
我在代码中给出了组织 ID、Auth 用户名和 Auth 密码。
所以请帮助我解决这个问题......
此外,如果您能推荐一本好的实用书籍给我,用有关物联网编程的示例来解释编码概念,那将会很有帮助。
答案1
问题已解决。触发顺序正确,我已使用 TLS1.2 安全成功连接到 IBM Bluemix。