Skip to content
Commit f85e37ae authored by Robert Lubos's avatar Robert Lubos Committed by Christopher Friedt
Browse files

samples: net: sockets: coap_client: Make use of CoAP APIs for observe



The sample oversimplified the observe mechanism a bit - instead of
making use of CoAP APIs to verify the packets received (if they are
actually notifications for the observe) it blindly assumed that any
received packet was a notification. This could be misleading for
potential users of the CoAP library, as the sample had little use as
a reference for the Observer functionality.

Fix this by making use of `coap_reply` structure and a corresponding
`coap_response_received()` function.

Additionally, make the observe cancellation compliant with the CoAP
specification - it should be either an empty Reset message, or a GET
request with Observe option set to 1. The sample used invalid
construct of a Reset message with Observe option. For the purpose of
the sample, use the latter option.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent ed497ba6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment