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 | Functions | Variables
simple-c-type.c File Reference

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_builderbuilder
 
static struct sol_flow_nodeflow
 
static struct sol_flow_node_typeflow_node_type
 
static struct sol_flow_node_typeisoddtype
 
static struct sol_flow_node_typemytype
 

Detailed Description

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.

Macro Definition Documentation

#define MYTYPE_OPTIONS_SUB_API   0x1234

Function Documentation

static int isodd ( struct sol_flow_node node,
const struct sol_flow_simple_c_type_event ev,
void *  data 
)
static
static int mytype_func ( struct sol_flow_node node,
const struct sol_flow_simple_c_type_event ev,
void *  data 
)
static
static bool on_timeout ( void *  data)
static
static void shutdown ( void  )
static
SOL_MAIN_DEFAULT ( startup  ,
shutdown   
)
static void startup ( void  )
static

Variable Documentation

struct sol_flow_builder* builder
static
struct sol_flow_node* flow
static

Referenced by shutdown(), and startup().

struct sol_flow_node_type* flow_node_type
static
struct sol_flow_node_type* isoddtype
static
struct sol_flow_node_type* mytype
static