g_ilm_init = ILM_TRUE;
// initialize the dbus connection
dbus_error_init(&g_ilm_client->dbus_error);
- g_ilm_client->dbus_type = DBUS_BUS_SYSTEM;
+ char* useSessionBus = getenv("LM_USE_SESSION_BUS");
+ if ( NULL != useSessionBus && strcmp(useSessionBus,"enable") == 0 )
+ {
+ g_ilm_client->dbus_type = DBUS_BUS_SESSION;
+ }
+ else
+ {
+ g_ilm_client->dbus_type = DBUS_BUS_SYSTEM;
+ }
+
g_ilm_client->dbus_connection = dbus_bus_get(g_ilm_client->dbus_type, &g_ilm_client->dbus_error);
if (!g_ilm_client->dbus_connection)
{
}
else
{
-/* // request name on connection
- dbus_bus_request_name(g_ilm_client->dbus_connection,
- ILM_INTERFACE_COMPOSITE_CLIENT,
- DBUS_NAME_FLAG_REPLACE_EXISTING,
- &g_ilm_client->dbus_error);
-
- if (dbus_error_is_set(&g_ilm_client->dbus_error))
- {
- ILM_ERROR("ilm_init","Can not request name\n");
- dbus_error_free(&g_ilm_client->dbus_error);
- }
- else
- {*/
- result = ILM_SUCCESS;
-/* }*/
+ result = ILM_SUCCESS;
}
}
}
#include "DBUSMessageHandler.h"
#include "DBUSConfiguration.h"
#include <stdlib.h>
+#include <string.h>
#include "Log.h"
DBUSMessageHandler::DBUSMessageHandler()
dbus_error_init(&m_err);
// connect to the bus and check for errors
- m_pConnection = dbus_bus_get(DBUS_BUS_SYSTEM, &m_err);
+ char* useSessionBus = getenv("LM_USE_SESSION_BUS");
+ if ( NULL != useSessionBus && strcmp(useSessionBus,"enable") == 0 )
+ {
+ LOG_INFO("DBUSCommunicator", "Using Session Bus");
+ m_pConnection = dbus_bus_get(DBUS_BUS_SESSION, &m_err);
+ }
+ else
+ {
+ LOG_INFO("DBUSCommunicator", "Using System Bus");
+ m_pConnection = dbus_bus_get(DBUS_BUS_SYSTEM, &m_err);
+ }
+
if (dbus_error_is_set(&m_err))
{
LOG_ERROR("DBUSCommunicator","Connection error");
{
LOG_ERROR("DBUSCommunicator","there was an dbus error");
}
- LOG_INFO("ask about owner name",0);
+ dbus_connection_unregister_object_path(m_pConnection,DBUS_SERVICE_OBJECT_PATH);
+ LOG_INFO("DBUSCommunicator","Ask about owner name");
dbus_bus_name_has_owner(m_pConnection, DBUS_SERVICE_PREFIX, &err);
errorset = dbus_error_is_set(&err);
if (errorset)