Commit graph

10 commits

Author SHA1 Message Date
Rick Bruyninckx 39f99d84d2 data: Use designated initializers consistently in macro's
This PR updates the json macros to be consistend with C++20
Signed-off-by: Rick Bruyninckx <xactme@gmail.com>
2024-05-23 07:51:56 -04:00
Bjarki Arge Andreasen ed92612689 data: Add navigation utils header
This commit adds the initial navigation data type and tools
which will lay the foundation to share and process navigation
data between the application and navigation systems like GNSS
and similar triangulation technologies.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bartosz Bilas 9ce202e50c lib: json: add helper macro for named array of array
Variant of JSON_OBJ_DESCR_ARRAY_ARRAY that can be used when the
 structure and JSON field names differ.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-07-26 09:11:16 +02:00
Gerard Marull-Paretas 044530c1be json/jwt: add to utilities Doxygen group
Remove the top-level "structured data" group as in practice it was used
only by JSON APIs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-05 20:21:09 -04:00
Miika Karanki d8166e813b json: add json_calc_encoded_arr_len
Analog to json_obj_encode vs. json_calc_encoded_len which
calculates the object len using json_obj_encode, introduce
json_calc_encoded_arr_len which calculates the length using
json_arr_encode. That is needed when the object to be encoded
is array on the root level.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2023-05-19 19:52:04 +00:00
René Beckmann 4978a651a7 lib: json: Use int32_t in examples
All examples in the header showcase the use of the type int in
structs that values should be parsed into (or serialized out of).
However, that is probably a bad idea if we consider the function
get_elem_size in the JSON library that calculates the field size:

static ptrdiff_t get_elem_size(const struct json_obj_descr *descr)
{
	switch (descr->type) {
	case JSON_TOK_NUMBER:
		return sizeof(int32_t);
	...
}

Hence, using int in structs on platforms where an int is not 32
bits wide (as rare as they may be) is probably a bad idea and will
lead to confusing errors and undefined behavior.

Signed-off-by: René Beckmann <rene.beckmann@grandcentrix.net>
2023-03-30 09:41:46 -04:00
Björn Stenberg 0321ac8dbf json: Increase max number of descriptor elements from 30 to 62
The limiting factor is the output bitmask that says which elements have
been filled in by the parser. This patch changes the bitmask type from int
to int64_t.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2023-01-26 09:51:54 +00:00
Juha Heiskanen ec1c85b385 lib: os: Extend Json library API and type update
New Types:
* Added support for Generic Numeric type (float, 64-bit)
* Added support for Opaque string type.
* Added support parse Array data in object for seprate array parsing
New API for Json Array parsing Object 1 by 1:
* json_arr_separate_object_parse_init() init array parse
* json_arr_separate_parse_object() Parsing 1 Json Object
Rename token and lexer structures and publish those.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-06-06 12:06:43 +02:00
Gerard Marull-Paretas fb9b3bcd93 include: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all includes within
include directory to the new prefix <zephyr/...>. Note that the
conversion has been scripted, refer to zephyrproject-rtos#45388 for more
details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:03:00 +02:00
Yuval Peress 53ef68d459 include: Prefix includes to use a scope
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
  example: <irq.h> -> <zephyr/irq.h>

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-08 19:03:32 +02:00