Lines Matching refs:obs

356 	struct observe_node *obs;  in lwm2m_notify_observer_path()  local
369 SYS_SLIST_FOR_EACH_CONTAINER(&sock_ctx[i]->observer, obs, node) { in lwm2m_notify_observer_path()
370 if (lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_notify_observer_path()
372 ret = engine_observe_attribute_list_get(&obs->path_list, &nattrs, in lwm2m_notify_observer_path()
380 obs->last_timestamp + MSEC_PER_SEC * nattrs.pmin; in lwm2m_notify_observer_path()
386 if (!obs->event_timestamp || obs->event_timestamp > timestamp) { in lwm2m_notify_observer_path()
387 obs->resource_update = true; in lwm2m_notify_observer_path()
388 obs->event_timestamp = timestamp; in lwm2m_notify_observer_path()
406 struct observe_node *obs = NULL; in engine_allocate_observer() local
412 obs = &observe_node_data[i]; in engine_allocate_observer()
417 if (!obs) { in engine_allocate_observer()
421 sys_slist_init(&obs->path_list); in engine_allocate_observer()
422 obs->composite = composite; in engine_allocate_observer()
430 lwm2m_engine_free_list(&obs->path_list, &obs_obj_path_list); in engine_allocate_observer()
437 sys_slist_append(&obs->path_list, &entry->node); in engine_allocate_observer()
440 return obs; in engine_allocate_observer()
443 static void engine_observe_node_init(struct observe_node *obs, const uint8_t *token, in engine_observe_node_init() argument
449 memcpy(obs->token, token, tkl); in engine_observe_node_init()
450 obs->tkl = tkl; in engine_observe_node_init()
452 obs->last_timestamp = k_uptime_get(); in engine_observe_node_init()
454 obs->event_timestamp = obs->last_timestamp + MSEC_PER_SEC * att_pmax; in engine_observe_node_init()
456 obs->event_timestamp = 0; in engine_observe_node_init()
458 obs->resource_update = false; in engine_observe_node_init()
459 obs->active_notify = NULL; in engine_observe_node_init()
460 obs->format = format; in engine_observe_node_init()
461 obs->counter = OBSERVE_COUNTER_START; in engine_observe_node_init()
462 sys_slist_append(&ctx->observer, &obs->node); in engine_observe_node_init()
464 SYS_SLIST_FOR_EACH_CONTAINER(&obs->path_list, tmp, node) { in engine_observe_node_init()
477 static void remove_observer_path_from_list(struct lwm2m_ctx *ctx, struct observe_node *obs, in remove_observer_path_from_list() argument
482 LOG_DBG("Removing observer %p for path %s", obs, lwm2m_path_log_buf(buf, &o_p->path)); in remove_observer_path_from_list()
487 sys_slist_remove(&obs->path_list, prev_node, &o_p->node); in remove_observer_path_from_list()
491 static void engine_observe_single_path_id_remove(struct lwm2m_ctx *ctx, struct observe_node *obs, in engine_observe_single_path_id_remove() argument
497 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&obs->path_list, o_p, tmp, node) { in engine_observe_single_path_id_remove()
504 remove_observer_path_from_list(ctx, obs, o_p, prev_node); in engine_observe_single_path_id_remove()
549 struct observe_node *obs; in engine_observe_node_discover() local
558 SYS_SLIST_FOR_EACH_CONTAINER(observe_node_list, obs, node) { in engine_observe_node_discover()
562 obs_list_size = engine_path_list_size(&obs->path_list); in engine_observe_node_discover()
565 *prev_node = &obs->node; in engine_observe_node_discover()
569 if (!engine_compare_obs_path_list(&obs->path_list, lwm2m_path_list, in engine_observe_node_discover()
571 *prev_node = &obs->node; in engine_observe_node_discover()
576 if (token && memcmp(obs->token, token, tkl)) { in engine_observe_node_discover()
578 *prev_node = &obs->node; in engine_observe_node_discover()
581 return obs; in engine_observe_node_discover()
589 struct observe_node *obs; in engine_add_observer() local
611 obs = engine_observe_node_discover(&msg->ctx->observer, &prev_node, &lwm2m_path_list, NULL, in engine_add_observer()
613 if (obs) { in engine_add_observer()
614 memcpy(obs->token, token, tkl); in engine_add_observer()
615 obs->tkl = tkl; in engine_add_observer()
618 if (obs->active_notify != NULL) { in engine_add_observer()
619 lwm2m_reset_message(obs->active_notify, true); in engine_add_observer()
620 obs->active_notify = NULL; in engine_add_observer()
636 obs = engine_allocate_observer(&lwm2m_path_list, false); in engine_add_observer()
637 if (!obs) { in engine_add_observer()
641 engine_observe_node_init(obs, token, msg->ctx, tkl, format, attrs.pmax); in engine_add_observer()
671 struct observe_node *obs; in engine_add_composite_observer() local
700 obs = engine_observe_node_discover(&msg->ctx->observer, &prev_node, &lwm2m_path_list, NULL, in engine_add_composite_observer()
702 if (obs) { in engine_add_composite_observer()
703 memcpy(obs->token, token, tkl); in engine_add_composite_observer()
704 obs->tkl = tkl; in engine_add_composite_observer()
707 if (obs->active_notify != NULL) { in engine_add_composite_observer()
708 lwm2m_reset_message(obs->active_notify, true); in engine_add_composite_observer()
709 obs->active_notify = NULL; in engine_add_composite_observer()
723 obs = engine_allocate_observer(&lwm2m_path_list, true); in engine_add_composite_observer()
724 if (!obs) { in engine_add_composite_observer()
727 engine_observe_node_init(obs, token, msg->ctx, tkl, format, attrs.pmax); in engine_add_composite_observer()
732 struct observe_node *obs) in remove_observer_from_list() argument
736 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&obs->path_list, o_p, tmp, node) { in remove_observer_from_list()
737 remove_observer_path_from_list(ctx, obs, o_p, NULL); in remove_observer_from_list()
739 sys_slist_remove(&ctx->observer, prev_node, &obs->node); in remove_observer_from_list()
740 (void)memset(obs, 0, sizeof(*obs)); in remove_observer_from_list()
745 struct observe_node *obs; in engine_remove_observer_by_token() local
753 obs = engine_observe_node_discover(&ctx->observer, &prev_node, NULL, token, tkl); in engine_remove_observer_by_token()
754 if (!obs) { in engine_remove_observer_by_token()
758 remove_observer_from_list(ctx, prev_node, obs); in engine_remove_observer_by_token()
768 struct observe_node *obs; in engine_remove_composite_observer() local
790 obs = engine_observe_node_discover(&msg->ctx->observer, &prev_node, &lwm2m_path_list, token, in engine_remove_composite_observer()
792 if (!obs) { in engine_remove_composite_observer()
796 remove_observer_from_list(msg->ctx, prev_node, obs); in engine_remove_composite_observer()
833 struct observe_node *obs; in engine_remove_observer_by_path() local
843 obs = engine_observe_node_discover(&ctx->observer, &prev_node, &lwm2m_path_list, NULL, 0); in engine_remove_observer_by_path()
844 if (!obs) { in engine_remove_observer_by_path()
850 remove_observer_from_list(ctx, prev_node, obs); in engine_remove_observer_by_path()
858 struct observe_node *obs, *tmp; in engine_remove_observer_by_id() local
865 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&sock_ctx[i]->observer, obs, tmp, node) { in engine_remove_observer_by_id()
866 engine_observe_single_path_id_remove(sock_ctx[i], obs, obj_id, obj_inst_id); in engine_remove_observer_by_id()
868 if (sys_slist_is_empty(&obs->path_list)) { in engine_remove_observer_by_id()
869 remove_observer_from_list(sock_ctx[i], prev_node, obs); in engine_remove_observer_by_id()
871 prev_node = &obs->node; in engine_remove_observer_by_id()
940 struct observe_node *obs; in lwm2m_engine_observer_timestamp_update() local
946 SYS_SLIST_FOR_EACH_CONTAINER(observer, obs, node) { in lwm2m_engine_observer_timestamp_update()
947 if (obs->resource_update) { in lwm2m_engine_observer_timestamp_update()
952 if (!lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_engine_observer_timestamp_update()
957 ret = engine_observe_attribute_list_get(&obs->path_list, &nattrs, srv_obj_inst); in lwm2m_engine_observer_timestamp_update()
965 timestamp = obs->last_timestamp + MSEC_PER_SEC * nattrs.pmax; in lwm2m_engine_observer_timestamp_update()
970 obs->event_timestamp = timestamp; in lwm2m_engine_observer_timestamp_update()
1372 struct observe_node *obs; in lwm2m_path_is_observed() local
1376 SYS_SLIST_FOR_EACH_CONTAINER(&sock_ctx[i]->observer, obs, node) { in lwm2m_path_is_observed()
1378 if (lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_path_is_observed()
1433 int64_t engine_observe_shedule_next_event(struct observe_node *obs, uint16_t srv_obj_inst, in engine_observe_shedule_next_event() argument
1440 ret = engine_observe_attribute_list_get(&obs->path_list, &attrs, srv_obj_inst); in engine_observe_shedule_next_event()