Python implements at command to send PDU SMS __python

Source: Internet
Author: User

These two days received the test at command to send information, when sending PDU format information need to manually input characters too much, more trouble, would like to write a small script with py, I am here to install is Python32. It seems that you also need to install the Pyserial package. PDU Information conversion can refer to http://www.multisilicon.com/_a/blog/a22201774~/pdu.htm

Directly on the code:

Import serial
Import time


Ser = serial. Serial ("COM16", 115200)
Type (Ser)
Ser.isopen ()
Time.sleep (5)
#write SMS Receiver
Ser.write ((' at+cmgs=19\r\n '). Encode ())
Time.sleep (5)
#write SMS Context
Ser.write ((' 0891683108200205f011000791680180f60008aa045403996d '). Encode ())
Time.sleep (5)
#send <ctrl+z>
Ser.write ((' \x1a\r\n '). Encode ())
Time.sleep (5)

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.