From 666e4263cdc74aa95ac4029358acd2053150c91b Mon Sep 17 00:00:00 2001 From: Takeshi Sakoda Date: Wed, 21 Nov 2018 17:27:20 +0900 Subject: [PATCH] tsch-rpl: add tsch_rpl_check_dodag_joined function in tsch-rpl. --- os/net/mac/tsch/tsch-rpl.c | 8 ++++++++ os/net/mac/tsch/tsch-rpl.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/os/net/mac/tsch/tsch-rpl.c b/os/net/mac/tsch/tsch-rpl.c index 951648d91..e8db94b57 100644 --- a/os/net/mac/tsch/tsch-rpl.c +++ b/os/net/mac/tsch/tsch-rpl.c @@ -136,5 +136,13 @@ tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new) rpl_parent_get_ipaddr(new))); } } +/*---------------------------------------------------------------------------*/ +/* Check RPL has joined DODAG. + * To use, set #define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined */ +int +tsch_rpl_check_dodag_joined(void) +{ + return NETSTACK_ROUTING.node_has_joined(); +} #endif /* UIP_CONF_IPV6_RPL */ /** @} */ diff --git a/os/net/mac/tsch/tsch-rpl.h b/os/net/mac/tsch/tsch-rpl.h index 23a148db8..95412e3d2 100644 --- a/os/net/mac/tsch/tsch-rpl.h +++ b/os/net/mac/tsch/tsch-rpl.h @@ -79,6 +79,12 @@ void tsch_rpl_callback_new_dio_interval(clock_time_t dio_interval); * \param new The new RPL parent */ void tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new); +/** + * \brief Check RPL has joined DODAG. + * To use, set TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined + * \return 1 if joined, 0 otherwise + */ +int tsch_rpl_check_dodag_joined(void); #endif /* __TSCH_RPL_H__ */ /** @} */