Merge branch 'develop' into bugfix/gpio/64bit

This commit is contained in:
Simon Duquennoy 2018-10-19 15:46:24 +02:00 committed by GitHub
commit 78d16284ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -99,7 +99,9 @@
#endif /* COAP_MAX_OBSERVERS */
/* 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
#endif /* COAP_OBSERVE_REFRESH_INTERVAL */

View File

@ -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 */
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");
notification->type = COAP_TYPE_CON;
}