net: lwm2m: remove deprecated functions & definition
These functions have been deprecated for more than 2 releases, remove them: - lwm2m_engine_update_observer_min_period - lwm2m_engine_update_observer_max_period - lwm2m_engine_create_obj_inst - lwm2m_engine_delete_obj_inst - lwm2m_engine_set_opaque - lwm2m_engine_set_string - lwm2m_engine_set_u8 - lwm2m_engine_set_u16 - lwm2m_engine_set_u32 - lwm2m_engine_set_u64 - lwm2m_engine_set_s8 - lwm2m_engine_set_s16 - lwm2m_engine_set_s32 - lwm2m_engine_set_s64 - lwm2m_engine_set_bool - lwm2m_engine_set_float - lwm2m_engine_set_objlnk - lwm2m_engine_set_time - lwm2m_engine_get_opaque - lwm2m_engine_get_string - lwm2m_engine_get_u8 - lwm2m_engine_get_u16 - lwm2m_engine_get_u32 - lwm2m_engine_get_u64 - lwm2m_engine_get_s8 - lwm2m_engine_get_s16 - lwm2m_engine_get_s32 - lwm2m_engine_get_s64 - lwm2m_engine_get_bool - lwm2m_engine_get_float - lwm2m_engine_get_objlnk - lwm2m_engine_get_time - lwm2m_engine_register_read_callback - lwm2m_engine_register_pre_write_callback - lwm2m_engine_register_validate_callback - lwm2m_engine_register_post_write_callback - lwm2m_engine_register_exec_callback - lwm2m_engine_register_create_callback - lwm2m_engine_register_delete_callback - lwm2m_engine_set_res_buf - lwm2m_engine_set_res_data - lwm2m_engine_set_res_data_len - lwm2m_engine_get_res_buf - lwm2m_engine_get_res_data - lwm2m_engine_create_res_inst - lwm2m_engine_delete_res_inst - lwm2m_engine_path_is_observed - lwm2m_engine_send - lwm2m_send - lwm2m_engine_enable_cache And additionally, the following definition: - LWM2M_RD_CLIENT_EVENT_REG_UPDATE_FAILURE Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
d85087ee46
commit
94e12d595e
5 changed files with 11 additions and 1545 deletions
File diff suppressed because it is too large
Load diff
|
@ -3602,34 +3602,3 @@ cleanup:
|
|||
return -ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
|
||||
int lwm2m_send(struct lwm2m_ctx *ctx, const struct lwm2m_obj_path path_list[],
|
||||
uint8_t path_list_size, bool confirmation_request)
|
||||
{
|
||||
if (!confirmation_request) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return lwm2m_send_cb(ctx, path_list, path_list_size, NULL);
|
||||
}
|
||||
|
||||
int lwm2m_engine_send(struct lwm2m_ctx *ctx, char const *path_list[], uint8_t path_list_size,
|
||||
bool confirmation_request)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path lwm2m_path_list[CONFIG_LWM2M_COMPOSITE_PATH_LIST_SIZE];
|
||||
|
||||
if (path_list_size > CONFIG_LWM2M_COMPOSITE_PATH_LIST_SIZE) {
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
for (int i = 0; i < path_list_size; i++) {
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(path_list[i], &lwm2m_path_list[i], '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return lwm2m_send_cb(ctx, lwm2m_path_list, path_list_size, NULL);
|
||||
}
|
||||
|
|
|
@ -1047,20 +1047,6 @@ int lwm2m_update_observer_min_period(struct lwm2m_ctx *client_ctx,
|
|||
return lwm2m_update_or_allocate_attribute(ref, LWM2M_ATTR_PMIN, &period_s);
|
||||
}
|
||||
|
||||
int lwm2m_engine_update_observer_min_period(struct lwm2m_ctx *client_ctx, const char *pathstr,
|
||||
uint32_t period_s)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_update_observer_min_period(client_ctx, &path, period_s);
|
||||
}
|
||||
|
||||
int lwm2m_update_observer_max_period(struct lwm2m_ctx *client_ctx,
|
||||
const struct lwm2m_obj_path *path, uint32_t period_s)
|
||||
{
|
||||
|
@ -1107,20 +1093,6 @@ int lwm2m_update_observer_max_period(struct lwm2m_ctx *client_ctx,
|
|||
client_ctx->srv_obj_inst);
|
||||
}
|
||||
|
||||
int lwm2m_engine_update_observer_max_period(struct lwm2m_ctx *client_ctx, const char *pathstr,
|
||||
uint32_t period_s)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_update_observer_max_period(client_ctx, &path, period_s);
|
||||
}
|
||||
|
||||
struct lwm2m_attr *lwm2m_engine_get_next_attr(const void *ref, struct lwm2m_attr *prev)
|
||||
{
|
||||
struct lwm2m_attr *iter = (prev == NULL) ? write_attr_pool : prev + 1;
|
||||
|
@ -1393,19 +1365,6 @@ bool lwm2m_path_is_observed(const struct lwm2m_obj_path *path)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool lwm2m_engine_path_is_observed(const char *pathstr)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return lwm2m_path_is_observed(&path);
|
||||
}
|
||||
|
||||
int lwm2m_engine_observation_handler(struct lwm2m_message *msg, int observe, uint16_t accept,
|
||||
bool composite)
|
||||
{
|
||||
|
|
|
@ -336,22 +336,6 @@ int lwm2m_create_object_inst(const struct lwm2m_obj_path *path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_create_obj_inst(const char *pathstr)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
LOG_DBG("path:%s", pathstr);
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_create_object_inst(&path);
|
||||
}
|
||||
|
||||
int lwm2m_delete_object_inst(const struct lwm2m_obj_path *path)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -371,22 +355,6 @@ int lwm2m_delete_object_inst(const struct lwm2m_obj_path *path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_delete_obj_inst(const char *pathstr)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
LOG_DBG("path: %s", pathstr);
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_delete_object_inst(&path);
|
||||
}
|
||||
|
||||
struct lwm2m_engine_obj_inst *lwm2m_engine_get_obj_inst(const struct lwm2m_obj_path *path)
|
||||
{
|
||||
if (path->level < LWM2M_PATH_LEVEL_OBJECT_INST) {
|
||||
|
@ -524,36 +492,6 @@ int lwm2m_set_res_buf(const struct lwm2m_obj_path *path, void *buffer_ptr, uint1
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_res_buf(const char *pathstr, void *buffer_ptr, uint16_t buffer_len,
|
||||
uint16_t data_len, uint8_t data_flags)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_set_res_buf(&path, buffer_ptr, buffer_len, data_len, data_flags);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_res_data(const char *pathstr, void *data_ptr, uint16_t data_len,
|
||||
uint8_t data_flags)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_set_res_buf(&path, data_ptr, data_len, data_len, data_flags);
|
||||
}
|
||||
|
||||
static bool lwm2m_validate_time_resource_lenghts(uint16_t resource_length, uint16_t buf_length)
|
||||
{
|
||||
if (resource_length != sizeof(time_t) && resource_length != sizeof(uint32_t)) {
|
||||
|
@ -789,18 +727,6 @@ int lwm2m_set_opaque(const struct lwm2m_obj_path *path, const char *data_ptr, ui
|
|||
return lwm2m_engine_set(path, data_ptr, data_len);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_opaque(const char *pathstr, const char *data_ptr, uint16_t data_len)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_opaque(&path, data_ptr, data_len);
|
||||
}
|
||||
|
||||
int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr)
|
||||
{
|
||||
uint16_t len = strlen(data_ptr);
|
||||
|
@ -813,155 +739,47 @@ int lwm2m_set_string(const struct lwm2m_obj_path *path, const char *data_ptr)
|
|||
return lwm2m_engine_set(path, data_ptr, len);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_string(const char *pathstr, const char *data_ptr)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_string(&path, data_ptr);
|
||||
}
|
||||
|
||||
int lwm2m_set_u8(const struct lwm2m_obj_path *path, uint8_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 1);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_u8(const char *pathstr, uint8_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_u8(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_u16(const struct lwm2m_obj_path *path, uint16_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 2);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_u16(const char *pathstr, uint16_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_u16(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_u32(const struct lwm2m_obj_path *path, uint32_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 4);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_u32(const char *pathstr, uint32_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_u32(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_u64(const struct lwm2m_obj_path *path, uint64_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 8);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_u64(const char *pathstr, uint64_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_s64(&path, (int64_t) value);
|
||||
}
|
||||
|
||||
int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 1);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_s8(const char *pathstr, int8_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_s8(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_s16(const struct lwm2m_obj_path *path, int16_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 2);
|
||||
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_s16(const char *pathstr, int16_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_s16(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_s32(const struct lwm2m_obj_path *path, int32_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 4);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_s32(const char *pathstr, int32_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_s32(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_s64(const struct lwm2m_obj_path *path, int64_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, 8);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_s64(const char *pathstr, int64_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_s64(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_bool(const struct lwm2m_obj_path *path, bool value)
|
||||
{
|
||||
uint8_t temp = (value != 0 ? 1 : 0);
|
||||
|
@ -969,69 +787,21 @@ int lwm2m_set_bool(const struct lwm2m_obj_path *path, bool value)
|
|||
return lwm2m_engine_set(path, &temp, 1);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_bool(const char *pathstr, bool value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_bool(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_f64(const struct lwm2m_obj_path *path, const double value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, sizeof(double));
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_float(const char *pathstr, const double *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_f64(&path, *value);
|
||||
}
|
||||
|
||||
int lwm2m_set_objlnk(const struct lwm2m_obj_path *path, const struct lwm2m_objlnk *value)
|
||||
{
|
||||
return lwm2m_engine_set(path, value, sizeof(struct lwm2m_objlnk));
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_objlnk(const char *pathstr, const struct lwm2m_objlnk *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_objlnk(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_time(const struct lwm2m_obj_path *path, time_t value)
|
||||
{
|
||||
return lwm2m_engine_set(path, &value, sizeof(time_t));
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_time(const char *pathstr, time_t value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_set_time(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1046,20 +816,6 @@ int lwm2m_set_res_data_len(const struct lwm2m_obj_path *path, uint16_t data_len)
|
|||
}
|
||||
return lwm2m_set_res_buf(path, buffer_ptr, buffer_len, data_len, data_flags);
|
||||
}
|
||||
|
||||
int lwm2m_engine_set_res_data_len(const char *pathstr, uint16_t data_len)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_set_res_data_len(&path, data_len);
|
||||
}
|
||||
/* User data getter functions */
|
||||
|
||||
int lwm2m_get_res_buf(const struct lwm2m_obj_path *path, void **buffer_ptr, uint16_t *buffer_len,
|
||||
|
@ -1104,36 +860,6 @@ int lwm2m_get_res_buf(const struct lwm2m_obj_path *path, void **buffer_ptr, uint
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_res_buf(const char *pathstr, void **buffer_ptr, uint16_t *buffer_len,
|
||||
uint16_t *data_len, uint8_t *data_flags)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_get_res_buf(&path, buffer_ptr, buffer_len, data_len, data_flags);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_res_data(const char *pathstr, void **data_ptr, uint16_t *data_len,
|
||||
uint8_t *data_flags)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_get_res_buf(&path, data_ptr, NULL, data_len, data_flags);
|
||||
}
|
||||
|
||||
static int lwm2m_engine_get(const struct lwm2m_obj_path *path, void *buf, uint16_t buflen)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -1278,18 +1004,6 @@ int lwm2m_get_opaque(const struct lwm2m_obj_path *path, void *buf, uint16_t bufl
|
|||
return lwm2m_engine_get(path, buf, buflen);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_opaque(const char *pathstr, void *buf, uint16_t buflen)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_opaque(&path, buf, buflen);
|
||||
}
|
||||
|
||||
int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t buflen)
|
||||
{
|
||||
/* Ensure termination, in case resource is not a string type */
|
||||
|
@ -1301,154 +1015,46 @@ int lwm2m_get_string(const struct lwm2m_obj_path *path, void *str, uint16_t bufl
|
|||
return lwm2m_engine_get(path, str, buflen);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_string(const char *pathstr, void *str, uint16_t buflen)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_string(&path, str, buflen);
|
||||
}
|
||||
|
||||
int lwm2m_get_u8(const struct lwm2m_obj_path *path, uint8_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 1);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_u8(const char *pathstr, uint8_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_u8(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_u16(const struct lwm2m_obj_path *path, uint16_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 2);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_u16(const char *pathstr, uint16_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_u16(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_u32(const struct lwm2m_obj_path *path, uint32_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 4);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_u32(const char *pathstr, uint32_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_u32(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_u64(const struct lwm2m_obj_path *path, uint64_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 8);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_u64(const char *pathstr, uint64_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_s64(&path, (int64_t *) value);
|
||||
}
|
||||
|
||||
int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 1);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_s8(const char *pathstr, int8_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_s8(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_s16(const struct lwm2m_obj_path *path, int16_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 2);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_s16(const char *pathstr, int16_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_s16(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_s32(const struct lwm2m_obj_path *path, int32_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 4);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_s32(const char *pathstr, int32_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_s32(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_s64(const struct lwm2m_obj_path *path, int64_t *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, 8);
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_s64(const char *pathstr, int64_t *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_s64(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_bool(const struct lwm2m_obj_path *path, bool *value)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -1462,69 +1068,21 @@ int lwm2m_get_bool(const struct lwm2m_obj_path *path, bool *value)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_bool(const char *pathstr, bool *value)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_bool(&path, value);
|
||||
}
|
||||
|
||||
int lwm2m_get_f64(const struct lwm2m_obj_path *path, double *value)
|
||||
{
|
||||
return lwm2m_engine_get(path, value, sizeof(double));
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_float(const char *pathstr, double *buf)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_f64(&path, buf);
|
||||
}
|
||||
|
||||
int lwm2m_get_objlnk(const struct lwm2m_obj_path *path, struct lwm2m_objlnk *buf)
|
||||
{
|
||||
return lwm2m_engine_get(path, buf, sizeof(struct lwm2m_objlnk));
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_objlnk(const char *pathstr, struct lwm2m_objlnk *buf)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_objlnk(&path, buf);
|
||||
}
|
||||
|
||||
int lwm2m_get_time(const struct lwm2m_obj_path *path, time_t *buf)
|
||||
{
|
||||
return lwm2m_engine_get(path, buf, sizeof(time_t));
|
||||
}
|
||||
|
||||
int lwm2m_engine_get_time(const char *pathstr, time_t *buf)
|
||||
{
|
||||
struct lwm2m_obj_path path;
|
||||
int ret = 0;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
return lwm2m_get_time(&path, buf);
|
||||
}
|
||||
|
||||
int lwm2m_get_resource(const struct lwm2m_obj_path *path, struct lwm2m_engine_res **res)
|
||||
{
|
||||
if (path->level < LWM2M_PATH_LEVEL_RESOURCE) {
|
||||
|
@ -1691,19 +1249,6 @@ int lwm2m_create_res_inst(const struct lwm2m_obj_path *path)
|
|||
return lwm2m_engine_allocate_resource_instance(res, &res_inst, path->res_inst_id);
|
||||
}
|
||||
|
||||
int lwm2m_engine_create_res_inst(const char *pathstr)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_create_res_inst(&path);
|
||||
}
|
||||
|
||||
int lwm2m_delete_res_inst(const struct lwm2m_obj_path *path)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1733,19 +1278,6 @@ int lwm2m_delete_res_inst(const struct lwm2m_obj_path *path)
|
|||
k_mutex_unlock(®istry_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_delete_res_inst(const char *pathstr)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_delete_res_inst(&path);
|
||||
}
|
||||
/* Register callbacks */
|
||||
|
||||
int lwm2m_register_read_callback(const struct lwm2m_obj_path *path, lwm2m_engine_get_data_cb_t cb)
|
||||
|
@ -1762,19 +1294,6 @@ int lwm2m_register_read_callback(const struct lwm2m_obj_path *path, lwm2m_engine
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_read_callback(const char *pathstr, lwm2m_engine_get_data_cb_t cb)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_register_read_callback(&path, cb);
|
||||
}
|
||||
|
||||
int lwm2m_register_pre_write_callback(const struct lwm2m_obj_path *path,
|
||||
lwm2m_engine_get_data_cb_t cb)
|
||||
{
|
||||
|
@ -1790,19 +1309,6 @@ int lwm2m_register_pre_write_callback(const struct lwm2m_obj_path *path,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_pre_write_callback(const char *pathstr, lwm2m_engine_get_data_cb_t cb)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_register_pre_write_callback(&path, cb);
|
||||
}
|
||||
|
||||
int lwm2m_register_validate_callback(const struct lwm2m_obj_path *path,
|
||||
lwm2m_engine_set_data_cb_t cb)
|
||||
{
|
||||
|
@ -1828,29 +1334,6 @@ int lwm2m_register_validate_callback(const struct lwm2m_obj_path *path,
|
|||
#endif /* CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE > 0 */
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_validate_callback(const char *pathstr, lwm2m_engine_set_data_cb_t cb)
|
||||
{
|
||||
#if CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE > 0
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_register_validate_callback(&path, cb);
|
||||
#else
|
||||
ARG_UNUSED(pathstr);
|
||||
ARG_UNUSED(cb);
|
||||
|
||||
LOG_ERR("Validation disabled. Set "
|
||||
"CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE > 0 to "
|
||||
"enable validation support.");
|
||||
return -ENOTSUP;
|
||||
#endif /* CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE > 0 */
|
||||
}
|
||||
|
||||
int lwm2m_register_post_write_callback(const struct lwm2m_obj_path *path,
|
||||
lwm2m_engine_set_data_cb_t cb)
|
||||
{
|
||||
|
@ -1866,19 +1349,6 @@ int lwm2m_register_post_write_callback(const struct lwm2m_obj_path *path,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_post_write_callback(const char *pathstr, lwm2m_engine_set_data_cb_t cb)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_register_post_write_callback(&path, cb);
|
||||
}
|
||||
|
||||
int lwm2m_register_exec_callback(const struct lwm2m_obj_path *path, lwm2m_engine_execute_cb_t cb)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1893,19 +1363,6 @@ int lwm2m_register_exec_callback(const struct lwm2m_obj_path *path, lwm2m_engine
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_exec_callback(const char *pathstr, lwm2m_engine_execute_cb_t cb)
|
||||
{
|
||||
int ret;
|
||||
struct lwm2m_obj_path path;
|
||||
|
||||
ret = lwm2m_string_to_path(pathstr, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return lwm2m_register_exec_callback(&path, cb);
|
||||
}
|
||||
|
||||
int lwm2m_register_create_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
||||
{
|
||||
struct lwm2m_engine_obj *obj = NULL;
|
||||
|
@ -1920,11 +1377,6 @@ int lwm2m_register_create_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_create_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
||||
{
|
||||
return lwm2m_register_create_callback(obj_id, cb);
|
||||
}
|
||||
|
||||
int lwm2m_register_delete_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
||||
{
|
||||
struct lwm2m_engine_obj *obj = NULL;
|
||||
|
@ -1938,11 +1390,6 @@ int lwm2m_register_delete_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
|||
obj->user_delete_cb = cb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lwm2m_engine_register_delete_callback(uint16_t obj_id, lwm2m_engine_user_cb_t cb)
|
||||
{
|
||||
return lwm2m_register_delete_callback(obj_id, cb);
|
||||
}
|
||||
/* Generic data handlers */
|
||||
|
||||
int lwm2m_get_or_create_engine_obj(struct lwm2m_message *msg,
|
||||
|
@ -2212,32 +1659,6 @@ int lwm2m_enable_cache(const struct lwm2m_obj_path *path, struct lwm2m_time_seri
|
|||
#endif /* CONFIG_LWM2M_RESOURCE_DATA_CACHE_SUPPORT */
|
||||
}
|
||||
|
||||
int lwm2m_engine_enable_cache(const char *resource_path, struct lwm2m_time_series_elem *data_cache,
|
||||
size_t cache_len)
|
||||
{
|
||||
#if defined(CONFIG_LWM2M_RESOURCE_DATA_CACHE_SUPPORT)
|
||||
struct lwm2m_obj_path path;
|
||||
int ret;
|
||||
|
||||
/* translate path -> path_obj */
|
||||
ret = lwm2m_string_to_path(resource_path, &path, '/');
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (path.level < LWM2M_PATH_LEVEL_RESOURCE) {
|
||||
LOG_ERR("path must have at least 3 parts");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return lwm2m_enable_cache(&path, data_cache, cache_len);
|
||||
#else
|
||||
LOG_ERR("LwM2M resource cache is only supported for "
|
||||
"CONFIG_LWM2M_RESOURCE_DATA_CACHE_SUPPORT");
|
||||
return -ENOTSUP;
|
||||
#endif /* CONFIG_LWM2M_RESOURCE_DATA_CACHE_SUPPORT */
|
||||
}
|
||||
|
||||
#if defined(CONFIG_LWM2M_RESOURCE_DATA_CACHE_SUPPORT)
|
||||
static int lwm2m_engine_data_cache_init(void)
|
||||
{
|
||||
|
|
|
@ -410,110 +410,6 @@ ZTEST(lwm2m_registry, test_strings)
|
|||
zassert_equal(ret, -ENOMEM);
|
||||
}
|
||||
|
||||
#if CONFIG_TEST_DEPRECATED
|
||||
/* Don't test deprecated functions on Twister builds */
|
||||
ZTEST(lwm2m_registry, test_deprecated_functions)
|
||||
{
|
||||
bool b = true;
|
||||
uint8_t opaque[] = {0xde, 0xad, 0xbe, 0xff, 0, 0};
|
||||
char string[] = "Hello";
|
||||
uint8_t u8 = 8;
|
||||
int8_t s8 = -8;
|
||||
uint16_t u16 = 16;
|
||||
int16_t s16 = -16;
|
||||
uint32_t u32 = 32;
|
||||
int32_t s32 = -32;
|
||||
int64_t s64 = -64;
|
||||
time_t t = 1687949519;
|
||||
double d = 3.1415;
|
||||
double d2;
|
||||
struct lwm2m_objlnk objl = {.obj_id = 1, .obj_inst = 2};
|
||||
uint16_t l = sizeof(opaque);
|
||||
|
||||
zassert_equal(lwm2m_engine_set_bool("32768/0/" STRINGIFY(LWM2M_RES_TYPE_BOOL), b), 0);
|
||||
zassert_equal(
|
||||
lwm2m_engine_set_opaque("32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), opaque, l), 0);
|
||||
zassert_equal(lwm2m_engine_set_string("32768/0/" STRINGIFY(LWM2M_RES_TYPE_STRING), string),
|
||||
0);
|
||||
zassert_equal(lwm2m_engine_set_u8("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U8), u8), 0);
|
||||
zassert_equal(lwm2m_engine_set_s8("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S8), s8), 0);
|
||||
zassert_equal(lwm2m_engine_set_u16("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U16), u16), 0);
|
||||
zassert_equal(lwm2m_engine_set_s16("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S16), s16), 0);
|
||||
zassert_equal(lwm2m_engine_set_u32("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U32), u32), 0);
|
||||
zassert_equal(lwm2m_engine_set_s32("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S32), s32), 0);
|
||||
zassert_equal(lwm2m_engine_set_s64("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S64), s64), 0);
|
||||
zassert_equal(lwm2m_engine_set_time("32768/0/" STRINGIFY(LWM2M_RES_TYPE_TIME), t), 0);
|
||||
zassert_equal(lwm2m_engine_set_float("32768/0/" STRINGIFY(LWM2M_RES_TYPE_FLOAT), &d), 0);
|
||||
zassert_equal(lwm2m_engine_set_objlnk("32768/0/" STRINGIFY(LWM2M_RES_TYPE_OBJLNK), &objl),
|
||||
0);
|
||||
zassert_equal(lwm2m_engine_get_bool("32768/0/" STRINGIFY(LWM2M_RES_TYPE_BOOL), &b), 0);
|
||||
zassert_equal(lwm2m_engine_get_opaque(
|
||||
"32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), &opaque, l), 0);
|
||||
zassert_equal(lwm2m_engine_get_string(
|
||||
"32768/0/" STRINGIFY(LWM2M_RES_TYPE_STRING), &string, l), 0);
|
||||
zassert_equal(lwm2m_engine_get_u8("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U8), &u8), 0);
|
||||
zassert_equal(lwm2m_engine_get_s8("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S8), &s8), 0);
|
||||
zassert_equal(lwm2m_engine_get_u16("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U16), &u16), 0);
|
||||
zassert_equal(lwm2m_engine_get_s16("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S16), &s16), 0);
|
||||
zassert_equal(lwm2m_engine_get_u32("32768/0/" STRINGIFY(LWM2M_RES_TYPE_U32), &u32), 0);
|
||||
zassert_equal(lwm2m_engine_get_s32("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S32), &s32), 0);
|
||||
zassert_equal(lwm2m_engine_get_s64("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S64), &s64), 0);
|
||||
zassert_equal(lwm2m_engine_get_time("32768/0/" STRINGIFY(LWM2M_RES_TYPE_TIME), &t), 0);
|
||||
zassert_equal(lwm2m_engine_get_float("32768/0/" STRINGIFY(LWM2M_RES_TYPE_FLOAT), &d2), 0);
|
||||
zassert_equal(lwm2m_engine_get_objlnk("32768/0/" STRINGIFY(LWM2M_RES_TYPE_OBJLNK), &objl),
|
||||
0);
|
||||
|
||||
zassert_equal(b, true);
|
||||
zassert_equal(memcmp(opaque, &(uint8_t[6]) {0xde, 0xad, 0xbe, 0xff, 0, 0}, l), 0);
|
||||
zassert_str_equal(string, "Hello");
|
||||
zassert_equal(u8, 8);
|
||||
zassert_equal(s8, -8);
|
||||
zassert_equal(u16, 16);
|
||||
zassert_equal(s16, -16);
|
||||
zassert_equal(u32, 32);
|
||||
zassert_equal(s32, -32);
|
||||
zassert_equal(s64, -64);
|
||||
zassert_equal(t, 1687949519);
|
||||
zassert_equal(d, d2);
|
||||
zassert_equal(
|
||||
memcmp(&objl, &(struct lwm2m_objlnk){.obj_id = 1, .obj_inst = 2}, sizeof(objl)), 0);
|
||||
|
||||
uint64_t u64 = 0xc0ffee;
|
||||
|
||||
zassert_equal(lwm2m_engine_set_u64("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S64), u64), 0);
|
||||
zassert_equal(lwm2m_engine_get_u64("32768/0/" STRINGIFY(LWM2M_RES_TYPE_S64), &u64), 0);
|
||||
zassert_equal(u64, 0xc0ffee);
|
||||
|
||||
zassert_equal(lwm2m_engine_create_obj_inst("32768/1"), -ENOMEM);
|
||||
zassert_equal(lwm2m_engine_delete_obj_inst("32768/1"), -ENOENT);
|
||||
|
||||
void *o_ptr;
|
||||
uint16_t o_len;
|
||||
|
||||
lwm2m_get_res_buf(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_OPAQUE), &o_ptr, &o_len, NULL, NULL);
|
||||
|
||||
zassert_equal(lwm2m_engine_set_res_buf(
|
||||
"32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), opaque, sizeof(opaque), 6, 0), 0);
|
||||
void *p;
|
||||
uint16_t len;
|
||||
|
||||
zassert_equal(lwm2m_engine_get_res_buf(
|
||||
"32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), &p, NULL, &len, NULL), 0);
|
||||
zassert_true(p == opaque);
|
||||
zassert_equal(len, 6);
|
||||
|
||||
zassert_equal(lwm2m_engine_set_res_data(
|
||||
"32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), string, sizeof(string), 0), 0);
|
||||
lwm2m_engine_get_res_data("32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), &p, &len, NULL);
|
||||
zassert_true(p == string);
|
||||
zassert_equal(len, sizeof(string));
|
||||
zassert_equal(lwm2m_engine_set_res_data_len("32768/0/" STRINGIFY(LWM2M_RES_TYPE_OPAQUE), 0),
|
||||
0);
|
||||
|
||||
lwm2m_set_res_buf(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_OPAQUE), o_ptr, o_len, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
ZTEST(lwm2m_registry, test_lock_unlock)
|
||||
{
|
||||
/* Should be recursive mutex and should not block */
|
||||
|
@ -619,8 +515,6 @@ ZTEST(lwm2m_registry, test_resource_cache)
|
|||
/* Resource cache is turned off */
|
||||
zassert_is_null(lwm2m_cache_entry_get_by_object(&path));
|
||||
zassert_equal(lwm2m_enable_cache(&path, &e, 1), -ENOTSUP);
|
||||
/* deprecated */
|
||||
/* zassert_equal(lwm2m_engine_enable_cache("32768/0/1", &e, 1), -ENOTSUP); */
|
||||
zassert_false(lwm2m_cache_write(NULL, NULL));
|
||||
zassert_false(lwm2m_cache_read(NULL, NULL));
|
||||
zassert_equal(lwm2m_cache_size(NULL), 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue