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 | Typedefs | Functions | Variables

Flow packet is the fundamental data structure used to pass information between nodes in a flow. More...

Data Structures

struct  sol_flow_packet_type
 A packet type defines what's the content of a packet and how it's stored and retrieved. More...
 

Typedefs

typedef struct sol_flow_packet sol_flow_packet
 A packet is a generic container for different kinds (types) of contents. More...
 
typedef struct sol_flow_packet_type sol_flow_packet_type
 A packet type defines what's the content of a packet and how it's stored and retrieved. More...
 

Functions

const char * sol_flow_get_packet_type_name (const struct sol_str_slice type)
 Returns the packet type variable as string. More...
 
void sol_flow_packet_del (struct sol_flow_packet *packet)
 Deletes a packet. More...
 
struct sol_flow_packetsol_flow_packet_dup (const struct sol_flow_packet *packet)
 Duplicates a packet. More...
 
int sol_flow_packet_get (const struct sol_flow_packet *packet, void *output)
 Retrieves the packet's content. More...
 
int sol_flow_packet_get_blob (const struct sol_flow_packet *packet, struct sol_blob **value)
 Retrieves the content of a Blob packet. More...
 
int sol_flow_packet_get_bool (const struct sol_flow_packet *packet, bool *boolean)
 Retrieves the content of a Boolean packet. More...
 
int sol_flow_packet_get_byte (const struct sol_flow_packet *packet, unsigned char *byte)
 Retrieves the content of a Byte packet. More...
 
int sol_flow_packet_get_composed_members (const struct sol_flow_packet *packet, struct sol_flow_packet ***children, uint16_t *len)
 Retrieves the list of packets contained in the composed packet. More...
 
int sol_flow_packet_get_composed_members_packet_types (const struct sol_flow_packet_type *type, const struct sol_flow_packet_type ***children, uint16_t *len)
 Retrieves the list of packet types that composes type. More...
 
int sol_flow_packet_get_direction_vector (const struct sol_flow_packet *packet, struct sol_direction_vector *direction_vector)
 Retrieves the content of a Direction Vector packet. More...
 
int sol_flow_packet_get_direction_vector_components (const struct sol_flow_packet *packet, double *x, double *y, double *z)
 Retrieves the direction components contained in a Direction Vector packet. More...
 
int sol_flow_packet_get_drange (const struct sol_flow_packet *packet, struct sol_drange *drange)
 Retrieves the content of an Drange packet. More...
 
int sol_flow_packet_get_drange_value (const struct sol_flow_packet *packet, double *value)
 Retrieves the Drange value of an Drange packet. More...
 
int sol_flow_packet_get_error (const struct sol_flow_packet *packet, int *code, const char **msg)
 Retrieves the content of an Error packet. More...
 
int sol_flow_packet_get_http_response (const struct sol_flow_packet *packet, int *response_code, const char **url, const char **content_type, const struct sol_blob **content, struct sol_vector *cookies, struct sol_vector *headers)
 Retrieves the content of a Timestamp packet. More...
 
int sol_flow_packet_get_irange (const struct sol_flow_packet *packet, struct sol_irange *irange)
 Retrieves the content of an Irange packet. More...
 
int sol_flow_packet_get_irange_value (const struct sol_flow_packet *packet, int32_t *value)
 Retrieves the Irange value of an Irange packet. More...
 
int sol_flow_packet_get_json_array (const struct sol_flow_packet *packet, struct sol_blob **value)
 Retrieves the content of a JSON Array packet. More...
 
int sol_flow_packet_get_json_object (const struct sol_flow_packet *packet, struct sol_blob **value)
 Retrieves the content of a JSON Object packet. More...
 
int sol_flow_packet_get_location (const struct sol_flow_packet *packet, struct sol_location *location)
 Retrieves the content of a Location packet. More...
 
int sol_flow_packet_get_location_components (const struct sol_flow_packet *packet, double *lat, double *lon, double *alt)
 Retrieves the location components contained in a Location packet. More...
 
int sol_flow_packet_get_rgb (const struct sol_flow_packet *packet, struct sol_rgb *rgb)
 Retrieves the content of a RGB packet. More...
 
int sol_flow_packet_get_rgb_components (const struct sol_flow_packet *packet, uint32_t *red, uint32_t *green, uint32_t *blue)
 Retrieves the RGB components contained in a RGB packet. More...
 
