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

CIPGSMLOC #604

Open gorogdaniel opened 2 years ago

gorogdaniel commented 2 years ago

Hi i try to use the command AT+CIPGSMLOC=1,1 for a localisatin of my sim800l. I must use this command becouse in Austria the other localisation command not work.

I get this part of code from an other script and put it inside of my but i get errors and cant bring it to run

my error is : `'sendAT' was not declared in this scope

       String getGsmLocation(){
           sendAT(GF("+CIPGSMLOC=1,1"));
           if (waitResponse(10000L, GF(GSM_NL "+CIPGSMLOC:")) != 1) {
               return "";
           }
           String res = stream.readStringUntil('\n');
           waitResponse();
           res.trim();
           return res;
       } 

The code of the old command what not work in my country looks so:


    DBG("Requesting current GSM location");
    if (modem.getGsmLocation(&lat, &lon, &accuracy, &year, &month, &day, &hour,
                             &min, &sec)) {
      DBG("Latitude:", String(lat, 8), "\tLongitude:", String(lon, 8));
      DBG("Accuracy:", accuracy);
      DBG("Year:", year, "\tMonth:", month, "\tDay:", day);
      DBG("Hour:", hour, "\tMinute:", min, "\tSecond:", sec);
      lat2 = String(lat, 8);
      lon2 = String(lon, 8);
      accuracy2 = accuracy;
      break;
    } else {
      DBG("Couldn't get GSM location.");
      delay(1000L);
      break;
    }
  }```

Maybe can someone help me to implement the first command in the else {}; part so if the script dont get any response from the first one it try the second command.

Thank you very much 
SRGDamia1 commented 2 years ago

I don't know if you're still having an issue, but your code probably needs to use something like modem.sendAT(...); rather than a naked sendAT(...).