本文整理汇总了C++中dbus_connection_close函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_connection_close函数的具体用法?C++ dbus_connection_close怎么用?C++ dbus_connection_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_connection_close函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ldbus_connection_gc
static int ldbus_connection_gc(lua_State *L) {
lDBusConnection *udata = check_lDBusConnection(L, 1);
if (udata->close) {
/* You must close a connection prior to releasing the last reference to the connection.
If you dbus_connection_unref() for the last time without closing the connection,
the results are undefined
*/
dbus_connection_close(udata->connection);
}
dbus_connection_unref(udata->connection);
return 0;
}
开发者ID:dodo,项目名称:ldbus,代码行数:15,代码来源:connection.c
示例2: DestroyConnection
static void DestroyConnection(struct DriverConnection *conn) {
api_("DestroyConnection(conn=%p {pid=%d dbus_conn=%p objpath='%s'})",
conn, conn->pid, conn->dbus, conn->objpath);
if (conn->dbus) {
verbose_("close and unref DBus conn=%p", conn->dbus);
dbus_connection_close(conn->dbus);
dbus_connection_unref(conn->dbus);
conn->dbus = NULL;
}
if (conn->pid > 0) {
TerminateChild(conn->pid);
conn->pid = 0;
}
}
开发者ID:google,项目名称:bzip2-rpc,代码行数:15,代码来源:bz2-stub-dbus.c
示例3: pa_dbus_wrap_connection_free
void pa_dbus_wrap_connection_free(pa_dbus_wrap_connection* c) {
pa_assert(c);
if (dbus_connection_get_is_connected(c->connection)) {
dbus_connection_close(c->connection);
/* must process remaining messages, bit of a kludge to handle
* both unload and shutdown */
while (dbus_connection_read_write_dispatch(c->connection, -1))
;
}
c->mainloop->defer_free(c->dispatch_event);
dbus_connection_unref(c->connection);
pa_xfree(c);
}
开发者ID:Klayv,项目名称:pulseaudio,代码行数:15,代码来源:dbus-util.c
示例4: server_done
static void server_done(Server *s) {
assert(s);
while (s->fifos)
fifo_free(s->fifos);
if (s->epoll_fd >= 0)
close_nointr_nofail(s->epoll_fd);
if (s->bus) {
dbus_connection_flush(s->bus);
dbus_connection_close(s->bus);
dbus_connection_unref(s->bus);
}
}
开发者ID:lynxis,项目名称:systemd,代码行数:15,代码来源:initctl.c
示例5: main
int main()
{
DBusError err;
DBusConnection* conn;
int ret;
dbus_uint32_t serial = 0; // unique number to associate replies with requests
DBusMessage* msg;
DBusMessageIter args;
dbus_error_init(&err);
conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
if (dbus_error_is_set(&err)) {
fprintf(stderr, "Connection Error (%s)\n", err.message);
dbus_error_free(&err);
}
if (NULL == conn) {
exit(1);
}
// create a signal and check for errors
msg = dbus_message_new_signal("/test/signal/Object", // object name of the signal
"test.signal.Type", // interface name of the signal
"Test"); // name of the signal
if (NULL == msg)
{
fprintf(stderr, "Message Null\n");
exit(1);
}
// append arguments onto signal
dbus_message_iter_init_append(msg, &args);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &sigvalue)) {
fprintf(stderr, "Out Of Memory!\n");
exit(1);
}
// send the message and flush the connection
if (!dbus_connection_send(conn, msg, &serial)) {
fprintf(stderr, "Out Of Memory!\n");
exit(1);
}
dbus_connection_flush(conn);
// free the message
dbus_message_unref(msg);
dbus_connection_close(conn);
return 0;
}
开发者ID:slapin,项目名称:dbus-tools,代码行数:48,代码来源:dbus.c
示例6: message
CLogindUPowerSyscall::CLogindUPowerSyscall()
{
m_delayLockFd = -1;
m_lowBattery = false;
CLog::Log(LOGINFO, "Selected Logind/UPower as PowerSyscall");
// Check if we have UPower. If not, we avoid any battery related operations.
CDBusMessage message("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", "EnumerateDevices");
m_hasUPower = message.SendSystem() != NULL;
if (!m_hasUPower)
CLog::Log(LOGINFO, "LogindUPowerSyscall - UPower not found, battery information will not be available");
m_canPowerdown = LogindCheckCapability("CanPowerOff");
m_canReboot = LogindCheckCapability("CanReboot");
m_canHibernate = LogindCheckCapability("CanHibernate");
m_canSuspend = LogindCheckCapability("CanSuspend");
InhibitDelayLock();
m_batteryLevel = 0;
if (m_hasUPower)
UpdateBatteryLevel();
DBusError error;
dbus_error_init(&error);
m_connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
if (dbus_error_is_set(&error))
{
CLog::Log(LOGERROR, "LogindUPowerSyscall: Failed to get dbus connection: %s", error.message);
dbus_connection_close(m_connection);
dbus_connection_unref(m_connection);
m_connection = NULL;
dbus_error_free(&error);
return;
}
dbus_connection_set_exit_on_disconnect(m_connection, false);
dbus_bus_add_match(m_connection, "type='signal',interface='org.freedesktop.login1.Manager',member='PrepareForSleep'", NULL);
if (m_hasUPower)
dbus_bus_add_match(m_connection, "type='signal',interface='org.freedesktop.UPower',member='DeviceChanged'", NULL);
dbus_connection_flush(m_connection);
dbus_error_free(&error);
}
开发者ID:Dreamer-4pda,项目名称:kodi-cmake,代码行数:48,代码来源:LogindUPowerSyscall.cpp
示例7: TestModuleIf
TInt Cstif_3::stif_dbus_connection_preallocate_send0( CStifItemParser& aItem )
{
TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests );
TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );
DBusConnection* connection;
DBusError error;
DBusMessage* msg;
char error_name[40];
char error_msg[40];
DBusPreallocatedSend* resource;
dbus_error_init(&error);
connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);
if(!connection)
{
sprintf(error_name, "Error_name : %s", error.name);
iLog->Log(_L8(error_name));
sprintf(error_msg, "Error_msg : %s", error.message);
iLog->Log(_L8(error_msg));
return 1;
}
resource = dbus_connection_preallocate_send( connection );
dbus_connection_free_preallocated_send(connection,resource);
if(resource == NULL)
{
iLog->Log(_L8("Preallocates resources needed to send a message is failed "));
iLog->Log(_L8(" test case Failed"));
return 1;
}
else
iLog->Log(_L8("Preallocation of resources needed to send a message is been created "));
iLog->Log( KSuccess );
dbus_connection_close(connection);
dbus_connection_unref(connection);
dbus_shutdown();
return KErrNone;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:48,代码来源:stif_3Blocks.cpp
示例8: wpa_supplicant_dbus_ctrl_iface_deinit
/**
* wpa_supplicant_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface
* @iface: Pointer to dbus private data from
* wpa_supplicant_dbus_ctrl_iface_init()
*
* Deinitialize the dbus control interface that was initialized with
* wpa_supplicant_dbus_ctrl_iface_init().
*/
void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface)
{
if (iface == NULL)
return;
if (iface->con) {
dbus_connection_set_watch_functions(iface->con, NULL, NULL,
NULL, NULL, NULL);
dbus_connection_set_timeout_functions(iface->con, NULL, NULL,
NULL, NULL, NULL);
dbus_connection_close(iface->con);
}
memset(iface, 0, sizeof(struct ctrl_iface_dbus_priv));
free(iface);
}
开发者ID:vutukurikishore,项目名称:wpa_supplicant,代码行数:24,代码来源:ctrl_iface_dbus.c
示例9: gupnp_network_manager_is_available
gboolean
gupnp_network_manager_is_available (GMainContext *main_context)
{
DBusConnection *connection;
DBusError derror;
DBusGConnection *gconnection;
DBusGProxy *dbus_proxy;
GError *error = NULL;
gboolean ret = FALSE;
/* Do fake open to initialize types */
dbus_g_connection_open ("", NULL);
dbus_error_init (&derror);
connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &derror);
if (connection == NULL) {
g_message ("Failed to connect to System Bus: %s",
derror.message);
return FALSE;
}
dbus_connection_setup_with_g_main (connection, main_context);
gconnection = dbus_connection_get_g_connection (connection);
dbus_proxy = dbus_g_proxy_new_for_name (gconnection,
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
if (!dbus_g_proxy_call (dbus_proxy,
"NameHasOwner",
&error,
G_TYPE_STRING, DBUS_SERVICE_NM,
G_TYPE_INVALID,
G_TYPE_BOOLEAN, &ret,
G_TYPE_INVALID)) {
g_warning ("%s.NameHasOwner() failed: %s",
DBUS_INTERFACE_DBUS,
error->message);
g_error_free (error);
}
g_object_unref (dbus_proxy);
dbus_connection_close (connection);
dbus_g_connection_unref (gconnection);
return ret;
}
开发者ID:ZachGoldberg,项目名称:gupnp-gi,代码行数:47,代码来源:gupnp-network-manager.c
示例10: no_bus_thread_func
static void*
no_bus_thread_func (void *data)
{
DBusError error;
GMainContext *context;
DBusConnection *connection;
ClientData cd;
g_printerr ("Starting client thread %p\n", g_thread_self());
dbus_error_init (&error);
connection = dbus_connection_open_private (messages_address, &error);
if (connection == NULL)
{
g_printerr ("could not open connection: %s\n", error.message);
dbus_error_free (&error);
exit (1);
}
context = g_main_context_new ();
cd.iterations = 1;
cd.loop = g_main_loop_new (context, FALSE);
if (!dbus_connection_add_filter (connection,
no_bus_client_filter, &cd, NULL))
g_error ("no memory");
dbus_connection_setup_with_g_main (connection, context);
g_printerr ("Client thread sending message to prime pingpong\n");
send_echo_method_call (connection);
g_printerr ("Client thread sent message\n");
g_printerr ("Client thread entering main loop\n");
g_main_loop_run (cd.loop);
g_printerr ("Client thread %p exiting main loop\n",
g_thread_self());
dbus_connection_close (connection);
g_main_loop_unref (cd.loop);
g_main_context_unref (context);
return NULL;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:dbus__dbus-qt3,代码行数:47,代码来源:test-profile.c
示例11: avahi_client_free
void avahi_client_free(AvahiClient *client) {
assert(client);
if (client->bus)
/* Disconnect in advance, so that the free() functions won't
* issue needless server calls */
#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(client->bus);
#else
dbus_connection_disconnect(client->bus);
#endif
while (client->groups)
avahi_entry_group_free(client->groups);
while (client->domain_browsers)
avahi_domain_browser_free(client->domain_browsers);
while (client->service_browsers)
avahi_service_browser_free(client->service_browsers);
while (client->service_type_browsers)
avahi_service_type_browser_free(client->service_type_browsers);
while (client->service_resolvers)
avahi_service_resolver_free(client->service_resolvers);
while (client->host_name_resolvers)
avahi_host_name_resolver_free(client->host_name_resolvers);
while (client->address_resolvers)
avahi_address_resolver_free(client->address_resolvers);
while (client->record_browsers)
avahi_record_browser_free(client->record_browsers);
if (client->bus)
dbus_connection_unref(client->bus);
avahi_free(client->version_string);
avahi_free(client->host_name);
avahi_free(client->host_name_fqdn);
avahi_free(client->domain_name);
avahi_free(client);
}
开发者ID:EBone,项目名称:Faust,代码行数:46,代码来源:client.c
示例12: Close
static void Close ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*) p_this;
intf_sys_t *p_sys = p_intf->p_sys;
playlist_t *p_playlist = p_sys->p_playlist;
vlc_cancel( p_sys->thread );
vlc_join( p_sys->thread, NULL );
var_DelCallback( p_playlist, "input-current", AllCallback, p_intf );
var_DelCallback( p_playlist, "volume", AllCallback, p_intf );
var_DelCallback( p_playlist, "mute", AllCallback, p_intf );
var_DelCallback( p_playlist, "playlist-item-append", AllCallback, p_intf );
var_DelCallback( p_playlist, "playlist-item-deleted", AllCallback, p_intf );
var_DelCallback( p_playlist, "random", AllCallback, p_intf );
var_DelCallback( p_playlist, "repeat", AllCallback, p_intf );
var_DelCallback( p_playlist, "loop", AllCallback, p_intf );
var_DelCallback( p_playlist, "fullscreen", AllCallback, p_intf );
if( p_sys->p_input )
{
var_DelCallback( p_sys->p_input, "intf-event", InputCallback, p_intf );
var_DelCallback( p_sys->p_input, "can-pause", AllCallback, p_intf );
var_DelCallback( p_sys->p_input, "can-seek", AllCallback, p_intf );
vlc_object_release( p_sys->p_input );
}
/* The dbus connection is private, so we are responsible
* for closing it */
dbus_connection_close( p_sys->p_conn );
dbus_connection_unref( p_sys->p_conn );
// Free the events array
for( int i = 0; i < vlc_array_count( p_sys->p_events ); i++ )
{
callback_info_t* info = vlc_array_item_at_index( p_sys->p_events, i );
free( info );
}
vlc_mutex_destroy( &p_sys->lock );
vlc_array_destroy( p_sys->p_events );
vlc_array_destroy( p_sys->p_timeouts );
vlc_array_destroy( p_sys->p_watches );
vlc_close( p_sys->p_pipe_fds[1] );
vlc_close( p_sys->p_pipe_fds[0] );
free( p_sys );
}
开发者ID:etix,项目名称:vlc,代码行数:46,代码来源:dbus.c
示例13: joy_dbus_new
JoyDBus *
joy_dbus_new(JoyApplication *app, const gchar *address, GError **error)
{
joy_return_error_if_fail(JOY_IS_APPLICATION(app), NULL, error);
joy_return_error_if_fail(address, NULL, error);
DBusError dbus_error;
dbus_error_init(&dbus_error);
DBusConnection *connection = dbus_connection_open_private(address,
&dbus_error);
if (!connection) {
g_set_error(error, JOY_ERROR, JOY_ERROR_DBUS,
"%s", dbus_error.message);
goto error;
}
if (!dbus_bus_register(connection, &dbus_error)) {
g_set_error(error, JOY_ERROR, JOY_ERROR_DBUS,
"%s", dbus_error.message);
goto error;
}
JoyDBus *self = g_object_new(JOY_TYPE_DBUS,
"application", app,
"connection", connection,
NULL);
if (!self) {
g_set_error_literal(error, JOY_ERROR, JOY_ERROR_NO_MEMORY,
Q_("out of memory"));
goto error;
}
if (!dbus_connection_set_watch_functions(connection, add, remove,
toggled, self, NULL)) {
g_set_error_literal(error, JOY_ERROR, JOY_ERROR_NO_MEMORY,
Q_("out of memory"));
goto error;
}
return self;
error:
dbus_error_free(&dbus_error);
if (connection) {
if (dbus_connection_get_is_connected(connection)) {
dbus_connection_close(connection);
}
dbus_connection_unref(connection);
}
return NULL;
}
开发者ID:msteinert,项目名称:joybubbles,代码行数:45,代码来源:dbus.c
示例14: main
int main(int argc, char *argv[]) {
int r, retval = EXIT_FAILURE;
DBusConnection *bus = NULL;
DBusError error;
dbus_error_init(&error);
setlocale(LC_ALL, "");
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
if (r < 0)
goto finish;
else if (r == 0) {
retval = EXIT_SUCCESS;
goto finish;
}
if (arg_transport == TRANSPORT_NORMAL)
bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
else if (arg_transport == TRANSPORT_POLKIT)
bus_connect_system_polkit(&bus, &error);
else if (arg_transport == TRANSPORT_SSH)
bus_connect_system_ssh(NULL, arg_host, &bus, &error);
else
assert_not_reached("Uh, invalid transport...");
r = localectl_main(bus, argc, argv, &error);
retval = r < 0 ? EXIT_FAILURE : r;
finish:
if (bus) {
dbus_connection_flush(bus);
dbus_connection_close(bus);
dbus_connection_unref(bus);
}
dbus_error_free(&error);
dbus_shutdown();
pager_close();
return retval;
}
开发者ID:felipec,项目名称:udev-fc,代码行数:45,代码来源:localectl.c
示例15: cleanupNative
static void cleanupNative(JNIEnv* env, jobject object) {
#ifdef HAVE_BLUETOOTH
LOGV("%s", __FUNCTION__);
native_data_t *nat =
(native_data_t *)env->GetIntField(object, field_mNativeData);
if (nat) {
if (!dbus_connection_unregister_object_path (nat->conn, GATT_CLIENT_WATCHER_PATH)) {
LOGE("%s: Can't unregister object path %s for GATT Client watcher!",
__FUNCTION__, GATT_CLIENT_WATCHER_PATH);
}
dbus_connection_close(nat->conn);
env->DeleteGlobalRef(nat->me);
free(nat);
nat = NULL;
}
#endif
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:18,代码来源:com_ti_bluetooth_gatt_BluetoothGattClient.cpp
示例16: dbus_error_init
CDeviceKitDisksProvider::CDeviceKitDisksProvider()
{
dbus_error_init (&m_error);
// TODO: do not use dbus_connection_pop_message() that requires the use of a
// private connection
m_connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &m_error);
dbus_connection_set_exit_on_disconnect(m_connection, false);
dbus_bus_add_match(m_connection, "type='signal',interface='org.freedesktop.DeviceKit.Disks'", &m_error);
dbus_connection_flush(m_connection);
if (dbus_error_is_set(&m_error))
{
CLog::Log(LOGERROR, "DeviceKit.Disks: Failed to attach to signal %s", m_error.message);
dbus_connection_close(m_connection);
dbus_connection_unref(m_connection);
m_connection = NULL;
}
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:18,代码来源:DeviceKitDisksProvider.cpp
示例17: filter_func
static DBusHandlerResult
filter_func (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
if (dbus_message_is_signal (message,
DBUS_INTERFACE_LOCAL,
"Disconnected"))
{
dbus_connection_close (connection);
quit ();
return DBUS_HANDLER_RESULT_HANDLED;
}
else
{
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
}
开发者ID:Distrotech,项目名称:dbus-glib,代码行数:18,代码来源:test-service.c
示例18: dbus_connection_close
CDeviceKitDisksProvider::~CDeviceKitDisksProvider()
{
DeviceMap::iterator itr;
for (itr = m_AvailableDevices.begin(); itr != m_AvailableDevices.end(); ++itr)
delete m_AvailableDevices[itr->first];
m_AvailableDevices.clear();
if (m_connection)
{
dbus_connection_close(m_connection);
dbus_connection_unref(m_connection);
m_connection = NULL;
}
dbus_error_free (&m_error);
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:18,代码来源:DeviceKitDisksProvider.cpp
示例19: dbus_error_init
int OMXControl::dbus_connect(std::string& dbus_name)
{
DBusError error;
dbus_error_init(&error);
if (!(bus = dbus_bus_get_private(DBUS_BUS_SESSION, &error)))
{
CLog::Log(LOGWARNING, "dbus_bus_get_private(): %s", error.message);
goto fail;
}
dbus_connection_set_exit_on_disconnect(bus, FALSE);
if (dbus_bus_request_name(
bus,
dbus_name.c_str(),
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
{
if (dbus_error_is_set(&error))
{
CLog::Log(LOGWARNING, "dbus_bus_request_name(): %s", error.message);
goto fail;
}
CLog::Log(LOGWARNING, "Failed to acquire D-Bus name '%s'", dbus_name.c_str());
goto fail;
}
return 0;
fail:
if (dbus_error_is_set(&error))
dbus_error_free(&error);
if (bus)
{
dbus_connection_close(bus);
dbus_connection_unref(bus);
bus = NULL;
}
return -1;
}
开发者ID:entrusc,项目名称:omxplayer,代码行数:44,代码来源:OMXControl.cpp
示例20: client_set_state
static void client_set_state(AvahiClient *client, AvahiClientState state) {
assert(client);
if (client->state == state)
return;
client->state = state;
switch (client->state) {
case AVAHI_CLIENT_FAILURE:
if (client->bus) {
#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(client->bus);
#else
dbus_connection_disconnect(client->bus);
#endif
dbus_connection_unref(client->bus);
client->bus = NULL;
}
/* Fall through */
case AVAHI_CLIENT_S_COLLISION:
case AVAHI_CLIENT_S_REGISTERING:
/* Clear cached strings */
avahi_free(client->host_name);
avahi_free(client->host_name_fqdn);
avahi_free(client->domain_name);
client->host_name = NULL;
client->host_name_fqdn = NULL;
client->domain_name = NULL;
break;
case AVAHI_CLIENT_S_RUNNING:
case AVAHI_CLIENT_CONNECTING:
break;
}
if (client->callback)
client->callback (client, state, client->userdata);
}
开发者ID:EBone,项目名称:Faust,代码行数:44,代码来源:client.c
注:本文中的dbus_connection_close函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论