# How to send SMS end char CTRL-Z

**URL:** <https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349>\
**Category:** Development tools\
**Created:** [June 3, 2013, 9:31am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349 "2013-06-03T09:31:44Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 3, 2013, 9:31am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/1 "2013-06-03T09:31:44Z")

</div>

Hi,

Can anyone knows how to send the SMS end char CTRL-Z in openAT.  
I am using AT+CMGS command to send SMS.  
So i am struggling to send the text of the message and end of the message characters.  
Can anyone help me

Thanks

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 3, 2013, 11:08am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/2 "2013-06-03T11:08:47Z")

</div>

Why don’t you use the ADL functions (adl\_smsSend)?

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 3, 2013, 11:53am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/3 "2013-06-03T11:53:49Z")

</div>

> [@tomridl](#):
>
> Why don’t you use the ADL functions (adl\_smsSend)?

I tried the sample code given in open at, the code as follows  
but it won’t send SMS

```auto
void main_task ( void )
{
	adl_InitType_e adlInitType = adl_InitGetType ();
    /* SMS automaton test application */
    TRACE ( ( SA_TRACE_LEVEL, "SMS automaton sample main" ) );
    TRACE ( ( SA_TRACE_LEVEL, __DATE__ ) );
    TRACE ( ( SA_TRACE_LEVEL, __TIME__ ) );

    TRACE ( ( SA_TRACE_LEVEL, "Start SMS_Automaton application" ) );

    /* Subscribe to the SMS Service */
    SmsAutoHandle = adl_smsSubscribe ( cbSmsAutoHandler, cbSmsAutoCtrlHandler,
                    ADL_SMS_MODE_TEXT );
    TRACE ( ( SA_TRACE_LEVEL, "adl_smsSubscribe : "
            "SmsAutoHandle %d", SmsAutoHandle ) );

    adl_smsSend(SmsAutoHandle , "9092363289", "Hello World!", ADL_SMS_MODE_TEXT);

}
```

can you tell me the handler function of adl\_smsSend(); syntax is correct

Thanks

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 3, 2013, 12:54pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/4 "2013-06-03T12:54:03Z")

</div>

Hi,  
I called the unsolicited response funtion to wait for “+wind:4” response after that in the unsolicited response handler i call ad\_atsendSms() calle then i received SMS.

But can any one tell how to send the hex values like SMS ending char.  
Is there any APIs available?

Because i am going to handle with sensor based on some protocole formate in this i need to send like the hex values, so is there any APIs?

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 3, 2013, 3:22pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/5 "2013-06-03T15:22:37Z")

</div>

SMS is either text or PDU based, so you will probably have to use PDU mode. However, you probably won’t be able to send raw hex values over PDU mode anyway, you will need to encode the hex somehow. Have a look at base64 encoding.  
[https://en.wikipedia.org/wiki/Base64](https://en.wikipedia.org/wiki/Base64)

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 3, 2013, 6:44pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/6 "2013-06-03T18:44:10Z")

</div>

> [@tomridl](#):
>
> you probably won’t be able to send raw hex values over PDU mode

Pretty sure you can…

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 4, 2013, 4:17am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/7 "2013-06-04T04:17:47Z")

</div>

Hi, i tried to intiate GSM through using GSM AT commands the code as follows

```auto
void ATCmdSend ( void )
{
    s8 s8Return = 0;

    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+CSQ' using the adl_atCmdSend API") );
    s8Return = adl_atCmdSend( "AT+CSQ",
                              ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                              "*",
                              NULL );
    if ( 0 > s8Return )
    {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
    }

    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+COPS' using the adl_atCmdSend API") );
    s8Return = adl_atCmdSend( "AT+COPS?",
                                  ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                  "*",
                                  NULL );
    if ( 0 > s8Return )
     {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
     }

    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+CREG' using the adl_atCmdSend API") );
    s8Return = adl_atCmdSend( "AT+CREG=1",
                                      ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                      "*",
                                      NULL );
    if ( 0 > s8Return )
     {
      TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
     }

    TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+WREGC' using the adl_atCmdSend API") );
    s8Return = adl_atCmdSend( "AT+WREGC=0",
                                      ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                      "*",
                                      NULL );
     if ( 0 > s8Return )
      {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
      }

     TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+WGPRS' using the adl_atCmdSend API") );
     s8Return = adl_atCmdSend( "AT+WGPRS=0,1",
                                           ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                           "*",
                                           NULL );
     if ( 0 > s8Return )
      {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
      }
     TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+WGPRS' using the adl_atCmdSend API") );
     s8Return = adl_atCmdSend( "AT+CMEE=1",
                                                ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                "*",
                                                NULL );
     if ( 0 > s8Return )
     {
       TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
     }

     TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+WGPRS' using the adl_atCmdSend API") );
      s8Return = adl_atCmdSend( "AT+CPIN?",
                                                ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                "*",
                                                NULL );
     if ( 0 > s8Return )
      {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }

     TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+CMGF' using the adl_atCmdSend API") );
          s8Return = adl_atCmdSend( "AT+CMGF?",
                                                ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                "*",
                                                NULL );
      if ( 0 > s8Return )
       {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }

     
      TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "Send 'AT+CMGS' using the adl_atCmdSend API") );
      s8Return = adl_atCmdSend( "AT+CMGS=+919092363289",
                                                 ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                 "*",
                                                 NULL );
      if ( 0 > s8Return )
       {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }
      s8Return = adl_atCmdSend( "0x0D",( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                       "*",
                                                       NULL );
      if ( 0 > s8Return )
       {
         TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }
      s8Return = adl_atCmdSend(SMSEND_IDENTIFICATION ,( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                       "*",
                                                       NULL );
      if ( 0 > s8Return )
       {
         TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }

}
```

