Skip to main content
AT+CNACT=1,"iot.1nce.net"

OK

+APP PDP: ACTIVE
AT+CCOAPINIT

OK
AT+CCOAPURL="coap://coap.os.1nce.com:5683"

OK
AT+CCOAPPARA=code,1,type,"NON",uri-query,0,"t=1",payload,0,"hello world"

OK
AT+CCOAPACTION

+CCOAPACTION: 0,1

OK

+CCOAPRECV: 1,14,9
AT+CCOAPACTION=4

+CCOAPACTION: 4,1,1

OK
AT+CCOAPHEAD=1,1

+CCOAPHEAD: 1,1,2,0,4.04,1,,,,,,,0,,,,,,,,,,,

OK
AT+CCOAPREAD=1

+CCOAPREAD: 5,Not Found

OK
AT+CCOAPTERM

OK
AT+CNACT=0

OK

+APP PDP: ACTIVE

Preparation

Configure the SIM7000 module with the appropriate network settings, operator ID, and ensure that it is connected to the cellular network.

Open data connection

Open data connection, the parameter is APN. This parameter needs to set different APN values according to 1nce sim card.

Create CoAP object

To create a CoAP object, one can use the CoAP Client destination we use AT+CCOAPINIT

Configure CoAP URL

Use the AT+CCOAPURL command to setup a URL and establish a connection with the 1NCE endpoint.

Assembling CoAP data packet

Assembling CoAP data packet with these parameters code,<hex_value> type,(("CON"),("NON"),("ACK"),("RST")) mid,<dec_value> token, ((0-ascii code),(1-hex code)),<value> content-format,<dec_value> accept,<dec_value> uri-path,((0-ascii code),(1-hex code)),<value> uri-query, ((0-ascii code),(1-hex code)),<value> etag, ((0-ascii code),(1-hex code)),<value> observe,<dec_value> max-age,<dec_value> size,<dec_value> payload, ((0-ascii code),(1-hex code)),<value>

Send Data

Received data, Message id is 1, data lengthis14bytes, data payload is 9 bytes

Get receive queen

The current receive queue has a total of 1datapacket, and the first packet id is 1.

Read header

Read the packet header with messageidof 1and print it parsed

Read the recieve

Read the receive packet payload with messageid of 1. The total byte length is 9 and the content is Not Found.

Delete CoAP Object

Disconnect data connection