APIs Device to Cloud UDP Devices Prepare devices
On this page you’ll find configuration settings so your devices can connect to the Device to Cloud infrastructure.
UDP devices can only be used from Telekom mobile network, because we identify the device using the SIM card.
About UDP
For a general overview of the protocol, when to choose UDP, and its limitations, see the About UDP page.
This page focuses on the practical steps to configure a UDP device and connect it to the Device to Cloud platform. The examples use a Quectel BC660 NB-IoT modem and AT commands, but the general approach applies to other NB-IoT, LTE-M, and LTE modems with vendor-specific AT command sets.
D2C UDP server endpoint
To send UDP data to the Device to Cloud platform, use the following endpoint:
| Parameter | Value |
|---|---|
| Hostname | udp.d2c.iot.telekom.de |
| Port | 15501 |
| APN | DEVICE-TO-CLOUD.IOT.TELEKOM.DE |
Working with a modem (AT commands)
The examples below use a Quectel BC660 modem connected via a serial interface (UART). Commands prefixed with > are sent to the modem; lines prefixed with < are responses from the modem.
Reset the modem
AT+QRST=1
Reset the modem when you made a mistake and don’t know how to recover. It will restart the modem.
Disable sleep mode
AT+QSCLK=0
Disable power save mode
AT+CPSMS=0
Enable signaling connection status
> AT+CSCON=1
< OK
Shows if the mobile termination (MT = device + network) is currently in idle or connected mode.
Set default APN
AT+QCGDEFCONT=IP
AT+CGDCONT=1,IP
Sets the default APN that is sent by the network (depends on the SIM card).
Set “Device to Cloud” APN
AT+QCGDEFCONT="IP","DEVICE-TO-CLOUD.IOT.TELEKOM.DE"
The Device to Cloud APN does not have access to the public internet. Use this APN to send UDP data.
Set Internet APN
AT+QCGDEFCONT="IP","INTERNET.M2MPORTAL.DE"
The Internet APN connects the module to the public network.
Get current default APN
AT+QCGDEFCONT?
Returns the currently configured default APN. The APN may have been configured by the SIM card, the network, or by a previous command.
Disable UE functionality
AT+CFUN=0
Disables the radio of the module/modem. The modem disconnects from the network.
Configure DNS servers — public DNS (Internet APN only)
AT+QIDNSCFG=0,"8.8.8.8","1.1.1.1"
Configure DNS servers — private DNS (Device to Cloud APN)
AT+QIDNSCFG=0,"10.74.210.210","10.74.210.211"
Show DNS server configuration
> AT+QIDNSCFG=0
< +QIDNSCFG: 0,"172.27.130.26","172.27.131.26","",""
Enable UE functionality
> AT+CFUN=1
< OK
Enables the radio of the module/modem. The modem connects to the network.
Ping a remote server — Internet APN only
AT+QPING=0,"iot.quectel.com"
AT+QPING=0,"www.google.com"
AT+QPING=0,"8.8.8.8"
Ping a remote server — Device to Cloud APN
> AT+QPING=0,"udp.d2c.iot.telekom.de"
< +CSCON: 1
< +QPING: 569
< +QPING: 569
< +QPING: 569
< +QPING: 569
< +QPING: 0,4,0,4,0,0,0
< +CSCON: 0
Sync time with NTP server — Internet APN only
> AT+QNTP=0,"ptbtime1.ptb.de"
Get IP address by DNS name — Internet APN only
> AT+QIDNSGIP=0,"www.google.com"
Get IP address by DNS name — Device to Cloud APN
> AT+QIDNSGIP=0,"udp.d2c.iot.telekom.de"
< +CSCON: 1
< +QIDNSGIP: 0,1,0
< +QIDNSGIP: 172.27.130.100
< +CSCON: 0
Configure text mode (ASCII)
> AT+QICFG="dataformat",0,0
< OK
Sets the data format of sent and received messages to ASCII characters. Use this mode when sending plain string payloads.
Configure hex mode (binary data)
> AT+QICFG="dataformat",1,1
< OK
Sets the data format to hexstring for both sending and receiving. Use this mode when your device needs to transmit binary data (e.g. sensor readings, protocol buffers).
Configure show remote address
> AT+QICFG="showRA",1
< OK
When the modem receives data, the IP address and port are printed on the UART serial line.
Open a UDP socket service
> AT+QIOPEN=0,0,"UDP SERVICE","udp.d2c.iot.telekom.de",0,1234,1
< OK
<
< +QIOPEN: 0,0
Opens a UDP socket service where both the context ID and socket ID are 0. The local port is 1234.
Query the connection status
> AT+QISTATE=1,0
< +QISTATE: 0,"UDP SERVICE","172.27.130.100",15501,1234,2,0,1
Queries the connection status of the UDP service whose socket ID is 0.
Send data
> AT+QISEND=0,"udp.d2c.iot.telekom.de",15501
< >
< OK
< SEND OK
<
< +CSCON: 1
< +CSCON: 0
Sends a string with variable length to the UDP server. Type the payload, then press Ctrl+Z to send the data.
Close UDP socket service
> AT+QICLOSE=0
<
< OK
<
< CLOSE OK
Get IP address
> AT+CGPADDR?
< +CGPADDR: 0,"10.32.129.19"
< +CGPADDR: 1
< +CGPADDR: 2
> AT+CGPADDR=0
< +CGPADDR: 0,"10.32.129.19"
Communicating with a modem
This section shows what happens on the modem side when uplink and downlink messages are exchanged with the platform.
Uplink (device → platform): When the modem sends data to the D2C UDP endpoint, the platform receives and stores the data as a received-msg content instance in DMO.
Downlink (platform → device): When a downlink message is created in the outgoing-msg container, the platform delivers it to the modem. The delivery timing depends on the queuing mode.
Receiving downlink messages — queuing disabled
When an outgoing-msg is created without queuing (or with queuing:disabled):
{
"m2m:cin": {
"con": "Hello 12"
}
}
The data is not immediately received by the modem. The platform forwards the message right away, but the mobile network can only deliver it when the modem switches from idle mode to connected mode. How long and how often the modem switches depends on the modem and network configuration.
Modem output:
< +CSCON: 1
< +CSCON: 0
< +CSCON: 1
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 30"
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 31"
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 31"
< +CSCON: 0
Receiving downlink messages — queuing enabled
When an outgoing-msg is created with queuing:enabled:
{
"m2m:cin": {
"con": "Hello 10",
"lbl": ["queuing:enabled"]
}
}
The platform holds the message until the device sends an uplink datagram. The queued data is then received immediately after the modem sends data to the server:
Modem output:
> AT+QISEND=0,"udp.d2c.iot.telekom.de",15501
< >
< OK
< SEND OK
< +CSCON: 1
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 10"
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 11"
< +QIURC: "recv",0,8,"172.27.130.100",15501,"Hello 12"
< +CSCON: 0
Next step
Use the API to onboard your devices to Device to Cloud.