Astarte device API for Zephyr 0.7.2
Astarte device SDK for Zephyr RTOS
Loading...
Searching...
No Matches
individual.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2024, SECO Mind Srl
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ASTARTE_DEVICE_SDK_INDIVIDUAL_H
8#define ASTARTE_DEVICE_SDK_INDIVIDUAL_H
9
26
28ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_binaryblob_t, void);
29
31typedef struct
32{
34 const void **blobs;
36 size_t *sizes;
38 size_t count;
39} astarte_individual_binaryblobarray_t;
40
42ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_booleanarray_t, bool);
44ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_doublearray_t, double);
46ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_integerarray_t, int32_t);
48ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_longintegerarray_t, int64_t);
50ASTARTE_UTIL_DEFINE_ARRAY(astarte_individual_stringarray_t, const char *);
51
54typedef union
55{
57 astarte_individual_binaryblob_t binaryblob;
59 bool boolean;
61 int64_t datetime;
63 double dbl;
65 int32_t integer;
67 int64_t longinteger;
69 const char *string;
70
72 astarte_individual_binaryblobarray_t binaryblob_array;
74 astarte_individual_booleanarray_t boolean_array;
76 astarte_individual_longintegerarray_t datetime_array;
78 astarte_individual_doublearray_t double_array;
80 astarte_individual_integerarray_t integer_array;
82 astarte_individual_longintegerarray_t longinteger_array;
84 astarte_individual_stringarray_t string_array;
85} astarte_individual_param_t;
86
127typedef struct
128{
130 astarte_individual_param_t data;
134
135#ifdef __cplusplus
136extern "C" {
137#endif
138
189
201 const void **blobs, size_t *sizes, size_t count);
242 int64_t *longinteger_array, size_t len);
250astarte_individual_t astarte_individual_from_string_array(const char **string_array, size_t len);
251
259
269 astarte_individual_t individual, void **binaryblob, size_t *len);
310 astarte_individual_t individual, int64_t *longinteger);
319
330 astarte_individual_t individual, const void ***blobs, size_t **sizes, size_t *count);
340 astarte_individual_t individual, bool **boolean_array, size_t *len);
350 astarte_individual_t individual, int64_t **datetime_array, size_t *len);
360 astarte_individual_t individual, double **double_array, size_t *len);
370 astarte_individual_t individual, int32_t **integer_array, size_t *len);
380 astarte_individual_t individual, int64_t **longinteger_array, size_t *len);
390 astarte_individual_t individual, const char ***string_array, size_t *len);
391
392#ifdef __cplusplus
393}
394#endif
395
400#endif /* ASTARTE_DEVICE_SDK_INDIVIDUAL_H */
Astarte types and defines.
astarte_result_t astarte_individual_to_integer_array(astarte_individual_t individual, int32_t **integer_array, size_t *len)
Convert an Astarte individual (of integer array type) to an int32_t array.
astarte_result_t astarte_individual_to_binaryblob_array(astarte_individual_t individual, const void ***blobs, size_t **sizes, size_t *count)
Convert an Astarte individual (of binaryblob array type) to an array of binaryblob arrays.
astarte_individual_t astarte_individual_from_integer_array(int32_t *integer_array, size_t len)
Initialize an astarte individual from the input integer array.
astarte_individual_t astarte_individual_from_boolean_array(bool *boolean_array, size_t len)
Initialize an astarte individual from the input boolean array.
astarte_individual_t astarte_individual_from_string(const char *string)
Initialize an astarte individual from the input string.
astarte_individual_t astarte_individual_from_string_array(const char **string_array, size_t len)
Initialize an astarte individual from the input string array.
astarte_result_t astarte_individual_to_longinteger_array(astarte_individual_t individual, int64_t **longinteger_array, size_t *len)
Convert an Astarte individual (of longinteger array type) to an int64_t array.
astarte_result_t astarte_individual_to_boolean_array(astarte_individual_t individual, bool **boolean_array, size_t *len)
Convert an Astarte individual (of boolean array type) to a bool array.
astarte_individual_t astarte_individual_from_double(double dbl)
Initialize an astarte individual from the input double.
astarte_individual_t astarte_individual_from_binaryblob(void *binaryblob, size_t len)
Initialize an astarte individual from the input binaryblob.
astarte_result_t astarte_individual_to_string_array(astarte_individual_t individual, const char ***string_array, size_t *len)
Convert an Astarte individual (of string type) to a const char* array.
astarte_result_t astarte_individual_to_binaryblob(astarte_individual_t individual, void **binaryblob, size_t *len)
Convert an Astarte individual (of the binary blob type) to an array of binary blobs.
astarte_individual_t astarte_individual_from_longinteger_array(int64_t *longinteger_array, size_t len)
Initialize an astarte individual from the input longinteger array.
astarte_result_t astarte_individual_to_double(astarte_individual_t individual, double *dbl)
Convert an Astarte individual (of double type) to a double.
astarte_individual_t astarte_individual_from_boolean(bool boolean)
Initialize an astarte individual from the input boolean.
astarte_mapping_type_t astarte_individual_get_type(astarte_individual_t individual)
Get the type of an Astarte individual.
astarte_result_t astarte_individual_to_integer(astarte_individual_t individual, int32_t *integer)
Convert an Astarte individual (of the integer type) to an int32_t.
astarte_result_t astarte_individual_to_longinteger(astarte_individual_t individual, int64_t *longinteger)
Convert an Astarte individual (of the long integer type) to an int64_t.
astarte_individual_t astarte_individual_from_datetime_array(int64_t *datetime_array, size_t len)
Initialize an astarte individual from the input datetime array.
astarte_result_t astarte_individual_to_datetime(astarte_individual_t individual, int64_t *datetime)
Convert an Astarte individual (of the datetime type) to an int64_t.
astarte_result_t astarte_individual_to_string(astarte_individual_t individual, const char **string)
Convert an Astarte individual (of the string type) to a const char *.
astarte_individual_t astarte_individual_from_longinteger(int64_t longinteger)
Initialize an astarte individual from the input longinteger.
astarte_individual_t astarte_individual_from_integer(int32_t integer)
Initialize an astarte individual from the input integer.
astarte_result_t astarte_individual_to_datetime_array(astarte_individual_t individual, int64_t **datetime_array, size_t *len)
Convert an Astarte individual (of datetime array type) to an int64_t array.
astarte_individual_t astarte_individual_from_double_array(double *double_array, size_t len)
Initialize an astarte individual from the input double array.
astarte_individual_t astarte_individual_from_binaryblob_array(const void **blobs, size_t *sizes, size_t count)
Initialize an astarte individual from the input binaryblob array.
astarte_result_t astarte_individual_to_boolean(astarte_individual_t individual, bool *boolean)
Convert an Astarte individual (of the boolean type) to a bool.
astarte_result_t astarte_individual_to_double_array(astarte_individual_t individual, double **double_array, size_t *len)
Convert an Astarte individual (of double array type) to a double array.
astarte_individual_t astarte_individual_from_datetime(int64_t datetime)
Initialize an astarte individual from the input datetime.
astarte_mapping_type_t
Allowed types in a mapping on an Astarte interface.
Definition mapping.h:34
astarte_result_t
Astarte Device SDK return codes.
Definition result.h:31
#define ASTARTE_UTIL_DEFINE_ARRAY(NAME, TYPE)
Define a struct that contains a pointer of type TYPE and a length.
Definition util.h:28
Astarte interface mapping representation.
Astarte result types.
Base Astarte individual data type.
Definition individual.h:128
astarte_mapping_type_t tag
Tag of the tagged enum.
Definition individual.h:132
astarte_individual_param_t data
Data portion of the tagged enum.
Definition individual.h:130
Utility macros and functions.