net: lib: LwM2M SenML-Cbor regenrated files update

Patched and fixed regenerated code.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
This commit is contained in:
Juha Heiskanen 2023-01-03 17:43:00 +02:00 committed by Carles Cufí
parent 637c9bbf95
commit d939c79af1
5 changed files with 164 additions and 137 deletions

View file

@ -1,6 +1,11 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
* https://github.com/NordicSemiconductor/zcbor
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -11,10 +16,6 @@
#include "zcbor_decode.h"
#include "lwm2m_senml_cbor_decode.h"
#if DEFAULT_MAX_QTY != 99
#error "The type file was generated with a different default_max_qty than this file"
#endif
static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result);
static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result);
static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result);
@ -45,11 +46,11 @@ static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *re
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) &&
(zcbor_int64_decode(state, (&(*result)._record_bt))) &&
((((*result)._record_bt >= -9223372036854775807LL) &&
((*result)._record_bt <= 9223372036854775807LL)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))));
bool tmp_result =
((((zcbor_int32_expect(state, (-3)))) &&
(zcbor_int64_decode(state, (&(*result)._record_bt))) &&
((((*result)._record_bt >= INT64_MIN) && ((*result)._record_bt <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))));
if (!tmp_result) {
zcbor_trace();
@ -76,11 +77,11 @@ static bool decode_repeated_record_t(zcbor_state_t *state, struct record_t *resu
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) &&
(zcbor_int64_decode(state, (&(*result)._record_t))) &&
((((*result)._record_t >= -9223372036854775807LL) &&
((*result)._record_t <= 9223372036854775807LL)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))));
bool tmp_result =
((((zcbor_uint32_expect(state, (6)))) &&
(zcbor_int64_decode(state, (&(*result)._record_t))) &&
((((*result)._record_t >= INT64_MIN) && ((*result)._record_t <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))));
if (!tmp_result) {
zcbor_trace();
@ -99,8 +100,8 @@ static bool decode_repeated_record_union(zcbor_state_t *state, struct record_uni
(((zcbor_union_start_code(state) &&
(int_res = (((((zcbor_uint32_expect_union(state, (2)))) &&
(zcbor_int64_decode(state, (&(*result)._union_vi))) &&
((((*result)._union_vi >= -9223372036854775807LL) &&
((*result)._union_vi <= 9223372036854775807LL)) ||
((((*result)._union_vi >= INT64_MIN) &&
((*result)._union_vi <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) &&
(((*result)._record_union_choice = _union_vi), true)) ||
((((zcbor_uint32_expect_union(state, (2)))) &&
@ -142,8 +143,8 @@ static bool decode_value(zcbor_state_t *state, struct value_ *result)
(((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) &&
(((*result)._value_choice = _value_bstr), true)) ||
(((zcbor_int64_decode(state, (&(*result)._value_int))) &&
((((*result)._value_int >= -9223372036854775807LL) &&
((*result)._value_int <= 9223372036854775807LL)) ||
((((*result)._value_int >= INT64_MIN) &&
((*result)._value_int <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) &&
(((*result)._value_choice = _value_int), true)) ||
(((zcbor_float_decode(state, (&(*result)._value_float)))) &&
@ -208,7 +209,8 @@ static bool decode_record(zcbor_state_t *state, struct record *result)
zcbor_present_decode(&((*result)._record_union_present),
(zcbor_decoder_t *)decode_repeated_record_union, state,
(&(*result)._record_union)) &&
zcbor_multi_decode(0, 5, &(*result)._record__key_value_pair_count,
zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->_record__key_value_pair),
&(*result)._record__key_value_pair_count,
(zcbor_decoder_t *)decode_repeated_record__key_value_pair,
state, (&(*result)._record__key_value_pair),
sizeof(struct record__key_value_pair))) ||
@ -226,13 +228,14 @@ static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result)
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = ((
(zcbor_list_start_decode(state) &&
((zcbor_multi_decode(1, 99, &(*result)._lwm2m_senml__record_count,
(zcbor_decoder_t *)decode_record, state,
(&(*result)._lwm2m_senml__record), sizeof(struct record))) ||
(zcbor_list_map_end_force_decode(state), false)) &&
zcbor_list_end_decode(state))));
bool tmp_result =
(((zcbor_list_start_decode(state) &&
((zcbor_multi_decode(
1, ZCBOR_ARRAY_SIZE(result->_lwm2m_senml__record),
&(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record,
state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) ||
(zcbor_list_map_end_force_decode(state), false)) &&
zcbor_list_end_decode(state))));
if (!tmp_result) {
zcbor_trace();

View file

@ -1,6 +1,11 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
* https://github.com/NordicSemiconductor/zcbor
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -14,10 +19,6 @@
#include "zcbor_decode.h"
#include "lwm2m_senml_cbor_types.h"
#if DEFAULT_MAX_QTY != 99
#error "The type file was generated with a different default_max_qty than this file"
#endif
int cbor_decode_lwm2m_senml(const uint8_t *payload, size_t payload_len, struct lwm2m_senml *result,
size_t *payload_len_out);

View file

@ -1,6 +1,11 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
* https://github.com/NordicSemiconductor/zcbor
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -10,10 +15,7 @@
#include <string.h>
#include "zcbor_encode.h"
#include "lwm2m_senml_cbor_encode.h"
#if DEFAULT_MAX_QTY != 99
#error "The type file was generated with a different default_max_qty than this file"
#endif
#include "lwm2m_senml_cbor_types.h"
static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input);
static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input);
@ -45,11 +47,11 @@ static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = ((((zcbor_int32_put(state, (-3)))) &&
((((*input)._record_bt >= -9223372036854775807LL) &&
((*input)._record_bt <= 9223372036854775807LL)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._record_bt)))));
bool tmp_result =
((((zcbor_int32_put(state, (-3)))) &&
((((*input)._record_bt >= INT64_MIN) && ((*input)._record_bt <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._record_bt)))));
if (!tmp_result) {
zcbor_trace();
@ -76,11 +78,11 @@ static bool encode_repeated_record_t(zcbor_state_t *state, const struct record_t
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = ((((zcbor_uint32_put(state, (6)))) &&
((((*input)._record_t >= -9223372036854775807LL) &&
((*input)._record_t <= 9223372036854775807LL)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._record_t)))));
bool tmp_result =
((((zcbor_uint32_put(state, (6)))) &&
((((*input)._record_t >= INT64_MIN) && ((*input)._record_t <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._record_t)))));
if (!tmp_result) {
zcbor_trace();
@ -97,41 +99,41 @@ static bool encode_repeated_record_union(zcbor_state_t *state, const struct reco
bool tmp_result = (((
((*input)._record_union_choice == _union_vi)
? (((zcbor_uint32_put(state, (2)))) &&
((((*input)._union_vi >= -9223372036854775807LL) &&
((*input)._union_vi <= 9223372036854775807LL)) ||
((((*input)._union_vi >= INT64_MIN) &&
((*input)._union_vi <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._union_vi))))
: (((*input)._record_union_choice == _union_vf)
? (((zcbor_uint32_put(state, (2)))) &&
(zcbor_float64_encode(state, (&(*input)._union_vf))))
: (((*input)._record_union_choice == _union_vs)
? (((zcbor_uint32_put(state, (3)))) &&
(zcbor_tstr_encode(state, (&(*input)._union_vs))))
: (((*input)._record_union_choice == _union_vb)
? (((zcbor_uint32_put(state, (4)))) &&
(zcbor_bool_encode(
state, (&(*input)._union_vb))))
: (((*input)._record_union_choice ==
_union_vd)
? (((zcbor_uint32_put(state,
(8)))) &&
(zcbor_bstr_encode(
state,
(&(*input)._union_vd))))
: (((*input)._record_union_choice ==
_union_vlo)
? (((zcbor_tstr_encode(
state,
((tmp_str.value =
(uint8_t *)"vlo",
tmp_str.len =
sizeof("vlo") -
1,
&tmp_str))))) &&
(zcbor_tstr_encode(
state,
(&(*input)._union_vlo))))
: false))))))));
: (((*input)._record_union_choice == _union_vf)
? (((zcbor_uint32_put(state, (2)))) &&
(zcbor_float64_encode(state, (&(*input)._union_vf))))
: (((*input)._record_union_choice == _union_vs)
? (((zcbor_uint32_put(state, (3)))) &&
(zcbor_tstr_encode(state, (&(*input)._union_vs))))
: (((*input)._record_union_choice == _union_vb)
? (((zcbor_uint32_put(state, (4)))) &&
(zcbor_bool_encode(
state, (&(*input)._union_vb))))
: (((*input)._record_union_choice ==
_union_vd)
? (((zcbor_uint32_put(state,
(8)))) &&
(zcbor_bstr_encode(
state,
(&(*input)._union_vd))))
: (((*input)._record_union_choice ==
_union_vlo)
? (((zcbor_tstr_encode(
state,
((tmp_str.value =
(uint8_t *)"vlo",
tmp_str.len =
sizeof("vlo") -
1,
&tmp_str))))) &&
(zcbor_tstr_encode(
state,
(&(*input)._union_vlo))))
: false))))))));
if (!tmp_result) {
zcbor_trace();
@ -149,24 +151,22 @@ static bool encode_value(zcbor_state_t *state, const struct value_ *input)
? ((zcbor_tstr_encode(state, (&(*input)._value_tstr))))
: (((*input)._value_choice == _value_bstr)
? ((zcbor_bstr_encode(state, (&(*input)._value_bstr))))
: (((*input)._value_choice == _value_int)
? (((((*input)._value_int >=
-9223372036854775807LL) &&
((*input)._value_int <=
9223372036854775807LL)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE),
false)) &&
(zcbor_int64_encode(state,
(&(*input)._value_int))))
: (((*input)._value_choice == _value_float)
? ((zcbor_float64_encode(
state,
(&(*input)._value_float))))
: (((*input)._value_choice == _value_bool)
? ((zcbor_bool_encode(
state,
(&(*input)._value_bool))))
: false)))))));
: (((*input)._value_choice == _value_int)
? (((((*input)._value_int >= INT64_MIN) &&
((*input)._value_int <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE),
false)) &&
(zcbor_int64_encode(state,
(&(*input)._value_int))))
: (((*input)._value_choice == _value_float)
? ((zcbor_float64_encode(
state,
(&(*input)._value_float))))
: (((*input)._value_choice == _value_bool)
? ((zcbor_bool_encode(
state,
(&(*input)._value_bool))))
: false)))))));
if (!tmp_result) {
zcbor_trace();
@ -207,29 +207,33 @@ static bool encode_record(zcbor_state_t *state, const struct record *input)
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = (((zcbor_map_start_encode(state, 10) &&
((zcbor_present_encode(&((*input)._record_bn_present),
(zcbor_encoder_t *)encode_repeated_record_bn,
state, (&(*input)._record_bn)) &&
zcbor_present_encode(&((*input)._record_bt_present),
(zcbor_encoder_t *)encode_repeated_record_bt,
state, (&(*input)._record_bt)) &&
zcbor_present_encode(&((*input)._record_n_present),
(zcbor_encoder_t *)encode_repeated_record_n,
state, (&(*input)._record_n)) &&
zcbor_present_encode(&((*input)._record_t_present),
(zcbor_encoder_t *)encode_repeated_record_t,
state, (&(*input)._record_t)) &&
zcbor_present_encode(&((*input)._record_union_present),
(zcbor_encoder_t *)encode_repeated_record_union,
state, (&(*input)._record_union)) &&
zcbor_multi_encode_minmax(
0, 5, &(*input)._record__key_value_pair_count,
(zcbor_encoder_t *)encode_repeated_record__key_value_pair,
state, (&(*input)._record__key_value_pair),
sizeof(struct record__key_value_pair))) ||
(zcbor_list_map_end_force_encode(state), false)) &&
zcbor_map_end_encode(state, 10))));
bool tmp_result =
(((zcbor_map_start_encode(state,
ZCBOR_ARRAY_SIZE(input->_record__key_value_pair) + 5) &&
((zcbor_present_encode(&((*input)._record_bn_present),
(zcbor_encoder_t *)encode_repeated_record_bn, state,
(&(*input)._record_bn)) &&
zcbor_present_encode(&((*input)._record_bt_present),
(zcbor_encoder_t *)encode_repeated_record_bt, state,
(&(*input)._record_bt)) &&
zcbor_present_encode(&((*input)._record_n_present),
(zcbor_encoder_t *)encode_repeated_record_n, state,
(&(*input)._record_n)) &&
zcbor_present_encode(&((*input)._record_t_present),
(zcbor_encoder_t *)encode_repeated_record_t, state,
(&(*input)._record_t)) &&
zcbor_present_encode(&((*input)._record_union_present),
(zcbor_encoder_t *)encode_repeated_record_union, state,
(&(*input)._record_union)) &&
zcbor_multi_encode_minmax(
0, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair),
&(*input)._record__key_value_pair_count,
(zcbor_encoder_t *)encode_repeated_record__key_value_pair, state,
(&(*input)._record__key_value_pair),
sizeof(struct record__key_value_pair))) ||
(zcbor_list_map_end_force_encode(state), false)) &&
zcbor_map_end_encode(state,
ZCBOR_ARRAY_SIZE(input->_record__key_value_pair) + 5))));
if (!tmp_result) {
zcbor_trace();
@ -242,13 +246,14 @@ static bool encode_lwm2m_senml(zcbor_state_t *state, const struct lwm2m_senml *i
{
zcbor_print("%s\r\n", __func__);
bool tmp_result = (((zcbor_list_start_encode(state, 99) &&
((zcbor_multi_encode_minmax(
1, 99, &(*input)._lwm2m_senml__record_count,
(zcbor_encoder_t *)encode_record, state,
(&(*input)._lwm2m_senml__record), sizeof(struct record))) ||
(zcbor_list_map_end_force_encode(state), false)) &&
zcbor_list_end_encode(state, 99))));
bool tmp_result =
(((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)) &&
((zcbor_multi_encode_minmax(
1, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record),
&(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record,
state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) ||
(zcbor_list_map_end_force_encode(state), false)) &&
zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)))));
if (!tmp_result) {
zcbor_trace();

View file

@ -1,6 +1,11 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
* https://github.com/NordicSemiconductor/zcbor
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -14,10 +19,6 @@
#include "zcbor_encode.h"
#include "lwm2m_senml_cbor_types.h"
#if DEFAULT_MAX_QTY != 99
#error "The type file was generated with a different default_max_qty than this file"
#endif
int cbor_encode_lwm2m_senml(uint8_t *payload, size_t payload_len, const struct lwm2m_senml *input,
size_t *payload_len_out);

View file

@ -1,6 +1,11 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
* https://github.com/NordicSemiconductor/zcbor
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -11,7 +16,19 @@
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "zcbor_encode.h"
#include "zcbor_common.h"
enum lwm2m_senml_cbor_key {
lwm2m_senml_cbor_key_bn = -2,
lwm2m_senml_cbor_key_bt = -3,
lwm2m_senml_cbor_key_n = 0,
lwm2m_senml_cbor_key_t = 6,
lwm2m_senml_cbor_key_vi = 2,
lwm2m_senml_cbor_key_vf = 2,
lwm2m_senml_cbor_key_vs = 3,
lwm2m_senml_cbor_key_vb = 4,
lwm2m_senml_cbor_key_vd = 8,
};
/** Which value for --default-max-qty this file was created with.
*
@ -20,7 +37,7 @@
*
* See `zcbor --help` for more information about --default-max-qty
*/
#define DEFAULT_MAX_QTY 99
#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS
struct record_bn {
struct zcbor_string _record_bn;
@ -111,7 +128,7 @@ struct record {
};
struct lwm2m_senml {
struct record _lwm2m_senml__record[99];
struct record _lwm2m_senml__record[DEFAULT_MAX_QTY];
uint_fast32_t _lwm2m_senml__record_count;
};