如何通过GSM调制解调器从Mac终端发送短信? [英] How to send SMS from Mac terminal via GSM modem?

查看:142
本文介绍了如何通过GSM调制解调器从Mac终端发送短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Mio A701通信器,我想用作GSM调制解调器从Mac发送短信.

I have Mio A701 communicator that I would like to use as GSM modem for sending SMS from my Mac.

到目前为止,我发现,如果调制解调器通过USB端口连接,则可以将AT命令直接从终端直接发送到特殊端口,例如/dev/ttyUSB0;如果通过蓝牙进行连接,则可以将/dev/rfcomm0发送给特殊端口. 我的问题是,当我尝试发出命令时,会收到权限被拒绝"响应:

What I've found so far is that one just can send an AT commands directly from terminal to special ports like /dev/ttyUSB0 if modem is connected via USB port or /dev/rfcomm0 if connection is handled via bluetooth. My problem is that when I try to issue a command I get a "permission denied" response:

"AT+CMGS=test\r" > /dev/ttyUSB0
-bash: /dev/ttyUSB0: Permission denied

"ls/dev"也表明那里既没有ttyUSB0也没有rfcomm0文件,因此我无法更新这些文件的权限.

Also "ls /dev" shows that neither ttyUSB0 nor rfcomm0 files are present there so I can't update permissions on these files.

任何帮助将不胜感激,在此先感谢.

Any help would be greatly appreciated, thanks in advance.

更新:问题已解决.
首先,Mio A701似乎是错误的选择,因为它不支持用于发送SMS的AT命令.

Update: problem is solved.
First of all Mio A701 appears to be wrong choice since it does not support AT commands for sending SMS.

此PHP代码与通过蓝牙连接的Nokia 3310c可以正常工作:

This PHP code works fine with Nokia 3310c connected via bluetooth:

$number="<phone number in international format with + sign>";
$message="Hello World\ntest"; // as far as I've tested \n successfully turns into a line break in SMS on Mio, Nokia and Alcatel phones
$port="/dev/tty.phone"; // this path was set in "Mac preferences" -> bluetooth -> "configure ports" for selected device


if($fd = fopen($port, 'a')) {
    fwrite($fd, "AT+CMGF=1\r"); // text mode for SMS
    sleep(2);
    fwrite($fd, "AT+CMGS=\"$number\"\r");
    sleep(2);
    fwrite($fd, "$message\032");
    sleep(2);
    $fh = null;
} else
    echo "Phone unreachable";

推荐答案

发送短信和usd消息的最佳方法是安装 smstools3 (不是 smstools )并在

best way to send sms and ussd messages is to install smstools3 (not smstools) and build on the sample scripts.

这篇关于如何通过GSM调制解调器从Mac终端发送短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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