vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.91k stars 709 forks source link

Getting URC Messages #615

Open HazemBenAmmar opened 2 years ago

HazemBenAmmar commented 2 years ago

Hello, I am trying to read the URC message (ALARM RING, +CMTI) sent back by the modem to detect some events. I managed to detect the reception of the message with the RING pin, but I can't find a solution to detect the Indicate expired alarm.

i'm working with: Modem: SIM800l Main processor board: ESP32 TinyGSM version: 0.11.4

Thank you.

SRGDamia1 commented 2 years ago

To act on any URC you have to keep listening for it with the blocking waitResponse() function. If you're ok with repeatably running the blocking function, you should be able to keep calling it with waitResponse(1000L, GF("ALARM RING"), GF("CMTI"));

This library is not built to efficiently intercept truly unsolicited responses and act on them with any sort of non-blocking interrupt-like functionality.

HazemBenAmmar commented 2 years ago

hello @SRGDamia1 thnak you for your response, i think of adding a callback message to be called when a URC message is received or to use the waitResponse and the RingPin.