4 PDU Mode

07.053GPPTSUse of Data Terminal Equipment - Data Circuit Terminating Equipment (DTE-DCE) Interface for Short Message Services (SMS) and Cell Broadcast Services (CBS)

The PDU mode uses the same commands and responses as the Text Mode described in clause 3. However, the following commands and responses have a different format. In the PDU mode, a complete SMS Message including all header information is passed as a binary string. This binary string is composed of hexadecimal IA5 characters as defined in clause 3 above under “Message Data Parameters”.

4.1 List Messages +CMGL

Action Command Syntax

Command

Possible response(s)

+CMGL[=<stat>]

if PDU mode (+CMGF=0) and command successful:

+CMGL: <index>,<stat>,[<alpha>],<length><CR><LF><pdu>

[<CR><LF>+CMGL:<index>,<stat>,[<alpha>],<length><CR><LF><pdu>

[…]]

otherwise:

+CMS ERROR: <err>

+CMGL=?

+CMGL: (list of supported <stat>s)

Description

Execution command returns messages with status value <stat> from preferred message storage <mem1> to the TE. Entire data units <pdu> are returned. If status of the message is ‘received unread’, status in the storage changes to ‘received read’. If listing fails, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for <err> values.

Test command shall give a list of all status values supported by the TA.

Implementation

Optional.

4.2 Read Message +CMGR

Action Command Syntax

Command

Possible response(s)

+CMGR=<index>

if PDU mode (+CMGF=0) and command successful:

+CMGR: <stat>,[<alpha>],<length><CR><LF><pdu>

otherwise:

+CMS ERROR: <err>

+CMGR=?

Description

Execution command returns message with location value <index> from preferred message storage <mem1> to the TE. Status of the message and entire message data unit <pdu> is returned. If status of the message is ‘received unread’, status in the storage changes to ‘received read’. If reading fails, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for <err> values.

Implementation

Optional.

4.3 Send Message +CMGS

Action Command Syntax

Command

Possible response(s)

if PDU mode (+CMGF=0):

+CMGS=<length><CR>

PDU is given<ctrl-Z/ESC>

if PDU mode (+CMGF=0) and sending successful:

+CMGS: <mr>[,<ackpdu>]

if sending fails:

+CMS ERROR: <err>

+CMGS=?

Description

Execution command sends message from a TE to the network (SMS-SUBMIT). Message reference value <mr> is returned to the TE on successful message delivery. Optionally (when +CSMS <service> value is 1 and network supports) <ackpdu> is returned. Values can be used to identify message upon unsolicited delivery status report result code. If sending fails in a network or an ME error, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for a list of <err> values. This command should be abortable.

– <length> must indicate the number of octets coded in the TP layer data unit to be given (i.e. SMSC address octets are excluded)

– the TA shall send a four character sequence <CR><LF><greater_than><space> (IRA 13, 10, 62, 32) after command line is terminated with <CR>; after that PDU can be given from TE to ME/TA

– the DCD signal shall be in ON state while PDU is given

– the echoing of given characters back from the TA is controlled by V.25ter echo command E

– the PDU shall be hexadecimal format (similarly as specified for <pdu>) and given in one line; ME/TA converts this coding into the actual octets of PDU

– when the length octet of the SMSC address (given in the PDU) equals zero, the SMSC address set with command Service Centre Address +CSCA is used; in this case the SMSC Type-of-Address octet shall not be present in the PDU, i.e. TPDU starts right after SMSC length octet

– sending can be cancelled by giving <ESC> character (IRA 27)

– <ctrl-Z> (IRA 26) must be used to indicate the ending of PDU

Implementation

Optional.

4.4 Write Message to Memory +CMGW

Action Command Syntax

Command

Possible response(s)

if PDU mode (+CMGF=0):

+CMGW=<length>[,<stat>]<CR>PDU is given<ctrl-Z/ESC>

+CMGW: <index>

+CMS ERROR: <err>

+CMGW=?

Description

Execution command stores a message to memory storage <mem2>. Memory location <index> of the stored message is returned. By default message status will be set to ‘stored unsent’, but parameter <stat> allows also other status values to be given. (ME/TA manufacturer may choose to use different default <stat> values for different message types.) The entering of PDU is done similarly as specified in command Send Message +CMGS. If writing fails, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for <err> values.

Implementation

Optional.

4.5 Send Command +CMGC

Action Command Syntax

Command

Possible response(s)

if PDU mode (+CMGF=0):

+CMGC=<length><CR>

PDU is given<ctrl-Z/ESC>

if PDU mode (+CMGF=0) and sending successful:

+CMGC: <mr>[,<ackpdu>]

if sending fails:

