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

can't get sim inbox #54

Closed anshem97 closed 4 years ago

anshem97 commented 4 years ago

Hi, I'm trying to get incoming SIM card messages, but they always get this kind of answer. image

This is my code, options as in the example.

let modem = serialportgsm.Modem();
    modem.open('COM16', options);
    modem.on('open', (data) => {
        modem.initializeModem((_) => {
            modem.getSimInbox((res) => {
                console.log(res);
            })
        })
    })

But on I have incoming messages, what confirm desktop utilities. Can someone help me ?

Apollon77 commented 4 years ago

Please use the second callback parameter as "err" and output result there too. Do you get an error?

anshem97 commented 4 years ago

No errors (

    let modem = await serialportgsm.Modem();
    modem.open('COM16', options);
    modem.on('open', data => {
        console.log(`Modem open - ${JSON.stringify(data)}`);
        modem.initializeModem((res, err) => {
            if (res) console.log(`Modem initializeModem res - ${JSON.stringify(res)}`);
            if (err) {
                console.log(`Modem initializeModem err - ${JSON.stringify(err)}`);
                return false;
            }
            modem.getSimInbox((res, err) => {
                if (res) console.log(`Modem getSimInbox res - ${JSON.stringify(res)}`);
                if (err) {
                    console.log(`Modem getSimInbox err - ${JSON.stringify(err)}`);
                    return false;
                }
            })
        })
    })

This is my output, with AT log. image image

Apollon77 commented 4 years ago

I now only can assume that there is not the correct "message source" is selected ... maybe experiment around a bit with https://www.developershome.com/sms/cpmsCommand.asp

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.