This is boring
Diff: SPWFSA01.cpp
- Revision:
- 27:0dc1402f42a9
- Parent:
- 26:70852d26853e
diff -r 70852d26853e -r 0dc1402f42a9 SPWFSA01.cpp --- a/SPWFSA01.cpp Fri Jan 13 09:56:54 2017 +0000 +++ b/SPWFSA01.cpp Fri Jan 13 14:35:49 2017 +0000 @@ -293,7 +293,6 @@ return false; } - int32_t SPWFSA01::recv(int id, void *data, uint32_t amount) { uint32_t recv_amount=0; @@ -409,6 +408,25 @@ return false; } +int32_t SPWFSA01::gettime(time_t *ctTime) +{ + _parser.flush(); + //May take a second try if device is busy or error is returned + for (unsigned i = 0; i < 2; i++) { + if (_parser.send("AT+S.STS=current_time") + && _parser.recv("# current_time = %u", ctTime) + && _parser.recv("OK")) { + return true; + } + else + { + debug_if(dbg_on, "SPWF> ERROR!!!!\r\n"); + return false; + } + } + return false; +} + int32_t SPWFSA01::setTLScertificate(char * cert, unsigned int size, CertType_t type) { _parser.flush();