You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

731 lines
17 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. /**
  2. * @file TinyGsmClientMC60.h
  3. * @author Volodymyr Shymanskyy
  4. * @license LGPL-3.0
  5. * @copyright Copyright (c) 2016 Volodymyr Shymanskyy
  6. * @date Nov 2016
  7. *
  8. * @MC60 support added by Tamas Dajka 2017.10.15 - with fixes by Sara Damiano
  9. *
  10. */
  11. #ifndef TinyGsmClientMC60_h
  12. #define TinyGsmClientMC60_h
  13. //#pragma message("TinyGSM: TinyGsmClientMC60")
  14. //#define TINY_GSM_DEBUG Serial
  15. //#define TINY_GSM_USE_HEX
  16. #define TINY_GSM_MUX_COUNT 6
  17. #include <TinyGsmCommon.h>
  18. #define GSM_NL "\r\n"
  19. static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
  20. static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL;
  21. enum SimStatus {
  22. SIM_ERROR = 0,
  23. SIM_READY = 1,
  24. SIM_LOCKED = 2,
  25. SIM_ANTITHEFT_LOCKED = 3,
  26. };
  27. enum RegStatus {
  28. REG_UNREGISTERED = 0,
  29. REG_SEARCHING = 2,
  30. REG_DENIED = 3,
  31. REG_OK_HOME = 1,
  32. REG_OK_ROAMING = 5,
  33. REG_UNKNOWN = 4,
  34. };
  35. class TinyGsmMC60
  36. {
  37. public:
  38. class GsmClient : public Client
  39. {
  40. friend class TinyGsmMC60;
  41. typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo;
  42. public:
  43. GsmClient() {}
  44. GsmClient(TinyGsmMC60& modem, uint8_t mux = 1) {
  45. init(&modem, mux);
  46. }
  47. bool init(TinyGsmMC60* modem, uint8_t mux = 1) {
  48. this->at = modem;
  49. this->mux = mux;
  50. sock_available = 0;
  51. sock_connected = false;
  52. got_data = false;
  53. at->sockets[mux] = this;
  54. return true;
  55. }
  56. public:
  57. virtual int connect(const char *host, uint16_t port) {
  58. stop();
  59. TINY_GSM_YIELD();
  60. rx.clear();
  61. sock_connected = at->modemConnect(host, port, mux);
  62. return sock_connected;
  63. }
  64. TINY_GSM_CLIENT_CONNECT_TO_IP()
  65. virtual void stop() {
  66. TINY_GSM_YIELD();
  67. // Read and dump anything remaining in the modem's internal buffer.
  68. // The socket will appear open in response to connected() even after it
  69. // closes until all data is read from the buffer.
  70. // Doing it this way allows the external mcu to find and get all of the data
  71. // that it wants from the socket even if it was closed externally.
  72. rx.clear();
  73. at->maintain();
  74. while (sock_available > 0) {
  75. at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
  76. rx.clear();
  77. at->maintain();
  78. }
  79. at->sendAT(GF("+QICLOSE="), mux);
  80. sock_connected = false;
  81. at->waitResponse(60000L, GF("CLOSED"), GF("CLOSE OK"), GF("ERROR"));
  82. }
  83. TINY_GSM_CLIENT_WRITE()
  84. TINY_GSM_CLIENT_AVAILABLE_NO_BUFFER_CHECK()
  85. TINY_GSM_CLIENT_READ_NO_BUFFER_CHECK()
  86. TINY_GSM_CLIENT_PEEK_FLUSH_CONNECTED()
  87. /*
  88. * Extended API
  89. */
  90. String remoteIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
  91. private:
  92. TinyGsmMC60* at;
  93. uint8_t mux;
  94. uint16_t sock_available;
  95. bool sock_connected;
  96. bool got_data;
  97. RxFifo rx;
  98. };
  99. // class GsmClientSecure : public GsmClient
  100. // {
  101. // public:
  102. // GsmClientSecure() {}
  103. //
  104. // GsmClientSecure(TinyGsmMC60& modem, uint8_t mux = 1)
  105. // : GsmClient(modem, mux)
  106. // {}
  107. //
  108. // public:
  109. // virtual int connect(const char *host, uint16_t port) {
  110. // stop();
  111. // TINY_GSM_YIELD();
  112. // rx.clear();
  113. // sock_connected = at->modemConnect(host, port, mux, true);
  114. // return sock_connected;
  115. // }
  116. // };
  117. public:
  118. TinyGsmMC60(Stream& stream)
  119. : stream(stream)
  120. {
  121. memset(sockets, 0, sizeof(sockets));
  122. }
  123. /*
  124. * Basic functions
  125. */
  126. bool init(const char* pin = NULL) {
  127. DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
  128. if (!testAT()) {
  129. return false;
  130. }
  131. sendAT(GF("&FZ")); // Factory + Reset
  132. waitResponse();
  133. sendAT(GF("E0")); // Echo Off
  134. if (waitResponse() != 1) {
  135. return false;
  136. }
  137. DBG(GF("### Modem:"), getModemName());
  138. getSimStatus();
  139. return true;
  140. }
  141. bool begin(const char* pin = NULL) {
  142. return init(pin);
  143. }
  144. String getModemName() {
  145. #if defined(TINY_GSM_MODEM_MC60)
  146. return "Quectel MC60";
  147. #elif defined(TINY_GSM_MODEM_MC60E)
  148. return "Quectel MC60E";
  149. #endif
  150. return "Quectel MC60";
  151. }
  152. TINY_GSM_MODEM_SET_BAUD_IPR()
  153. TINY_GSM_MODEM_TEST_AT()
  154. TINY_GSM_MODEM_MAINTAIN_CHECK_SOCKS()
  155. bool factoryDefault() {
  156. sendAT(GF("&FZE0&W")); // Factory + Reset + Echo Off + Write
  157. waitResponse();
  158. sendAT(GF("+IPR=0")); // Auto-baud
  159. waitResponse();
  160. sendAT(GF("&W")); // Write configuration
  161. return waitResponse() == 1;
  162. }
  163. TINY_GSM_MODEM_GET_INFO_ATI()
  164. /*
  165. * under development
  166. */
  167. // bool hasSSL() {
  168. // sendAT(GF("+QIPSSL=?"));
  169. // if (waitResponse(GF(GSM_NL "+CIPSSL:")) != 1) {
  170. // return false;
  171. // }
  172. // return waitResponse() == 1;
  173. // }
  174. bool hasSSL() {
  175. return false; // TODO: For now
  176. }
  177. bool hasWifi() {
  178. return false;
  179. }
  180. bool hasGPRS() {
  181. return true;
  182. }
  183. /*
  184. * Power functions
  185. */
  186. bool restart() {
  187. if (!testAT()) {
  188. return false;
  189. }
  190. sendAT(GF("+CFUN=0"));
  191. if (waitResponse(10000L) != 1) {
  192. return false;
  193. }
  194. sendAT(GF("+CFUN=1,1"));
  195. if (waitResponse(10000L) != 1) {
  196. return false;
  197. }
  198. delay(3000);
  199. return init();
  200. }
  201. bool poweroff() {
  202. sendAT(GF("+QPOWD=1"));
  203. return waitResponse(GF("NORMAL POWER DOWN")) == 1;
  204. }
  205. bool radioOff() {
  206. if (!testAT()) {
  207. return false;
  208. }
  209. sendAT(GF("+CFUN=0"));
  210. if (waitResponse(10000L) != 1) {
  211. return false;
  212. }
  213. delay(3000);
  214. return true;
  215. }
  216. bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
  217. /*
  218. * SIM card functions
  219. */
  220. TINY_GSM_MODEM_SIM_UNLOCK_CPIN()
  221. TINY_GSM_MODEM_GET_SIMCCID_CCID()
  222. TINY_GSM_MODEM_GET_IMEI_GSN()
  223. SimStatus getSimStatus(unsigned long timeout = 10000L) {
  224. for (unsigned long start = millis(); millis() - start < timeout; ) {
  225. sendAT(GF("+CPIN?"));
  226. if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
  227. delay(1000);
  228. continue;
  229. }
  230. int status = waitResponse(GF("READY"), GF("SIM PIN"), GF("SIM PUK"), GF("NOT INSERTED"), GF("PH_SIM PIN"), GF("PH_SIM PUK"));
  231. waitResponse();
  232. switch (status) {
  233. case 2:
  234. case 3: return SIM_LOCKED;
  235. case 5:
  236. case 6: return SIM_ANTITHEFT_LOCKED;
  237. case 1: return SIM_READY;
  238. default: return SIM_ERROR;
  239. }
  240. }
  241. return SIM_ERROR;
  242. }
  243. TINY_GSM_MODEM_GET_REGISTRATION_XREG(CREG)
  244. TINY_GSM_MODEM_GET_OPERATOR_COPS()
  245. /*
  246. * Generic network functions
  247. */
  248. TINY_GSP_MODEM_GET_CSQ()
  249. bool isNetworkConnected() {
  250. RegStatus s = getRegistrationStatus();
  251. return (s == REG_OK_HOME || s == REG_OK_ROAMING);
  252. }
  253. TINY_GSM_MODEM_WAIT_FOR_NETWORK()
  254. /*
  255. * GPRS functions
  256. */
  257. bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) {
  258. gprsDisconnect();
  259. // select foreground context 0 = VIRTUAL_UART_1
  260. sendAT(GF("+QIFGCNT=0"));
  261. if (waitResponse() != 1) {
  262. return false;
  263. }
  264. //Select GPRS (=1) as the Bearer
  265. sendAT(GF("+QICSGP=1,\""), apn, GF("\",\""), user, GF("\",\""), pwd, GF("\""));
  266. if (waitResponse() != 1) {
  267. return false;
  268. }
  269. //Define PDP context - is this necessary?
  270. sendAT(GF("+CGDCONT=1,\"IP\",\""), apn, '"');
  271. waitResponse();
  272. // Activate PDP context - is this necessary?
  273. sendAT(GF("+CGACT=1,1"));
  274. waitResponse(60000L);
  275. //Start TCPIP Task and Set APN, User Name and Password
  276. sendAT("+QIREGAPP=\"", apn, "\",\"", user, "\",\"", pwd, "\"" );
  277. if (waitResponse() != 1) {
  278. return false;
  279. }
  280. //Activate GPRS/CSD Context
  281. sendAT(GF("+QIACT"));
  282. if (waitResponse(60000L) != 1) {
  283. return false;
  284. }
  285. //Enable multiple TCP/IP connections
  286. sendAT(GF("+QIMUX=1"));
  287. if (waitResponse() != 1) {
  288. return false;
  289. }
  290. //Request an IP header for received data ("IPD(data length):")
  291. sendAT(GF("+QIHEAD=1"));
  292. if (waitResponse() != 1) {
  293. return false;
  294. }
  295. //Set Method to Handle Received TCP/IP Data - Retrieve Data by Command
  296. sendAT(GF("+QINDI=1"));
  297. if (waitResponse() != 1) {
  298. return false;
  299. }
  300. // Check that we have a local IP address
  301. if (localIP() != 0) {
  302. return true;
  303. }
  304. return false;
  305. }
  306. bool gprsDisconnect() {
  307. sendAT(GF("+QIDEACT"));
  308. return waitResponse(60000L, GF("DEACT OK"), GF("ERROR")) == 1;
  309. }
  310. TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
  311. /*
  312. * IP Address functions
  313. */
  314. String getLocalIP() {
  315. sendAT(GF("+QILOCIP"));
  316. stream.readStringUntil('\n');
  317. String res = stream.readStringUntil('\n');
  318. res.trim();
  319. return res;
  320. }
  321. IPAddress localIP() {
  322. return TinyGsmIpFromString(getLocalIP());
  323. }
  324. /*
  325. * Messaging functions
  326. */
  327. String sendUSSD(const String& code) {
  328. sendAT(GF("+CMGF=1"));
  329. waitResponse();
  330. sendAT(GF("+CSCS=\"HEX\""));
  331. waitResponse();
  332. sendAT(GF("+CUSD=1,\""), code, GF("\""));
  333. if (waitResponse(10000L, GF(GSM_NL "+CUSD:")) != 1) {
  334. return "";
  335. }
  336. stream.readStringUntil('"');
  337. String hex = stream.readStringUntil('"');
  338. stream.readStringUntil(',');
  339. int dcs = stream.readStringUntil('\n').toInt();
  340. if (waitResponse() != 1) {
  341. return "";
  342. }
  343. if (dcs == 15) {
  344. return TinyGsmDecodeHex8bit(hex);
  345. } else if (dcs == 72) {
  346. return TinyGsmDecodeHex16bit(hex);
  347. } else {
  348. return hex;
  349. }
  350. }
  351. bool sendSMS(const String& number, const String& text) {
  352. sendAT(GF("+CMGF=1"));
  353. waitResponse();
  354. //Set GSM 7 bit default alphabet (3GPP TS 23.038)
  355. sendAT(GF("+CSCS=\"GSM\""));
  356. waitResponse();
  357. sendAT(GF("+CMGS=\""), number, GF("\""));
  358. if (waitResponse(GF(">")) != 1) {
  359. return false;
  360. }
  361. stream.print(text);
  362. stream.write((char)0x1A);
  363. stream.flush();
  364. return waitResponse(60000L) == 1;
  365. }
  366. bool sendSMS_UTF16(const String& number, const void* text, size_t len) {
  367. sendAT(GF("+CMGF=1"));
  368. waitResponse();
  369. sendAT(GF("+CSCS=\"HEX\""));
  370. waitResponse();
  371. sendAT(GF("+CSMP=17,167,0,8"));
  372. waitResponse();
  373. sendAT(GF("+CMGS=\""), number, GF("\""));
  374. if (waitResponse(GF(">")) != 1) {
  375. return false;
  376. }
  377. uint16_t* t = (uint16_t*)text;
  378. for (size_t i=0; i<len; i++) {
  379. uint8_t c = t[i] >> 8;
  380. if (c < 0x10) { stream.print('0'); }
  381. stream.print(c, HEX);
  382. c = t[i] & 0xFF;
  383. if (c < 0x10) { stream.print('0'); }
  384. stream.print(c, HEX);
  385. }
  386. stream.write((char)0x1A);
  387. stream.flush();
  388. return waitResponse(60000L) == 1;
  389. }
  390. /** Delete all SMS */
  391. bool deleteAllSMS() {
  392. sendAT(GF("+QMGDA=6"));
  393. if (waitResponse(waitResponse(60000L, GF("OK"), GF("ERROR")) == 1) ) {
  394. return true;
  395. }
  396. return false;
  397. }
  398. /*
  399. * Location functions
  400. */
  401. String getGsmLocation() {
  402. sendAT(GF("+CIPGSMLOC=1,1"));
  403. if (waitResponse(10000L, GF(GSM_NL "+CIPGSMLOC:")) != 1) {
  404. return "";
  405. }
  406. String res = stream.readStringUntil('\n');
  407. waitResponse();
  408. res.trim();
  409. return res;
  410. }
  411. /*
  412. * Battery functions
  413. */
  414. // Use: float vBatt = modem.getBattVoltage() / 1000.0;
  415. uint16_t getBattVoltage() {
  416. sendAT(GF("+CBC"));
  417. if (waitResponse(GF(GSM_NL "+CBC:")) != 1) {
  418. return 0;
  419. }
  420. streamSkipUntil(','); // Skip
  421. streamSkipUntil(','); // Skip
  422. uint16_t res = stream.readStringUntil(',').toInt();
  423. waitResponse();
  424. return res;
  425. }
  426. int8_t getBattPercent() {
  427. sendAT(GF("+CBC"));
  428. if (waitResponse(GF(GSM_NL "+CBC:")) != 1) {
  429. return false;
  430. }
  431. stream.readStringUntil(',');
  432. int res = stream.readStringUntil(',').toInt();
  433. waitResponse();
  434. return res;
  435. }
  436. /*
  437. * Client related functions
  438. */
  439. protected:
  440. bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool ssl = false) {
  441. sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
  442. int rsp = waitResponse(75000L,
  443. GF("CONNECT OK" GSM_NL),
  444. GF("CONNECT FAIL" GSM_NL),
  445. GF("ALREADY CONNECT" GSM_NL));
  446. return (1 == rsp);
  447. }
  448. int16_t modemSend(const void* buff, size_t len, uint8_t mux) {
  449. sendAT(GF("+QISEND="), mux, ',', len);
  450. if (waitResponse(GF(">")) != 1) {
  451. return 0;
  452. }
  453. stream.write((uint8_t*)buff, len);
  454. stream.flush();
  455. if (waitResponse(GF(GSM_NL "SEND OK")) != 1) {
  456. return 0;
  457. }
  458. bool allAcknowledged = false;
  459. // bool failed = false;
  460. while ( !allAcknowledged ) {
  461. sendAT( GF("+QISACK"));
  462. if (waitResponse(5000L, GF(GSM_NL "+QISACK:")) != 1) {
  463. return -1;
  464. } else {
  465. streamSkipUntil(','); /** Skip total */
  466. streamSkipUntil(','); /** Skip acknowledged data size */
  467. if ( stream.readStringUntil('\n').toInt() == 0 ) {
  468. allAcknowledged = true;
  469. }
  470. }
  471. }
  472. waitResponse(5000L);
  473. // streamSkipUntil(','); // Skip mux
  474. // return stream.readStringUntil('\n').toInt();
  475. return len; // TODO
  476. }
  477. size_t modemRead(size_t size, uint8_t mux) {
  478. sendAT(GF("+QIRD="), mux, ',', size);
  479. if (waitResponse(GF("+QIRD:")) != 1) {
  480. return 0;
  481. }
  482. size_t len = stream.readStringUntil('\n').toInt();
  483. sockets[mux]->sock_available = len;
  484. for (size_t i=0; i<len; i++) {
  485. while (!stream.available()) { TINY_GSM_YIELD(); }
  486. char c = stream.read();
  487. sockets[mux]->rx.put(c);
  488. }
  489. waitResponse();
  490. DBG("### READ:", len, "from", mux);
  491. return len;
  492. }
  493. size_t modemGetAvailable(uint8_t mux) {
  494. sendAT(GF("+QIRD="), mux, GF(",0"));
  495. size_t result = 0;
  496. if (waitResponse(GF("+QIRD:")) == 1) {
  497. streamSkipUntil(','); // Skip total received
  498. streamSkipUntil(','); // Skip have read
  499. result = stream.readStringUntil('\n').toInt();
  500. if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
  501. waitResponse();
  502. }
  503. if (!result) {
  504. sockets[mux]->sock_connected = modemGetConnected(mux);
  505. }
  506. return result;
  507. }
  508. bool modemGetConnected(uint8_t mux) {
  509. sendAT(GF("+QISTATE=1,"), mux);
  510. //+QISTATE: 0,"TCP","151.139.237.11",80,5087,4,1,0,0,"uart1"
  511. if (waitResponse(GF("+QISTATE:")))
  512. return false;
  513. streamSkipUntil(','); // Skip mux
  514. streamSkipUntil(','); // Skip socket type
  515. streamSkipUntil(','); // Skip remote ip
  516. streamSkipUntil(','); // Skip remote port
  517. streamSkipUntil(','); // Skip local port
  518. int res = stream.readStringUntil(',').toInt(); // socket state
  519. waitResponse();
  520. // 0 Initial, 1 Opening, 2 Connected, 3 Listening, 4 Closing
  521. return 2 == res;
  522. }
  523. public:
  524. /*
  525. Utilities
  526. */
  527. TINY_GSP_MODEM_STREAM_UTILITIES()
  528. // TODO: Optimize this!
  529. uint8_t waitResponse(uint32_t timeout, String& data,
  530. GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
  531. GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
  532. {
  533. /*String r1s(r1); r1s.trim();
  534. String r2s(r2); r2s.trim();
  535. String r3s(r3); r3s.trim();
  536. String r4s(r4); r4s.trim();
  537. String r5s(r5); r5s.trim();
  538. String r6s(r6); r6s.trim();
  539. DBG("### ..:", r1s, ",", r2s, ",", r3s, ",", r4s, ",", r5s, ",", r6s);*/
  540. data.reserve(64);
  541. int index = 0;
  542. unsigned long startMillis = millis();
  543. do {
  544. TINY_GSM_YIELD();
  545. while (stream.available() > 0) {
  546. int a = stream.read();
  547. if (a <= 0) continue; // Skip 0x00 bytes, just in case
  548. data += (char)a;
  549. if (r1 && data.endsWith(r1)) {
  550. index = 1;
  551. goto finish;
  552. } else if (r2 && data.endsWith(r2)) {
  553. index = 2;
  554. goto finish;
  555. } else if (r3 && data.endsWith(r3)) {
  556. index = 3;
  557. goto finish;
  558. } else if (r4 && data.endsWith(r4)) {
  559. index = 4;
  560. goto finish;
  561. } else if (r5 && data.endsWith(r5)) {
  562. index = 5;
  563. goto finish;
  564. } else if (r6 && data.endsWith(r6)) {
  565. index = 6;
  566. goto finish;
  567. } else if (data.endsWith(GF(GSM_NL "+QIRD:"))) {
  568. streamSkipUntil(','); // Skip the context
  569. streamSkipUntil(','); // Skip the role
  570. int mux = stream.readStringUntil('\n').toInt();
  571. DBG("### Got Data:", mux);
  572. if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) {
  573. sockets[mux]->got_data = true;
  574. }
  575. } else if (data.endsWith(GF("CLOSED" GSM_NL))) {
  576. int nl = data.lastIndexOf(GSM_NL, data.length()-8);
  577. int coma = data.indexOf(',', nl+2);
  578. int mux = data.substring(nl+2, coma).toInt();
  579. if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) {
  580. sockets[mux]->sock_connected = false;
  581. }
  582. data = "";
  583. DBG("### Closed: ", mux);
  584. }
  585. }
  586. } while (millis() - startMillis < timeout);
  587. finish:
  588. if (!index) {
  589. data.trim();
  590. if (data.length()) {
  591. DBG("### Unhandled:", data);
  592. }
  593. data = "";
  594. }
  595. //DBG('<', index, '>');
  596. return index;
  597. }
  598. uint8_t waitResponse(uint32_t timeout,
  599. GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
  600. GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
  601. {
  602. String data;
  603. return waitResponse(timeout, data, r1, r2, r3, r4, r5, r6);
  604. }
  605. uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
  606. GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
  607. {
  608. return waitResponse(1000, r1, r2, r3, r4, r5, r6);
  609. }
  610. public:
  611. Stream& stream;
  612. protected:
  613. GsmClient* sockets[TINY_GSM_MUX_COUNT];
  614. };
  615. #endif