int sol_flow_packet_get_string (const struct sol_flow_packet *packet, const char **value)
 Retrieves the content of a String packet. More...
 
int sol_flow_packet_get_timestamp (const struct sol_flow_packet *packet, struct timespec *timestamp)
 Retrieves the content of a Timestamp packet. More...
 
const struct sol_flow_packet_typesol_flow_packet_get_type (const struct sol_flow_packet *packet)
 Retrieves the packet's type. More...
 
bool sol_flow_packet_is_composed_type (const struct sol_flow_packet_type *type)
 Checks if a given packet type is a composed packet type. More...
 
struct sol_flow_packetsol_flow_packet_new (const struct sol_flow_packet_type *type, const void *value)
 Creates a packet. More...
 
struct sol_flow_packetsol_flow_packet_new_blob (const struct sol_blob *value)
 Creates a new packet of type Blob. More...
 
struct sol_flow_packetsol_flow_packet_new_bool (bool boolean)
 Creates a new packet of type Boolean. More...
 
struct sol_flow_packetsol_flow_packet_new_byte (unsigned char byte)
 Creates a new packet of type Byte. More...
 
struct sol_flow_packetsol_flow_packet_new_direction_vector (const struct sol_direction_vector *direction_vector)
 Creates a new packet of type Direction Vector. More...
 
struct sol_flow_packetsol_flow_packet_new_direction_vector_components (double x, double y, double z)
 Creates a new packet of type Direction Vector from the given x, y and z components. More...
 
struct sol_flow_packetsol_flow_packet_new_drange (const struct sol_drange *drange)
 Creates a new packet of type Drange. More...
 
struct sol_flow_packetsol_flow_packet_new_drange_value (double value)
 Creates a new packet of type Drange with initial value value and default spec. More...
 
struct sol_flow_packetsol_flow_packet_new_empty (void)
 Creates a new packet of type Empty. More...
 
struct sol_flow_packetsol_flow_packet_new_error (int code, const char *msg)
 Creates a new packet of type Error. More...
 
struct sol_flow_packetsol_flow_packet_new_http_response (int response_code, const char *url, const char *content_type, const struct sol_blob *content, const struct sol_vector *cookies, const struct sol_vector *headers)
 Creates a new packet of type HTTP Response. More...
 
struct sol_flow_packetsol_flow_packet_new_irange (const struct sol_irange *irange)
 Creates a new packet of type Irange. More...
 
struct sol_flow_packetsol_flow_packet_new_irange_value (int32_t value)
 Creates a new packet of type Irange with initial value value and default spec. More...
 
struct sol_flow_packetsol_flow_packet_new_json_array (const struct sol_blob *value)
 Creates a new packet of type JSON Array. More...
 
struct sol_flow_packetsol_flow_packet_new_json_object (const struct sol_blob *value)
 Creates a new packet of type JSON Object. More...
 
struct sol_flow_packetsol_flow_packet_new_location (const struct sol_location *location)
 Creates a new packet of type Location. More...
 
struct sol_flow_packetsol_flow_packet_new_location_components (double lat, double lon, double alt)
 Creates a new packet of type Location from the given lat, lon, alt components. More...
 
struct sol_flow_packetsol_flow_packet_new_rgb (const struct sol_rgb *rgb)
 Creates a new packet of type RGB. More...
 
struct sol_flow_packetsol_flow_packet_new_rgb_components (uint32_t red, uint32_t green, uint32_t blue)
 Creates a new packet of type RGB from the given red, green and blue components. More...
 
struct sol_flow_packetsol_flow_packet_new_string (const char *value)
 Creates a new packet of type String. More...
 
struct sol_flow_packetsol_flow_packet_new_string_slice (struct sol_str_slice slice)
 Creates a new packet of type String from string slice slice. More...
 
struct sol_flow_packetsol_flow_packet_new_string_take (char *value)
 Similar to sol_flow_packet_new_string() but takes ownership of value to use as the packet content. More...
 
struct sol_flow_packetsol_flow_packet_new_timestamp (const struct timespec *timestamp)
 Creates a new packet of type Timestamp. More...
 
