1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/emcute_mqttsn: allow override of EMCUTE_ID

This commit is contained in:
Hauke Petersen 2019-06-26 12:03:01 +02:00
parent 2ff5720c95
commit 514d771064
3 changed files with 18 additions and 1 deletions

View File

@ -33,6 +33,11 @@ USEMODULE += ps
# For testing we also include the ping6 command and some stats
USEMODULE += gnrc_icmpv6_echo
# Allow for env-var-based override of the nodes name (EMCUTE_ID)
ifneq (,$(EMCUTE_ID))
CFLAGS += -DEMCUTE_ID=\"$(EMCUTE_ID)\"
endif
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:

View File

@ -95,3 +95,13 @@ pub hello/world "One more beer, please."
```
That's it, happy publishing!
## FAQ
### I can't connect multiple RIOT nodes to a broker, what can I do?
Each node that connects to the broker must have a unique node ID string set. Per
default, this example sets this statically ID to `getrud`. If you want to
connect more than one node to the broker, you need to set a custom ID for each
node during compile time. Simply use the `EMCUTE_ID` environment variable for
this, e.g. build with `EMCUTE_ID=horst make all`.

View File

@ -28,8 +28,10 @@
#include "net/emcute.h"
#include "net/ipv6/addr.h"
#define EMCUTE_PORT (1883U)
#ifndef EMCUTE_ID
#define EMCUTE_ID ("gertrud")
#endif
#define EMCUTE_PORT (1883U)
#define EMCUTE_PRIO (THREAD_PRIORITY_MAIN - 1)
#define NUMOFSUBS (16U)