zabsalahid / serialport-gsm

SerialPort-GSM is a simplified plugin for communicating with gsm modems. (Primarily for sms) (Focused in PDU mode)
MIT License
90 stars 47 forks source link

Sending message takes to much time. #44

Closed hamidafghan closed 4 years ago

hamidafghan commented 4 years ago

I am using ubuntu 19.04 with 8 GB memory and Core i5 processor. The modem is Hawaii E303. Sending message is working but takes to much time, about 1 or more minutes. There is what I have code:

  let serialportgsm = require("serialport-gsm");

  let modem = serialportgsm.Modem();

  let options = {
    baudRate: 115200,
    dataBits: 8,
    stopBits: 1,
    parity: "none",
    rtscts: false,
    xon: false,
    xoff: false,
    xany: false,
    autoDeleteOnReceive: true,
    enableConcatenation: true,
    incomingCallIndication: true,
    incomingSMSIndication: true,
    pin: "",
    customInitCommand: "",
    logger: console
  };

  modem.open("/dev/ttyUSB2", options, () => console.log("Connected"));

  modem.on("open", data => {
    // initialze the modem
    modem.initializeModem(function() {
      console.log("The GSM Modem is ready now.");
    });

    // set the the modem mode to PDU
    modem.setModemMode(function() {
      console.log("Setting the mode to PDU");
    }, "PDU");

    // Sending message
    // modem.sendSMS("+93747912248", "I am fine!", true, function() {
    //   console.log("sending message");
    // });

    modem.getNetworkSignal(result => {
      console.log(`Signal Strength = ${result}`);
    });
    //send message(number, text, alert(true or false), callback)
    modem.sendSMS("+93747912248", `Hello there zab!`, false, function(response) {
      console.log("message status", response);
    });
  });

So what I want to know is, is it the normal process that takes the time or any suggestion?

zabsalahid commented 4 years ago

Hello @hamidafghan ! Have you tried changing the baudRate? I'm sorry but I do not know what baudRate to use for Huawei E303. Can you try 9600?

Apollon77 commented 4 years ago

But baudRate: 115200, should be faster then 9600 :-) I think debug log would be helpful

hamidafghan commented 4 years ago

@zabsalahid is there any way to get the baudRate from the device connected?

zabsalahid commented 4 years ago

@hamidafghan Nope, you have to set it. Different devices have different requirement for baudRate when connecting. But as @Apollon77 said

But baudRate: 115200, should be faster then 9600 :-) I think debug log would be helpful

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.