+CMS ERROR: <err>

+CMGC=?


Description

Execution command sends a command message from a TE to the network (SMS-COMMAND). The entering of PDU is done similarly as specified in command Send Message +CMGS. Message reference value <mr> is returned to the TE on successful message delivery. Optionally (when +CSMS <service> value is 1 and network supports) <ackpdu> is returned. Values can be used to identify message upon unsolicited delivery status report result code. If sending fails in a network or an ME error, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for a list of <err> values. This command should be abortable.

Implementation

Optional.

4.6 New Message Acknowledgement to ME/TA +CNMA

Action Command Syntax

Command

Possible response(s)

if PDU mode (+CMGF=0):

+CNMA[=<n>[,<length>[<CR>

PDU is given<ctrl-Z/ESC>]]]

+CMS ERROR: <err>

+CNMA=?

if PDU mode (+CMGF=0):

+CNMA: (list of supported <n>s)

Description

Execution command confirms reception of a new message (SMS-DELIVER or SMS-STATUS-REPORT) which is routed directly to the TE (refer command +CNMI tables 11 and 12). This acknowledgement command shall be used when +CSMS parameter <service> equals 1. In PDU mode, it is possible to send either positive (RP-ACK) or negative (RP-ERROR) acknowledgement to the network. Parameter <n> defines which one will be sent. Optionally (when <length> is greater than zero) an acknowledgement TPDU (SMS-DELIVER-REPORT for RP-ACK or RP-ERROR) may be sent to the network. The entering of PDU is done similarly as specified in command Send Message +CMGS, except that the format of <ackpdu> is used instead of <pdu> (i.e. SMSC address field is not present). PDU shall not be bounded by double quotes. TA shall not send another +CMT or +CDS result code to TE before previous one is acknowledged.

If ME does not get acknowledgement within required time (network timeout), ME should send RP-ERROR to the network. ME/TA shall automatically disable routing to TE by setting both <mt> and <ds> values of +CNMI to zero.

If command is executed, but no acknowledgement is expected, or some other ME related error occurs, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for a list of <err> values.

NOTE: In case that a directly routed message must be buffered in ME/TA (possible when +CNMI parameter <mode> equals 0 or 2) or AT interpreter remains too long in a state where result codes cannot be sent to TE (e.g. user is entering a message using +CMGS), acknowledgement (RP-ACK) must be sent to the network without waiting +CNMA command from TE. Later, when buffered result codes are flushed to TE, TE must send +CNMA[=0] acknowledgement for each result code. In this way, ME/TA can determine if message should be placed in non-volatile memory and routing to TE disabled (+CNMA[=0] not received). Refer command +CNMI for more details how to use <mode> parameter reliably.

Test command returns a list of supported <n> values. If the only value supported is 0, the device does not support sending of TPDU.

Defined Values

<n>:

0 command operates similarly as defined for the text mode

1 send RP-ACK (or buffered result code received correctly)

2 send RP-ERROR (if PDU is not given, ME/TA shall send SMS-DELIVER-REPORT with GSM 03.40 TP-FCS value set to ‘FF’ (unspecified error cause))

Implementation

Mandatory when <service> value 1 of command Select Message Service +CSMS is supported.

4.7 Send Message from Storage +CMSS

Action Command Syntax

Command

Possible response(s)

+CMSS=<index>[,<da>[,<toda>]]

if PDU mode (+CMGF=0) and sending successful:

+CMSS: <mr>[,<ackpdu>]

if sending fails:

+CMS ERROR: <err>

+CMSS=?

Description

Execution command sends message with location value <index> from message storage <mem2> to the network (SMS-SUBMIT or SMS-COMMAND). If new recipient address <da> is given for SMS-SUBMIT, it shall be used instead of the one stored with the message. Reference value <mr> is returned to the TE on successful message delivery. Optionally (when +CSMS <service> value is 1 and network supports) <ackpdu> is returned. Values can be used to identify message upon unsolicited delivery status report result code. If sending fails in a network or an ME error, final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for a list of <err> values. This command should be abortable.

Implementation

Optional.

Annex A (Normative):
Character Set Conversions for SMS Text Mode

The following conversions to and from GSM 03.38 default alphabet are defined:

TE char set

bits/char

Commands

PC Code Page 437

8

+CMGF=1;+CSCS="PCCP437"

PC Danish/Norwegian

8

+CMGF=1;+CSCS="PCDN"

ISO 8859 Latin 1

8

+CMGF=1;+CSCS="8859-1"

IRA

7

+CMGF=1;+CSCS="IRA"

GSM default alphabet

7

+CMGF=1;+CSCS="GSM"

The tables below show which 7 bit GSM value corresponds to the 7 or 8 bit value of external character set. The TE character set value is computed by adding column value, 00H through F0H (70H for 7 bits/char), with the row value (00H through 0FH). All values are in hexadecimal, but the H suffix is not used. When text mode is implemented, it is mandatory for a TA to have at least one conversion which include the conversion table of IRA (e.g. PC Code Page 437 does). Additional conversions can be defined by manufacturers. It is manufacturer specific if the TE set is actually converted to GSM set in the TA or in the ME, and if the TE set is converted to a ME specific set in the TA before converting it to GSM set when message is sent to the network. It is recommended that characters which cannot be converted to GSM set are deleted.

Conversion from IRA to GSM:

00

10

20

30

40

50

60

70

00

20

30

00

50

70

01

21

31

41

51

61

71

02

22

32

42

52

62

72

03

23

33

43

53

63

73

04

02

34

44

54

64

74

05

25

35

45

55

65

75

06

26

36

46

56

66

76

07

27

37

47

57

67

77

08

28

38

48

58

68

78

09

29

39

49

59

69

79

0A

LF

2A

3A

4A

5A

6A

7A

0B

2B

3B

4B

6B

0C

2C

3C

4C

6C

0D

CR-

2D

3D

4D

6D

0E

2E

3E

4E

6E

0F

2F

3F

4F

11

6F

Conversion from PCCP437 (PC-8 Code Page 437) to GSM:

00

10

20

30

40

50

60

70

80

90

A0

B0

C0

D0

E0

F0

00

20

30

00

50

70

09

1F

6110

01

21

31

41

51

61

71

7E

1D

6911

1E

02

22

32

42

52

62

72

05

1C

6F12

13

03

23

33

43

53

63

73

611

6F7

7513

04

02

34

44

54

64

74

7B

7C

7D

18

05

5F

25

35

45

55

65

75

7F

08

5D

06

26

36

46

56

66

76

0F

758

07

27

37

47

57

67

77

092

06

08

28

38

48

58

68

78

653

799

60

12

09

29

39

49

59

69

79

654

5C

19

0A

LF

2A

3A

4A

5A

6A

7A

04

5E

15

0B

2B

3B

4B

6B

695

0C

2C

3C

4C

6C

696

01

0D

CR-

2D

3D

4D

6D

07

03

40

0E

2E

3E

4E

6E

5B

0F

2F

3F

4F

11

6F

0E

1 : â  a 2 : ç  Ç 3 : ê  e 4 : ë  e 5 : ï  i

6 : î  i 7 : ô  o 8 : û  u 9 : ÿ  y 10 : á  a

11 : í  i 12 : ó  o 13 : ú  u

Conversion from PCDN (PC-8 Danish/ Norwegian) to GSM:

00

10

20

30

40

50

60

70

80

90

A0

B0

C0

D0

E0

F0

00

20

30

00

50

70

09

1F

6110

01

21

31

41

51

61

71

7E

1D

6911

1E

02

22

32

42

52

62

72

05

1C

6F12

13

03

23

33

43

53

63

73

611

6F7

7513

04

02

34

44

54

64

74

7B

7C

7D

18

05

5F

25

35

45

55

65

75

7F

08

5D

06

26

36

46

56

66

76

0F

758

07

27

37

47

57

67

77

092

06

08

28

38

48

58

68

78

653

799

60

12

09

29

39

49

59

69

79

654

5C

19

0A

LF

2A

3A

4A

5A

6A

7A

04

5E

15

0B

2B

3B

4B

6B

695

0C

0C

2C

3C

4C

6C

696

01

0D

CR

2D

3D

4D

6D

07

0B

40

0E

2E

3E

4E

6E

5B

0F

2F

3F

4F

11

6F

0E

1 : â  a 2 : ç  Ç 3 : ê  e 4 : ë  e 5 : ï  i

6 : î  i 7 : ô  o 8 : û  u 9 : ÿ  y 10 : á  a

11 : í  i 12 : ó  o 13 : ú  u

Conversion from 8859-1 (ISO 8859 Latin 1) to GSM:

00

10

20

30

40

50

60

70

80

90

A0

B0

C0

D0

E0

F0

00

20

30

00

50

70

411

7F

01

21

31

41

51

61

71

40

412

5D

6120

7D

02

22

32

42

52

62

72

413

4F12

6121

08

03

23

33

43

53

63

73

01

414

4F13

6122

6F29

04

02

34

44

54

64

74

24

5B

4F14

7B

6F30

05

25

35

45

55

65

75

03

0E

4F15

0F

6F31

06

26

36

46

56

66

76

1C

5C

1D

7C

07

27

37

47

57

67

77

