Commit graph

9 commits

Author SHA1 Message Date
Jukka Rissanen b994970068 net: doc: coap: Fix doxygen documentation
Fix doxygen documentation in COAP header files to improve
documentation coverage.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-21 15:41:19 -07:00
Benjamin Lindqvist ed025b2f04 net: lib: coap_client: observe-related fixes
An earlier pull request implementing observe support was merged too
hastily. It had a few issues:

1. The predicate for whether a request should be marked not ongoing was
wrong (it checked ret != 0 instead of ret < 0)
2. Without observes in mind, MID-based deduplication is not a required
feature. Deduplication was handled implicitly - the exchange would get
dropped after the first response anyway, so duplicate responses would
not get matched to anything. But with observes, there are several
responses in an exchange. This commit adds this.
3. Using coap_request_is_observe(&internal_req->request) in the response
handler requires the whole request to stay in scope for the lifetime of
the observation, which I observed was not always the case. Adding an
is_observe bool to the internal struct improved stability significantly.

With these fixes, GETs with observe option works very well.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2024-05-21 16:42:38 -04:00
Pete Skeggs f04f8b2422 net: lib: coap_client: Improve cancel function
Improve coap_client_cancel_requests(). Ensure it can be
called from a callback. Report error to waiting callbacks.
Clear active flag.

This is useful when the network becomes unavailable
or prior to disconnecting in order to save power.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2024-05-17 10:34:12 +02:00
Benjamin Lindqvist 0d14143926 net: coap_client: handle observe requests as intended
The coap_client lib only handled "one-shot" requests properly. This
patch allows it to keep listening for additional responses to a request,
if the request was made with the CoAP OBSERVE option appended.

An API for canceling such requests is also added.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2024-05-06 17:31:19 +01:00
Juha Ylinen d09d3d82ef net: lib: coap: Change coap_pending_init()
Replace function parameter 'retries' with pointer to structure
holding coap transmission parameters. This allows setting the
retransmission parameters individually for each pending request.

Add coap transmission parameters to coap_pending structure.

Update migration guide and release notes.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Juha Ylinen 1aef034126 net: coap: add support for Echo option (RFC 9175)
Resend the request with Echo option and the received Echo
option value when receiving a 4.01 (Unauthorized) response
with the Echo option.

Add missing header file kernel.h to coap_client.h.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-10-20 15:09:44 +02:00
Juha Ylinen 1d9098f3f0 net: coap: Add support for request-tag (RFC 9175)
Add support for Request-Tag (RFC 9175) when doing block-wise
send.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-10-20 15:09:44 +02:00
Jarno Lämsä 419fa3ca6a net: lib: coap: CoAP client, multiple request handling
Use only single thread for handling polling of the sockets.
Each client will have only 1 active socket which to poll.
Each client can have multiple simultaneous requests ongoing.
The client only has one buffer for receiving and one buffer for sending.
Therefore the messages are reformed when resending.

Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
2023-06-28 15:19:34 +02:00
Jarno Lämsä 05e0b31fa8 net: lib: coap: Add an asynchronous coap client
The coap client takes requests and provides responses
asynchronously to callback given in a request.
Currently supports only 1 request at a time.

Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
2023-05-26 09:44:50 -04:00