GithubHelp home page GithubHelp logo

Comments (24)

goldcode88 avatar goldcode88 commented on August 23, 2024 1

@zabsalahid
case 1: success, get a sms message
modem.setModemMode(msg => console.log('set pdu msg:', msg), 'PDU');
modem.sendSMS('+639991115555', Hello there zab!, false, function (response) {
console.log('message status', response)
})
case 2: success, get a pdu message
modem.setModemMode(msg => console.log('set pdu msg:', msg), 'PDU');
modem.sendSMS('+639991115555', Hello there zab!, true, function (response) {
console.log('message status', response)
})
case 3: failure
modem.setModemMode(msg => console.log('set pdu msg:', msg), 'SMS');
modem.sendSMS('+639991115555', Hello there zab!, true, function (response) {
console.log('message status', response)
})
case 4: failure
modem.setModemMode(msg => console.log('set pdu msg:', msg), 'SMS');
modem.sendSMS('+639991115555', Hello there zab!, false, function (response) {
console.log('message status', response)
})
Anyway, case1 and case2 Can meet all needs for send sms/pdu message. Thanks again.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024 1

Thanks for this package. I was reviewing this issue as I was first attempting to use in 'SMS' mode. Works fine in 'PDU' mode so I will use that. BTW using with a RaspberryPi 3B+ and Quectel EC25 module.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024 1

@zabsalahid
Hi zabsalahid,
My bad...I had a Picocom terminal attached to same gsm serial port and it was confusing things, I think it was picking up some of the responses and clearing the buffer so your code was not seeing all the responses. I've still got a couple issues but can see a lot more. Let me debug a bit before I make any further requests. BTW really nice code. I also like the work you guys did with embedding a Promises interface inside the functions.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024 1

@zabsalahid

Found the issue... putting these emails together must be good therapy. It occured to me as I stepped away for an hour, that since I was not seeing an +CMTI when I instrumented your code, and therefore it really cannot be your issue (i.e. if your code can't see it, it can't handle it). After much digging around and experimenting manually with the Quectel EC25 I discovered an obscure, and I believe proprietary, command AT+QURCCFG which is used to select the output port for the URC (default was something called an 'usbat' which actually sounded correct if one assumes USB-AT would be the port you issued the AT commands over - evidently not). When I changed the URC port to the 'usbmodem' and everthing appeared to work and I see your code gets and properly handles the +CMTI command. I will play with this a bit more to make sure its solid. I may need to issue an AT+QURCCFG command at start-up to get the unit into the correct configuration. I can tell you how much I appreciate your work on this code. Really Great! Thank you.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024 1

@zabsalahid

Hi Zab,

Is this a bug or a Quectel behavioral issue? Not quite sure what's going on....

I noticed that you use the SIM memory vs internal "ME" memory, but noticed you do not appear to intialize to SM until after a message has arrived in the default "ME" (see trace below).

You can see from the trace I first send one message out, and then from my phone I send three texts in a row ("Test1", "Test2" and "Test3") back to the device. All three messages appear to arrive via the +CMTI URC indicaton and the code correspondingly issues a CMGR for each. However only the first message gets read, I suspect because it sucessfully gets the message from "ME" prior to your chaning from "ME" to "SM". The next two messages show +CMTI: "ME" still but the corresponding CMGR gets just OK vs. the expected message. This leads to a timeout on the CMGR since no actual message was retrieved. I think things are out of sequence - the module is still storing in "ME" but you have switched to "SM" and not getting anything since the messages are in "ME"?

I was able to fix this by changing to "ME". i.e. I change AT+CPMS="SM" to AT+CPMS="ME" (along with the expected DataReceived) and it appears to work fine (since we are deleting messages as we read them, the ME is plenty large enough)

