节点js AT命令返回+ CMS错误:302

时间:2018-12-02 17:10:36

标签: node.js at-command sms-gateway

我正在尝试使用来自华为调制解调器的AT命令发送短信。但有时在使用 AT + CMGS 时会返回 + CMS错误:302

这是我的代码

var SerialPort = require('serialport');
var port = new SerialPort("/dev/ttyUSB0", {
baudRate: 9600,
dataBits: 8,
parity: 'none'
});

console.log('port is now open');

port.on("open", function () {

console.log('Serial communication open');
port.write("AT");
port.write('\r');
port.on('data', function(data) {
    console.log("Received data: " + data);
});



gsm_message_sending(port, "test", "+94758034032"); 
 });

function gsm_message_sending(serial, message ,phone_no) {
serial.write("AT+CMGF=1");
serial.write('\r');
serial.write("AT+CMGS=\"" + phone_no + "\"");
serial.write('\r');
serial.write(message); 
serial.write(Buffer([0x1A]));
serial.write('^z');
}

我需要帮助找出导致此错误的原因..谢谢

0 个答案:

没有答案