Open brvdg opened 7 years ago
Is there a need to read sms upon reception, or just from the internal memory?
Read from internal memory is for me enough.
I think, to react in the moment when the sms is received is very difficult. The SimCom module sends an AT command at this moment. If you are in the interaction with the module you get an AT command in the middle of an existing communication.
Take a lock in my code. There is an example to read a sms from the internal storage. For my project is this enough. I check the storage from time to time.
I also want that feature.
+1
What hardware is under the question?
would be good to have for credit balance checking
I use ussd for balance check
On 25 Oct 2017 12:05 p.m., "9H1LO" notifications@github.com wrote:
would be good to have for credit balance checking
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vshymanskyy/TinyGSM/issues/79#issuecomment-339264751, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb9lCuIGrrXfW17GTpguSaurF74giE2ks5svvnAgaJpZM4PUlZ9 .
i don't think my operator has a ussd code for balance check but i will ask around
do you have a link to a doc/example on ussd query/reply and can this be performed whilst an active gprs & mqtt session is running ?
managed to get ussd code from operator and send with:
String ussd_balance = modem.sendUSSD("*123#"); Serial.print(ussd_balance);
but get nothing in return
The library looks awesome but receiving and acting on SMS is the sole purpose I bought a SIM800L shield for so I'll join the people wishing for this feature.
I currently use a very old proprietary system to toggle power outlets at a remote location using SMS as the 4G based modem there does not reconnect reliably after a power outage for example. With SMS it's possible to use a prepaid SIM card with no monthly fees for this purpose.
I believe I can make this work using some other library or AT commands but it's a shame as this library looks the most promising otherwise (and I'm a big fan of Blynk!). Who knows if I'll be able to contribute to this in case I find a good solution. :)
Ajudem sou novo aqui estou a utilizar o módulo A6, como faço ele ler uma mensagem recebida.
@PES-TANA Yes, definitely! nostro appetere ut eam. In cum primis corrumpit tincidunt, mel omnes utinam at. Ne qui fabulas laoreet. Et qui dolore epicurei. At pri movet graece utroque, quidam mollis iudicabit eum te. Libris essent euismod in ius, eum ut idque consectetuer. Maybe I should use google translate at least...
Upvote for this feature. Also @vshymanskyy thank you so much for this library, I'm so thankful to not have to start from scratch. Seriously thank you!
+1 I also need this feature! Is the commit from @szotsaki going to be approved and merged?
After adding your code in https://github.com/szotsaki/TinyGSM/commit/21845ba49be35058f77c0f54f868cd7238472538 , when I send an SMS to the SIM808 it displays error:
How do I get the GSMclient to read the latest SMS when this command is received?
It seems the waitResponse function is going to the finalise clause when receiving this command.
@jashinj The library itself just turns on the unsolicited messages when an SMS/MMS arrives; this is what you see (+CMTI: "SM",14
).
It's the user's responsibility to periodically check their UART line if anything, like an unsolicited message, has been put there. The CMTI message holds the memory index so after you extracted that index you can call readSmsMessage
with that index.
I created a merged master
branch with all my pull requests in my fork so if you clone that one, you can use SIM800 SMS handling right away.
Two notes:
gnu++11
to gnu++14
in your <Arduino IDE directory>/hardware/arduino/avr/platform.txt
.Is there a need to read sms upon reception, or just from the internal memory?
Is there a need to read sms upon reception, or just from the internal memory Please add THESE FEATURES for sim800 In the ReadSMS feature, these things might be useful
- Check for number of unread SMS
- Read SMS form pointer This function should return the sender (mobile num) and message
@szotsaki Hello and respect I tested your code. When compiling, I encountered the following. It should be noted that I am using the visual studio for arduino coding (visual micro), however, I did the changes you have made to convert gnu 11 to gnu 14. I also use the IDE 1.8.7 version. The eyeball is as follows:
Error error: invalid use of 'auto error: invalid conversion from 'const __FlashStringHelper *' to 'int' [-fpermissive]
@mayurharge
just Download and install library https://github.com/szotsaki/TinyGSM
and compile any example on this Library (Example on szotaski Repository equal to vshymanskyy/TinyGSM ) error in mentioned in last post for Library szotsaki/TinyGSM
but in vshymanskyy/TinyGSM no have error
Thanks.
i want use MQTT and read/delete SMS feature in my sim800 project. Tomorrow I must deliver my project. If you have an existing source code or need to make changes to the library, share it here. thank you
@mbta009 it seems that data type of defined function and the return value is not same. so you might need to edit the data type for each function
if you just want to use sms feel free to use my forked library https://github.com/mayurharge/TinyGSM for deleting the sms use modem.emptySMSBuffer()
@mayurharge no MQTT and sms. but see your GSM lib, It was interesting to set up a webserver with Simcom. can you test https://github.com/szotsaki/TinyGSM and compile without error?
@mbta009 it has MQTT also but in a separate example, you can do some copy+paste and build the code you need
@mayurharge oh. ok that's good. https://github.com/mayurharge/TinyGSM have MQTT and SMS feature. test it now. no problem run sms and gprs together?
yes it does I have used it myself
@mayurharge Thanks. Check Example code of your lib, that's Compile without error. my main code work with vshymanskyy/TinyGSM but with your lib have error : ago mentioned:
@mbta009 it seems that data type of defined function and the return value is not same. so you might need to edit the data type for each function Can you explain more? Thanks.
Severity Code Description Project File Line Suppression State Error (active) E1696 cannot open source file "stddef.h" Logger_Sim800 c:\Users\MBTA\Documents\Arduino\libraries\ArduinoJson-master\src\ArduinoJson\JsonVariant.hpp 7 Error 465:38: error: 'REG_OK_ROAMING' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientSIM800.h 465 Error 465:18: error: 'REG_OK_HOME' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientSIM800.h 465 Error 462:36: error: 'REG_OK_TCP' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientESP8266.h 462 Error 462:18: error: 'REG_OK_IP' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientESP8266.h 462 Error 428:38: error: 'REG_OK_ROAMING' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientBG96.h 428 Error 428:18: error: 'REG_OK_HOME' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientBG96.h 428 Error 427:38: error: 'REG_OK_ROAMING' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientUBLOX.h 427 Error 427:18: error: 'REG_OK_HOME' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientUBLOX.h 427 Error 404:38: error: 'REG_OK_ROAMING' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientM590.h 404 Error 404:18: error: 'REG_OK_HOME' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientM590.h 404 Error 395:38: error: 'REG_OK_ROAMING' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientA6.h 395 Error 395:18: error: 'REG_OK_HOME' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientA6.h 395 Error 38:28: error: redefinition of 'const char GSM_OK [] C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmCommon.h 38 Error 38:28: error: redefinition of 'const char GSM_OK [] C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmCommon.h 38 Error 38:28: error: redefinition of 'const char GSM_OK [] C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmCommon.h 38 Error 38:28: error: redefinition of 'const char GSM_ERROR [] C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmCommon.h 38 Error 38:28: error: redefinition of 'const char GSM_ERROR [] C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmCommon.h 38 Error 355:36: error: 'REG_OK_TCP' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientESP8266.h 355 Error 355:18: error: 'REG_OK_IP' was not declared in this scope C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientESP8266.h 355 Error 33:6: error: multiple definition of 'enum RegStatus C:\Users\MBTA\Documents\Arduino\libraries\TinyGSM-master\src\TinyGsmClientBG96.h 33
@mayurharge The problem was solved. Thanks.
@mbta009 It seems I was a few minutes too late. I've been planning to test @szotsaki 's fork also, so this discussion got me interested to see if it'll build ok on my system. I am using PlatformIO for development and got the same error on compilation (MQTTClient.ino example).
The only thing I had to do to get it to compile was remove the (AFAIK optional) return type declaration -> auto
on line 954 of TinyGSMClientSim800.h. So change from:
const auto convertMstToString = [](const MessageStorageType &type) -> auto {
To:
const auto convertMstToString = [](const MessageStorageType &type) {
I don't have the hardware at hand to test it though but at least now it compiles to both ATmega2580 and ESP8266. I did not even need to modify anything in platform.txt
.
@ristomatti Thanks for test. yes my compiler also error at "auto", your compile, Did not get the error? no problem for remove "auto" in performance Library?
@mbta009 To be honest, I'm not an expert on C++ (quite the contrary). But my understanding is that adding a return type to a lambda function (-> <type>
) can be used for extra type safety. Setting a return type auto
does not seem to make sense to me as it by definition means that the compiler should be able to figure out the correct type based on the code. That's the point of having the variable type of const auto
.
@mbta009 If you were worried about the effect on performance, it should not make any difference. The return type is just for compile time type safety (static error checking of the code).
Another way to make it compile is to change the line to:
const auto convertMstToString = [](const MessageStorageType &type) -> const __FlashStringHelper* {
But that just looks ugly.
@ristomatti
Thank you for your information. I'm currently using the https://github.com/mayurharge/TinyGSM library. But now I have time limits for the end of the project. After completing the project, I will test https://github.com/szotsaki/TinyGSM, and I will quote the result of the removal of "auto". Thanks
+1 for read new SMS... from memory is fine, don't necessarily need to trigger an event right at time of SMS reception.
Hi
I used to trigger an event right at time of SMS reception for immediate action like open a door
while (SerialAT.available() > 0) { int index = modem.newMessageIndex(0); if (index > 0) { String SMS = modem.readSMS(index); String ID = modem.getSenderID(index); DBG("new message arrived from :"); DBG(ID); DBG("Says"); DBG(SMS); SerialMon.println(sizeof(SMS.toInt()));
And work fine, just not sure if olds SMS are deleted . the library deleted itself?
@mbta009 It seems I was a few minutes too late. I've been planning to test @szotsaki 's fork also, so this discussion got me interested to see if it'll build ok on my system. I am using PlatformIO for development and got the same error on compilation (MQTTClient.ino example).
The only thing I had to do to get it to compile was remove the (AFAIK optional) return type declaration
-> auto
on line 954 of TinyGSMClientSim800.h. So change from:const auto convertMstToString = [](const MessageStorageType &type) -> auto {
To:
const auto convertMstToString = [](const MessageStorageType &type) {
I don't have the hardware at hand to test it though but at least now it compiles to both ATmega2580 and ESP8266. I did not even need to modify anything in
platform.txt
.
put to platformio.ini src_build_flags = -Os -std=gnu++14
after
const auto convertMstToString = [](const MessageStorageType &type) -> auto {
is approved
Thanks for the tip @alexgavs !
Hello guys,
Sorry for this taking so long; I've updated my fork and besides merged in the latest version of this variant, I've removed the -> auto
return value indicator so no C++14 is required from now on.
Please, test it at https://github.com/szotsaki/TinyGSM and tell me if you bumped into an issue and I'll try to fix it.
@szotsaki Hi
I use the library below: https://github.com/szotsaki/TinyGSM
But I have trouble using the message reading function. Can you show the reading message by an example? Please help me.
thanks
Hello, this look like the newest update for reading SMS but can't get it to work properly. Any good example is much appreciated.
I open this, because right now there is no feature to read a SMS.