Soletta™ Framework
|
Example how to create and use a single node without an associated flow. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "sol-flow-single.h"
#include "sol-log.h"
#include "sol-util.h"
#include "soletta.h"
Functions | |
static void | create_minutes (void) |
static void | create_seconds (void) |
static int32_t | get_int32_packet_and_log (const struct sol_flow_node *n, uint16_t port, const struct sol_flow_packet *packet) |
static void | on_minutes_packet (void *data, struct sol_flow_node *n, uint16_t port, const struct sol_flow_packet *packet) |
static void | on_seconds_packet (void *data, struct sol_flow_node *n, uint16_t port, const struct sol_flow_packet *packet) |
static void | shutdown (void) |
SOL_MAIN_DEFAULT (startup, shutdown) | |
static void | startup (void) |
Variables | |
static struct sol_flow_node * | minutes |
static uint16_t | minutes_port_enabled |
static uint16_t | minutes_port_out |
static struct sol_flow_node * | seconds |
static uint16_t | seconds_port_enabled |
static uint16_t | seconds_port_out |
Example how to create and use a single node without an associated flow.
This is useful when you need to access a component, send packets to its input ports manually and be notified when it's sending packets on its output ports.
To showcase it we use "wallclock/minute" and "wallclock/second" node types, they use both input and output ports as well as options. Although simple, this is a realistic example since to properly tick at every minute one needs to calculate the expire time to the next minute (not just start a 60s timer) and handle monitoring the system clock for changes.
|
static |
References minutes, minutes_port_enabled, minutes_port_out, on_minutes_packet(), sol_flow_get_node_type, sol_flow_node_named_options_fini(), sol_flow_node_named_options_init_from_strv(), sol_flow_node_options_del(), sol_flow_node_options_new(), SOL_FLOW_SINGLE_CONNECTIONS, sol_flow_single_new(), and sol_quit_with_code().
Referenced by startup().
|
static |
References on_seconds_packet(), seconds, seconds_port_enabled, seconds_port_out, sol_flow_get_node_type, sol_flow_node_named_options_fini(), sol_flow_node_named_options_init_from_strv(), sol_flow_node_options_del(), sol_flow_node_options_new(), SOL_FLOW_SINGLE_CONNECTIONS, sol_flow_single_new(), and sol_quit_with_code().
Referenced by startup().
|
static |
References sol_flow_node_get_type(), sol_flow_packet_get_irange_value(), sol_util_strerrora, and value.
Referenced by on_minutes_packet(), and on_seconds_packet().
|
static |
References get_int32_packet_and_log(), seconds, seconds_port_enabled, seconds_port_out, sol_flow_send_bool_packet(), sol_flow_single_connect_port_out(), sol_flow_single_disconnect_port_out(), and value.
Referenced by create_minutes().
|
static |
References get_int32_packet_and_log().
Referenced by create_seconds().
|
static |
References minutes, seconds, and sol_flow_node_del().
|
static |
References create_minutes(), and create_seconds().
|
static |
Referenced by create_minutes(), and shutdown().
|
static |
Referenced by create_minutes().
|
static |
Referenced by create_minutes().
|
static |
Referenced by create_seconds(), on_minutes_packet(), print_time(), and shutdown().
|
static |
Referenced by create_seconds(), and on_minutes_packet().
|
static |
Referenced by create_seconds(), and on_minutes_packet().