Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
Types

Data Structures

struct  sol_blob
 Data type describing the default blob implementation. More...
 
struct  sol_blob_type
 Data type describing a blob type. More...
 
struct  sol_direction_vector
 Data type to describe a direction vector. More...
 
struct  sol_drange
 Data type describing a Double range. More...
 
struct  sol_drange_spec
 Data type describing a spec for Double ranges. More...
 
struct  sol_irange
 Data type describing Integer ranges. More...
 
struct  sol_irange_spec
 Data type describing a spec for Integer ranges. More...
 
struct  sol_key_value
 Data type to describe <key, value> pairs of strings. More...
 
struct  sol_location
 Data type to describe a location. More...
 
struct  sol_rgb
 Data type to describe a RGB color. More...
 

Macros

#define SOL_BLOB_NEW_DUP(mem_)   sol_blob_new_dup((&mem_), sizeof(mem_))
 Helper macro to create a new blob duplicating target memory calculating target size. More...
 
#define SOL_DRANGE_INIT()
 Helper macro to initialize a double range with default values. More...
 
#define SOL_DRANGE_INIT_VALUE(value_)
 Helper macro to initialize a double range with default spec and a given value. More...
 
#define SOL_IRANGE_INIT()
 Helper macro to initialize an integer range with default values. More...
 
#define SOL_IRANGE_INIT_VALUE(value_)
 Helper macro to initialize a integer range with default spec and a given value. More...
 

Typedefs

typedef struct sol_blob sol_blob
 Data type describing the default blob implementation. More...
 
typedef struct sol_blob_type sol_blob_type
 Data type describing a blob type. More...
 
typedef struct sol_direction_vector sol_direction_vector
 Data type to describe a direction vector. More...
 
typedef struct sol_drange sol_drange
 Data type describing a Double range. More...
 
typedef struct sol_drange_spec sol_drange_spec
 Data type describing a spec for Double ranges. More...
 
typedef struct sol_irange sol_irange
 Data type describing Integer ranges. More...
 
typedef struct sol_irange_spec sol_irange_spec
 Data type describing a spec for Integer ranges. More...
 
typedef struct sol_key_value sol_key_value
 Data type to describe <key, value> pairs of strings. More...
 
typedef struct sol_location sol_location
 Data type to describe a location. More...
 
typedef struct sol_rgb sol_rgb
 Data type to describe a RGB color. More...
 

Functions

struct sol_blobsol_blob_new (const struct sol_blob_type *type, struct sol_blob *parent, const void *mem, size_t size)
 Creates a new blob instance of the given type type. More...
 
static struct sol_blobsol_blob_new_dup (const void *mem, size_t size)
 Creates a new blob duplicating target memory,. More...
 
static struct sol_blobsol_blob_new_dup_str (const char *str)
 Creates a new blob duplicating target NUL terminated string. More...
 
struct sol_blobsol_blob_ref (struct sol_blob *blob)
 Increments the reference counter of the given blob. More...
 
void sol_blob_set_parent (struct sol_blob *blob, struct sol_blob *parent)
 Set the blob's parent. More...
 
int sol_blob_setup (struct sol_blob *blob, const struct sol_blob_type *type, const void *mem, size_t size)
 Setup a blob structure with the given parameters. More...
 
void sol_blob_unref (struct sol_blob *blob)
 Decreases the reference counter of the given blob. More...
 
bool sol_direction_vector_eq (const struct sol_direction_vector *var0, const struct sol_direction_vector *var1)
 Checks the ranges of var0 and var1 for equality. More...
 
int sol_drange_add (const struct sol_drange *var0, const struct sol_drange *var1, struct sol_drange *result)
 Adds the double ranges var0 and var1 and stores the result in result. More...
 
int sol_drange_compose (const struct sol_drange_spec *spec, double value, struct sol_drange *result)
 Initializes result with the given spec and value. More...
 
int sol_drange_div (const struct sol_drange *var0, const struct sol_drange *var1, struct sol_drange *result)
 Divides the double range var0 by var1 and stores the result in result. More...
 