const struct sol_flow_packet_typesol_flow_packet_type_composed_new (const struct sol_flow_packet_type **types)
 Creates a new packet type that is composed by the packets types in types. More...
 
const struct sol_flow_packet_typesol_flow_packet_type_from_string (const struct sol_str_slice type)
 Returns the packet type from string. More...
 

Variables

const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_ANY
 Type of the Any packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_BLOB
 Type of the Blob packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_BOOL
 Type of the Boolean packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_BYTE
 Type of the Byte packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_DIRECTION_VECTOR
 Type of the Direction Vector packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_DRANGE
 Type of the Drange packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_EMPTY
 Type of the Empty packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_ERROR
 Type of the Error packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_HTTP_RESPONSE
 Type of the Http Response packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_IRANGE
 Type of the Irange packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_JSON_ARRAY
 Type of the JSON Array packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_JSON_OBJECT
 Type of the JSON Object packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_LOCATION
 Type of the Location packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_RGB
 Type of the RGB packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_STRING
 Type of the String packet. More...
 
const struct sol_flow_packet_typeSOL_FLOW_PACKET_TYPE_TIMESTAMP
 Type of the Timestamp packet. More...
 

Detailed Description

Flow packet is the fundamental data structure used to pass information between nodes in a flow.

Typedef Documentation

A packet is a generic container for different kinds (types) of contents.

A packet type defines what's the content of a packet and how it's stored and retrieved.

Function Documentation

const char* sol_flow_get_packet_type_name ( const struct sol_str_slice  type)

Returns the packet type variable as string.

This function will return the sol_flow_packet_type variable for a given type as string. A common use for this function is when one is generating code for meta types nodes that will be used by sol-fbp-generator.

Example:

// will return the string "SOL_FLOW_PACKET_TYPE_IRANGE"
const char *int_packet_name = sol_flow_get_packet_type_name(sol_str_slice_from_str("int"));
// will return the string "SOL_FLOW_PACKET_TYPE_LOCATION"
const char *location_packet_name = sol_flow_get_packet_type_name(sol_str_slice_from_str("location"));
Parameters
typeThe Soletta type name (int, blob, error, string, location etc.)
Returns
The Soletta packet type variable as string or NULL if the type was not found.
void sol_flow_packet_del ( struct sol_flow_packet packet)

Deletes a packet.

Parameters
packetPacket to be deleted
struct sol_flow_packet* sol_flow_packet_dup ( const struct sol_flow_packet packet)

Duplicates a packet.

Parameters
packetPacket to be duplicated
Returns
The packet copy on success, NULL otherwise
int sol_flow_packet_get ( const struct sol_flow_packet packet,
void *  output 
)

Retrieves the packet's content.

Parameters
packetThe packet
outputWhere to store a copy the packet's content
Returns
0 on success, error code (always negative) otherwise
int sol_flow_packet_get_blob ( const struct sol_flow_packet packet,
struct sol_blob **  value 
)

Retrieves the content of a Blob packet.

Parameters
packetThe packet
valueThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_bool ( const struct sol_flow_packet packet,
bool *  boolean 
)

Retrieves the content of a Boolean packet.

Parameters
packetThe packet
booleanThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
Examples:
/src/samples/flow/c-api/custom-node-types.c, and /src/samples/flow/c-api/simple-c-type.c.

Referenced by mytype_func(), and writer_in_process().

int sol_flow_packet_get_byte ( const struct sol_flow_packet packet,
unsigned char *  byte 
)

Retrieves the content of a Byte packet.

Parameters
packetThe packet
byteThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_composed_members ( const struct sol_flow_packet packet,
struct sol_flow_packet ***  children,
uint16_t *  len 
)

Retrieves the list of packets contained in the composed packet.

A composed packet is an instance of a composed packet type.

Parameters
packetThe composed packet
childrenRetrieved list of packets that composes packet
lenLength of the list
Returns
0 on success, error code (always negative) otherwise
int sol_flow_packet_get_composed_members_packet_types ( const struct sol_flow_packet_type type,
const struct sol_flow_packet_type ***  children,
uint16_t *  len 
)

Retrieves the list of packet types that composes type.

Parameters
typeThe packet type
childrenRetrieved list of packet types that composes type
lenLength of the list
Returns
0 on success, error code (always negative) otherwise
int sol_flow_packet_get_direction_vector ( const struct sol_flow_packet packet,
struct sol_direction_vector direction_vector 
)

