• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 Freie Universität Berlin
3  * Copyright (C) 2018 Inria
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 /**
11  * @ingroup     examples
12  * @{
13  *
14  * @file
15  * @brief       Example application for libcoap client
16  *
17  * @author      Raul Fuentes <>
18  *
19  * @}
20  */
21 
22 #include <stdio.h>
23 
24 #include "shell.h"
25 #include "msg.h"
26 
27 #include "coap3/coap.h"
28 
29 #define MAIN_QUEUE_SIZE     (8)
30 static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
31 
32 extern int client_coap_init(int argc, char **argv);
33 
34 static const shell_command_t shell_commands[] = {
35   { "coapc", "Start a libcoap client", client_coap_init },
36   { NULL, NULL, NULL }
37 };
38 
39 int
main(void)40 main(void) {
41   /* we need a message queue for the thread running the shell in order to
42    * receive potentially fast incoming networking packets */
43   msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
44   puts("RIOT libcoap client testing implementation");
45 
46   /* start shell */
47   puts("All up, running the shell now");
48   char line_buf[SHELL_DEFAULT_BUFSIZE];
49   shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
50 
51   /* should be never reached */
52   return 0;
53 }
54