6p-packet example: use MAC address instead of node_id to hardcode coordinator
This commit is contained in:
parent
abeffecbff
commit
bfb4f9537b
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
#include <contiki.h>
|
#include <contiki.h>
|
||||||
#include <lib/assert.h>
|
#include <lib/assert.h>
|
||||||
#include <sys/node-id.h>
|
|
||||||
#include <net/mac/tsch/tsch.h>
|
#include <net/mac/tsch/tsch.h>
|
||||||
#include <net/mac/tsch/tsch-queue.h>
|
#include <net/mac/tsch/tsch-queue.h>
|
||||||
#include <net/mac/tsch/sixtop/sixtop.h>
|
#include <net/mac/tsch/sixtop/sixtop.h>
|
||||||
|
|
||||||
|
/* Hard-coded MAC address of the TSCH coordinator */
|
||||||
|
static linkaddr_t coordinator_addr = {{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }};
|
||||||
|
|
||||||
extern const sixtop_sf_t test_sf;
|
extern const sixtop_sf_t test_sf;
|
||||||
extern int test_sf_start(const linkaddr_t *addr);
|
extern int test_sf_start(const linkaddr_t *addr);
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ PROCESS_THREAD(sixp_node_process, ev, data)
|
||||||
|
|
||||||
sixtop_add_sf(&test_sf);
|
sixtop_add_sf(&test_sf);
|
||||||
|
|
||||||
if(node_id == COORDINATOR_NODE_ID) {
|
if(linkaddr_cmp(&coordinator_addr, &linkaddr_node_addr)) {
|
||||||
tsch_set_coordinator(1);
|
tsch_set_coordinator(1);
|
||||||
assert(test_sf_start(NULL) == 0);
|
assert(test_sf_start(NULL) == 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue