c++ - Receiving sms through gprs shield on Arduino -
I am trying to find some example code which is about listening to sms and reading it. I am new in command, so I am trying to see some examples. My intention is to listen to SMS and read content. If there is a word in the message: 'Forward', I want it to run a certain function. I am using a studio GPRS v1.4 gradient with my arduino uno.
I found a library but I am confused with the readSMS () function. The library is found here:.
I have the current code:
GPRS GPRTtext (8, 7 9, 600, "1818XXXXXXXXX"); // Texas, Rx, PWR, Bodrate, phone number zero setup () {Serial.begin (9600); GprsTest.preInit (); Delay (1000); While (0! = GprsTest.init ()) {delay (1000); Serial. Print ("init error \ r \ n"); }} Zero loop () {// is not gprsTest.readSMS () for doing anything; }
My problem is that what I want to do in the parameters of the readSMS function.
According to the API, the int, string, and other int
int readSMS (int message index, four * message, integer length) in the function;
Any ideas? There is really no document in receiving SMS
I see- I am not familiar with studio (whose comments The header files have not been well maintained properly to give you some help), but here's the basic idea:
Receive text messages on selected message memory (SIM or phone that will be modem in your case) Are stored on independent indexes. . New messages usually take the smallest unused index (index starting from 1).
There are two ways to find a new SMS: 1) Modem sends a string to the output port to indicate the new SMS (like an obstacle)
2) You can read the unread count Message yourself (voting)
These methods require the knowledge of hardware dependent AT commands. If you understand what's going on, then read the AT command CMRR and CMGF
He has said that the information you clearly demand The readSMS function of gprs.cpp can be found in the function.
* Message
is a buffer in which the message will be read.
length
.
The return status is always 0 (not a good strategy).
I would recommend using a custom code to distinguish between unread and unread messages. It depends on your application
Comments
Post a Comment