Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialport isse! #42

Open
alexptbg opened this issue Aug 9, 2018 · 1 comment
Open

serialport isse! #42

alexptbg opened this issue Aug 9, 2018 · 1 comment

Comments

@alexptbg
Copy link

alexptbg commented Aug 9, 2018

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

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!

@wehanvandermerwe
Copy link

image
Go read up on the newer documentation for SerialPort, some stuff changed, don't use sp.SerialPort anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants