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