Retrieves the content of a Direction Vector packet.

Parameters
packetThe packet
direction_vectorThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_direction_vector_components
int sol_flow_packet_get_direction_vector_components ( const struct sol_flow_packet packet,
double *  x,
double *  y,
double *  z 
)

Retrieves the direction components contained in a Direction Vector packet.

Parameters
packetThe packet
xRetrieved x component
yRetrieved y component
zRetrieved z component
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_direction_vector
int sol_flow_packet_get_drange ( const struct sol_flow_packet packet,
struct sol_drange drange 
)

Retrieves the content of an Drange packet.

Parameters
packetThe packet
drangeThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_drange_value
Examples:
/src/samples/flow/tilt-angle/arctan-node.c.

Referenced by logic_process().

int sol_flow_packet_get_drange_value ( const struct sol_flow_packet packet,
double *  value 
)

Retrieves the Drange value of an Drange packet.

Parameters
packetThe packet
valueDrange value contained in the packet
Returns
0 if the value was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_drange
int sol_flow_packet_get_error ( const struct sol_flow_packet packet,
int *  code,
const char **  msg 
)

Retrieves the content of an Error packet.

Parameters
packetThe packet
codeRetrieved error code
msgRetrieved error message
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_http_response ( const struct sol_flow_packet packet,
int *  response_code,
const char **  url,
const char **  content_type,
const struct sol_blob **  content,
struct sol_vector cookies,
struct sol_vector headers 
)

Retrieves the content of a Timestamp packet.

Parameters
packetThe packet
response_codeRetrieved response code
urlRetrieved response URL
content_typeRetrieved response content type
contentRetrieved response content
cookiesRetrieved response cookies
headersRetrieved response headers
Returns
0 if all content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_irange ( const struct sol_flow_packet packet,
struct sol_irange irange 
)

Retrieves the content of an Irange packet.

Parameters
packetThe packet
irangeThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_irange_value
Examples:
/src/samples/flow/c-api/custom-node-types.c.

Referenced by logic_process().

int sol_flow_packet_get_irange_value ( const struct sol_flow_packet packet,
int32_t *  value 
)

Retrieves the Irange value of an Irange packet.

Parameters
packetThe packet
valueIrange value contained in the packet
Returns
0 if the value was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_irange
Examples:
/src/samples/flow/c-api/simple-c-type.c, and /src/samples/flow/c-api/single-node.c.

Referenced by get_int32_packet_and_log(), isodd(), and mytype_func().

int sol_flow_packet_get_json_array ( const struct sol_flow_packet packet,
struct sol_blob **  value 
)

Retrieves the content of a JSON Array packet.

Parameters
packetThe packet
valueThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_json_object ( const struct sol_flow_packet packet,
struct sol_blob **  value 
)

Retrieves the content of a JSON Object packet.

Parameters
packetThe packet
valueThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_location ( const struct sol_flow_packet packet,
struct sol_location location 
)

Retrieves the content of a Location packet.

Parameters
packetThe packet
locationThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_location_components ( const struct sol_flow_packet packet,
double *  lat,
double *  lon,
double *  alt 
)

Retrieves the location components contained in a Location packet.

Parameters
packetThe packet
latRetrieved latitude component
lonRetrieved longitutde component
altRetrieved altitude component
Returns
0 if the content was successfullu retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_location
int sol_flow_packet_get_rgb ( const struct sol_flow_packet packet,
struct sol_rgb rgb 
)

Retrieves the content of a RGB packet.

Parameters
packetThe packet
rgbThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_rgb_components
int sol_flow_packet_get_rgb_components ( const struct sol_flow_packet packet,
uint32_t *  red,
uint32_t *  green,
uint32_t *  blue 
)

Retrieves the RGB components contained in a RGB packet.

Parameters
packetThe packet
redRetrieved red component
greenRetrieved green component
blueRetrieved blue component
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
See Also
sol_flow_packet_get_rgb
int sol_flow_packet_get_string ( const struct sol_flow_packet packet,
const char **  value 
)

Retrieves the content of a String packet.

Parameters
packetThe packet
valueThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
int sol_flow_packet_get_timestamp ( const struct sol_flow_packet packet,
struct timespec *  timestamp 
)

