Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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) {
