SMS Service

Last Updated on : 2024-06-04 09:17:25download

This topic describes the commands for the SMS service.

Receive SMS messages (0x71 24 00)

The module sends the received SMS message to the MCU and deletes this message when it confirms that the MCU receives it. This ensures that the SIM card has enough space to receive new messages.

If not specified, the default format of SMS transmission and reception is JSON.

The module sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03/0x04
Command 1 0x71
Data length 2 0x0002 + N
Data 2+N
  • Subcommand: 0x24
  • Control command: 0x00
  • The message content: N byte(s)
  • Protocol version 0x03 takes the format:
    • {"n":"10086", "t":"2021-3-29 16:58","c":"xxxdfasfd"}
  • Protocol version 0x04 takes the format:
    • The length of the phone number: 1 byte
    • The phone number: N byte(s)
    • The length of the date and time: 1 byte
    • The date and time: N byte(s)
      • Year: 2 bytes, little-endian format
      • Month: 1 byte
      • Day: 1 byte
      • Hour: 1 byte
      • Minute: 1 byte
      • Second: 1 byte
      • Time zone: 1 byte
    • The length of the message content: 2 bytes
    • The message content: N byte(s)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The MCU returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x00
  • Result:
    • 0: Failure.
    • 1: Success.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The SMS message reported to the cloud is in JSON format, in which n represents the phone number, t represents the date and time, and c represents the message content. The encoding format of GB2312 is adopted.

Send SMS messages (0x71 24 01)

If not specified, the default format of SMS transmission is JSON in protocol version 0x03 and hexadecimal in protocol version 0x04.

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03/0x04
Command 1 0x71
Data length 2 0x0002 + N
Data 2+N
  • Subcommand: 0x24
  • Control command: 0x01
  • Protocol version 0x03 takes the format:
    • {"n":"10086", "c":"xxxdfasfd"}
  • Protocol version 0x04 takes the format:
    • The length of the phone number: 1 byte
    • The phone number: N byte(s)
    • The length of the message content: 2 bytes
    • The message content: N byte(s)
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: Send a message with the content of Hello in Chinese.

55aa037100202401 7b226e223a223135383930393836373533222c2263223a22c4e3bac3227d A2

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x01
  • Result:
    • 0: Failure.
    • 1: Success.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example: Send a message with the content of Hello in Chinese.

55aa00710003240101 99

Set SMS encoding (0x71 24 02)

Set the encoding of SMS transmission and reception. The EAU series module uses UTF-8 as its default encoding, while the CN series module uses CP936. The setting is stored in the volatile memory.

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x02
  • Encoding options:
    • 0x00: ISO8859-1 (Chinese characters are not supported)
    • 0x01: UTF-8
    • 0x02: UTF-16BE
    • 0x03: UTF-16LE
    • 0x04: GSM (Chinese characters are not supported)
    • 0x05: CP936
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x02
  • Result: 0: Failure. 1: Success.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Set SMS transmission and reception format (0x71 24 03)

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x03
  • Encoding options:
    • 0x00: JSON
    • 0x01: Hexadecimal
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x71
Data length 2 0x0003
Data 3
  • Subcommand: 0x24
  • Control command: 0x03
  • Result: 0: Failure. 1: Success.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.