mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
|
/*
|
||
|
* Copyright (C) 2017 Freie Universität Berlin
|
||
|
*
|
||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||
|
* directory for more details.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @ingroup net_rdcli_simple
|
||
|
* @{
|
||
|
*
|
||
|
* @file
|
||
|
* @brief Standalone extension for the simple RD registration client
|
||
|
*
|
||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||
|
*
|
||
|
* @}
|
||
|
*/
|
||
|
|
||
|
#include "log.h"
|
||
|
#include "thread.h"
|
||
|
#include "xtimer.h"
|
||
|
#include "net/rdcli_config.h"
|
||
|
#include "net/rdcli_simple.h"
|
||
|
|
||
|
#define STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
||
|
#define PRIO (THREAD_PRIORITY_MAIN - 1)
|
||
|
#define TNAME "rdcli_simple"
|
||
|
|
||
|
static char _stack[STACKSIZE];
|
||
|
|
||
|
static void *reg_runner(void *arg)
|
||
|
{
|
||
|
(void)arg;
|
||
|
|
||
|
/* wait some seconds to give the address configuration some time to settle */
|
||
|
xtimer_sleep(RDCLI_STARTUP_DELAY);
|
||
|
|
||
|
while (1) {
|
||
|
int res = rdcli_simple_register();
|
||
|
if (res < 0) {
|
||
|
LOG_ERROR("[rdcli_simple] error: unable to trigger registration\n");
|
||
|
}
|
||
|
xtimer_sleep(RDCLI_UPDATE_INTERVAL);
|
||
|
}
|
||
|
|
||
|
return NULL; /* should never be reached */
|
||
|
}
|
||
|
|
||
|
void rdcli_simple_run(void)
|
||
|
{
|
||
|
thread_create(_stack, sizeof(_stack), PRIO, 0, reg_runner, NULL, TNAME);
|
||
|
}
|