Skip to content

Commit

Permalink
samples: net: sockets: Add CoAP service example
Browse files Browse the repository at this point in the history
Replaced the CoAP server example with CoAP services.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
  • Loading branch information
pdgendt committed Oct 24, 2023
1 parent c2ae672 commit a48bb39
Show file tree
Hide file tree
Showing 17 changed files with 1,148 additions and 1,476 deletions.
2 changes: 2 additions & 0 deletions samples/net/sockets/coap_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ project(coap_server)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip)

zephyr_linker_sources(DATA_SECTIONS sections-ram.ld)
4 changes: 2 additions & 2 deletions samples/net/sockets/coap_server/README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. zephyr:code-sample:: coap-server
:name: CoAP server
:name: CoAP service
:relevant-api: coap udp

Use the CoAP library to implement a server that exposes CoAP resources.
Use the CoAP server subsystem that exposes CoAP resources.

Overview
********
Expand Down
3 changes: 3 additions & 0 deletions samples/net/sockets/coap_server/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_NET_L2_ETHERNET=y
CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME=y
CONFIG_NATIVE_UART_0_ON_STDINOUT=y
3 changes: 3 additions & 0 deletions samples/net/sockets/coap_server/boards/native_posix_64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_NET_L2_ETHERNET=y
CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME=y
CONFIG_NATIVE_UART_0_ON_STDINOUT=y
4 changes: 4 additions & 0 deletions samples/net/sockets/coap_server/boards/qemu_cortex_m3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_DRIVER=y
CONFIG_ETH_STELLARIS=y
CONFIG_NET_QEMU_ETHERNET=y
7 changes: 4 additions & 3 deletions samples/net/sockets/coap_server/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ CONFIG_NET_SOCKETS_POLL_MAX=4

# CoAP
CONFIG_COAP=y
CONFIG_COAP_SERVER=y
CONFIG_COAP_SERVER_WELL_KNOWN_CORE=y
CONFIG_COAP_WELL_KNOWN_BLOCK_WISE=n
CONFIG_COAP_OBSERVER_EVENTS=y

# Kernel options
CONFIG_ENTROPY_GENERATOR=y
Expand All @@ -22,9 +25,7 @@ CONFIG_NET_LOG=y

# Network Shell
CONFIG_NET_SHELL=y

CONFIG_MAIN_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_COAP_SERVER_SHELL=y

# Configuration
CONFIG_NET_CONFIG_SETTINGS=y
Expand Down
10 changes: 5 additions & 5 deletions samples/net/sockets/coap_server/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
common:
filter: TOOLCHAIN_HAS_NEWLIB == 1
sample:
description: TBD
name: TBD
description: BSD Sockets API CoAP server example
name: socket_coap_server
tests:
sample.net.sockets.coap_server:
harness: net
tags:
- net
- socket
platform_allow: qemu_x86
platform_allow:
- native_posix
- qemu_x86
5 changes: 5 additions & 0 deletions samples/net/sockets/coap_server/sections-ram.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* SPDX-License-Identifier: Apache-2.0 */

#include <zephyr/linker/iterable_sections.h>

ITERABLE_SECTION_RAM(coap_resource_coap_server, 4)

0 comments on commit a48bb39

Please sign in to comment.