Moved stream write and stream skip into common

This commit is contained in:
Sara Damiano
2018-09-13 17:08:09 -04:00
parent 06b54e8463
commit 0004bebf16
11 changed files with 27 additions and 196 deletions

View File

@@ -736,29 +736,6 @@ public:
Utilities
*/
template<typename T>
void streamWrite(T last) {
stream.print(last);
}
template<typename T, typename... Args>
void streamWrite(T head, Args... tail) {
stream.print(head);
streamWrite(tail...);
}
bool streamSkipUntil(char c, const unsigned long timeout = 1000L) {
unsigned long startMillis = millis();
while (millis() - startMillis < timeout) {
while (millis() - startMillis < timeout && !stream.available()) {
TINY_GSM_YIELD();
}
if (stream.read() == c)
return true;
}
return false;
}
template<typename... Args>
void sendAT(Args... cmd) {
streamWrite("AT", cmd..., GSM_NL);