Skip to content
Snippets Groups Projects
Unverified Commit c74686df authored by George Oikonomou's avatar George Oikonomou Committed by GitHub
Browse files

Merge pull request #632 from atiselsts/contrib/coap-noncomfirmable-observe

CoAP: allow observations that do not timeout
parents 77492ee9 9faa834f
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,9 @@ ...@@ -99,7 +99,9 @@
#endif /* COAP_MAX_OBSERVERS */ #endif /* COAP_MAX_OBSERVERS */
/* Interval in notifies in which NON notifies are changed to CON notifies to check client. */ /* Interval in notifies in which NON notifies are changed to CON notifies to check client. */
#ifndef COAP_OBSERVE_REFRESH_INTERVAL #ifdef COAP_CONF_OBSERVE_REFRESH_INTERVAL
#define COAP_OBSERVE_REFRESH_INTERVAL COAP_CONF_OBSERVE_REFRESH_INTERVAL
#else
#define COAP_OBSERVE_REFRESH_INTERVAL 20 #define COAP_OBSERVE_REFRESH_INTERVAL 20
#endif /* COAP_OBSERVE_REFRESH_INTERVAL */ #endif /* COAP_OBSERVE_REFRESH_INTERVAL */
......
...@@ -244,7 +244,9 @@ coap_notify_observers_sub(coap_resource_t *resource, const char *subpath) ...@@ -244,7 +244,9 @@ coap_notify_observers_sub(coap_resource_t *resource, const char *subpath)
/*TODO implement special transaction for CON, sharing the same buffer to allow for more observers */ /*TODO implement special transaction for CON, sharing the same buffer to allow for more observers */
if((transaction = coap_new_transaction(coap_get_mid(), &obs->endpoint))) { if((transaction = coap_new_transaction(coap_get_mid(), &obs->endpoint))) {
if(obs->obs_counter % COAP_OBSERVE_REFRESH_INTERVAL == 0) { /* if COAP_OBSERVE_REFRESH_INTERVAL is zero, never send observations as confirmable messages */
if(COAP_OBSERVE_REFRESH_INTERVAL != 0
&& (obs->obs_counter % COAP_OBSERVE_REFRESH_INTERVAL == 0)) {
LOG_DBG(" Force Confirmable for\n"); LOG_DBG(" Force Confirmable for\n");
notification->type = COAP_TYPE_CON; notification->type = COAP_TYPE_CON;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment