Browse Source

Merge pull request #34 from adrianca88/add_getIMSI_SIM800

Add get imsi sim800
v_master
Sara Damiano 5 years ago
committed by GitHub
parent
commit
7adf85de1c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions
  1. +1
    -2
      README.md
  2. +1
    -1
      src/TinyGsmClientA6.h
  3. +4
    -2
      src/TinyGsmClientSIM800.h
  4. +14
    -0
      src/TinyGsmCommon.h

+ 1
- 2
README.md View File

@ -116,9 +116,8 @@ Watch this repo for new updates! And of course, contributions are welcome ;)
- SIM800, SIM and SIM7000 only
**Credits**
- Primary Author/Contributor:
- Primary Authors/Contributors:
- [vshymanskyy](https://github.com/vshymanskyy)
- Digi XBee, editing of all modules:
- [SRGDamia1](https://github.com/SRGDamia1/)
- SIM7000:
- [captFuture](https://github.com/captFuture/)


+ 1
- 1
src/TinyGsmClientA6.h View File

@ -596,7 +596,7 @@ protected:
return len;
}
bool modemGetConnected(uint8_t mux) {
bool modemGetConnected(uint8_t) {
sendAT(GF("+CIPSTATUS")); //TODO mux?
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
waitResponse();


+ 4
- 2
src/TinyGsmClientSIM800.h View File

@ -323,6 +323,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
TINY_GSM_MODEM_GET_IMEI_GSN()
TINY_GSM_MODEM_GET_IMSI_CIMI()
SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
sendAT(GF("+CPIN?"));
@ -700,7 +702,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
}
uint8_t getBattChargeState() {
sendAT(GF("+CBC?"));
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) {
return false;
}
@ -712,7 +714,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
}
bool getBattStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) {
sendAT(GF("+CBC?"));
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) {
return false;
}


+ 14
- 0
src/TinyGsmCommon.h View File

@ -527,6 +527,20 @@ String TinyGsmDecodeHex16bit(String &instr) {
}
// Asks for International Mobile Subscriber Identity IMSI via the AT+CIMI command
#define TINY_GSM_MODEM_GET_IMSI_CIMI() \
String getIMSI() { \
sendAT(GF("+CIMI")); \
if (waitResponse(GF(GSM_NL)) != 1) { \
return ""; \
} \
String res = stream.readStringUntil('\n'); \
waitResponse(); \
res.trim(); \
return res; \
}
// Gets the modem's registration status via CREG/CGREG/CEREG
// CREG = Generic network registration
// CGREG = GPRS service registration


Loading…
Cancel
Save