Go Down

Topic: Using GSM_Shield library with WaveCom modem (Read 2368 times) previous topic - next topic


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: [Select]

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;
  // 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?
    // ---------------------------------------------
      // 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: [Select]

enum cmti_ret_val_enum

In GSM_Shield.h (Inside "GSM class" Part)
Code: [Select]

    byte IsCMTIPresent(void);

I Used this line inside my sketch
Code: [Select]

    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".



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 :D

Go Up