0

I'm trying to send sms using huawei e173 gsm modem. Everything works fine in text mode, but I can't figure out how to send sms in pdu mode. I have tried to send simple message that will say "hellohello". This is my message format in Qt designer (which is irrelevant for this subject, I'm having problems with error 304 - invalid PDU mode parameter):

QByteArray PDUtext;
PDUtext[0] = 0x00;
PDUtext[1] = 0x11;
PDUtext[2] = 0x00;
PDUtext[3] = 0x0b; // Phone number length

PDUtext[4] = 0x91; // International

//Phone: +381 600123456 (83 61 00 21 43 65)

PDUtext[5] = 0x83;
PDUtext[6] = 0x61;
PDUtext[7] = 0x00;
PDUtext[8] = 0x21;
PDUtext[9] = 0x43;
PDUtext[10] = 0x65;

PDUtext[11] = 0x00;
PDUtext[12] = 0x00;
PDUtext[13] = 0xaa; // 4 days validity period

//E8 32 9B FD 46 97 D9 EC 37

PDUtext[14] = 0x0a; // Message length

// Message "hellohello"

PDUtext[15] = 0xe8;
PDUtext[16] = 0x32;
PDUtext[17] = 0x9b;
PDUtext[18] = 0xfd;
PDUtext[19] = 0x46;
PDUtext[20] = 0x97;
PDUtext[20] = 0xd9;
PDUtext[20] = 0xec;
PDUtext[20] = 0x37; 

What is wrong with this message?

Commands look like this:

AT+CMGF=0<CR> // PDU mode

Modem > OK

AT+CMGS=20<CR> // Send with message length
>PDUtext<Ctrl+z>

Modem > +CMS ERROR: 304
user2880783
  • 145
  • 6
  • 18

1 Answers1

0

There are two errors in your PDU.

1) The destination number length is incorrect

You have used 0x0B when infact you should have used 0C

2) Bytes incorrectly assigned

PDUtext[20] = 0x97;
PDUtext[20] = 0xd9;
PDUtext[20] = 0xec;
PDUtext[20] = 0x37; 

Should be

PDUtext[20] = 0x97;
PDUtext[21] = 0xd9;
PDUtext[22] = 0xec;
PDUtext[23] = 0x37; 
Matt Aldridge
  • 2,037
  • 16
  • 21