Skip to content

Commit

Permalink
gcoap: include CoAP resrouces from NANOCOAP_RESOURCE() XFA
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Mar 9, 2023
1 parent 13aa272 commit cc30b81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sys/include/net/nanocoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ extern ssize_t coap_well_known_core_default_handler(coap_pkt_t *pkt, \
* @brief Respond to `/.well-known/core` to list all resources on the server
*/
#ifndef CONFIG_NANOCOAP_SERVER_WELL_KNOWN_CORE
#define CONFIG_NANOCOAP_SERVER_WELL_KNOWN_CORE (1)
#define CONFIG_NANOCOAP_SERVER_WELL_KNOWN_CORE !IS_USED(MODULE_GCOAP)
#endif

/**
Expand Down
11 changes: 11 additions & 0 deletions sys/net/application_layer/gcoap/gcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,17 @@ kernel_pid_t gcoap_init(void)
gcoap_forward_proxy_init();
}

#ifdef MODULE_NANOCOAP_RESOURCES
/* add CoAP resources from XFA */
XFA_USE_CONST(coap_resource_t, coap_resources_xfa);
static gcoap_listener_t _xfa_listener = {
.resources = coap_resources_xfa,
};
_xfa_listener.resources_len = XFA_LEN(coap_resource_t, coap_resources_xfa),

gcoap_register_listener(&_xfa_listener);
#endif

return _pid;
}

Expand Down

0 comments on commit cc30b81

Please sign in to comment.