Lines Matching full:path
99 const struct lwm2m_obj_path *path, const void *value,
158 struct lwm2m_engine_obj *lwm2m_engine_get_obj(const struct lwm2m_obj_path *path) in lwm2m_engine_get_obj() argument
160 if (path->level < LWM2M_PATH_LEVEL_OBJECT) { in lwm2m_engine_get_obj()
164 return get_engine_obj(path->obj_id); in lwm2m_engine_get_obj()
319 int lwm2m_create_object_inst(const struct lwm2m_obj_path *path) in lwm2m_create_object_inst() argument
324 if (path->level != LWM2M_PATH_LEVEL_OBJECT_INST) { in lwm2m_create_object_inst()
325 LOG_ERR("path must have 2 parts"); in lwm2m_create_object_inst()
329 ret = lwm2m_create_obj_inst(path->obj_id, path->obj_inst_id, &obj_inst); in lwm2m_create_object_inst()
339 int lwm2m_delete_object_inst(const struct lwm2m_obj_path *path) in lwm2m_delete_object_inst() argument
343 if (path->level != LWM2M_PATH_LEVEL_OBJECT_INST) { in lwm2m_delete_object_inst()
344 LOG_ERR("path must have 2 parts"); in lwm2m_delete_object_inst()
348 ret = lwm2m_delete_obj_inst(path->obj_id, path->obj_inst_id); in lwm2m_delete_object_inst()
358 struct lwm2m_engine_obj_inst *lwm2m_engine_get_obj_inst(const struct lwm2m_obj_path *path) in lwm2m_engine_get_obj_inst() argument
360 if (path->level < LWM2M_PATH_LEVEL_OBJECT_INST) { in lwm2m_engine_get_obj_inst()
364 return get_engine_obj_inst(path->obj_id, path->obj_inst_id); in lwm2m_engine_get_obj_inst()
367 int path_to_objs(const struct lwm2m_obj_path *path, struct lwm2m_engine_obj_inst **obj_inst, in path_to_objs() argument
377 if (!path) { in path_to_objs()
381 oi = get_engine_obj_inst(path->obj_id, path->obj_inst_id); in path_to_objs()
383 LOG_ERR("obj instance %d/%d not found", path->obj_id, path->obj_inst_id); in path_to_objs()
392 of = lwm2m_get_engine_obj_field(oi->obj, path->res_id); in path_to_objs()
394 LOG_ERR("obj field %d not found", path->res_id); in path_to_objs()
399 if (oi->resources[i].res_id == path->res_id) { in path_to_objs()
407 LOG_DBG("resource %d not found", path->res_id); in path_to_objs()
409 LOG_ERR("resource %d not found", path->res_id); in path_to_objs()
416 if (r->res_instances[i].res_inst_id == path->res_inst_id) { in path_to_objs()
443 static bool is_string(const struct lwm2m_obj_path *path) in is_string() argument
448 ret = path_to_objs(path, NULL, &obj_field, NULL, NULL); in is_string()
460 int lwm2m_set_res_buf(const struct lwm2m_obj_path *path, void *buffer_ptr, uint16_t buffer_len, in lwm2m_set_res_buf() argument
466 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_set_res_buf()
467 LOG_ERR("path must have at least 3 parts"); in lwm2m_set_res_buf()
473 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in lwm2m_set_res_buf()
480 LOG_ERR("res instance %d not found", path->res_inst_id); in lwm2m_set_res_buf()
537 static int lwm2m_engine_set(const struct lwm2m_obj_path *path, const void *value, uint16_t len) in lwm2m_engine_set() argument
548 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_engine_set()
549 LOG_ERR("path must have at least 3 parts"); in lwm2m_engine_set()
553 LOG_DBG("path:%u/%u/%u, buf:%p, len:%d", path->obj_id, path->obj_inst_id, in lwm2m_engine_set()
554 path->res_id, value, len); in lwm2m_engine_set()
558 ret = path_to_objs(path, &obj_inst, &obj_field, &res, &res_inst); in lwm2m_engine_set()
565 LOG_ERR("res instance %d not found", path->res_inst_id); in lwm2m_engine_set()
572 "[%u/%u/%u/%u:lvl%u]", path->obj_id, path->obj_inst_id, path->res_id, in lwm2m_engine_set()
573 path->res_inst_id, path->level); in lwm2m_engine_set()
589 LOG_ERR("res instance data pointer is NULL [%u/%u/%u/%u:%u]", path->obj_id, in lwm2m_engine_set()
590 path->obj_inst_id, path->res_id, path->res_inst_id, path->level); in lwm2m_engine_set()
663 "[%u/%u/%u/%u:%u]", path->obj_id, path->obj_inst_id, path->res_id, in lwm2m_engine_set()
664 path->res_inst_id, path->level); in lwm2m_engine_set()
712 lwm2m_engine_cache_write(obj_field, path, value, len); in lwm2m_engine_set()
721 lwm2m_notify_observer_path(path); in lwm2m_engine_set()
727 int lwm2m_set_opaque(const struct lwm2m_obj_path *path, const char *data_ptr, uint16_t data_len) in lwm2m_set_opaque() argument
729 return lwm2m_engine_set(path, data_ptr, data_len); in lwm2m_set_opaque()
732 int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr) in lwm2m_set_string() argument
737 if (is_string(path)) { in lwm2m_set_string()
741 return lwm2m_engine_set(path, data_ptr, len); in lwm2m_set_string()
744 int lwm2m_set_u8(const struct lwm2m_obj_path *path, uint8_t value) in lwm2m_set_u8() argument
746 return lwm2m_engine_set(path, &value, 1); in lwm2m_set_u8()
749 int lwm2m_set_u16(const struct lwm2m_obj_path *path, uint16_t value) in lwm2m_set_u16() argument
751 return lwm2m_engine_set(path, &value, 2); in lwm2m_set_u16()
754 int lwm2m_set_u32(const struct lwm2m_obj_path *path, uint32_t value) in lwm2m_set_u32() argument
756 return lwm2m_engine_set(path, &value, 4); in lwm2m_set_u32()
759 int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value) in lwm2m_set_s8() argument
761 return lwm2m_engine_set(path, &value, 1); in lwm2m_set_s8()
764 int lwm2m_set_s16(const struct lwm2m_obj_path *path, int16_t value) in lwm2m_set_s16() argument
766 return lwm2m_engine_set(path, &value, 2); in lwm2m_set_s16()
770 int lwm2m_set_s32(const struct lwm2m_obj_path *path, int32_t value) in lwm2m_set_s32() argument
772 return lwm2m_engine_set(path, &value, 4); in lwm2m_set_s32()
775 int lwm2m_set_s64(const struct lwm2m_obj_path *path, int64_t value) in lwm2m_set_s64() argument
777 return lwm2m_engine_set(path, &value, 8); in lwm2m_set_s64()
780 int lwm2m_set_bool(const struct lwm2m_obj_path *path, bool value) in lwm2m_set_bool() argument
784 return lwm2m_engine_set(path, &temp, 1); in lwm2m_set_bool()
787 int lwm2m_set_f64(const struct lwm2m_obj_path *path, const double value) in lwm2m_set_f64() argument
789 return lwm2m_engine_set(path, &value, sizeof(double)); in lwm2m_set_f64()
792 int lwm2m_set_objlnk(const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value) in lwm2m_set_objlnk() argument
794 return lwm2m_engine_set(path, value, sizeof(struct lwm2m_objlnk)); in lwm2m_set_objlnk()
797 int lwm2m_set_time(const struct lwm2m_obj_path *path, time_t value) in lwm2m_set_time() argument
799 return lwm2m_engine_set(path, &value, sizeof(time_t)); in lwm2m_set_time()
802 int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len) in lwm2m_set_res_data_len() argument
810 ret = lwm2m_get_res_buf(path, &buffer_ptr, &buffer_len, &old_len, &data_flags); in lwm2m_set_res_data_len()
814 return lwm2m_set_res_buf(path, buffer_ptr, buffer_len, data_len, data_flags); in lwm2m_set_res_data_len()
818 int lwm2m_get_res_buf(const struct lwm2m_obj_path *path, void **buffer_ptr, uint16_t *buffer_len, in lwm2m_get_res_buf() argument
824 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_get_res_buf()
825 LOG_ERR("path must have at least 3 parts"); in lwm2m_get_res_buf()
831 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in lwm2m_get_res_buf()
838 LOG_ERR("res instance %d not found", path->res_inst_id); in lwm2m_get_res_buf()
860 static int lwm2m_engine_get(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen) in lwm2m_engine_get() argument
870 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_engine_get()
871 LOG_ERR("path must have at least 3 parts"); in lwm2m_engine_get()
874 LOG_DBG("path:%u/%u/%u/%u, level %u, buf:%p, buflen:%d", path->obj_id, path->obj_inst_id, in lwm2m_engine_get()
875 path->res_id, path->res_inst_id, path->level, buf, buflen); in lwm2m_engine_get()
879 ret = path_to_objs(path, &obj_inst, &obj_field, &res, &res_inst); in lwm2m_engine_get()
886 LOG_ERR("res instance %d not found", path->res_inst_id); in lwm2m_engine_get()
1000 int lwm2m_get_opaque(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen) in lwm2m_get_opaque() argument
1002 return lwm2m_engine_get(path, buf, buflen); in lwm2m_get_opaque()
1005 int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t buflen) in lwm2m_get_string() argument
1008 if (!is_string(path)) { in lwm2m_get_string()
1013 return lwm2m_engine_get(path, str, buflen); in lwm2m_get_string()
1016 int lwm2m_get_u8(const struct lwm2m_obj_path *path, uint8_t *value) in lwm2m_get_u8() argument
1018 return lwm2m_engine_get(path, value, 1); in lwm2m_get_u8()
1021 int lwm2m_get_u16(const struct lwm2m_obj_path *path, uint16_t *value) in lwm2m_get_u16() argument
1023 return lwm2m_engine_get(path, value, 2); in lwm2m_get_u16()
1026 int lwm2m_get_u32(const struct lwm2m_obj_path *path, uint32_t *value) in lwm2m_get_u32() argument
1028 return lwm2m_engine_get(path, value, 4); in lwm2m_get_u32()
1031 int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value) in lwm2m_get_s8() argument
1033 return lwm2m_engine_get(path, value, 1); in lwm2m_get_s8()
1036 int lwm2m_get_s16(const struct lwm2m_obj_path *path, int16_t *value) in lwm2m_get_s16() argument
1038 return lwm2m_engine_get(path, value, 2); in lwm2m_get_s16()
1041 int lwm2m_get_s32(const struct lwm2m_obj_path *path, int32_t *value) in lwm2m_get_s32() argument
1043 return lwm2m_engine_get(path, value, 4); in lwm2m_get_s32()
1046 int lwm2m_get_s64(const struct lwm2m_obj_path *path, int64_t *value) in lwm2m_get_s64() argument
1048 return lwm2m_engine_get(path, value, 8); in lwm2m_get_s64()
1051 int lwm2m_get_bool(const struct lwm2m_obj_path *path, bool *value) in lwm2m_get_bool() argument
1056 ret = lwm2m_get_s8(path, &temp); in lwm2m_get_bool()
1064 int lwm2m_get_f64(const struct lwm2m_obj_path *path, double *value) in lwm2m_get_f64() argument
1066 return lwm2m_engine_get(path, value, sizeof(double)); in lwm2m_get_f64()
1069 int lwm2m_get_objlnk(const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf) in lwm2m_get_objlnk() argument
1071 return lwm2m_engine_get(path, buf, sizeof(struct lwm2m_objlnk)); in lwm2m_get_objlnk()
1074 int lwm2m_get_time(const struct lwm2m_obj_path *path, time_t *buf) in lwm2m_get_time() argument
1076 return lwm2m_engine_get(path, buf, sizeof(time_t)); in lwm2m_get_time()
1079 int lwm2m_get_resource(const struct lwm2m_obj_path *path, struct lwm2m_engine_res **res) in lwm2m_get_resource() argument
1081 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_get_resource()
1082 LOG_ERR("path must have 3 parts"); in lwm2m_get_resource()
1086 return path_to_objs(path, NULL, NULL, res, NULL); in lwm2m_get_resource()
1165 int lwm2m_engine_get_create_res_inst(const struct lwm2m_obj_path *path, in lwm2m_engine_get_create_res_inst() argument
1173 ret = path_to_objs(path, NULL, NULL, &r, &r_i); in lwm2m_engine_get_create_res_inst()
1185 if (path->level < LWM2M_PATH_LEVEL_RESOURCE_INST) { in lwm2m_engine_get_create_res_inst()
1189 ret = lwm2m_engine_allocate_resource_instance(r, &r_i, path->res_inst_id); in lwm2m_engine_get_create_res_inst()
1200 int lwm2m_create_res_inst(const struct lwm2m_obj_path *path) in lwm2m_create_res_inst() argument
1206 if (path->level < LWM2M_PATH_LEVEL_RESOURCE_INST) { in lwm2m_create_res_inst()
1207 LOG_ERR("path must have 4 parts"); in lwm2m_create_res_inst()
1211 ret = path_to_objs(path, NULL, NULL, &res, &res_inst); in lwm2m_create_res_inst()
1218 LOG_ERR("resource %u not found", path->res_id); in lwm2m_create_res_inst()
1224 LOG_ERR("res instance %u already exists", path->res_inst_id); in lwm2m_create_res_inst()
1229 return lwm2m_engine_allocate_resource_instance(res, &res_inst, path->res_inst_id); in lwm2m_create_res_inst()
1232 int lwm2m_delete_res_inst(const struct lwm2m_obj_path *path) in lwm2m_delete_res_inst() argument
1237 if (path->level < LWM2M_PATH_LEVEL_RESOURCE_INST) { in lwm2m_delete_res_inst()
1238 LOG_ERR("path must have 4 parts"); in lwm2m_delete_res_inst()
1242 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in lwm2m_delete_res_inst()
1249 LOG_ERR("res instance %u not found", path->res_inst_id); in lwm2m_delete_res_inst()
1263 int lwm2m_register_read_callback(const struct lwm2m_obj_path *path, lwm2m_engine_get_data_cb_t cb) in lwm2m_register_read_callback() argument
1268 ret = lwm2m_get_resource(path, &res); in lwm2m_register_read_callback()
1277 int lwm2m_register_pre_write_callback(const struct lwm2m_obj_path *path, in lwm2m_register_pre_write_callback() argument
1283 ret = lwm2m_get_resource(path, &res); in lwm2m_register_pre_write_callback()
1292 int lwm2m_register_validate_callback(const struct lwm2m_obj_path *path, in lwm2m_register_validate_callback() argument
1299 ret = lwm2m_get_resource(path, &res); in lwm2m_register_validate_callback()
1307 ARG_UNUSED(path); in lwm2m_register_validate_callback()
1317 int lwm2m_register_post_write_callback(const struct lwm2m_obj_path *path, in lwm2m_register_post_write_callback() argument
1323 ret = lwm2m_get_resource(path, &res); in lwm2m_register_post_write_callback()
1332 int lwm2m_register_exec_callback(const struct lwm2m_obj_path *path, lwm2m_engine_execute_cb_t cb) in lwm2m_register_exec_callback() argument
1337 ret = lwm2m_get_resource(path, &res); in lwm2m_register_exec_callback()
1384 *obj_inst = get_engine_obj_inst(msg->path.obj_id, msg->path.obj_inst_id); in lwm2m_get_or_create_engine_obj()
1386 ret = lwm2m_create_obj_inst(msg->path.obj_id, msg->path.obj_inst_id, obj_inst); in lwm2m_get_or_create_engine_obj()
1404 struct lwm2m_engine_res *lwm2m_engine_get_res(const struct lwm2m_obj_path *path) in lwm2m_engine_get_res() argument
1409 if (path->level < LWM2M_PATH_LEVEL_RESOURCE) { in lwm2m_engine_get_res()
1413 ret = path_to_objs(path, NULL, NULL, &res, NULL); in lwm2m_engine_get_res()
1421 struct lwm2m_engine_res_inst *lwm2m_engine_get_res_inst(const struct lwm2m_obj_path *path) in lwm2m_engine_get_res_inst() argument
1426 if (path->level != LWM2M_PATH_LEVEL_RESOURCE_INST) { in lwm2m_engine_get_res_inst()
1430 ret = path_to_objs(path, NULL, NULL, NULL, &res_inst); in lwm2m_engine_get_res_inst()
1467 lwm2m_cache_entry_allocate(const struct lwm2m_obj_path *path) in lwm2m_cache_entry_allocate() argument
1472 entry = lwm2m_cache_entry_get_by_object(path); in lwm2m_cache_entry_allocate()
1478 if (lwm2m_cache_entries[i].path.level == 0) { in lwm2m_cache_entry_allocate()
1479 lwm2m_cache_entries[i].path = *path; in lwm2m_cache_entry_allocate()
1489 const struct lwm2m_obj_path *path, const void *value, in lwm2m_engine_cache_write() argument
1495 cache_entry = lwm2m_cache_entry_get_by_object(path); in lwm2m_engine_cache_write()
1569 LOG_ERR("Path level wrong for cache %u", obj_path->level); in lwm2m_cache_entry_get_by_object()
1578 if (lwm2m_obj_path_equal(&entry->path, obj_path)) { in lwm2m_cache_entry_get_by_object()
1587 int lwm2m_enable_cache(const struct lwm2m_obj_path *path, struct lwm2m_time_series_elem *data_cache, in lwm2m_enable_cache() argument
1599 ret = path_to_objs(path, &obj_inst, &obj_field, NULL, &res_inst); in lwm2m_enable_cache()
1605 LOG_ERR("res instance %d not found", path->res_inst_id); in lwm2m_enable_cache()
1621 cache_entry = lwm2m_cache_entry_allocate(path); in lwm2m_enable_cache()
1650 lwm2m_cache_entries[i].path.level = LWM2M_PATH_LEVEL_NONE; in lwm2m_engine_data_cache_init()
1748 ret = lwm2m_engine_set(res_list[i].path, res_list[i].value, res_list[i].size); in lwm2m_set_bulk()