Dear All.
First, Thankyou for the "GSM Shield" Team for the great library.
I tried to use GSM_Shield library with WaveCom modem.
It works as expected, well with some commenting at init part for lines that I "think" not a mandatory.
By default this library use a pooling methode to check for new SMS, using AT+CMGL.
Wavecom modem can send +CMTI if there is a new msg come, without first requested by application (It's simply Modem initiated).
Is there a way to catch this using GSM_Shield library ?.
I tried to add methode to GSM Class, name it as -> IsCMTIPresent
In GSM_Shield.cpp
/**********************************************************
Method checks if there is +CMTI available
It's just adapted from CheckRegistration
return values:
CMTI_NOT_AVAILABLE - There is no new msg announced by modem
CMTI_AVAILABLE - Modem said there is New Mesg
CMTI_TIMEOUT - Timeout
**********************************************************/
byte GSM::IsCMTIPresent(void)
{
byte status;
byte ret_val = CMTI_NOT_AVAILABLE;
SetCommLineStatus(CLS_FREE);
// 1 sec. for initial comm tmout
// 50 msec. for inter character timeout
Serial.print("Just Check mySerial ... ");
status = WaitResp(5000, 50);
Serial.print("Status is : ");
Serial.println(status, DEC);
if (status == RX_FINISHED) {
Serial.println("Finish Checking");
// something was received but what was received?
// ---------------------------------------------
if(IsStringReceived("+CMTI")){
// it means There is New Mesg Received
// ----------------------------
Serial.println("There is New Msg");
ret_val = CMTI_AVAILABLE;
}
else {
Serial.println("There is NO NEW Msg");
ret_val = CMTI_NOT_AVAILABLE;
}
}
else {
// nothing was received
// --------------------
Serial.println("Ouuchhh ... mySerial not responding");
ret_val = CMTI_TIMEOUT;
}
return (ret_val);
}
In GSM_Shield.h (The "enum" Part)
enum cmti_ret_val_enum
{
CMTI_NOT_AVAILABLE = 0,
CMTI_AVAILABLE,
CMTI_TIMEOUT,
CMTI_LAST_ITEM
};
In GSM_Shield.h (Inside "GSM class" Part)
byte IsCMTIPresent(void);
I Used this line inside my sketch
if (gsm.IsCMTIPresent()== 1){
Check_SMS(); //Check if there is SMS
}
But it didn't work
I think there is something wrong with the way I call
WaitResp(5000, 50)
It always retval with --> RX_TMOUT_ERR,
So , kindly please tell me how to catch that "+CMTI".
Sincerely
-bino-