Other Parts Discussed in Thread: Z-STACK
Traditional way to detect device joining is to receive ZDP-Device-Announce. But this is not perfect. ZDP-Device-Announce is send by broadcast, so it might be missed. The End-Device rejoin network or restart, it will also broadcast ZDP-Device-Announce.
Exchange key is a best event to detect a new device joining. function "bdb_RegisterTCLinkKeyExchangeProcessCB" can detect a device first-time join into coordinator. But in ZNP sample, the "bdb_RegisterTCLinkKeyExchangeProcessCB" has never be used