CDMA cat with at command send Chinese SMS (C #) _c# Tutorial

Source: Internet
Author: User
Tags error code
CDMA Cat really! @#¥#% (*, even the PDU is not supported, can only send text messages. And the Chinese text message is actually Unicode, can not be entered in the Super terminal. can only write programs.
Online This problem to talk about more, do up more tired, but also occasionally garbled. You might as well post the success code for C #.
Reprint please indicate the source
Copy Code code as follows:

void Sendchnsms (String content,string phone)
{
Chinese CDMA send, Unicode encoded byte
Byte[] B = Encoding.BigEndianUnicode.GetBytes (content);
CDMA at command phone number in front can not add 86, otherwise, although the display successfully sent, but the Message Center response error code 5
if (phone. IndexOf ("86") ==0)
{
Phone = phone. Substring (2);
}
Assuming it's a COM3 mouth.
SerialPort sp = new SerialPort ("COM3");
Unlike GSM cats, the baud rate is 115200, and this problem has been troubling for a long time saying
Sp. BaudRate = 115200;
Sp. Open ();
Set up Chinese SMS
Sp. Write ("at+wscl=6,4\r");
Thread.Sleep (500);
Set Text Format SMS
Sp. Write ("at+cmgf=1\r");
Thread.Sleep (500);
Set the number to send and the byte length of the Send content
Sp. Write ("at+cmgs=\" "+ Phone +" \ "," + B.length + "\ r");
Thread.Sleep (500);
Write
Sp. Write (b, 0, b.length);
Thread.Sleep (500);
Write Ctrl+z End SMS content, note that in Unicode mode requires two bytes, this is also unable to operate under HyperTerminal reason
byte[] B2 = new byte[] {0x00, 0x1a};
Sp. Write (B2, 0, B2. Length);
Sp. Close ();
}

May 15

"Original" CDMA cat with at command send Chinese text message (C #)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.