bool sol_drange_eq (const struct sol_drange *var0, const struct sol_drange *var1)
 Checks the double ranges var0 and var1 for equality. More...
 
int sol_drange_mod (const struct sol_drange *var0, const struct sol_drange *var1, struct sol_drange *result)
 Calculates the module of the double range var0 by var1 and stores the result in result. More...
 
int sol_drange_mul (const struct sol_drange *var0, const struct sol_drange *var1, struct sol_drange *result)
 Multiplies the double ranges var0 and var1 and stores the result in result. More...
 
int sol_drange_sub (const struct sol_drange *var0, const struct sol_drange *var1, struct sol_drange *result)
 Subtracts the double range var1 from var0 and stores the result in result. More...
 
int sol_irange_add (const struct sol_irange *var0, const struct sol_irange *var1, struct sol_irange *result)
 Adds the integer ranges var0 and var1 and stores the result in result. More...
 
int sol_irange_compose (const struct sol_irange_spec *spec, int32_t value, struct sol_irange *result)
 Initializes result with the given spec and value. More...
 
int sol_irange_div (const struct sol_irange *var0, const struct sol_irange *var1, struct sol_irange *result)
 Divides the integer range var0 by var1 and stores the result in result. More...
 
bool sol_irange_eq (const struct sol_irange *var0, const struct sol_irange *var1)
 Checks the integer ranges var0 and var1 for equality. More...
 
int sol_irange_mod (const struct sol_irange *var0, const struct sol_irange *var1, struct sol_irange *result)
 Calculates the module of the integer range var0 by var1 and stores the result in result. More...
 
int sol_irange_mul (const struct sol_irange *var0, const struct sol_irange *var1, struct sol_irange *result)
 Multiplies the integer ranges var0 and var1 and stores the result in result. More...
 
int sol_irange_sub (const struct sol_irange *var0, const struct sol_irange *var1, struct sol_irange *result)
 Subtracts the integer range var1 from var0 and stores the result in result. More...
 
bool sol_rgb_eq (const struct sol_rgb *var0, const struct sol_rgb *var1)
 Checks the ranges of var0 and var1 for equality. More...
 
int sol_rgb_set_max (struct sol_rgb *color, uint32_t max_value)
 Set a maximum value for all components of a RGB color. More...
 

Variables

const struct sol_blob_type SOL_BLOB_TYPE_DEFAULT
 Blob type object for the default implementation. More...
 
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE
 Blob type object for the nofree implementation. More...
 
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE_DATA
 Blob type object for the nofree implementation. More...
 

Detailed Description

Macro Definition Documentation

#define SOL_BLOB_NEW_DUP (   mem_)    sol_blob_new_dup((&mem_), sizeof(mem_))

Helper macro to create a new blob duplicating target memory calculating target size.

#define SOL_DRANGE_INIT ( )
Value:
{ \
.val = 0, \
.min = -DBL_MAX, \
.max = DBL_MAX, \
.step = DBL_MIN \
}

Helper macro to initialize a double range with default values.

#define SOL_DRANGE_INIT_VALUE (   value_)
Value:
{ \
.val = value_, \
.min = -DBL_MAX, \
.max = DBL_MAX, \
.step = DBL_MIN \
}

Helper macro to initialize a double range with default spec and a given value.

Parameters
value_Initial value
#define SOL_IRANGE_INIT ( )
Value:
{ \
.val = 0, \
.min = INT32_MIN, \
.max = INT32_MAX, \
.step = 1 \
}

Helper macro to initialize an integer range with default values.

#define SOL_IRANGE_INIT_VALUE (   value_)
Value:
{ \
.val = value_, \
.min = INT32_MIN, \
.max = INT32_MAX, \
.step = 1 \
}

Helper macro to initialize a integer range with default spec and a given value.

Parameters
value_Initial value

Typedef Documentation

typedef struct sol_blob sol_blob

Data type describing the default blob implementation.

typedef struct sol_blob_type sol_blob_type

Data type describing a blob type.

This should be used by different kinds of Blob implementation to make than compatible to our blob API.

Data type to describe a direction vector.

typedef struct sol_drange sol_drange

Data type describing a Double range.

Data type describing a spec for Double ranges.

A range spec is composed by the range limits and step.

typedef struct sol_irange sol_irange

Data type describing Integer ranges.

Data type describing a spec for Integer ranges.

A range spec is composed by the range limits and step.

typedef struct sol_key_value sol_key_value

Data type to describe <key, value> pairs of strings.

typedef struct sol_location sol_location

Data type to describe a location.

typedef struct sol_rgb sol_rgb

Data type to describe a RGB color.

Function Documentation

struct sol_blob* sol_blob_new ( const struct sol_blob_type type,
struct sol_blob parent,
const void *  mem,
size_t  size 
)

Creates a new blob instance of the given type type.

Parameters
typeBlob type of the new instance
parentParent blob
memBlob's data
sizeBlob's data size
Returns
A new blob instance
Examples:
/src/samples/coap/lwm2m-client.c, /src/samples/common/uart.c, /src/samples/crypto/message-digest.c, /src/samples/crypto/sha256sum.c, and /src/samples/design_patterns/stream_sample.c.

Referenced by coord_to_str(), on_data(), on_stdin_hash(), producer_make_data(), sol_blob_new_dup(), sol_efivars_write_string(), sol_fs_write_string(), sol_memmap_write_string(), sol_str_slice_to_blob(), and startup().

static struct sol_blob* sol_blob_new_dup ( const void *  mem,
size_t  size 
)
static

Creates a new blob duplicating target memory,.

Instead creating a blob wrapping any given memory, it duplicates given memory. Useful, for instance, to create blobs for packet types.

Parameters
memmemory that blob will duplicate and refers to
sizesize of memory block
Returns
new sol_blob on success. NULL on failure
Examples:
/src/samples/coap/lwm2m-bs-server.c, /src/samples/coap/lwm2m-client.c, and /src/samples/coap/lwm2m-server.c.

References sol_blob_new(), and SOL_BLOB_TYPE_DEFAULT.

Referenced by main(), and sol_blob_new_dup_str().

static struct sol_blob* sol_blob_new_dup_str ( const char *  str)
static

Creates a new blob duplicating target NUL terminated string.

Parameters
strstring to be duplicated in a blob.
Returns
new sol_blob on success. NULL on failure

References sol_blob_new_dup().

struct sol_blob* sol_blob_ref ( struct sol_blob blob)

Increments the reference counter of the given blob.

Parameters
blobThe Blob increase the references
Returns
Pointer to the referenced blob
Examples:
/src/samples/coap/lwm2m-client.c, and /src/samples/design_patterns/stream_sample.c.

Referenced by my_stream_api_feed(), write_security_res(), and write_server_res().

void sol_blob_set_parent ( struct sol_blob blob,
struct sol_blob parent 
)

Set the blob's parent.

Parameters
blobThe blob
parentNew parent
int sol_blob_setup ( struct sol_blob blob,
const struct sol_blob_type type,
const void *  mem,
size_t  size 
)

Setup a blob structure with the given parameters.

Parameters
blobBlob to setup
typeBlob's type
memBlob's data
sizeBlob's data size
Returns
0 on success, error code (always negative) otherwise.
void sol_blob_unref ( struct sol_blob blob)
bool sol_direction_vector_eq ( const struct sol_direction_vector var0,
const struct sol_direction_vector var1 
)

Checks the ranges of var0 and var1 for equality.

Parameters
var0The first direction vector
var1The second direction vector
Returns
true if both are equal, false otherwise.
int sol_drange_add ( const struct sol_drange var0,
const struct sol_drange var1,
struct sol_drange result 
)

Adds the double ranges var0 and var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First double range
var1Second double range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_drange_compose ( const struct sol_drange_spec spec,
double  value,
struct sol_drange result 
)

Initializes result with the given spec and value.

Parameters
specDouble range spec
valueDesired value
resultDouble range to be initialized
Returns
0 on success, error code (always negative) otherwise.
int sol_drange_div ( const struct sol_drange var0,
const struct sol_drange var1,
struct sol_drange result 
)

