5G Academy / Mbed 2 deprecated LoRaWAN

Dependencies:   mbed X_NUCLEO_IKS01A2

Files at this revision

API Documentation at this revision

Comitter:
rschiano75
Date:
Thu Apr 23 19:55:53 2020 +0000
Parent:
0:2da416334d69
Commit message:
Corretto mancata stampa del port

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Apr 23 18:36:48 2020 +0000
+++ b/main.cpp	Thu Apr 23 19:55:53 2020 +0000
@@ -105,13 +105,15 @@
 }
 
 void at_send(uint16_t port, const string& payload, bool ack = false) {
-    string port_msg;
-    port_msg.reserve(5); // max port 2^16-1 = 65545
-    sprintf(&port_msg[0], "%d", port);
-    
+    //string port_msg;
+    char port_pref[12] = {"AT+SEND="};
+    //port_msg.reserve(5); // max port 2^16-1 = 65545
+    sprintf(port_pref + 8, "%d", port);
+    //pc.printf(port_pref);
     string hex_payload = hex_encode(payload);
-    
-    modem_at_cmd("AT+SEND=" + port_msg + "," + hex_payload + "," + (ack ? '1' : '0'));
+    //string test = (string)port_pref + "," + hex_payload + "," + (ack ? '1' : '0');
+    //pc.printf(&test[0]);
+    modem_at_cmd((string)port_pref + "," + hex_payload + "," + (ack ? '1' : '0'));
 }
 
 void modem_at_cmd(const string& buffer) {