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
Macros | Functions
find-type.c File Reference

Example how to find a node type given its name, then print its description such as ports and options. More...

#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <dlfcn.h>
#include "sol-flow.h"
#include "sol-flow-resolver.h"
#include "sol-util-file.h"
#include "soletta.h"

Macros

#define CHECK_TYPE_API_VERSION(type,...)
 
#define CHECK_TYPE_DESC_API_VERSION(type,...)
 
#define FLOWMODULESDIR   MODULESDIR "/flow"
 
#define MODULESDIR   "/usr/lib/soletta/modules"
 

Functions

static bool cb_print_type_name (void *data, const struct sol_flow_node_type *type)
 
static void print_type (const struct sol_flow_node_type *type)
 
static void show_builtins (void)
 
static void show_help (void)
 
static void show_module_types (const char *modname)
 
static void show_resolved_type (const char *name)
 
static void shutdown (void)
 
 SOL_MAIN_DEFAULT (startup, shutdown)
 
static void startup (void)
 

Detailed Description

Example how to find a node type given its name, then print its description such as ports and options.

Macro Definition Documentation

#define CHECK_TYPE_API_VERSION (   type,
  ... 
)
Value:
do { \
if (type->api_version != SOL_FLOW_NODE_TYPE_API_VERSION) { \
fprintf(stderr, "ERROR: type=%p has api_version=%" PRIu16 \
" while %" PRIu16 " was expected.\n", \
type, type->api_version, SOL_FLOW_NODE_TYPE_API_VERSION); \
return __VA_ARGS__; \
} \
} while (0)
#define SOL_FLOW_NODE_TYPE_API_VERSION
Compile time API version to be checked during runtime.
Definition: sol-flow.h:799
Examples:
/src/samples/flow/c-api/find-type.c.

Referenced by cb_print_type_name(), and print_type().

#define CHECK_TYPE_DESC_API_VERSION (   type,
  ... 
)
Value:
do { \
if (!type->description) { \
fprintf(stderr, "ERROR: type=%p has no description.\n", type); \
return __VA_ARGS__; \
} \
if (type->description->api_version != SOL_FLOW_NODE_TYPE_DESCRIPTION_API_VERSION) { \
fprintf(stderr, "ERROR: type=%p description->api_version=%" PRIu16 \
" while %" PRIu16 " was expected.\n", \
type, type->description->api_version, SOL_FLOW_NODE_TYPE_DESCRIPTION_API_VERSION); \
return __VA_ARGS__; \
} \
} while (0)
Examples:
/src/samples/flow/c-api/find-type.c.

Referenced by cb_print_type_name(), and print_type().

#define FLOWMODULESDIR   MODULESDIR "/flow"
#define MODULESDIR   "/usr/lib/soletta/modules"

Function Documentation

static bool cb_print_type_name ( void *  data,
const struct sol_flow_node_type type 
)
static
static void print_type ( const struct sol_flow_node_type type)
static
static void show_builtins ( void  )
static
static void show_help ( void  )
static
Examples:
/src/samples/flow/c-api/find-type.c.

References sol_argv().

Referenced by startup().

static void show_module_types ( const char *  modname)
static
static void show_resolved_type ( const char *  name)
static
static void shutdown ( void  )
static
SOL_MAIN_DEFAULT ( startup  ,
shutdown   
)
static void startup ( void  )
static