library for enebular edge agent board(version p1)
Revision 3:f80f2838a956, committed 2017-10-22
- 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 |
diff -r d48fcae8b5bd -r f80f2838a956 Eeabp1.cpp --- 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]); }
diff -r d48fcae8b5bd -r f80f2838a956 Eeabp1.h --- 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) */