lwm2m_senml_cbor: Regenerate code files using zcbor 0.7.0

and the _regenerate.sh script.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
This commit is contained in:
Øyvind Rønningstad 2023-04-14 12:54:25 +02:00 committed by Carles Cufí
parent e9eb61bd14
commit d0c278af78
5 changed files with 114 additions and 101 deletions

View file

@ -2,9 +2,8 @@
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
*
* Generated using zcbor version 0.7.0
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/

View file

@ -2,9 +2,8 @@
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
*
* Generated using zcbor version 0.7.0
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -16,10 +15,17 @@
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "zcbor_decode.h"
#include "lwm2m_senml_cbor_types.h"
#ifdef __cplusplus
extern "C" {
#endif
int cbor_decode_lwm2m_senml(const uint8_t *payload, size_t payload_len, struct lwm2m_senml *result,
size_t *payload_len_out);
#ifdef __cplusplus
}
#endif
#endif /* LWM2M_SENML_CBOR_DECODE_H__ */

View file

@ -2,9 +2,8 @@
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
*
* Generated using zcbor version 0.7.0
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -15,7 +14,6 @@
#include <string.h>
#include "zcbor_encode.h"
#include "lwm2m_senml_cbor_encode.h"
#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);
@ -103,37 +101,37 @@ static bool encode_repeated_record_union(zcbor_state_t *state, const struct reco
((*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();
@ -151,22 +149,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 >= 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)))))));
: (((*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,33 +205,31 @@ 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,
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))));
bool tmp_result = ((
(zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair)) &&
((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)))));
if (!tmp_result) {
zcbor_trace();

View file

@ -2,9 +2,8 @@
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
*
* Generated using zcbor version 0.7.0
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -16,10 +15,17 @@
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "zcbor_encode.h"
#include "lwm2m_senml_cbor_types.h"
#ifdef __cplusplus
extern "C" {
#endif
int cbor_encode_lwm2m_senml(uint8_t *payload, size_t payload_len, const struct lwm2m_senml *input,
size_t *payload_len_out);
#ifdef __cplusplus
}
#endif
#endif /* LWM2M_SENML_CBOR_ENCODE_H__ */

View file

@ -2,9 +2,8 @@
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Generated using zcbor version 0.6.0
*
* Generated using zcbor version 0.7.0
* https://github.com/zephyrproject-rtos/zcbor
* Generated with a --default-max-qty of 99
*/
@ -15,8 +14,11 @@
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "zcbor_common.h"
#include <zcbor_common.h>
#ifdef __cplusplus
extern "C" {
#endif
enum lwm2m_senml_cbor_key {
lwm2m_senml_cbor_key_bn = -2,
@ -114,22 +116,26 @@ struct record__key_value_pair {
struct record {
struct record_bn _record_bn;
uint_fast32_t _record_bn_present;
bool _record_bn_present;
struct record_bt _record_bt;
uint_fast32_t _record_bt_present;
bool _record_bt_present;
struct record_n _record_n;
uint_fast32_t _record_n_present;
bool _record_n_present;
struct record_t _record_t;
uint_fast32_t _record_t_present;
bool _record_t_present;
struct record_union_ _record_union;
uint_fast32_t _record_union_present;
bool _record_union_present;
struct record__key_value_pair _record__key_value_pair[5];
uint_fast32_t _record__key_value_pair_count;
size_t _record__key_value_pair_count;
};
struct lwm2m_senml {
struct record _lwm2m_senml__record[DEFAULT_MAX_QTY];
uint_fast32_t _lwm2m_senml__record_count;
size_t _lwm2m_senml__record_count;
};
#ifdef __cplusplus
}
#endif
#endif /* LWM2M_SENML_CBOR_TYPES_H__ */