Open alexptbg opened 6 years ago
Hi,
gsm.js
` function err(message) { console.log('Usage: node send_sms.js /path/to/device xxxxyyzz "Foo Bar"'); process.exit(); } var device = process.argv[2]; var receiver = process.argv[3]; var text = process.argv[4]; if(!device || !receiver || !text) err(); var modem = require('modem').Modem(); modem.open('/dev/ttyS0', function() { modem.sms({ receiver:receiver, text:text, encoding:'7bit' }, function(err, sent_ids) { console.log('>>', arguments); if(err) console.log('Error sending sms:', err); else console.log('Message sent successfully, here are reference ids:', sent_ids.join(',')); }); }); `
console error:
node gsm.js /dev/ttyS0 +359894587672 "test node" DEPRECATION: Please use require('serialport') instead of require('serialport').SerialPort ^C
require('serialport')
require('serialport').SerialPort
modem.js
1: var pdu = require('pdu'); 2: var sp = require('serialport'); 3: var EventEmitter = require('events').EventEmitter; ...... 81: modem.open = function(device, callback) { 82: modem.port = new sp.SerialPort(device, { 83: parser: sp.parsers.raw 84: });
Cant find that DEPRECATION error!
Go read up on the newer documentation for SerialPort, some stuff changed, don't use sp.SerialPort anymore
Hi,
gsm.js
console error:
modem.js
Cant find that DEPRECATION error!