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 | Typedefs | Functions | Variables
sol-mainloop.h File Reference

These routines are used for Soletta's mainloop manipulation. More...

#include "sol-common-buildopts.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  sol_main_callbacks
 Structure used to keep the application main callbacks. More...
 
struct  sol_mainloop_implementation
 Structure representing a mainloop implementation (hooks). More...
 
struct  sol_mainloop_source_type
 Structure representing the type of a source of mainloop events. More...
 

Macros

#define SOL_MAIN_CALLBACKS_API_VERSION   (1)
 
#define SOL_MAINLOOP_FD_ENABLED
 This macro is defined by Soletta at build time and will state if file descriptor (fd) functionality is available, this is common in Linux/UNIX environments. More...
 
#define SOL_MAINLOOP_FORK_WATCH_ENABLED
 This macro is defined by Soletta at build time and will state if monitoring (watch) of child process functionality is available, this is common in Linux/UNIX environments. More...
 
#define SOL_MAINLOOP_IMPLEMENTATION_API_VERSION   (1)
 compile time API version to be checked during runtime More...
 
#define SOL_MAINLOOP_SOURCE_TYPE_API_VERSION   (1)
 Compile time API version to be checked during runtime. More...
 
#define SOL_NO_API_VERSION
 This macro is defined by Soletta at build time and will state if api_version structure members and related defines shouldn't be used. More...
 
#define SOL_SET_API_VERSION(expression)
 This macro will cope with SOL_NO_API_VERSION and allows easy declaration of api_version fields. More...
 

Typedefs

typedef struct sol_idle sol_idle
 Handle for idlers. More...
 
typedef struct sol_main_callbacks sol_main_callbacks
 Structure used to keep the application main callbacks. More...
 
typedef struct
sol_mainloop_implementation 
sol_mainloop_implementation
 Structure representing a mainloop implementation (hooks). More...
 
typedef struct sol_mainloop_source sol_mainloop_source
 Structure of a Source of mainloop events. More...
 
typedef struct
sol_mainloop_source_type 
sol_mainloop_source_type
 Structure representing the type of a source of mainloop events. More...
 
typedef struct sol_timeout sol_timeout
 Handle for timers tracking the timeouts. More...
 

Functions

int sol_argc (void)
 Gets the argument count the application was launched with, if any. More...
 
char ** sol_argv (void)
 Gets the list of arguments the application was launched with, if any. More...
 
struct sol_idlesol_idle_add (bool(*cb)(void *data), const void *data)
 Adds a function to be called when the application goes idle. More...
 
bool sol_idle_del (struct sol_idle *handle)
 Deletes the given idler. More...
 
int sol_init (void)
 Initializes the Soletta library. More...
 
struct sol_mainloop_sourcesol_mainloop_add_source (const struct sol_mainloop_source_type *type, const void *data)
 Create a new source of events to the main loop. More...
 
int sol_mainloop_default_main (const struct sol_main_callbacks *callbacks, int argc, char *argv[])
 Helper function called by SOL_MAIN. More...
 
void sol_mainloop_del_source (struct sol_mainloop_source *handle)
 Destroy a source of main loop events. More...
 
const struct
sol_mainloop_implementation
sol_mainloop_get_implementation (void)
 Returns the current mainloop implementation in use. More...
 
bool sol_mainloop_set_implementation (const struct sol_mainloop_implementation *impl)
 Changes the mainloop implementation. More...
 
void * sol_mainloop_source_get_data (const struct sol_mainloop_source *handle)
 Retrieve the user data (context) given to the source at creation time. More...
 
void sol_quit (void)
 Terminates the main loop. More...
 
void sol_quit_with_code (int return_code)
 Terminates the main loop, setting a specific return code. More...
 
int sol_run (void)
 Runs the main loop. More...
 
void sol_set_args (int argc, char *argv[])
 Sets a new list of arguments and its count. More...
 
void sol_shutdown (void)
 Shutdown Soletta library. More...
 
struct sol_timeoutsol_timeout_add (uint32_t timeout_ms, bool(*cb)(void *data), const void *data)
 Adds a function to be called periodically by the main loop. More...
 
bool sol_timeout_del (struct sol_timeout *handle)
 Deletes the given timeout. More...
 

Variables

const struct
sol_mainloop_implementation
SOL_MAINLOOP_IMPLEMENTATION_DEFAULT
 Pointer to Soletta's internal mainloop implementation, that is the default to be used if no other is set. More...
 

Detailed Description

These routines are used for Soletta's mainloop manipulation.

Macro Definition Documentation

#define SOL_MAIN_CALLBACKS_API_VERSION   (1)
#define SOL_MAINLOOP_IMPLEMENTATION_API_VERSION   (1)

compile time API version to be checked during runtime

#define SOL_MAINLOOP_SOURCE_TYPE_API_VERSION   (1)

Compile time API version to be checked during runtime.