1diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c 2index f97f0ebb2d..1c1233d616 100644 3--- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c 4+++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c 5@@ -4,7 +4,7 @@ 6 * SPDX-License-Identifier: Apache-2.0 7 * 8 * Generated using zcbor version 0.7.0 9- * https://github.com/NordicSemiconductor/zcbor 10+ * https://github.com/zephyrproject-rtos/zcbor 11 * Generated with a --default-max-qty of 99 12 */ 13 14@@ -15,9 +15,6 @@ 15 #include "zcbor_decode.h" 16 #include "lwm2m_senml_cbor_decode.h" 17 18-#if DEFAULT_MAX_QTY != 99 19-#error "The type file was generated with a different default_max_qty than this file" 20-#endif 21 22 static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result); 23 static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result); 24@@ -52,7 +49,7 @@ static bool decode_repeated_record_bt( 25 26 bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) 27 && (zcbor_int64_decode(state, (&(*result)._record_bt))) 28- && ((((*result)._record_bt >= -9223372036854775807LL) 29+ && ((((*result)._record_bt >= INT64_MIN) 30 && ((*result)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); 31 32 if (!tmp_result) 33@@ -82,7 +79,7 @@ static bool decode_repeated_record_t( 34 35 bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) 36 && (zcbor_int64_decode(state, (&(*result)._record_t))) 37- && ((((*result)._record_t >= -9223372036854775807LL) 38+ && ((((*result)._record_t >= INT64_MIN) 39 && ((*result)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); 40 41 if (!tmp_result) 42@@ -100,7 +97,7 @@ static bool decode_repeated_record_union( 43 44 bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (((((zcbor_uint32_expect_union(state, (2)))) 45 && (zcbor_int64_decode(state, (&(*result)._union_vi))) 46- && ((((*result)._union_vi >= -9223372036854775807LL) 47+ && ((((*result)._union_vi >= INT64_MIN) 48 && ((*result)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._record_union_choice = _union_vi), true)) 49 || ((((zcbor_uint32_expect_union(state, (2)))) 50 && (zcbor_float_decode(state, (&(*result)._union_vf)))) && (((*result)._record_union_choice = _union_vf), true)) 51@@ -128,7 +125,7 @@ static bool decode_value( 52 bool tmp_result = (((zcbor_union_start_code(state) && (int_res = ((((zcbor_tstr_decode(state, (&(*result)._value_tstr)))) && (((*result)._value_choice = _value_tstr), true)) 53 || (((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) && (((*result)._value_choice = _value_bstr), true)) 54 || (((zcbor_int64_decode(state, (&(*result)._value_int))) 55- && ((((*result)._value_int >= -9223372036854775807LL) 56+ && ((((*result)._value_int >= INT64_MIN) 57 && ((*result)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._value_choice = _value_int), true)) 58 || (((zcbor_float_decode(state, (&(*result)._value_float)))) && (((*result)._value_choice = _value_float), true)) 59 || (((zcbor_bool_decode(state, (&(*result)._value_bool)))) && (((*result)._value_choice = _value_bool), true))), zcbor_union_end_code(state), int_res)))); 60@@ -176,7 +173,7 @@ static bool decode_record( 61 && zcbor_present_decode(&((*result)._record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, (&(*result)._record_n)) 62 && zcbor_present_decode(&((*result)._record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, (&(*result)._record_t)) 63 && zcbor_present_decode(&((*result)._record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, (&(*result)._record_union)) 64- && zcbor_multi_decode(0, 5, &(*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))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); 65+ && 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))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); 66 67 if (!tmp_result) 68 zcbor_trace(); 69@@ -189,7 +186,7 @@ static bool decode_lwm2m_senml( 70 { 71 zcbor_print("%s\r\n", __func__); 72 73- 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)))); 74+ 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)))); 75 76 if (!tmp_result) 77 zcbor_trace(); 78diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h 79index cb5d5c9695..7db7ed0591 100644 80--- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h 81+++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h 82@@ -4,7 +4,7 @@ 83 * SPDX-License-Identifier: Apache-2.0 84 * 85 * Generated using zcbor version 0.7.0 86- * https://github.com/NordicSemiconductor/zcbor 87+ * https://github.com/zephyrproject-rtos/zcbor 88 * Generated with a --default-max-qty of 99 89 */ 90 91@@ -21,10 +21,6 @@ 92 extern "C" { 93 #endif 94 95-#if DEFAULT_MAX_QTY != 99 96-#error "The type file was generated with a different default_max_qty than this file" 97-#endif 98- 99 100 int cbor_decode_lwm2m_senml( 101 const uint8_t *payload, size_t payload_len, 102diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c 103index 982cfca6c3..afdc6a32f7 100644 104--- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c 105+++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c 106@@ -4,7 +4,7 @@ 107 * SPDX-License-Identifier: Apache-2.0 108 * 109 * Generated using zcbor version 0.7.0 110- * https://github.com/NordicSemiconductor/zcbor 111+ * https://github.com/zephyrproject-rtos/zcbor 112 * Generated with a --default-max-qty of 99 113 */ 114 115@@ -15,10 +15,6 @@ 116 #include "zcbor_encode.h" 117 #include "lwm2m_senml_cbor_encode.h" 118 119-#if DEFAULT_MAX_QTY != 99 120-#error "The type file was generated with a different default_max_qty than this file" 121-#endif 122- 123 static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input); 124 static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input); 125 static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input); 126@@ -51,7 +47,7 @@ static bool encode_repeated_record_bt( 127 zcbor_print("%s\r\n", __func__); 128 129 bool tmp_result = ((((zcbor_int32_put(state, (-3)))) 130- && ((((*input)._record_bt >= -9223372036854775807LL) 131+ && ((((*input)._record_bt >= INT64_MIN) 132 && ((*input)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) 133 && (zcbor_int64_encode(state, (&(*input)._record_bt))))); 134 135@@ -81,7 +77,7 @@ static bool encode_repeated_record_t( 136 zcbor_print("%s\r\n", __func__); 137 138 bool tmp_result = ((((zcbor_uint32_put(state, (6)))) 139- && ((((*input)._record_t >= -9223372036854775807LL) 140+ && ((((*input)._record_t >= INT64_MIN) 141 && ((*input)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) 142 && (zcbor_int64_encode(state, (&(*input)._record_t))))); 143 144@@ -98,7 +94,7 @@ static bool encode_repeated_record_union( 145 struct zcbor_string tmp_str; 146 147 bool tmp_result = (((((*input)._record_union_choice == _union_vi) ? (((zcbor_uint32_put(state, (2)))) 148- && ((((*input)._union_vi >= -9223372036854775807LL) 149+ && ((((*input)._union_vi >= INT64_MIN) 150 && ((*input)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) 151 && (zcbor_int64_encode(state, (&(*input)._union_vi)))) 152 : (((*input)._record_union_choice == _union_vf) ? (((zcbor_uint32_put(state, (2)))) 153@@ -126,7 +122,7 @@ static bool encode_value( 154 155 bool tmp_result = (((((*input)._value_choice == _value_tstr) ? ((zcbor_tstr_encode(state, (&(*input)._value_tstr)))) 156 : (((*input)._value_choice == _value_bstr) ? ((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) 157- : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= -9223372036854775807LL) 158+ : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= INT64_MIN) 159 && ((*input)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) 160 && (zcbor_int64_encode(state, (&(*input)._value_int)))) 161 : (((*input)._value_choice == _value_float) ? ((zcbor_float64_encode(state, (&(*input)._value_float)))) 162@@ -171,12 +167,12 @@ static bool encode_record( 163 { 164 zcbor_print("%s\r\n", __func__); 165 166- 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)) 167+ 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)) 168 && zcbor_present_encode(&((*input)._record_bt_present), (zcbor_encoder_t *)encode_repeated_record_bt, state, (&(*input)._record_bt)) 169 && zcbor_present_encode(&((*input)._record_n_present), (zcbor_encoder_t *)encode_repeated_record_n, state, (&(*input)._record_n)) 170 && zcbor_present_encode(&((*input)._record_t_present), (zcbor_encoder_t *)encode_repeated_record_t, state, (&(*input)._record_t)) 171 && zcbor_present_encode(&((*input)._record_union_present), (zcbor_encoder_t *)encode_repeated_record_union, state, (&(*input)._record_union)) 172- && 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)))); 173+ && 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))))); 174 175 if (!tmp_result) 176 zcbor_trace(); 177@@ -189,7 +185,7 @@ static bool encode_lwm2m_senml( 178 { 179 zcbor_print("%s\r\n", __func__); 180 181- 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)))); 182+ 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))))); 183 184 if (!tmp_result) 185 zcbor_trace(); 186diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h 187index b6c54afde5..cbc32e540c 100644 188--- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h 189+++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h 190@@ -4,7 +4,7 @@ 191 * SPDX-License-Identifier: Apache-2.0 192 * 193 * Generated using zcbor version 0.7.0 194- * https://github.com/NordicSemiconductor/zcbor 195+ * https://github.com/zephyrproject-rtos/zcbor 196 * Generated with a --default-max-qty of 99 197 */ 198 199@@ -21,10 +21,6 @@ 200 extern "C" { 201 #endif 202 203-#if DEFAULT_MAX_QTY != 99 204-#error "The type file was generated with a different default_max_qty than this file" 205-#endif 206- 207 208 int cbor_encode_lwm2m_senml( 209 uint8_t *payload, size_t payload_len, 210diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h 211index e12f33636e..f709086a5c 100644 212--- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h 213+++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h 214@@ -4,7 +4,7 @@ 215 * SPDX-License-Identifier: Apache-2.0 216 * 217 * Generated using zcbor version 0.7.0 218- * https://github.com/NordicSemiconductor/zcbor 219+ * https://github.com/zephyrproject-rtos/zcbor 220 * Generated with a --default-max-qty of 99 221 */ 222 223@@ -20,6 +20,18 @@ 224 extern "C" { 225 #endif 226 227+enum lwm2m_senml_cbor_key { 228+ lwm2m_senml_cbor_key_bn = -2, 229+ lwm2m_senml_cbor_key_bt = -3, 230+ lwm2m_senml_cbor_key_n = 0, 231+ lwm2m_senml_cbor_key_t = 6, 232+ lwm2m_senml_cbor_key_vi = 2, 233+ lwm2m_senml_cbor_key_vf = 2, 234+ lwm2m_senml_cbor_key_vs = 3, 235+ lwm2m_senml_cbor_key_vb = 4, 236+ lwm2m_senml_cbor_key_vd = 8, 237+}; 238+ 239 /** Which value for --default-max-qty this file was created with. 240 * 241 * The define is used in the other generated file to do a build-time 242@@ -27,7 +39,7 @@ extern "C" { 243 * 244 * See `zcbor --help` for more information about --default-max-qty 245 */ 246-#define DEFAULT_MAX_QTY 99 247+#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS 248 249 struct record_bn { 250 struct zcbor_string _record_bn; 251@@ -118,7 +130,7 @@ struct record { 252 }; 253 254 struct lwm2m_senml { 255- struct record _lwm2m_senml__record[99]; 256+ struct record _lwm2m_senml__record[DEFAULT_MAX_QTY]; 257 size_t _lwm2m_senml__record_count; 258 }; 259 260