sigfox
Fork of Sigfox by
Diff: Sigfox.cpp
- Revision:
- 3:279bed56f354
- Parent:
- 2:d07e3b39ff74
- Child:
- 4:c77d5019b264
--- a/Sigfox.cpp Wed Apr 19 20:57:38 2017 +0000
+++ b/Sigfox.cpp Mon May 01 08:26:05 2017 +0000
@@ -6,9 +6,28 @@
return _at->recv("OK");
}
-bool Sigfox::send(const char *data) {
- _at->send("AT$SF=%s", data);
- return _at->recv("OK");
+bool Sigfox::send(const char *data, char* response) {
+ // If require a response add plus in message
+ if(response != NULL) {
+ // Add request response data
+ _at->send("AT$SF=%s,1", data);
+ // Wait response from sigfox after send
+ if(_at->recv("OK")) {
+ char message[20];
+ // Wait return
+ // TODO add loop to load data
+ if(_at->recv("+RX%s", &message)) {
+ // Check if message received is equal to " OK"
+ if(strcmp(message, " OK") == 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ } else {
+ _at->send("AT$SF=%s", data);
+ return _at->recv("OK");
+ }
}
bool Sigfox::setPower(uint8_t power) {
