-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/gcoap: split client and server implementation
Move client and server side implementations into separate files to increase readability. Also get rid of a goto.
- Loading branch information
Showing
8 changed files
with
290 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 examples | ||
* @{ | ||
* | ||
* @file | ||
* @brief gcoap example | ||
* | ||
* @author Ken Bannister <kb2ma@runbox.com> | ||
*/ | ||
|
||
#ifndef GCOAP_EXAMPLE_H | ||
#define GCOAP_EXAMPLE_H | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "fmt.h" | ||
#include "net/gcoap.h" | ||
#include "net/utils.h" | ||
#include "od.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern uint16_t req_count; /**< Counts requests sent by CLI. */ | ||
|
||
/** | ||
* @brief Shell interface exposing the client side features of gcoap | ||
* @param argc Number of shell arguments (including shell command name) | ||
* @param argv Shell argument values (including shell command name) | ||
* @return Exit status of the shell command | ||
*/ | ||
int gcoap_cli_cmd(int argc, char **argv); | ||
|
||
/** | ||
* @brief Registers the CoAP resources exposed in the example app | ||
* | ||
* Run this exactly one during startup. | ||
*/ | ||
void server_init(void); | ||
|
||
/** | ||
* @brief Notifies all observers registered to /cli/stats - if any | ||
* | ||
* Call this whenever the count of successfully send client requests changes | ||
*/ | ||
void notify_observers(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* CC110X_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.