Soletta™ Framework
|
Example how to create and use a simple C node type and the high-level API. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "soletta.h"
#include "sol-flow-builder.h"
#include "sol-flow-simple-c-type.h"
Data Structures | |
struct | mytype_context |
struct | mytype_options |
Macros | |
#define | MYTYPE_OPTIONS_SUB_API 0x1234 |
Functions | |
static int | isodd (struct sol_flow_node *node, const struct sol_flow_simple_c_type_event *ev, void *data) |
static int | mytype_func (struct sol_flow_node *node, const struct sol_flow_simple_c_type_event *ev, void *data) |
static bool | on_timeout (void *data) |
static void | shutdown (void) |
SOL_MAIN_DEFAULT (startup, shutdown) | |
static void | startup (void) |
Variables | |
static struct sol_flow_builder * | builder |
static struct sol_flow_node * | flow |
static struct sol_flow_node_type * | flow_node_type |
static struct sol_flow_node_type * | isoddtype |
static struct sol_flow_node_type * | mytype |
Example how to create and use a simple C node type and the high-level API.
To understand how to use the high-level C API with existing or custom C types using the generator from JSON (recommended), take a look at highlevel.c
Note that this sample's 'mytype*' uses all features of simple_c_type, usually some options will not be used in most applications, such as port connections and disconnection events or context. One example of the simplistic version is the 'isodd' that checks if if the given number is odd or even.
#define MYTYPE_OPTIONS_SUB_API 0x1234 |
Referenced by mytype_func(), and startup().
|
static |
References sol_flow_simple_c_type_event::packet, sol_flow_packet_get_irange_value(), sol_flow_send_bool_packet(), and sol_flow_simple_c_type_event::type.
Referenced by startup().
|
static |
References sol_flow_simple_c_type_event::conn_id, MYTYPE_OPTIONS_SUB_API, on_timeout(), sol_flow_simple_c_type_event::options, sol_flow_simple_c_type_event::packet, sol_flow_simple_c_type_event::port, sol_flow_simple_c_type_event::port_name, sol_flow_packet_get_bool(), sol_flow_packet_get_irange_value(), SOL_NO_API_VERSION, sol_timeout_add(), sol_timeout_del(), mytype_options::somebool, mytype_context::somebool, mytype_options::someint, mytype_context::someint, sol_flow_node_options::sub_api, mytype_context::timer, and sol_flow_simple_c_type_event::type.
Referenced by startup().
|
static |
|
static |
References builder, flow, sol_flow_builder_del(), sol_flow_node_del(), and sol_flow_node_type_del().
|
static |
References sol_flow_node_options::api_version, mytype_options::base, builder, flow, isodd(), mytype_func(), MYTYPE_OPTIONS_SUB_API, sol_flow_builder_add_node(), sol_flow_builder_add_node_by_type(), sol_flow_builder_connect(), sol_flow_builder_get_node_type(), sol_flow_builder_new(), sol_flow_node_new(), SOL_FLOW_NODE_OPTIONS_API_VERSION, SOL_FLOW_PACKET_TYPE_BOOL, SOL_FLOW_PACKET_TYPE_IRANGE, SOL_FLOW_PACKET_TYPE_STRING, sol_flow_simple_c_type_new_full(), sol_flow_simple_c_type_new_nocontext, SOL_FLOW_SIMPLE_C_TYPE_PORT_IN, and SOL_FLOW_SIMPLE_C_TYPE_PORT_OUT.
|
static |
Referenced by shutdown(), and startup().
|
static |
Referenced by shutdown(), and startup().
|
static |
|
static |
|
static |