1 #ifndef PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_
2 #define PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_
4 /******************************************************************************
7 * Company XS Embedded GmbH
8 *****************************************************************************/
9 /******************************************************************************
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
12 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 ******************************************************************************/
15 * @file persistence_client_library_dbus_service.h
16 * @ingroup Persistence client library
17 * @author Ingo Huerner
18 * @brief Header of the persistence client library dbus service.
22 #include <dbus/dbus.h>
25 #include <sys/eventfd.h>
26 #include <sys/timerfd.h>
28 /// mutex to make sure main loop is running
29 extern pthread_mutex_t gDbusInitializedMtx;
30 extern pthread_cond_t gDbusInitializedCond;
31 extern pthread_mutex_t gDbusPendingRegMtx;
33 /// command definitions for main loop
36 CMD_NONE = 0, /// command none
37 CMD_PAS_BLOCK_AND_WRITE_BACK, /// command block access and write data back
38 CMD_LC_PREPARE_SHUTDOWN, /// command to prepare shutdown
39 CMD_SEND_NOTIFY_SIGNAL, /// command send changed notification signal
40 CMD_REG_NOTIFY_SIGNAL, /// command send register/unregister command
41 //CMD_SEND_PAS_REQUEST, /// command send admin request
42 CMD_SEND_PAS_REGISTER, /// command send admin register/unregister
43 //CMD_SEND_LC_REQUEST, /// command send lifecycle request
44 CMD_SEND_LC_REGISTER, /// command send lifecycle register/unregister
45 CMD_QUIT /// quit command
49 /// pipe file descriptors
54 * @brief DBus main loop to dispatch events and dbus messages
56 * @param vtable the function pointer tables for '/org/genivi/persistence/adminconsumer' messages
57 * @param vtable2 the function pointer tables for '/com/contiautomotive/NodeStateManager/LifecycleConsumer' messages
58 * @param vtableFallback the fallback function pointer tables
59 * @param userData data to pass to the main loop
63 int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
64 DBusObjectPathVTable vtableFallback, void* userData);
69 * @brief Setup the dbus main dispatching loop
73 int setup_dbus_mainloop(void);
76 int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
79 int deliverToMainloop_NM(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
81 #endif /* PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_ */