library for enebular edge agent board(version p1)

Dependents:   ina-hack-2nd

Files at this revision

API Documentation at this revision

Comitter:
koyo_take
Date:
Sun Oct 22 03:56:20 2017 +0000
Parent:
2:d48fcae8b5bd
Commit message:
resolve LoRa port number conflit

Changed in this revision

Eeabp1.cpp Show annotated file Show diff for this revision Revisions of this file
Eeabp1.h Show annotated file Show diff for this revision Revisions of this file
--- a/Eeabp1.cpp	Sun Oct 22 01:22:24 2017 +0000
+++ b/Eeabp1.cpp	Sun Oct 22 03:56:20 2017 +0000
@@ -138,7 +138,7 @@
     vsnprintf(str, sizeof(str), format, arg);
     va_end(arg);
 
-    p += sprintf(msg, "lorawan tx ucnf 16 ");
+    p += sprintf(msg, "lorawan tx ucnf %d ", getLoraPort());
     for (unsigned int i = 0; i < strlen(str); i++) {
         p += sprintf(p, "%02x", str[i]);
     }
@@ -164,7 +164,7 @@
     vsnprintf(str, sizeof(str), format, arg);
     va_end(arg);
 
-    p += sprintf(msg, "lorawan tx ucnf 3 ");
+    p += sprintf(msg, "lorawan tx ucnf %d ", getLoraPort());
     for (unsigned int i = 0; i < strlen(str); i++) {
         p += sprintf(p, "%02x", str[i]);
     }
@@ -208,7 +208,7 @@
     if (lora_msg_max_len < len)
         return -1;
 
-    p += sprintf(msg, "lorawan tx ucnf 16 ");
+    p += sprintf(msg, "lorawan tx ucnf %d ", getLoraPort());
     for (unsigned int i = 0; i < len; i++) {
         p += sprintf(p, "%02x", payload[i]);
     }
--- a/Eeabp1.h	Sun Oct 22 01:22:24 2017 +0000
+++ b/Eeabp1.h	Sun Oct 22 03:56:20 2017 +0000
@@ -103,6 +103,16 @@
     int waitSerialChar(const char,uint16_t);
     int chkSerialCharOk();
     int chkSerialCharRes(char);
+    
+    int getLoraPort(void) {
+        static int port = 1;
+
+        port += 1;
+        if (233 < port)
+            port = 1;
+
+        return port;
+    }
 };
 
 #endif /* !defined(EEAPP1_H) */