This commit contains some improvements and fixes to the CoAP-observe
(RFC 7641) messaging model implementation.
It also adds an 'expect' test for using the CoAP-observe related CLI
commands.
Specific items:
- ensure that a NON observe request is not acknowledged with an Ack.
- enable a NON observe request to never time out, unless cancelled
explicitly, or unless 0 observe responses are received within the
NON request's timeout period. This fixes an issue that responses
were not recognized anymore by the client after some time.
- allow an observe request to be silently cancelled by the client,
which is the suggested way per RFC 7641, in case a new observe
request is started and the CLI user did not explicitly cancel the
previous observe. This leaves the choice to the CLI user whether to
explicitly cancel or just forget the request.
- ensure that the client accepts CON notifications which are
interspersed with NON notifications per RFC 7641. Previously, this
caused the client to send RST instead of ACK.
- avoids the error 28 ResponseTimeout popping up in various cases by
keeping the observe request active.
- implements the mandatory interspersing of CON notifications when a
NON observe relation is ongoing, per RFC 7641. This is done by
sending a CON notification after every 5 NON notifications, same as
done by libcoap. When such CON notification times out
(i.e. undelivered/unack'ed) then the observe subscription is
automatically cleared after all its retries have been made. During
this effort of trying to deliver the notification, the NON
notifications (in case these follow) are still being sent in
fire-and-forget mode as usual.
- if already one subscription is ongoing, the server will ignore
further subscription requests (Observe Option) per RFC 7641 Section
4.1 and treat the request normally.
- log message at server side when a subscriber is cancelled.
Fixes#11971