net: lwm2m: expose lwm2m_engine_get_resource() for lwm2m subsys

The lwm2m_engine_get_resource() function needs to be made available to
other portions of the lwm2m subsys in order for firmware resource data
to be used in the future.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
Michael Scott 2017-10-26 23:41:17 -07:00 committed by Jukka Rissanen
commit f32815a8d5
2 changed files with 8 additions and 6 deletions

View file

@ -1626,8 +1626,7 @@ static int engine_get_resource(struct lwm2m_obj_path *path,
return 0; return 0;
} }
static int engine_get_resource_from_pathstr(char *pathstr, int lwm2m_engine_get_resource(char *pathstr, struct lwm2m_engine_res_inst **res)
struct lwm2m_engine_res_inst **res)
{ {
int ret; int ret;
struct lwm2m_obj_path path; struct lwm2m_obj_path path;
@ -1652,7 +1651,7 @@ int lwm2m_engine_register_read_callback(char *pathstr,
int ret; int ret;
struct lwm2m_engine_res_inst *res = NULL; struct lwm2m_engine_res_inst *res = NULL;
ret = engine_get_resource_from_pathstr(pathstr, &res); ret = lwm2m_engine_get_resource(pathstr, &res);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@ -1667,7 +1666,7 @@ int lwm2m_engine_register_pre_write_callback(char *pathstr,
int ret; int ret;
struct lwm2m_engine_res_inst *res = NULL; struct lwm2m_engine_res_inst *res = NULL;
ret = engine_get_resource_from_pathstr(pathstr, &res); ret = lwm2m_engine_get_resource(pathstr, &res);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@ -1682,7 +1681,7 @@ int lwm2m_engine_register_post_write_callback(char *pathstr,
int ret; int ret;
struct lwm2m_engine_res_inst *res = NULL; struct lwm2m_engine_res_inst *res = NULL;
ret = engine_get_resource_from_pathstr(pathstr, &res); ret = lwm2m_engine_get_resource(pathstr, &res);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@ -1697,7 +1696,7 @@ int lwm2m_engine_register_exec_callback(char *pathstr,
int ret; int ret;
struct lwm2m_engine_res_inst *res = NULL; struct lwm2m_engine_res_inst *res = NULL;
ret = engine_get_resource_from_pathstr(pathstr, &res); ret = lwm2m_engine_get_resource(pathstr, &res);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }

View file

@ -112,6 +112,9 @@ enum coap_block_size lwm2m_default_block_size(void);
int lwm2m_engine_add_service(void (*service)(void), u32_t period_ms); int lwm2m_engine_add_service(void (*service)(void), u32_t period_ms);
int lwm2m_engine_get_resource(char *pathstr,
struct lwm2m_engine_res_inst **res);
size_t lwm2m_engine_get_opaque_more(struct lwm2m_input_context *in, size_t lwm2m_engine_get_opaque_more(struct lwm2m_input_context *in,
u8_t *buf, size_t buflen, bool *last_block); u8_t *buf, size_t buflen, bool *last_block);