Observe: Clarify observing of Unknown or Proxy URIs is not supported

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-04-14 16:08:25 +01:00
1 parent 17204f488d
commit f97bc19434
2 files changed
+11 -3

No files matched your search

+4 -2
View File
@@ -99,11 +99,13 @@ observable status of the _resource_ by the setting of _mode_. If _mode_ is
_resource_ is no longer observable.
*NOTE:* It is not possible for the Unknown Resource, created by
*coap_resource_unknown_init*(3), to be observable as the Uri-Path is not known
*coap_resource_unknown_init2*(3), to be observable as the Uri-Path is not known
when libcoap creates a "fake GET/FETCH request". The Unknown Resource PUT
handler must create a new resource and mark the resource as "observable" if
a specific resource needs to be observable. The application must then
manage the deletion of the resource at the appropriate time.
manage the deletion of the resource at the appropriate time. Similarily,
it is not possible to observe the resource set up by
*coap_resource_proxy_uri_init2*() or *coap_resource_reverse_proxy_init*().
*NOTE:* The type (confirmable or non-confirmable) of the triggered observe
GET response is determined not by the initial GET/FETCH request, but
+7 -1
View File
@@ -1379,7 +1379,13 @@ coap_resource_release_userdata_handler(coap_context_t *context,
void
coap_resource_set_get_observable(coap_resource_t *resource, int mode) {
resource->observable = mode ? 1 : 0;
if (resource->is_unknown || resource->is_proxy_uri) {
/* We cannot observe these */
coap_log_debug("coap_resource_set_get_observable: Not supported for Unknown or Proxy URIs\n");
resource->observable = 0;
} else {
resource->observable = mode ? 1 : 0;
}
}
coap_str_const_t *