Divides the double range var0 by var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First double range
var1Second double range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
bool sol_drange_eq ( const struct sol_drange var0,
const struct sol_drange var1 
)

Checks the double ranges var0 and var1 for equality.

This function takes into consideration the range spec of the arguments.

Parameters
var0First double range
var1Second double range
Returns
true if both are equal, false otherwise.
int sol_drange_mod ( const struct sol_drange var0,
const struct sol_drange var1,
struct sol_drange result 
)

Calculates the module of the double range var0 by var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First double range
var1Second double range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_drange_mul ( const struct sol_drange var0,
const struct sol_drange var1,
struct sol_drange result 
)

Multiplies the double ranges var0 and var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First double range
var1Second double range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_drange_sub ( const struct sol_drange var0,
const struct sol_drange var1,
struct sol_drange result 
)

Subtracts the double range var1 from var0 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First double range
var1Second double range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_irange_add ( const struct sol_irange var0,
const struct sol_irange var1,
struct sol_irange result 
)

Adds the integer ranges var0 and var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First integer range
var1Second integer range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_irange_compose ( const struct sol_irange_spec spec,
int32_t  value,
struct sol_irange result 
)

Initializes result with the given spec and value.

Parameters
specInteger range spec
valueDesired value
resultInteger range to be initialized
Returns
0 on success, error code (always negative) otherwise.
int sol_irange_div ( const struct sol_irange var0,
const struct sol_irange var1,
struct sol_irange result 
)

Divides the integer range var0 by var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First integer range
var1Second integer range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
bool sol_irange_eq ( const struct sol_irange var0,
const struct sol_irange var1 
)

Checks the integer ranges var0 and var1 for equality.

This function takes into consideration the range spec of the arguments.

Parameters
var0First integer range
var1Second integer range
Returns
true if both are equal, false otherwise.
int sol_irange_mod ( const struct sol_irange var0,
const struct sol_irange var1,
struct sol_irange result 
)

Calculates the module of the integer range var0 by var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First integer range
var1Second integer range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_irange_mul ( const struct sol_irange var0,
const struct sol_irange var1,
struct sol_irange result 
)

Multiplies the integer ranges var0 and var1 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First integer range
var1Second integer range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
int sol_irange_sub ( const struct sol_irange var0,
const struct sol_irange var1,
struct sol_irange result 
)

Subtracts the integer range var1 from var0 and stores the result in result.

This function takes into consideration the range spec of the arguments and set the appropriated spec in the result.

Parameters
var0First integer range
var1Second integer range
resultResulting range
Returns
0 on success, error code (always negative) otherwise.
bool sol_rgb_eq ( const struct sol_rgb var0,
const struct sol_rgb var1 
)

Checks the ranges of var0 and var1 for equality.

Parameters
var0The first RGB
var1The second RGB
Returns
true if both are equal, false otherwise.
int sol_rgb_set_max ( struct sol_rgb color,
uint32_t  max_value 
)

Set a maximum value for all components of a RGB color.

Parameters
colorThe RGB color
max_valueMaximum value to set
Returns
0 on success, error code (always negative) otherwise

Variable Documentation

const struct sol_blob_type SOL_BLOB_TYPE_DEFAULT
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE

Blob type object for the nofree implementation.

The no-free type doesn't free blob's data memory and the blob itself. Used when creating a blob in the application's stack with constant data.

Examples:
/src/samples/coap/lwm2m-bs-server.c, /src/samples/coap/lwm2m-client.c, and /src/samples/coap/lwm2m-server.c.
const struct sol_blob_type SOL_BLOB_TYPE_NO_FREE_DATA

Blob type object for the nofree implementation.

The no-free type doesn't free blob's data memory. Used when pointing to inner position of a pre existing blob or any other case when blob's data memory shouldn't be freed.

Note
Blob's struct memory will be freed.
Examples:
/src/samples/crypto/message-digest.c, and /src/samples/design_patterns/stream_sample.c.

Referenced by on_data(), and startup().