在Raspberry Pi 2上使用AT命令和Python接收空白SMS SIM800 [英] Recieving Blank SMS SIM800 using AT Commands and Python on Raspberry Pi 2

查看:82
本文介绍了在Raspberry Pi 2上使用AT命令和Python接收空白SMS SIM800的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在rpi2上创建了这个python脚本,消息通过,但是它是空消息.这是编码问题吗?

I created this python script on rpi2, the message goes through, but it is a blank message. Is it a encoding issue?

import serial
import time
from sys import version_info
from curses import ascii
phone = serial.Serial("/dev/ttyAMA0", 115200, timeout=0.5)
def send_text(number,message):    
    phone.write(b'AT+CMGF=1\r')
    phone.write(b'AT+CMGS="' + number.encode() + b'"\r')
    phone.write(message.encode())
    phone.write(ascii.ctrl('z'))
    for i in range(len(reply)):
        reply[i] = reply[i].rstrip()
    print reply

AT命令(其中0000000000是10位手机号码) 在Minicom中,仍然空白消息

AT commands (where 0000000000 is a 10 digit mobile number) in Minicom, still blank message

minicom -D /dev/ttyAMA0 -b 115200 -o

AT
OK
AT+CMGS="0000000000"
>Hello
 <ctrl-z>
+CMGS: 14
OK

来自GSM模块的消息的屏幕截图

推荐答案

文本模式参数存在问题.下面的AT命令将其修复-

There was an issue with the text mode parameters. The AT command below fixed it -

AT+CSMP=17,167,0,0

--info about it
AT+CSMP=<fo>,<vp>,<pid>,<dcs>
<fo>=17 Sets reply pat, user data header, status report request, validity period format, reject duplicates and message type.
<vp>=167 Sets validity period.
<pid>=0 Higher layer protocol indicator.
<dcs>=0 Information encode format.
OK Modem Response.

这篇关于在Raspberry Pi 2上使用AT命令和Python接收空白SMS SIM800的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