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 extern pthread_mutex_t gMainLoopMtx;
35 // declared in persistence_client_library_dbus_service.c
36 // used to end dbus library
39 extern pthread_t gMainLoopThread;
42 /// command definitions for main loop
45 CMD_NONE = 0, /// command none
46 CMD_PAS_BLOCK_AND_WRITE_BACK, /// command block access and write data back
47 CMD_LC_PREPARE_SHUTDOWN, /// command to prepare shutdown
48 CMD_SEND_NOTIFY_SIGNAL, /// command send changed notification signal
49 CMD_REG_NOTIFY_SIGNAL, /// command send register/unregister command
50 //CMD_SEND_PAS_REQUEST, /// command send admin request
51 CMD_SEND_PAS_REGISTER, /// command send admin register/unregister
52 //CMD_SEND_LC_REQUEST, /// command send lifecycle request
53 CMD_SEND_LC_REGISTER, /// command send lifecycle register/unregister
54 CMD_QUIT /// quit command
58 /// pipe file descriptors
63 * @brief DBus main loop to dispatch events and dbus messages
65 * @param vtable the function pointer tables for '/org/genivi/persistence/adminconsumer' messages
66 * @param vtable2 the function pointer tables for '/com/contiautomotive/NodeStateManager/LifecycleConsumer' messages
67 * @param vtableFallback the fallback function pointer tables
68 * @param userData data to pass to the main loop
72 int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
73 DBusObjectPathVTable vtableFallback, void* userData);
78 * @brief Setup the dbus main dispatching loop
82 int setup_dbus_mainloop(void);
85 int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
88 int deliverToMainloop_NM(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
91 #endif /* PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_ */