This trace was created by adding console.log(`_dataReceived ${newpart}`) right after newparts.forEach(newpart => { line in your modem.js file.

GSM Control Server Started on Port: 3000!
_dataReceived ATZ
_dataReceived OK
Modem Successfully Initialized
_dataReceived AT+QURCCFG="urcport","usbmodem". <====this is a Quectel init command I added
_dataReceived OK
URC Port Set to: "usbmodem"
_dataReceived AT+CMGF=0
_dataReceived OK
Set Mode: PDU_Mode
_dataReceived AT+CSQ
_dataReceived +CSQ: 23,99
_dataReceived 
_dataReceived OK
Signal Strength = 23
_dataReceived AT+CLIP=1
_dataReceived OK 
Message no: 1 Msg ID: TZthaEPFZ3NdIKW5KEASqVKoF,Successfully Sent to Message Queue To: undefined
/var/www/rpi-gsm-local-server-nodejs/public-/On
_dataReceived AT+CMGS=107
_dataReceived > 0001000B9xxxxxxxxxxxF400006B316499CD7E83A0E13A9B05A2A2D37350BB3C9F87CF65D03D3C07CDCB6E3AC82C7FB741D0709D7D9A83A4E1395C5C96CBF320681AE47C93CBCA39E85E1683E665B9BD2C0F815A2038BB1C9E9741E437C8FDA683E4E539FCED2683C4E1F11A
_dataReceived +CMGS: 137
_dataReceived 
_dataReceived OK
Message no: 1 Msg ID: TZthaEPFZ3NdIKW5KEASqVKoF,Message Successfully Sent To: 1xxxxxxxxxx
_dataReceived 
_dataReceived +CMTI: "ME",0    <=== indicates first "Test 1" message arrived in ME
_dataReceived AT+CMGR=0
_dataReceived +CMGR: 0,,25
_dataReceived 079xxxxxxxxxxxF9040B919187735610F400009140602131906906D4F29C0E8A01
New Message Received: Sat Apr 06 2019 12:13:09 GMT-0400 (EDT)
New Message:Test 1  From: 1xxxxxxxxxx At time: Sat Apr 06 2019 12:13:09 GMT-0400 (EDT)
_dataReceived 
_dataReceived OK
_dataReceived AT+CMGD=0
_dataReceived OK
_dataReceived AT+CPMS="SM"    <====== now switch to preferred memory "SM"
_dataReceived +CPMS: 0,30,0,255,0,255
_dataReceived 
_dataReceived OK
_dataReceived 
_dataReceived +CMTI: "ME",0. <==== indicates "Test2" message arrived in "ME"
_dataReceived AT+CMGR=0
_dataReceived OK
_dataReceived 
_dataReceived +CMTI: "ME",1 <==== indicates "Test3" message arrived in "ME"
(node:1306) UnhandledPromiseRejectionWarning: Error: timeout: 
{"domain":null,"_events":{},"_eventsCount":1,"command":"AT+CMGR=0","add_time":"2019-04-06T16:13:18.217Z","id":12,"timeout":60000,"execute_time":"2019-04-06T16:13:18.217Z"}
    at EventEmitter.item.on (/var/www/rpi-gsm-local-server-nodejs/lib/serialport-gsm/lib/functions/modem.js:392:27)
    at emitNone (events.js:106:13)
    at EventEmitter.emit (events.js:208:7)
    at Timeout.timeouts.(anonymous function).setTimeout [as _onTimeout] (/var/www/rpi-gsm-local-server-nodejs/lib/serialport-gsm/lib/functions/modem.js:438:14)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
(node:1306) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1306) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
_dataReceived AT+CMGR=1
_dataReceived OK
(node:1306) UnhandledPromiseRejectionWarning: Error: timeout: 
{"domain":null,"_events":{},"_eventsCount":1,"command":"AT+CMGR=1","add_time":"2019-04-06T16:13:37.679Z","id":13,"timeout":60000,"execute_time":"2019-04-06T16:14:18.261Z"}
    at EventEmitter.item.on (/var/www/rpi-gsm-local-server-nodejs/lib/serialport-gsm/lib/functions/modem.js:392:27)
    at emitNone (events.js:106:13)
    at EventEmitter.emit (events.js:208:7)
    at Timeout.timeouts.(anonymous function).setTimeout [as _onTimeout] (/var/www/rpi-gsm-local-server-nodejs/lib/serialport-gsm/lib/functions/modem.js:438:14)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
(node:1306) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024 1

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

Hello @goldcode88!

Sorry for the late reply, been busy.

Example:

let serialportgsm = require('./lib')
let modem = serialportgsm.Modem()
let options = {
    baudRate: 115200,
    dataBits: 8,
    parity: 'none',
    stopBits: 1,
    flowControl: false,
    xon: false,
    rtscts: false,
    xoff: false,
    xany: false,
    buffersize: 0,
    autoDeleteOnReceive: true,
    enableConcatenation: true
}

modem.open('COM5', options, (data)=>{console.log(data)});
modem.on('open', () => {
    modem.initializeModem(msg => console.log('initialize msg:', msg));
    modem.setModemMode(msg => console.log('set pdu msg:', msg), 'PDU');
});
modem.on('close', msg => console.log('on close msg:' , msg));

modem.on('error',  msg => console.log('on error msg:' , msg));

from serialport-gsm.

goldcode88 avatar goldcode88 commented on August 23, 2024

Hi @zabsalahid,
Thank you for your reply! I have successfully sent a short message using PDU mode.But use SMS code, it return failure, the error log is as follows.

initialize msg: { status: 'success',
  request: 'modemInitialized',
  data: 'Modem Successfully Initialized' }
set pdu msg: { status: 'success', request: 'modemMode', data: 'SMS_Mode' }
{ status: 'success',
  request: 'sendSMS',
  data: 
   { messageId: 'ZWMuuYYBZwcdoTvko2BpXGzda',
     response: 'Successfully Sent to Message Queue' } }
/home/vgsoma/node_modules/serialport-gsm/lib/functions/modem.js:214
            if (data.status == 'fail') {
                     ^

TypeError: Cannot read property 'status' of undefined
    at /home/vgsoma/node_modules/serialport-gsm/lib/functions/modem.js:214:22
    at EventEmitter.item.on (/home/vgsoma/node_modules/serialport-gsm/lib/functions/modem.js:358:7)
    at emitNone (events.js:106:13)
    at EventEmitter.emit (events.js:208:7)
    at Timeout.timeouts.(anonymous function).setTimeout [as _onTimeout] (/home/vgsoma/node_modules/serialport-gsm/lib/functions/modem.js:404:14)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)


from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

@goldcode88 here's an example of sending a message. Kindly also update package to updated version.

modem.open('COM3', options, (data) => { console.log(data) });
modem.on('open', () => {
    modem.initializeModem(msg => console.log('initialize msg:', msg));
    modem.setModemMode(msg => console.log('set pdu msg:', msg), 'PDU');
    modem.sendSMS('+639991115555', `Hello there zab!`, false, function (response) {
        console.log('message status', response)
    })
});

from serialport-gsm.

goldcode88 avatar goldcode88 commented on August 23, 2024

@zabsalahid
What's your mean is "setModemMode = PDU, and sendSMS=false is send message by SMS" and "setModemMode = PDU, and sendSMS=true is send message by PDU". Is it right?

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

@goldcode88 the false on sendSMS sends it as a normal message, setting it to true will send it as a class 0 message or flash message. Give it a try. 👍
setModemMode will set the gsm as PDU mode or SMS mode, but most commands implemented are mostly PDU mode.

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

@goldcode88 Yes, call functions shown at the documentation are supported with PDU mode. So, for the meantime, only use PDU mode as it is also more supported in most gsm modems.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024

@zabsalahid
Really great library...standing on the shoulders of giants...but.. I could use a bit of help to get everything working properly - thank you in advance...

I've run in to two issues.

  1. Can you give clip of demo code for receive?
  2. On Open and intialization, while transmit/sendSMS works, I don't seem to get response msgs that you guys show above.

Env: npm ls shows I have serialport-gsm 2.3.1 / serialport 7.1.4 (currently the latest)

Here is my code snippet:

const serialportgsm = require('serialport-gsm');

var gsmModem = serialportgsm.Modem()
let options = {
    baudRate: 115200,
    dataBits: 8,
    parity: 'none',
    stopBits: 1,
    flowControl: false,
    xon: false,
    rtscts: false,
    xoff: false,
    xany: false,
    autoDeleteOnReceive: true,
    enableConcatenation: true,
    incomingCallIndication: true
}


let phone = {
    name: "Paul",
    number: "1xxxxxxxxxx",
    mode: "PDU"
}

var message = `Hello ${phone.name}, Try again....This message was sent from Paul\'s Raspberry Pi NodeJs web server! - please do not respond back`;	    

gsmModem.open('/dev/ttyUSB3', options, (data) => {console.log(`Modem Opened ${data}`)});
gsmModem.on('open', () => {
    gsmModem.initializeModem((msg) => console.log(`Modem initialize msg: ${msg}`));
    gsmModem.setModemMode(msg => {
	console.log(`Set Mode to ${phone.mode}`);
	console.log(`Who ${phone.name} number ${phone.number}`);
	console.log(`Return Message =  ${msg}`);
    }, phone.mode);
    gsmModem.getNetworkSignal(result => {
	console.log(`Signal Strength = ${result}`);
    });
});

gsmModem.on('error', (err) => {
    console.log(`Modem threw error: ${err}`);
    gsmModem.getNetworkSignal((result) => {
	console.log(`Signal Strength = ${result}`);
    });
});

Output:

/var/www/rpi-gsm-local-server-nodejs/public
GSM Control Server Started on Port: 3000!
Modem Opened null
Modem initialize msg: undefined
Set Mode to PDU
Who Paul number 1xxxxxxxxxx
Return Message =  undefined
Signal Strength = [object Object]

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

Hello @psmass!

  1. Can you give clip of demo code for receive?
gsmModem.on('onNewMessageIndicator', data => {
 //indicator for new message only (sender, timeSent)
  console.log(data)
})

gsmModem.on('onNewMessage', data => {
  //whole message data
  console.log(data)
})
  1. On Open and intialization, while transmit/sendSMS works, I don't seem to get response msgs that you guys show above.

Set modem mode is for setting the gsm modem to PDU mode or SMS mode only. The package currently supports PDU mode only as most gsm modem support PDU mode. so set it as PDU.

You have to call another method for sending message.

gsmModem.on('open', () => {
    //init
    gsmModem.initializeModem((msg) => console.log(`Modem initialize msg: ${msg}`));
    //set modem mode
    gsmModem.setModemMode(msg => {
	console.log('set pdu msg:', msg)
    }, phone.mode);
    //get network signal
    gsmModem.getNetworkSignal(result => {
	console.log(`Signal Strength = ${result}`);
    });
    //send message(number, text, alert(true or false), callback)
    gsmModem.sendSMS('+639991234567', `Hello there zab!`, false, function (response) {
        console.log('message status', response)
    })
});

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024

@zabsalahid

Thank you fso much for your prompt response. With regard to #2 I was not clear. Yes I did a transmit and it works fine - enclosed code snippet I did not include.

	
	gsmModem.sendSMS(phone.number, message, false, (result) => {
	    console.log(`Sent Message to ${phone.name} with result ${result}`);
	});

My issue was that I don't seem to get the return status that you get. Note my output variables that are undefined or [Object, Object].

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

Hey @psmass!

Regarding the [Object, Object], you can do this

        gsmModem.sendSMS(phone.number, message, false, (result) => {
	    console.log(`Sent Message to ${phone.name} with result`, result);
	});

console log does not output objects and its fields when it is directly mixed with a string, you can display it separately on a console log.

Regarding with Promises interface, @karianpour was the big help on it!

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024

@zabsalahid

Thanks so much for your ongoing support - I don't seem to be getting the receive messages Indications (see second item below). Again for clarity I am using a Quectel EC25 module connected to a Raspberry 3 B+.

Note: I did modify the following examples in redacting my phone number as this is a public forum.

Sorry for the long winded detail let me know if you require anything else or if a live debug session would help.

First let me say that I have the transmit working great and displaying status etc as well. BTW I use the undocumented err return codes you provide on all of my calls to your library (let me know if you think I should not). example:

    gsmModem.initializeModem((msg, err) => {
	if (err) {
	    console.log(`Error Initializing Modem - ${err}`);
	} else {
	    console.log(`${msg.data}`);
	}
    });

Output: (also provides nice timeout errors if I connect picocom to the modem port)

Modem Sucessfully Opened
Configuring Modem for: Paul Tel no: 1xxxxxxxxxx Mode: PDU
/var/www/rpi-gsm-local-server-nodejs/public
GSM Control Server Started on Port: 3000!
Modem Successfully Initialized
Set Mode: PDU_Mode
Signal Strength = 23

Secondly - using the receive code you provided (thanks again for that), I don't seem to be receiving any incomming SMS messages. I can see one arrived as expected with the getSimInbox call(I added this right after my sendSMS code block as shown below. I also instrumented your modem.js to console log each text newpart in the modem.dataReceived function (console logged immediately after the text newparts.forEach(newpart => { statement.) Below is the latest version of my code and output.

gsmModem.on('open', () => {
    console.log(`Modem Sucessfully Opened`);
    gsmModem.initializeModem((msg, err) => {
	if (err) {
	    console.log(`Error Initializing Modem - ${err}`);
	} else {
	    console.log(`${msg.data}`);
	}
    });

    console.log(`Configuring Modem for: ${phone.name} Tel no: ${phone.number} Mode: ${phone.mode}`);
    gsmModem.setModemMode((msg,err) => {
	if (err) {
	    console.log(`Error Setting Modem Mode - ${err}`);
	} else {
	    console.log(`Set Mode: ${msg.data}`);	}	
    }, phone.mode);
    
    gsmModem.getNetworkSignal((sigStrength, err) => {
	if (err) {
	    console.log(`Error retrieving Signal Strength - ${err}`);
	} else {
	    console.log(`Signal Strength = ${sigStrength.data.signalQuality}`);
	}
    });

    gsmModem.on('onNewMessageIndicator', data => {
    //indicator for new message only (sender, timeSent)
        console.log(`New Message Indication: ${data}`);
    });

    gsmModem.on('onNewMessage', data => {
    //whole message data
        console.log(`New Message: ${data}`);
    });
... 
	    msgNum +=1;
	    gsmModem.sendSMS(phone.number, msgNum+message, false, (result) => {
		console.log(`Message no: ${msgNum} Msg ID: ${result.data.messageId},` +
			    `${result.data.response} To: ${result.data.recipient}`);
	    });
	    
	    gsmModem.getSimInbox((result, err) => {
		if(err) {
		    console.log(`Failed to get SimInbox ${err}`);
		} else {
		    console.log(`Sim Inbox Result: ${JSON.stringify(result)}`);
		}
	    });

In the instrumented _dataReceived, after I send a text back to the unit, I would have expected to see a URC of +CMTI but do not seem to get one. I see in your code that's one of the first things you check for in the modem.dataReceived function. Below is my output trace. I send out message #1 , text a reply Test Receive Message and then I send out message #2 (so that I can see if the Test Receieve message is in the simInbox.)

Modem Sucessfully Opened
Configuring Modem for: Paul Tel no: 1xxxxxxxxxx Mode: PDU
/var/www/rpi-gsm-local-server-nodejs/public
GSM Control Server Started on Port: 3000!
_dataReceived ATZ
_dataReceived OK
Modem Successfully Initialized
_dataReceived AT+CMGF=0
_dataReceived OK
Set Mode: PDU_Mode
_dataReceived AT+CSQ
_dataReceived +CSQ: 23,99
_dataReceived 
_dataReceived OK
Signal Strength = 23
_dataReceived AT+CLIP=1
_dataReceived OK
GET request for '/led/toggle?'
Message no: 1 Msg ID: xsQXwXmuI7FaqWXmKp2zDEtuF,Successfully Sent to Message Queue To: undefined
/var/www/rpi-gsm-local-server-nodejs/public-/On
_dataReceived AT+CMGS=107
GET request for '/images/rpi-logo.png'
GET request for '/images/LedOn.png'
GET request for '/images/nodejs-logo.png'
_dataReceived > 0001000B911111111111F400006B316499CD7E83A0E13A9B05A2A2D37350BB3C9F87CF65D03D3C07CDCB6E3AC82C7FB741D0709D7D9A83A4E1395C5C96CBF320681AE47C93CBCA39E85E1683E665B9BD2C0F815A2038BB1C9E9741E437C8FDA683E4E539FCED2683C4E1F11A
_dataReceived +CMGS: 106
_dataReceived 
_dataReceived OK
Message no: 1 Msg ID: xsQXwXmuI7FaqWXmKp2zDEtuF,Message Successfully Sent To: 1xxxxxxxxxx
_dataReceived AT+CMGL=4
_dataReceived OK
Sim Inbox Result: {"status":"success","request":"getSimInbox","data":[]}
GET request for '/led/toggle?'

Here I text a message back to my Quectel unit and then send a 2nd message out:

Message no: 2 Msg ID: B6fGzjLE5pfeADArdHNmf1tqz,Successfully Sent to Message Queue To: undefined
/var/www/rpi-gsm-local-server-nodejs/public-/Off
_dataReceived AT+CMGS=107
GET request for '/images/LedOff.png'
GET request for '/images/rpi-logo.png'
GET request for '/images/nodejs-logo.png'
_dataReceived > 0001000B911111111111F400006B326499CD7E83A0E13A9B05A2A2D37350BB3C9F87CF65D03D3C07CDCB6E3AC82C7FB741D0709D7D9A83A4E1395C5C96CBF320681AE47C93CBCA39E85E1683E665B9BD2C0F815A2038BB1C9E9741E437C8FDA683E4E539FCED2683C4E1F11A
_dataReceived +CMGS: 107
_dataReceived 
_dataReceived OK
Message no: 2 Msg ID: B6fGzjLE5pfeADArdHNmf1tqz,Message Successfully Sent To: 1xxxxxxxxxxx
_dataReceived AT+CMGL=4
_dataReceived +CMGL: 0,0,,37
_dataReceived 07919107739667F9040B911111111111F400009130629021806914D4F29C0E9296C7E5B4BD0C6A96E7F3F0B90C
_dataReceived 
_dataReceived OK
Sim Inbox Result: {"status":"success","request":"getSimInbox","data":[{"sender":"1xxxxxxxxxx","message":"Test Receive Message","index":0,"dateTimeSent":"2019-03-26T13:12:08.000Z","header":{"encoding":"7bit","smsc":"19703769769","smscType":"INTERNATIONAL","smscPlan":"ISDN"}}]}

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

Hey @psmass ! Sorry I wasn't able to help you on that but I'm glad you were able to play things through. Actually that's a good idea, like having an additional initialize modem parameter as other gsm modems sometimes require different AT commands on startup.

from serialport-gsm.

psmass avatar psmass commented on August 23, 2024

@zabsalahid
Thanks again for your help and for this library, but this was my issue - ideally an inheritable initialize C'tor.

Hey looks like modem.executeCommand(command, callback, priority, timeout) is not really generally available. In order to use it, it appears that you also need to 'register it' in the ' modem.dataReceived' function (i.e. for each command you send, that command needs to be expected (coded into) the dataReceived function in order to cancel the timer and send the result back). Is this true or am I missunderstanding the interface?

This is what I did to get what I needed to work (i.e. added an AT+QURCCFG command):

In modem.js I added:

  modem.setURCPort = function (callback, priority, port, timeout) {
    if (callback == undefined) {
      return new Promise((resolve, reject) => {
        modem.setURCPort((result, error) => {
          if (error) {
            reject(error)
          } else {
            resolve(result)
          }
        }, priority, timeout)
      })
    }
    if (priority == null) priority = false
      modem.executeCommand('AT+QURCCFG="urcport","'+port+'"', function (result, error) {
	 callback(result, error)
      }, false, timeout || 30000)
  }
...

Still in modem.js, under modem.receiveData: (after the 'ATZ' command)

else if (modem.queue[0] && (modem.queue[0].command.substr(0, 10) == 'AT+QURCCFG')) { // Set URC port (Quectel specific command)
            resultData = {
              status: 'success',
		request: 'URC Port Set to: "' + modem.queue[0].command.substr(22,),
              data: 'URC Port Successfully Set'
            }
            if ((newpart == ">" || newpart == "> " || newpart == 'OK') && resultData) {
              returnResult = true
            }
          }

in my code:

    gsmModem.setURCPort((result, err) => {
	if (err) {
	    console.log(`Initialize URC port failed: ${err}`);
	} else {
	    console.log (`${result.request}`);
	}
    }, false, "usbmodem");

Output:

Modem Sucessfully Opened
Configuring Modem for: Paul Tel no: 1xxxxxxxxxx Mode: PDU
/var/www/rpi-gsm-local-server-nodejs/public
GSM Control Server Started on Port: 3000!
Modem Successfully Initialized
URC Port Set to: "usbmodem"
Set Mode: PDU_Mode
Signal Strength = 23

from serialport-gsm.

zabsalahid avatar zabsalahid commented on August 23, 2024

Hello @goldcode88 ! Yep, it's still a work in progress but I got help from @karianpour and @Apollon77 . So good to know this library helped you.

from serialport-gsm.

adesurya avatar adesurya commented on August 23, 2024

Any Sample to use ussd dial and parsing the response ussd in string?

from serialport-gsm.

Apollon77 avatar Apollon77 commented on August 23, 2024

Positing in a closed issue makes not that much sense, or?! If you need something please create a new issue or better texting find it out by yourself and provide an example ;-)

from serialport-gsm.

karianpour avatar karianpour commented on August 23, 2024

@adesurya take a look at the this issue

from serialport-gsm.

Akmyrat17 avatar Akmyrat17 commented on August 23, 2024

how can i make otp service with adonis js

from serialport-gsm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.