int main(void) { /* we need a message queue for the thread running the shell in order to * receive potentially fast incoming networking packets */ struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); random_init((uint32_t)ts.tv_nsec); msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); puts("RIOT network stack example application"); gnrc_rpl_init(6); /* start shell */ puts("All up, running the shell now"); char line_buf[SHELL_DEFAULT_BUFSIZE]; char *arg[2]; char *cmd = "stats"; char *status = "start"; arg[0] = cmd; arg[1] = status; _stats_cmd(2, arg); shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); /* should be never reached */ return 0; }
/** * Initialize this node to join a RPL routing network. * @param iface_pid The ID for the RPL interface * @return true on successful init, false otherwise */ bool rpl_init(kernel_pid_t iface_pid) { // Check if interface exists gnrc_ipv6_netif_t* entry = NULL; entry = gnrc_ipv6_netif_get(iface_pid); if (entry == NULL) { puts("unknown interface specified"); return false; } // RPL init gnrc_rpl_init(iface_pid); return true; }