3 title: Functions of class afb_daemon
5 https://git.automotivelinux.org/src/app-framework-binder/plain/docs/reference-v3/func-daemon.md?h=master
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/app-framework-binder-developer-guides-api-services-book.yml -->
10 Functions of class **afb_daemon**
11 ============================
13 All the functions of the class **afb_daemon** use the default api.
14 This are internally aliased to the corresponding function of class afb_api_t.
18 * Retrieves the common systemd's event loop of AFB
20 struct sd_event *afb_daemon_get_event_loop();
23 * Retrieves the common systemd's user/session d-bus of AFB
25 struct sd_bus *afb_daemon_get_user_bus();
28 * Retrieves the common systemd's system d-bus of AFB
30 struct sd_bus *afb_daemon_get_system_bus();
33 * Broadcasts widely the event of 'name' with the data 'object'.
34 * 'object' can be NULL.
36 * For convenience, the function calls 'json_object_put' for 'object'.
37 * Thus, in the case where 'object' should remain available after
38 * the function returns, the function 'json_object_get' shall be used.
40 * Calling this function is only forbidden during preinit.
42 * Returns the count of clients that received the event.
44 int afb_daemon_broadcast_event(
46 struct json_object *object);
49 * Creates an event of 'name' and returns it.
51 * Calling this function is only forbidden during preinit.
53 * See afb_event_is_valid to check if there is an error.
55 afb_event_t afb_daemon_make_event(
59 * @deprecated use bindings version 3
61 * Send a message described by 'fmt' and following parameters
62 * to the journal for the verbosity 'level'.
64 * 'file', 'line' and 'func' are indicators of position of the code in source files
65 * (see macros __FILE__, __LINE__ and __func__).
67 * 'level' is defined by syslog standard:
68 * EMERGENCY 0 System is unusable
69 * ALERT 1 Action must be taken immediately
70 * CRITICAL 2 Critical conditions
71 * ERROR 3 Error conditions
72 * WARNING 4 Warning conditions
73 * NOTICE 5 Normal but significant condition
74 * INFO 6 Informational
75 * DEBUG 7 Debug-level messages
77 void afb_daemon_verbose(
86 * @deprecated use bindings version 3
88 * Get the root directory file descriptor. This file descriptor can
89 * be used with functions 'openat', 'fstatat', ...
91 * Returns the file descriptor or -1 in case of error.
93 int afb_daemon_rootdir_get_fd();
96 * Opens 'filename' within the root directory with 'flags' (see function openat)
97 * using the 'locale' definition (example: "jp,en-US") that can be NULL.
99 * Returns the file descriptor or -1 in case of error.
101 int afb_daemon_rootdir_open_locale(
102 const char *filename,
107 * Queue the job defined by 'callback' and 'argument' for being executed asynchronously
108 * in this thread (later) or in an other thread.
109 * If 'group' is not NUL, the jobs queued with a same value (as the pointer value 'group')
110 * are executed in sequence in the order of there submission.
111 * If 'timeout' is not 0, it represent the maximum execution time for the job in seconds.
112 * At first, the job is called with 0 as signum and the given argument.
113 * The job is executed with the monitoring of its time and some signals like SIGSEGV and
114 * SIGFPE. When a such signal is catched, the job is terminated and reexecuted but with
115 * signum being the signal number (SIGALRM when timeout expired).
117 * Returns 0 in case of success or -1 in case of error.
119 int afb_daemon_queue_job(
120 void (*callback)(int signum, void *arg),
126 * Tells that it requires the API of "name" to exist
127 * and if 'initialized' is not null to be initialized.
128 * Calling this function is only allowed within init.
130 * Returns 0 in case of success or -1 in case of error.
132 int afb_daemon_require_api(
137 * Create an aliased name 'as_name' for the api 'name'.
138 * Calling this function is only allowed within preinit.
140 * Returns 0 in case of success or -1 in case of error.
142 int afb_daemon_add_alias(const char *name, const char *as_name);
145 * Creates a new api of name 'api' with brief 'info'.
147 * Returns 0 in case of success or -1 in case of error.
149 int afb_daemon_new_api(
153 int (*preinit)(void*, struct afb_api_x3 *),