Pages: [1]   Go Down
Author Topic: Using GSM_Shield library with WaveCom modem  (Read 1493 times)
0 Members and 1 Guest are viewing this topic.
Indonesia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Code:
/**********************************************************
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)
Code:
enum cmti_ret_val_enum
{
  CMTI_NOT_AVAILABLE = 0,
  CMTI_AVAILABLE,
  CMTI_TIMEOUT,
   
  CMTI_LAST_ITEM
};

In GSM_Shield.h (Inside "GSM class" Part)
Code:
    byte IsCMTIPresent(void);


I Used this line inside my sketch
Code:

    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-
Logged

Indonesia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

bump
Logged

jakarta
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks about your share
and i want ask about if i want to call with wavecom M1306B Q2403A, may you can give the example code
thanks again bevore smiley-grin
Logged

Pages: [1]   Go Up
Jump to: