MQTTS-Verify Server 통신연습
MQTT (Message Queuing Telemetry Transport) is a lightweight broker-based publish/subscribe messaging protocol.
It is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol.
It was designed as an extremely lightweight publish/subscribe messaging transport.
It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.
1. 통신시스템: MQTTS – Verify Server
2. 명령시퀀스: MQTTS – Verify Server
No | Command | Response | Description |
1 | PDP Context 설정 | ||
2.1 | AT+CCERTDOWN=”server_ca.pem”,1602 |
|
|
2.2 |
|
||
– | AT+CCERTLIST |
|
|
– | AT+CCERTDELE=”server_ca.pem” |
|
|
3 | AT+CSSLCFG=”sslversion”,0,4 |
|
Set the SSL version of the first SSL context |
4 | AT+CSSLCFG=”authmode”,0,1 |
|
Set the authentication mode(verify server) of the first SSL context |
5 |
AT+CSSLCFG=”cacert”,0, “server_ca.pem” |
|
|
|
|||
|
|||
6 | AT+CMQTTSTART |
+CMQTTSTART: 0 OK |
Start MQTT service, activate PDP context |
7 | AT+CMQTTACCQ=0, “client test0” | OK |
Acquire one client which will connect to a MQTT server without SSL/TLS. |
8 | AT+CMQTTSSLCFG=0,0 | OK |
Set the first SSL context to be used in the SSL connection |
4.1 | AT+CMQTTWILLTOPIC=0,10 | > | Set the topic of the will |
4.2 | >Topic_will | OK | Input 10 Character as topic |
5.1 | AT+CMQTTWILLMSG=0,6,1 | > | Set the will message |
5.2 | >qwerty | OK | Input 6 Character |
6 |
AT+CMQTTCONNECT=0, “tcp://mqtts_server:port”,60,1 |
OK +CMQTTCONNECT: 0,0 |
Connect to a MQTT server, input the right server and port. |
7.1 | AT+CMQTTTOPIC=0,13 | > | Set the topic for the PUBLISH message |
7.2 | >dddrrrggghhhk | OK | Input topic to publish |
8.1 | AT+CMQTTPAYLOAD=0,60 | > | Set the payload for the PUBLISH message |
8.2 |
>012345678901234567890123456789 012345678901234567890123456789 |
OK | Input message |
9 | AT+CMQTTPUB=0,1,60 |
|
Publish a message |
10.1 | AT+CMQTTSUBTOPIC=0,9,1 | > | Set one topic for the SUBSCRIBE message |
10.2 | >123456789 | OK | |
11 | AT+CMQTTSUB=0 | OK +CMQTTSUB: 0,0 |
Subscribe a message |
12.1 | AT+CMQTTUNSUB=0,9,1 | > | Unsubscribe one topic from the server |
12.2 | >simcommsg |
OK +CMQTTUNSUB: 0,0 |
|
13 | AT+CMQTTDISC=0,120 |
OK +CMQTTDISC: 0,0 |
Disconnect from server |
14 | AT+CMQTTREL=0 | OK | Release the client |
15 | AT+CMQTTSTOP |
+CMQTTSTOP: 0 OK +CMQTTNONET |
Stop MQTT Service |