5F

09

0923

08

28

38

48

58

68

78

455

0B

04

0C

09

29

39

49

59

69

79

1F

5516

05

06

0A

LF

2A

3A

4A

5A

6A

7A

456

5517

6524

7532

0B

2B

3B

4B

6B

457

5518

6525

7533

0C

2C

3C

4C

6C

498

5E

07

7E

0D

CR

2D

3D

4D

6D

499

5919

6926

7934

0E

2E

3E

4E

6E

4910

6927

0F

2F

3F

4F

11

6F

60

4911

1E

6928

7935

1 : À  A 2 : Á  A 3 : Â  A 4 : Ã  A 5 : È  E

6 : Ê  E 7 : Ë  E 8 : Ì  I 9 : Í  I 10 : Î  I

11 : Ï  I 12 : Ò  O 13 : Ó  O 14 : Ô  O 15 : Õ  O

16 : Ù  U 17 : Ú  U 18 : Û  U 19 : Ý  Y 20 : á  a

21 : â  a 22 : ã  a 23 : ç  Ç 24 : ê  e 25 : ë  e

26 : í  i 27 : î  i 28 : ï  i 29 : ó  o 30 : ô  o

31 : õ  o 32 : ú  u 33 : û  u 34 : ý  y 35 : ÿ  y

Conversions from GSM default alphabet to above character sets are otherwise straightforward, but no conversions of the characters listed below tables are applied.

Annex B (Informative):
Example of processing a data block

B.1 Example state diagrams for the block receiver

The state diagrams on the following two pages show how the receiver component at the block level could work. In this example the received octets are processed in two stages.

Stage 1 is a low level function which detects the unique start and end markers, and removes any stuffing octets. The results of this stage are passed to stage 2. Any unexpected octet value after a DLE will be indicated as ‘abort’.

Stage 2 assembles the message content and the BCS octets, using octets passed from stage 1 and the ‘start’ and ‘end’ indications. A ‘start’ will always reset the process to state 1 from any state. An ‘abort’ will always cause a return to state 0 where a ‘start’ will be awaited. When an ‘end’ is received in state 1, the following two octets are checked as the BCS. If the BCS is correct, the message content is passed to another stage of the receiver for processing of the message content.

B.2 Example of coding and decoding a data block

The last page of this annex shows the coding of an example message at a transmitter, and the decoding stages at a receiver which has the two stages of processing as described above.

In this example, the message content and the BCS both contain an octet with a value of 10 hex. Therefore the message as transmitted over the interface has additional stuffing octets (00 hex) inserted after these octets. The receiver first detects the start and end markers, and removes the stuffing octets. Finally the BCS is checked.

Annex C (Informative):
Change History

SMG#

TDoc

VERS

CR

REV

PHASE

CAT

WORKITEM

SUBJECT

NEW_VERS

S20

612/96

5.0.0

A022

2+

B

TEI

Enhanced SMS routing to TE in AT modes

5.1.0

S20

612/96

5.0.0

A023

2+

B

TEI

Underscore character in Annex A

5.1.0

S20

612/96

5.0.0

A024

2+

B

TEI

New +CMS ERROR codes

5.1.0

S20

612/96

5.0.0

A025

2+

B

TEI

UCS2 in text mode

5.1.0

S20

612/96

5.0.0

A026

2+

B

TEI

Enhanced SMS storage handling in AT modes

5.1.0

S20

612/96

4.7.0

A027

2

F

IEI value for TP Failure Case (Phase 2)

4.8.0

S20

612/96

5.0.0

A028

2+

A

IEI value for TP Failure Case (Phase 2+)

5.1.0

S20

612/96

5.0.0

A029

2+

D

TEI

OK response to AT+CESP

5.1.0

S20

612/96

5.0.0

A030

2+

B

TEI

RP-Ack PDU

5.1.0

s21

060/97

5.1.0

A031

2+

D

CBS editorial modifications in AT modes

5.2.0

s21

060/97

5.1.0

A032

2+

F

Correction of error in SMS Block mode

5.2.0

s21

060/97

5.1.0

A033

2+

D

Further text for PDU mode +CMGS

5.2.0

s22

415/97

5.2.0

A034

2+

F

Editorial corrections

5.3.0

s22

415/97

5.2.0

A035

R97

B

TEI R97

More messages to send

5.3.0

s23

97-702

5.3.0

A036

R97

B

TEI R97

Enhanced validity period format in text mode

5.4.0

s24

97-922

5.4.0

A037

R96

F

Unnecessary conversion in Annex A

5.5.0

s28

99-060

5.5.0

A038

R98

B

TEI

Improvement for AT command for deleting Short Messages

7.0.0