Lines Matching full:path
193 static bool lwm2m_notify_observer_list(sys_slist_t *path_list, const struct lwm2m_obj_path *path) in lwm2m_notify_observer_list() argument
198 if (lwm2m_observer_path_compare(&o_p->path, path)) { in lwm2m_notify_observer_list()
208 struct lwm2m_obj_path path; in lwm2m_notify_observer() local
210 path.level = LWM2M_PATH_LEVEL_RESOURCE; in lwm2m_notify_observer()
211 path.obj_id = obj_id; in lwm2m_notify_observer()
212 path.obj_inst_id = obj_inst_id; in lwm2m_notify_observer()
213 path.res_id = res_id; in lwm2m_notify_observer()
215 return lwm2m_notify_observer_path(&path); in lwm2m_notify_observer()
218 static int engine_observe_get_attributes(const struct lwm2m_obj_path *path, in engine_observe_get_attributes() argument
233 obj = get_engine_obj(path->obj_id); in engine_observe_get_attributes()
235 LOG_ERR("unable to find obj: %u", path->obj_id); in engine_observe_get_attributes()
245 if (path->level >= LWM2M_PATH_LEVEL_OBJECT_INST) { in engine_observe_get_attributes()
246 obj_inst = get_engine_obj_inst(path->obj_id, path->obj_inst_id); in engine_observe_get_attributes()
260 if (path->level >= LWM2M_PATH_LEVEL_RESOURCE) { in engine_observe_get_attributes()
262 if (obj_inst->resources[i].res_id == path->res_id) { in engine_observe_get_attributes()
268 LOG_ERR("unable to find res_id: %u/%u/%u", path->obj_id, path->obj_inst_id, in engine_observe_get_attributes()
269 path->res_id); in engine_observe_get_attributes()
276 LOG_ERR("unable to find obj_field: %u/%u/%u", path->obj_id, in engine_observe_get_attributes()
277 path->obj_inst_id, path->res_id); in engine_observe_get_attributes()
293 if (IS_ENABLED(CONFIG_LWM2M_VERSION_1_1) && path->level == LWM2M_PATH_LEVEL_RESOURCE_INST) { in engine_observe_get_attributes()
294 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in engine_observe_get_attributes()
327 ret = engine_observe_get_attributes(&o_p->path, nattrs, server_obj_inst); in engine_observe_attribute_list_get()
354 int lwm2m_notify_observer_path(const struct lwm2m_obj_path *path) in lwm2m_notify_observer_path() argument
363 if (path->level < LWM2M_PATH_LEVEL_OBJECT) { in lwm2m_notify_observer_path()
370 if (lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_notify_observer_path()
391 LOG_DBG("NOTIFY EVENT %u/%u/%u", path->obj_id, path->obj_inst_id, in lwm2m_notify_observer_path()
392 path->res_id); in lwm2m_notify_observer_path()
424 /* Allocate and copy path */ in engine_allocate_observer()
426 /* Allocate path entry */ in engine_allocate_observer()
435 memcpy(&entry->path, &tmp->path, sizeof(tmp->path)); in engine_allocate_observer()
465 LOG_DBG("OBSERVER ADDED %u/%u/%u/%u(%u)", tmp->path.obj_id, tmp->path.obj_inst_id, in engine_observe_node_init()
466 tmp->path.res_id, tmp->path.res_inst_id, tmp->path.level); in engine_observe_node_init()
469 ctx->observe_cb(LWM2M_OBSERVE_EVENT_OBSERVER_ADDED, &tmp->path, ctx); in engine_observe_node_init()
482 LOG_DBG("Removing observer %p for path %s", obs, lwm2m_path_log_buf(buf, &o_p->path)); in remove_observer_path_from_list()
484 ctx->observe_cb(LWM2M_OBSERVE_EVENT_OBSERVER_REMOVED, &o_p->path, NULL); in remove_observer_path_from_list()
498 if (o_p->path.obj_id != obj_id && o_p->path.obj_inst_id) { in engine_observe_single_path_id_remove()
503 if (obj_inst_id == -1 || o_p->path.obj_inst_id == obj_inst_id) { in engine_observe_single_path_id_remove()
522 if (memcmp(&obs_path->path, &comp_path->path, sizeof(struct lwm2m_obj_path))) { in engine_compare_obs_path_list()
561 /* Validate Path for discovery */ in engine_observe_node_discover()
606 /* Create 1 entry linked list for message path */ in engine_add_observer()
607 memcpy(&obs_path_list_buf.path, &msg->path, sizeof(struct lwm2m_obj_path)); in engine_add_observer()
623 LOG_DBG("OBSERVER DUPLICATE %u/%u/%u(%u) [%s]", msg->path.obj_id, in engine_add_observer()
624 msg->path.obj_inst_id, msg->path.res_id, msg->path.level, in engine_add_observer()
631 ret = engine_observe_get_attributes(&msg->path, &attrs, msg->ctx->srv_obj_inst); in engine_add_observer()
804 char *lwm2m_path_log_buf(char *buf, struct lwm2m_obj_path *path) in lwm2m_path_log_buf() argument
808 if (!path) { in lwm2m_path_log_buf()
813 cur = sprintf(buf, "%u", path->obj_id); in lwm2m_path_log_buf()
815 if (path->level > 1) { in lwm2m_path_log_buf()
816 cur += sprintf(buf + cur, "/%u", path->obj_inst_id); in lwm2m_path_log_buf()
818 if (path->level > 2) { in lwm2m_path_log_buf()
819 cur += sprintf(buf + cur, "/%u", path->res_id); in lwm2m_path_log_buf()
821 if (path->level > 3) { in lwm2m_path_log_buf()
822 cur += sprintf(buf + cur, "/%u", path->res_inst_id); in lwm2m_path_log_buf()
830 static int engine_remove_observer_by_path(struct lwm2m_ctx *ctx, struct lwm2m_obj_path *path) in engine_remove_observer_by_path() argument
838 /* Create 1 entry linked list for message path */ in engine_remove_observer_by_path()
839 memcpy(&obs_path_list_buf.path, path, sizeof(struct lwm2m_obj_path)); in engine_remove_observer_by_path()
848 LOG_INF("Removing observer for path %s", lwm2m_path_log_buf(buf, path)); in engine_remove_observer_by_path()
937 const struct lwm2m_obj_path *path, in lwm2m_engine_observer_timestamp_update() argument
951 /* Compare Observation node path to updated one */ in lwm2m_engine_observer_timestamp_update()
952 if (!lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_engine_observer_timestamp_update()
956 /* Read Attributes after validation Path */ in lwm2m_engine_observer_timestamp_update()
979 int lwm2m_get_path_reference_ptr(struct lwm2m_engine_obj *obj, const struct lwm2m_obj_path *path, in lwm2m_get_path_reference_ptr() argument
989 obj = get_engine_obj(path->obj_id); in lwm2m_get_path_reference_ptr()
996 if (path->level == LWM2M_PATH_LEVEL_OBJECT) { in lwm2m_get_path_reference_ptr()
998 } else if (path->level == LWM2M_PATH_LEVEL_OBJECT_INST) { in lwm2m_get_path_reference_ptr()
999 obj_inst = get_engine_obj_inst(path->obj_id, path->obj_inst_id); in lwm2m_get_path_reference_ptr()
1005 } else if (path->level == LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_get_path_reference_ptr()
1006 ret = path_to_objs(path, NULL, NULL, &res, NULL); in lwm2m_get_path_reference_ptr()
1013 path->level == LWM2M_PATH_LEVEL_RESOURCE_INST) { in lwm2m_get_path_reference_ptr()
1015 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in lwm2m_get_path_reference_ptr()
1030 const struct lwm2m_obj_path *path, uint32_t period_s) in lwm2m_update_observer_min_period() argument
1038 ret = lwm2m_get_path_reference_ptr(NULL, path, &ref); in lwm2m_update_observer_min_period()
1053 /* Read Pmin & Pmax values for path */ in lwm2m_update_observer_min_period()
1054 ret = engine_observe_get_attributes(path, &attrs, client_ctx->srv_obj_inst); in lwm2m_update_observer_min_period()
1068 const struct lwm2m_obj_path *path, uint32_t period_s) in lwm2m_update_observer_max_period() argument
1076 ret = lwm2m_get_path_reference_ptr(NULL, path, &ref); in lwm2m_update_observer_max_period()
1091 /* Read Pmin & Pmax values for path */ in lwm2m_update_observer_max_period()
1092 ret = engine_observe_get_attributes(path, &attrs, client_ctx->srv_obj_inst); in lwm2m_update_observer_max_period()
1109 return lwm2m_engine_observer_timestamp_update(&client_ctx->observer, path, in lwm2m_update_observer_max_period()
1164 ret = lwm2m_get_path_reference_ptr(obj, &msg->path, &ref); in lwm2m_write_attr_handler()
1216 if (plen == 2 && msg->path.level <= 2U) { in lwm2m_write_attr_handler()
1363 lwm2m_engine_observer_timestamp_update(&msg->ctx->observer, &msg->path, in lwm2m_write_attr_handler()
1369 bool lwm2m_path_is_observed(const struct lwm2m_obj_path *path) in lwm2m_path_is_observed() argument
1378 if (lwm2m_notify_observer_list(&obs->path_list, path)) { in lwm2m_path_is_observed()
1417 r = engine_remove_observer_by_path(msg->ctx, &msg->path); in lwm2m_engine_observation_handler()
1493 const struct lwm2m_obj_path *path) in lwm2m_engine_add_path_to_list() argument
1500 if (path->level == LWM2M_PATH_LEVEL_NONE) { in lwm2m_engine_add_path_to_list()
1501 /* Clear the list if we are adding the root path which includes all */ in lwm2m_engine_add_path_to_list()
1511 new_entry->path = *path; in lwm2m_engine_add_path_to_list()
1518 if (entry->path.level == LWM2M_PATH_LEVEL_NONE || in lwm2m_engine_add_path_to_list()
1519 lwm2m_obj_path_equal(&entry->path, &new_entry->path)) { in lwm2m_engine_add_path_to_list()
1520 /* Already Root request at list or current path is at list */ in lwm2m_engine_add_path_to_list()
1528 * - if at any level up to new entry's path level, IDs below the level in lwm2m_engine_add_path_to_list()
1533 * higher path level and come after the new entry. in lwm2m_engine_add_path_to_list()
1535 switch (new_entry->path.level) { in lwm2m_engine_add_path_to_list()
1537 add_before_current = new_entry->path.obj_id <= entry->path.obj_id; in lwm2m_engine_add_path_to_list()
1542 (new_entry->path.obj_id < entry->path.obj_id) || in lwm2m_engine_add_path_to_list()
1544 (entry->path.level >= LWM2M_PATH_LEVEL_OBJECT_INST && in lwm2m_engine_add_path_to_list()
1545 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1546 new_entry->path.obj_inst_id <= entry->path.obj_inst_id); in lwm2m_engine_add_path_to_list()
1551 (new_entry->path.obj_id < entry->path.obj_id) || in lwm2m_engine_add_path_to_list()
1553 (entry->path.level >= LWM2M_PATH_LEVEL_OBJECT_INST && in lwm2m_engine_add_path_to_list()
1554 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1555 new_entry->path.obj_inst_id < entry->path.obj_inst_id) || in lwm2m_engine_add_path_to_list()
1557 (entry->path.level >= LWM2M_PATH_LEVEL_RESOURCE && in lwm2m_engine_add_path_to_list()
1558 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1559 entry->path.obj_inst_id == new_entry->path.obj_inst_id && in lwm2m_engine_add_path_to_list()
1560 new_entry->path.res_id <= entry->path.res_id); in lwm2m_engine_add_path_to_list()
1565 (new_entry->path.obj_id < entry->path.obj_id) || in lwm2m_engine_add_path_to_list()
1567 (entry->path.level >= LWM2M_PATH_LEVEL_OBJECT_INST && in lwm2m_engine_add_path_to_list()
1568 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1569 new_entry->path.obj_inst_id < entry->path.obj_inst_id) || in lwm2m_engine_add_path_to_list()
1571 (entry->path.level >= LWM2M_PATH_LEVEL_RESOURCE && in lwm2m_engine_add_path_to_list()
1572 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1573 entry->path.obj_inst_id == new_entry->path.obj_inst_id && in lwm2m_engine_add_path_to_list()
1574 new_entry->path.res_id < entry->path.res_id) || in lwm2m_engine_add_path_to_list()
1576 (entry->path.level >= LWM2M_PATH_LEVEL_RESOURCE_INST && in lwm2m_engine_add_path_to_list()
1577 entry->path.obj_id == new_entry->path.obj_id && in lwm2m_engine_add_path_to_list()
1578 entry->path.obj_inst_id == new_entry->path.obj_inst_id && in lwm2m_engine_add_path_to_list()
1579 entry->path.res_id == new_entry->path.res_id && in lwm2m_engine_add_path_to_list()
1580 new_entry->path.res_inst_id <= entry->path.res_inst_id); in lwm2m_engine_add_path_to_list()
1612 /* Keep list Ordered but remove if shorter path is similar */ in lwm2m_engine_clear_duplicate_path()
1615 if (prev && prev->path.level < entry->path.level) { in lwm2m_engine_clear_duplicate_path()
1616 if (prev->path.level == LWM2M_PATH_LEVEL_OBJECT && in lwm2m_engine_clear_duplicate_path()
1617 entry->path.obj_id == prev->path.obj_id) { in lwm2m_engine_clear_duplicate_path()
1619 } else if (prev->path.level == LWM2M_PATH_LEVEL_OBJECT_INST && in lwm2m_engine_clear_duplicate_path()
1620 entry->path.obj_id == prev->path.obj_id && in lwm2m_engine_clear_duplicate_path()
1621 entry->path.obj_inst_id == prev->path.obj_inst_id) { in lwm2m_engine_clear_duplicate_path()
1624 } else if (prev->path.level == LWM2M_PATH_LEVEL_RESOURCE && in lwm2m_engine_clear_duplicate_path()
1625 entry->path.obj_id == prev->path.obj_id && in lwm2m_engine_clear_duplicate_path()
1626 entry->path.obj_inst_id == prev->path.obj_inst_id && in lwm2m_engine_clear_duplicate_path()
1627 entry->path.res_id == prev->path.res_id) { in lwm2m_engine_clear_duplicate_path()