for the above thing only i need to send end of sms char, can you help me?

Thanks

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 4, 2013, 6:07am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/8 "2013-06-04T06:07:01Z")

</div>

> [@awneil](#):
>
> > [@tomridl](#):
> >
> > you probably won’t be able to send raw hex values over PDU mode
> 
> Pretty sure you can…

Cool, never used PDU mode before, so wasn’t sure. You won’t however be able to view the hex characters on a phone unless they are printable ascii chars.

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 4, 2013, 10:27am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/9 "2013-06-04T10:27:49Z")

</div>

> [@tomridl](#):
>
> Cool, never used PDU mode before, so wasn’t sure. You won’t however be able to view the hex characters on a phone unless they are printable ascii chars.

Please close look in to the code ,i send the hex vaue of CTRL-Z its indicating end of the SMS text. so can you guide me

Thanks

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 4, 2013, 7:16pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/10 "2013-06-04T19:16:35Z")

</div>

I thought you already had the code working for sending one SMS, and your problem was just how to repeat the sending for multiple recipients ❓

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forum.sierrawireless.com/u/tobias)\
**Post date:** [June 5, 2013, 8:07am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/11 "2013-06-05T08:07:01Z")

</div>

If you insist on using AT+CMGS to send SMS in your code, use adl\_atCmdSendText to send your text after receiving the \> character. It appends the 0x1A (ctrl-Z) if it’s not in the end of the string already.

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 5, 2013, 11:00am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/12 "2013-06-05T11:00:20Z")

</div>

> [@tobias](#):
>
> If you insist on using AT+CMGS to send SMS in your code, use adl\_atCmdSendText to send your text after receiving the \> character. It appends the 0x1A (ctrl-Z) if it’s not in the end of the string already.

Hi,

I tried in the following way still i didn’t received SMS, can you explain me where i done the mistake

```auto
s8Return = adl_atCmdSend( "AT+CMGS=+919092363289",
                                                 ( adl_atRspHandler_t ) ATCmdSend_Response_Handler,
                                                 "*",
                                                 NULL );
      if ( 0 > s8Return )
       {
        TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }
      s8Return = adl_atCmdSendText( ADL_PORT_NONE, "HI");
      if ( 0 > s8Return )
       {
         TRACE( ( APPLI_AT_CMD_TRACE_LEVEL, "ATCmdSend: error in adl_atCmdSend: %d", s8Return ) );
       }
```

Thanks

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 5, 2013, 11:15am UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/13 "2013-06-05T11:15:57Z")

</div>

You are not waiting for the ‘\>’ sign before sending your text, and you are also not sending the text termination character with the text (0x1A) that tobias told you about.

Please explain why you are using the AT commands, instead of the ADL functions? If you just use adl\_smsSend, you don’t have to worry about AT commands!

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 5, 2013, 12:26pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/14 "2013-06-05T12:26:08Z")

</div>

> [@](#):
>
> You are not waiting for the ‘\>’ sign before sending your text, and you are also not sending the text termination character with the text (0x1A) that tobias told you about.

How to implement the wait fucntion to wait the response ‘\>’. But i am able to see the response in the response handler function?  
For wait i tried adl\_eventwait() function and adl\_ctxsleep() functions even though i am not able to getting?  
can you explain how implement wait function?

> [@](#):
>
> Please explain why you are using the AT commands, instead of the ADL functions? If you just use adl\_smsSend, you don’t have to worry about AT commands!

the main aim is i am goin to handle with sensors. That sensors are based on some protocol, that are implemented based on the hex values ony. so that i want to know how to send hex char?

Thanks

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 5, 2013, 3:01pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/15 "2013-06-05T15:01:01Z")

</div>

Once again, you will need to use PDU mode (regardless of whether you use AT commands or ADL functions), you can find some info here [http://www.gsm-modem.de/sms-pdu-mode.html](http://www.gsm-modem.de/sms-pdu-mode.html) or just Google it.

I highly recommend you first learn how to send an SMS using the ADL functions before you worry about PDU mode and sending hex data. Have a look at the example applications to get started.

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [June 5, 2013, 3:03pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/16 "2013-06-05T15:03:43Z")

</div>

> [@prakash12345](#):
>
> How to implement the wait fucntion to wait the response ‘\>’. But i am able to see the response in the response handler function?  
> For wait i tried adl\_eventwait() function and adl\_ctxsleep() functions even though i am not able to getting?  
> can you explain how implement wait function?

Think about what happens when you type the command in the terminal: You type AT+CMGS=+123456780 and then press enter. The modem then returns a ‘\>’ sign to you. So in ADL, how would you see that? You would get a callback to your ATCmdSend\_Response\_Handler function and the string would be ‘\>’. So then you send your text followed by 0x1A, and your message gets sent.

Or just use adl\_smsSend.

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [June 5, 2013, 4:47pm UTC](https://forum.sierrawireless.com/t/how-to-send-sms-end-char-ctrl-z/6349/17 "2013-06-05T16:47:04Z")

</div>

> [@](#):
>
> The modem then returns a ‘\>’ sign to you. So in ADL, how would you see that? You would get a callback to your ATCmdSend\_Response\_Handler function and the string would be ‘\>’. So then you send your text followed by 0x1A, and your message gets sent.

Kindly close look into the code i post i used the call back function for handle response after that only i send the text through adl\_atcmndsendTxt().  
can you please explain me?

> [@](#):
>
> Or just use adl\_smsSend.

Hi i tried this function in this i cant able to receive more than one sms in this also i struggle in the wait function only?

Thanks