Retrieves the content of a Timestamp packet.

Parameters
packetThe packet
timestampThe retrieved content
Returns
0 if the content was successfully retrieved, error code (always negative) otherwise.
const struct sol_flow_packet_type* sol_flow_packet_get_type ( const struct sol_flow_packet packet)

Retrieves the packet's type.

Parameters
packetThe packet
Returns
Type of the packet, NULL on errors
bool sol_flow_packet_is_composed_type ( const struct sol_flow_packet_type type)

Checks if a given packet type is a composed packet type.

Parameters
typePacket type to check
Returns
true if packet type type is composed, false otherwise
struct sol_flow_packet* sol_flow_packet_new ( const struct sol_flow_packet_type type,
const void *  value 
)

Creates a packet.

Parameters
typeThe packet's type
valueData to use in the packet initialization
Returns
A new packet of type type, NULL on errors
struct sol_flow_packet* sol_flow_packet_new_blob ( const struct sol_blob value)

Creates a new packet of type Blob.

Parameters
valueInitial blob
Returns
A new Blob packet
struct sol_flow_packet* sol_flow_packet_new_bool ( bool  boolean)

Creates a new packet of type Boolean.

Parameters
booleanInitial value
Returns
A new Boolean packet
struct sol_flow_packet* sol_flow_packet_new_byte ( unsigned char  byte)

Creates a new packet of type Byte.

Parameters
byteInitial value
Returns
A new Byte packet
struct sol_flow_packet* sol_flow_packet_new_direction_vector ( const struct sol_direction_vector direction_vector)

Creates a new packet of type Direction Vector.

Parameters
direction_vectorInitial value
Returns
A new Direction Vector packet
See Also
sol_flow_packet_new_direction_vector_components
struct sol_flow_packet* sol_flow_packet_new_direction_vector_components ( double  x,
double  y,
double  z 
)

Creates a new packet of type Direction Vector from the given x, y and z components.

Parameters
xInitial x value
yInitial y value
zInitial z value
Returns
A new Direction Vector packet
See Also
sol_flow_packet_new_direction_vector
struct sol_flow_packet* sol_flow_packet_new_drange ( const struct sol_drange drange)

Creates a new packet of type Drange.

Parameters
drangeInitial value
Returns
A new Drange packet
See Also
sol_flow_packet_new_drange_value
struct sol_flow_packet* sol_flow_packet_new_drange_value ( double  value)

Creates a new packet of type Drange with initial value value and default spec.

Parameters
valueInitial value
Returns
A new Drange packet
See Also
sol_flow_packet_new_drange
struct sol_flow_packet* sol_flow_packet_new_empty ( void  )

Creates a new packet of type Empty.

Returns
A new Empty packet
struct sol_flow_packet* sol_flow_packet_new_error ( int  code,
const char *  msg 
)

Creates a new packet of type Error.

Parameters
codeError code
msgError message
Returns
A new Error packet
struct sol_flow_packet* sol_flow_packet_new_http_response ( int  response_code,
const char *  url,
const char *  content_type,
const struct sol_blob content,
const struct sol_vector cookies,
const struct sol_vector headers 
)

Creates a new packet of type HTTP Response.

Parameters
response_codeThe response code
urlResponse URL
content_typeThe response content type
contentThe response content
cookiesResponse cookies
headersResponse headers
Returns
A new HTTP Response packet
struct sol_flow_packet* sol_flow_packet_new_irange ( const struct sol_irange irange)

Creates a new packet of type Irange.

Parameters
irangeInitial value
Returns
A new Irange packet
See Also
sol_flow_packet_new_irange_value
struct sol_flow_packet* sol_flow_packet_new_irange_value ( int32_t  value)

Creates a new packet of type Irange with initial value value and default spec.

Parameters
valueInitial value
Returns
A new Irange packet
See Also
sol_flow_packet_new_irange
struct sol_flow_packet* sol_flow_packet_new_json_array ( const struct sol_blob value)

Creates a new packet of type JSON Array.

Note
The blob content should be a string with a valid JSON Array.
May or may not be NUL terminated.
Parameters
valueInitial blob containing a JSON Array.
Returns
A new JSON Array packet
struct sol_flow_packet* sol_flow_packet_new_json_object ( const struct sol_blob value)

Creates a new packet of type JSON Object.

Note
The blob content should be a string with a valid JSON object.
May or may not be NUL terminated.
Parameters
valueInitial blob containing a JSON Object.
Returns
A new JSON Object packet
struct sol_flow_packet* sol_flow_packet_new_location ( const struct sol_location location)

Creates a new packet of type Location.

Parameters
locationInitial value
Returns
A new Location packet
struct sol_flow_packet* sol_flow_packet_new_location_components ( double  lat,
double  lon,
double  alt 
)

Creates a new packet of type Location from the given lat, lon, alt components.

Parameters
latInitial latitude value
lonInitial longitude value
altInitial altitude value
Returns
A new Location packet
See Also
sol_flow_packet_new_location
struct sol_flow_packet* sol_flow_packet_new_rgb ( const struct sol_rgb rgb)

Creates a new packet of type RGB.

Parameters
rgbInitial RGB value
Returns
A new RGB packet
See Also
sol_flow_packet_new_rgb_components
struct sol_flow_packet* sol_flow_packet_new_rgb_components ( uint32_t  red,
uint32_t  green,
uint32_t  blue 
)

Creates a new packet of type RGB from the given red, green and blue components.

Parameters
redInitial red value
greenInitial green value
blueInitial blue value
Returns
A new RGB packet
See Also
sol_flow_packet_new_rgb
struct sol_flow_packet* sol_flow_packet_new_string ( const char *  value)

Creates a new packet of type String.

Parameters
valueInitial string
Returns
A new String packet
See Also
sol_flow_packet_new_string_slice
sol_flow_packet_new_string_take
struct sol_flow_packet* sol_flow_packet_new_string_slice ( struct sol_str_slice  slice)

Creates a new packet of type String from string slice slice.

Parameters
sliceString slice with the initial content
Returns
A new String packet
See Also
sol_flow_packet_new_string
sol_flow_packet_new_string_take
struct sol_flow_packet* sol_flow_packet_new_string_take ( char *  value)

Similar to sol_flow_packet_new_string() but takes ownership of value to use as the packet content.

Instead of copying the initial string to the packets content, takes ownership of value memory.

Parameters
valueInitial string
Returns
A new String packet
See Also
sol_flow_packet_new_string
sol_flow_packet_new_string_slice
struct sol_flow_packet* sol_flow_packet_new_timestamp ( const struct timespec *  timestamp)

Creates a new packet of type Timestamp.

Parameters
timestampInitial value
Returns
A new Timestamp packet
const struct sol_flow_packet_type* sol_flow_packet_type_composed_new ( const struct sol_flow_packet_type **  types)

Creates a new packet type that is composed by the packets types in types.

Parameters
typesInitial list of packet types
Returns
A new composed packet type packet
const struct sol_flow_packet_type* sol_flow_packet_type_from_string ( const struct sol_str_slice  type)

Returns the packet type from string.

This function will return the sol_flow_packet_type based on its string name. If the type starts with "composed:", then it will search for composed packets with that signature and if none exists, then it will try to create one.

Parameters
typeThe Soletta type name (int, blob, error, string, composed:int,boolean...)
Returns
The Soletta packet type reference or NULL if the type was not found.

Variable Documentation

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_ANY

Type of the Any packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BLOB

Type of the Blob packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BOOL

Type of the Boolean packet.

Examples:
/src/samples/flow/c-api/simple-c-type.c.

Referenced by startup().

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BYTE

Type of the Byte packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_DIRECTION_VECTOR

Type of the Direction Vector packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_DRANGE

Type of the Drange packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_EMPTY

Type of the Empty packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_ERROR

Type of the Error packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_HTTP_RESPONSE

Type of the Http Response packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_IRANGE

Type of the Irange packet.

Examples:
/src/samples/flow/c-api/simple-c-type.c.

Referenced by startup().

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_JSON_ARRAY

Type of the JSON Array packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_JSON_OBJECT

Type of the JSON Object packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_LOCATION

Type of the Location packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_RGB

Type of the RGB packet.

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_STRING

Type of the String packet.

Examples:
/src/samples/flow/c-api/simple-c-type.c.

Referenced by startup().

const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_TIMESTAMP

Type of the Timestamp packet.