• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dbus_pending_call_unref函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dbus_pending_call_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_pending_call_unref函数的具体用法?C++ dbus_pending_call_unref怎么用?C++ dbus_pending_call_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dbus_pending_call_unref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: g_dbus_client_unref

void g_dbus_client_unref(GDBusClient *client)
{
	unsigned int i;

	if (client == NULL)
		return;

	if (__sync_sub_and_fetch(&client->ref_count, 1) > 0)
		return;

	if (client->pending_call != NULL) {
		dbus_pending_call_cancel(client->pending_call);
		dbus_pending_call_unref(client->pending_call);
	}

	if (client->get_objects_call != NULL) {
		dbus_pending_call_cancel(client->get_objects_call);
		dbus_pending_call_unref(client->get_objects_call);
	}

	for (i = 0; i < client->match_rules->len; i++) {
		modify_match(client->dbus_conn, "RemoveMatch",
				g_ptr_array_index(client->match_rules, i));
	}

	g_ptr_array_free(client->match_rules, TRUE);

	dbus_connection_remove_filter(client->dbus_conn,
						message_filter, client);

	g_list_free_full(client->proxy_list, proxy_free);

	/*
	 * Don't call disconn_func twice if disconnection
	 * was previously reported.
	 */
	if (client->disconn_func && client->connected)
		client->disconn_func(client->dbus_conn, client->disconn_data);

	g_dbus_remove_watch(client->dbus_conn, client->watch);
	g_dbus_remove_watch(client->dbus_conn, client->added_watch);
	g_dbus_remove_watch(client->dbus_conn, client->removed_watch);

	dbus_connection_unref(client->dbus_conn);

	g_free(client->service_name);
	g_free(client->base_path);
	g_free(client->root_path);

	g_free(client);
}
开发者ID:AwxiVYTHUIiMOol,项目名称:bluez,代码行数:51,代码来源:client.c


示例2: wicd_interface_cb

static void wicd_interface_cb(DBusPendingCall *pending, void *user_data)
{
	struct connline_context *context = user_data;
	char **properties = NULL;
	struct wicd_dbus *wicd;
	DBusMessageIter arg;
	DBusMessage *reply;
	const char *iface;

	if (dbus_pending_call_get_completed(pending) == FALSE)
		return;

	wicd = context->backend_data;
	wicd->call = NULL;

	reply = dbus_pending_call_steal_reply(pending);
	if (reply == NULL)
		goto error;

	if (dbus_message_iter_init(reply, &arg) == FALSE)
		goto error;

	if (connline_dbus_get_basic(&arg, DBUS_TYPE_STRING, &iface) != 0)
		goto error;

	properties = insert_into_property_list(properties, "bearer",
				connline_bearer_to_string(wicd->bearer));

	properties = insert_into_property_list(properties, "interface", iface);

	properties = insert_into_property_list(properties,
						"address", wicd->ip);

	if (properties != NULL)
		__connline_call_property_callback(context, properties);

	dbus_message_unref(reply);
	dbus_pending_call_unref(pending);

	return;

error:
	if (reply != NULL)
		dbus_message_unref(reply);

	dbus_pending_call_unref(pending);

	wicd_backend_data_cleanup(context);
	__connline_call_error_callback(context, false);
}
开发者ID:connectivity,项目名称:connline,代码行数:50,代码来源:wicd.c


示例3: operation_unref

static gboolean
operation_unref (gpointer data)
{
	GkrOperation *op = data;
	g_assert (op);

	if (!g_atomic_int_dec_and_test (&op->refs))
		return FALSE;

	if (op->pending) {
		dbus_pending_call_cancel (op->pending);
		dbus_pending_call_unref (op->pending);
		op->pending = NULL;
	}

	operation_clear_callbacks (op);

	if (op->conn) {
		dbus_connection_unref (op->conn);
		op->conn = NULL;
	}

	g_slice_free (GkrOperation, op);
	return TRUE;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:25,代码来源:gkr-operation.c


示例4: networkmanager_dbus_send

/**
 * send data for dbus method call
 */
static int networkmanager_dbus_send(DBusMessage** msg, DBusConnection* dbus_connection)
{
	DBusPendingCall* pending;
	int success;

	// send dbus message
	// -1 is the default time out. Other time outs can be configured in milli seconds.
	success = dbus_connection_send_with_reply(dbus_connection, *msg, &pending, -1);
	if(!success)
	{
		printf("networkmanager_dbus_send dbus send error\n");
		return 0;
	}
	if(pending == NULL)
	{
		printf ("networkmanager_dbus_send dbus calling error\n");
		return 0;
	}

	dbus_connection_flush(dbus_connection);
	dbus_message_unref(*msg);
	dbus_pending_call_block(pending);
	*msg = dbus_pending_call_steal_reply(pending);
	dbus_pending_call_unref(pending);

	if(*msg == NULL)
		return 0;

	return 1;
}
开发者ID:anuvazhayil,项目名称:qaul.net,代码行数:33,代码来源:network.c


示例5: modify_match

static gboolean modify_match(DBusConnection *conn, const char *member,
							const char *rule)
{
	DBusMessage *msg;
	DBusPendingCall *call;

	msg = dbus_message_new_method_call(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
					DBUS_INTERFACE_DBUS, member);
	if (msg == NULL)
		return FALSE;

	dbus_message_append_args(msg, DBUS_TYPE_STRING, &rule,
						DBUS_TYPE_INVALID);

	if (g_dbus_send_message_with_reply(conn, msg, &call, -1) == FALSE) {
		dbus_message_unref(msg);
		return FALSE;
	}

	dbus_pending_call_set_notify(call, modify_match_reply, NULL, NULL);
	dbus_pending_call_unref(call);

	dbus_message_unref(msg);

	return TRUE;
}
开发者ID:AwxiVYTHUIiMOol,项目名称:bluez,代码行数:26,代码来源:client.c


示例6: get_calls

static int get_calls(struct modem_data *modem)
{
	DBusMessage *msg;
	DBusPendingCall *call;

	msg = dbus_message_new_method_call(OFONO_SERVICE, modem->path,
				OFONO_CALLMANAGER_INTERFACE, "GetCalls");
	if (msg == NULL)
		return -ENOMEM;

	dbus_message_set_auto_start(msg, FALSE);

	g_print("getting calls (%s)\n", modem->path);

	if (dbus_connection_send_with_reply(modem->conn, msg,
						&call, -1) == FALSE) {
		dbus_message_unref(msg);
		return -EIO;
	}

	dbus_message_unref(msg);

	if (call == NULL)
		return -EINVAL;

	dbus_pending_call_set_notify(call, get_calls_reply, modem, NULL);

	dbus_pending_call_unref(call);

	return 0;
}
开发者ID:Informatic,项目名称:ofono,代码行数:31,代码来源:huawei-audio.c


示例7: dbus_error_init

void
nsNetworkManagerListener::RegisterWithConnection(DBusConnection* connection) {
  DBusError error;
  dbus_error_init(&error);
  
  dbus_bus_add_match(connection,
                     "type='signal',"
                     "interface='" NM_DBUS_INTERFACE "',"
                     "sender='" NM_DBUS_SERVICE "',"
                     "path='" NM_DBUS_PATH "'", &error);
  mOK = !dbus_error_is_set(&error);
  dbus_error_free(&error);
  if (!mOK)
    return;
  
  DBusMessage* msg =
    dbus_message_new_method_call(NM_DBUS_SERVICE, NM_DBUS_PATH,
                                 NM_DBUS_INTERFACE, "state");
  if (!msg) {
    mOK = PR_FALSE;
    return;
  }
  
  DBusPendingCall* reply = mDBUS->SendWithReply(this, msg);
  if (!reply) {
    mOK = PR_FALSE;
    return;
  }

  dbus_pending_call_set_notify(reply, NetworkStatusNotify, this, NULL);
  dbus_pending_call_unref(reply);
}
开发者ID:isleon,项目名称:Jaxer,代码行数:32,代码来源:nsNetworkManagerListener.cpp


示例8: mafw_proxy_renderer_playback_cb

/**
 * mafw_proxy_renderer_playback_cb:
 * @pending_call: A DBusPendingCall that is the reply for a playback call
 * @user_data:    AsyncParams*
 *
 * Receives the resulting DBus reply message for a playback call and calls
 * the assigned callback function to pass the actual result to the UI layer.
 */
static void mafw_proxy_renderer_playback_cb(DBusPendingCall *pending_call,
					 gpointer user_data)
{
	AsyncParams *ap;
	DBusMessage *reply;
	GError *error;

	ap = (AsyncParams*) user_data;
	g_assert(ap != NULL);

	reply = dbus_pending_call_steal_reply(pending_call);
	error = mafw_dbus_is_error(reply, MAFW_RENDERER_ERROR);

	if (error == NULL) {
		if (ap->callback)
			((MafwRendererPlaybackCB) ap->callback)
				(ap->renderer, ap->user_data, NULL);
	} else {
		if (ap->callback)
			((MafwRendererPlaybackCB) ap->callback)
				(ap->renderer, ap->user_data, error);
		g_error_free(error);
	}

	dbus_message_unref(reply);
	dbus_pending_call_unref(pending_call);
}
开发者ID:community-ssu,项目名称:mafw,代码行数:35,代码来源:mafw-proxy-renderer.c


示例9: get_connection_unix_user_reply

static void get_connection_unix_user_reply(DBusPendingCall *call,
						void *user_data)
{
	struct callback_data *data = user_data;
	connman_dbus_get_connection_unix_user_cb_t cb = data->cb;
	DBusMessageIter iter;
	DBusMessage *reply;
	int err = 0;
	unsigned int uid;

	reply = dbus_pending_call_steal_reply(call);

	if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
		DBG("Failed to retrieve UID");
		err = -EIO;
		goto done;
	}

	if (!dbus_message_has_signature(reply, "u")) {
		DBG("Message signature is wrong");
		err = -EINVAL;
		goto done;
	}

	dbus_message_iter_init(reply, &iter);
	dbus_message_iter_get_basic(&iter, &uid);

done:
	(*cb)(uid, data->user_data, err);

	dbus_message_unref(reply);

	dbus_pending_call_unref(call);
}
开发者ID:rzr,项目名称:connman,代码行数:34,代码来源:dbus.c


示例10: property_get_reply

static void property_get_reply(DBusPendingCall *call, void *user_data)
{
	struct property_get_data *data = user_data;
	DBusMessage *reply;
	DBusMessageIter iter;

	reply = dbus_pending_call_steal_reply(call);

	if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
		goto done;

	if (dbus_message_iter_init(reply, &iter) == FALSE)
		goto done;

	if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) {
		DBusMessageIter variant;

		dbus_message_iter_recurse(&iter, &variant);

		if (data->function != NULL)
			data->function(NULL, &variant, data->user_data);
	}
done:
	dbus_message_unref(reply);

	dbus_pending_call_unref(call);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman,代码行数:27,代码来源:dbus.c


示例11: xconnman_get_properties

/** Initiate asynchronous connman properties query
 *
 * @return TRUE if the method call was initiated, or FALSE in case of errors
 */
static gboolean xconnman_get_properties(void)
{
	gboolean         res  = FALSE;
	DBusMessage     *req  = 0;
	DBusPendingCall *pc   = 0;

	if( !(req = dbus_message_new_method_call(CONNMAN_SERVICE,
						 CONNMAN_OBJECT_PATH,
						 CONNMAN_INTERFACE,
						 CONNMAN_GET_PROPERTIES_REQ)) )
		goto EXIT;

	if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
		goto EXIT;

	if( !dbus_pending_call_set_notify(pc, xconnman_get_properties_cb, 0, 0) )
		goto EXIT;

	// success
	res = TRUE;

EXIT:
	if( pc )  dbus_pending_call_unref(pc);
	if( req ) dbus_message_unref(req);

	return res;
}
开发者ID:Vesuri,项目名称:mce,代码行数:31,代码来源:radiostates.c


示例12: _libnm_glib_nm_state_cb

static void
_libnm_glib_nm_state_cb (DBusPendingCall *pcall, void *user_data)
{
	DBusMessage *		reply;
	libnm_glib_ctx *	ctx = (libnm_glib_ctx *) user_data;
	NMState			nm_state;

	g_return_if_fail (pcall != NULL);
	g_return_if_fail (ctx != NULL);

	if (!(reply = dbus_pending_call_steal_reply (pcall)))
		goto out;

	if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
	{
		DBusError err;

		dbus_error_init (&err);
		dbus_set_error_from_message (&err, reply);
		fprintf (stderr, "%s: dbus returned an error.\n  (%s) %s\n", __func__, err.name, err.message);
		dbus_error_free (&err);
		dbus_message_unref (reply);
		goto out;
	}

	if (dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &nm_state, DBUS_TYPE_INVALID))
		_libnm_glib_update_state (ctx, nm_state);

	dbus_message_unref (reply);

out:
	dbus_pending_call_unref (pcall);
}
开发者ID:BtbN,项目名称:NetworkManager,代码行数:33,代码来源:libnm_glib.c


示例13: property_get_all_reply

static void property_get_all_reply(DBusPendingCall *call, void *user_data)
{
	struct property_get_data *data = user_data;
	DBusMessage *reply;
	DBusMessageIter iter;

	reply = dbus_pending_call_steal_reply(call);

	if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
		goto done;

	if (dbus_message_iter_init(reply, &iter) == FALSE)
		goto done;

	supplicant_dbus_property_foreach(&iter, data->function,
							data->user_data);

	if (data->function != NULL)
		data->function(NULL, NULL, data->user_data);

done:
	dbus_message_unref(reply);

	dbus_pending_call_unref(call);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman,代码行数:25,代码来源:dbus.c


示例14: printf

static DBusMessage *excute_method_a(DBusConnection *conn, DBusMessage* msg)
{
    DBusPendingCall* pending;

    if (NULL == msg) {
        printf("Message NULL\n");
        return NULL;
    }

    if (!dbus_connection_send_with_reply(conn, msg, &pending, -1))
    {
        printf("Out Of Memory!");
        return NULL;
    }

    if (NULL == pending) {
        printf("Pending Call Null");
        return NULL;
    }

    dbus_connection_flush(conn);
    dbus_message_unref(msg);

    dbus_pending_call_block(pending);
    msg = dbus_pending_call_steal_reply(pending);
    if (NULL == msg) {
        printf("Reply Null\n");
    }
    dbus_pending_call_unref(pending);

    return msg;
}
开发者ID:jolin90,项目名称:dbus,代码行数:32,代码来源:scan.c


示例15: disconnect_reply

static void disconnect_reply(DBusPendingCall *call, void *user_data)
{
	DBusMessage *reply;
	DBusError error;

	if (dbus_pending_call_get_completed(call) == FALSE)
		return;

	DBG("user %p", user_data);

	reply = dbus_pending_call_steal_reply(call);

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, reply) == TRUE) {
		connman_error("%s", error.message);
		dbus_error_free(&error);
		goto done;
	}

done:
	dbus_message_unref(reply);

	dbus_pending_call_unref(call);
}
开发者ID:manjurajv,项目名称:connman,代码行数:25,代码来源:vpn.c


示例16: remove_connection_reply

static void remove_connection_reply(DBusPendingCall *call, void *user_data)
{
	DBusMessage *reply;
	DBusError error;

	if (dbus_pending_call_get_completed(call) == FALSE)
		return;

	DBG("");

	reply = dbus_pending_call_steal_reply(call);

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, reply) == TRUE) {
		/*
		 * If the returned error is NotFound, it means that we
		 * have actually removed the provider in vpnd already.
		 */
		if (dbus_error_has_name(&error, CONNMAN_ERROR_INTERFACE
						".NotFound") == FALSE)
			connman_error("%s", error.message);

		dbus_error_free(&error);
	}

	dbus_message_unref(reply);

	dbus_pending_call_unref(call);
}
开发者ID:manjurajv,项目名称:connman,代码行数:30,代码来源:vpn.c


示例17: FcitxNotificationItemRegister

void FcitxNotificationItemRegister(FcitxNotificationItem* notificationitem)
{
    if (!notificationitem->serviceName) {
        FcitxLog(ERROR, "This should not happen, please report bug.");
        return;
    }

    DBusMessage *message =
        dbus_message_new_method_call(NOTIFICATION_WATCHER_DBUS_ADDR,
                                     NOTIFICATION_WATCHER_DBUS_OBJ,
                                     NOTIFICATION_WATCHER_DBUS_IFACE,
                                     "RegisterStatusNotifierItem");
    dbus_message_append_args(message,
                             DBUS_TYPE_STRING, &notificationitem->serviceName,
                             DBUS_TYPE_INVALID);

    DBusPendingCall *call = NULL;
    dbus_bool_t reply =
        dbus_connection_send_with_reply(notificationitem->conn, message,
                                        &call, DBUS_TIMEOUT_USE_DEFAULT);
    dbus_message_unref(message);
    if (reply == TRUE) {
        dbus_pending_call_set_notify(call,
                                     FcitxNotificationItemRegisterSuccess,
                                     notificationitem,
                                     NULL);
        dbus_pending_call_unref(call);
    }
}
开发者ID:Nervengift,项目名称:fcitx,代码行数:29,代码来源:notificationitem.c


示例18: xconnman_check_service

/** Initiate asynchronous connman service name ownership query
 *
 * @return TRUE if the method call was initiated, or FALSE in case of errors
 */
static gboolean xconnman_check_service(void)
{
	gboolean         res  = FALSE;
	DBusMessage     *req  = 0;
	DBusPendingCall *pc   = 0;
	const char      *name = CONNMAN_SERVICE;

	if( !(req = dbus_message_new_method_call(DBUS_SERVICE_DBUS,
					   DBUS_PATH_DBUS,
					   DBUS_INTERFACE_DBUS,
					   "GetNameOwner")) )
		goto EXIT;

	if( !dbus_message_append_args(req,
				      DBUS_TYPE_STRING, &name,
				      DBUS_TYPE_INVALID) )
		goto EXIT;

	if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
		goto EXIT;

	if( !dbus_pending_call_set_notify(pc, xconnman_check_service_cb, 0, 0) )
		goto EXIT;

	// success
	res = TRUE;

EXIT:
	if( pc )  dbus_pending_call_unref(pc);
	if( req ) dbus_message_unref(req);

	return res;
}
开发者ID:Vesuri,项目名称:mce,代码行数:37,代码来源:radiostates.c


示例19: register_external_service

static void register_external_service(gpointer a, gpointer b)
{
	DBusConnection *conn = b;
	const char *path = a;
	DBusMessage *msg;
	DBusPendingCall *call;
	DBusMessageIter iter, dict;

	msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
					GATT_MGR_IFACE, "RegisterService");
	if (!msg) {
		printf("Couldn't allocate D-Bus message\n");
		return;
	}

	dbus_message_iter_init_append(msg, &iter);

	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path);

	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &dict);

	/* TODO: Add options dictionary */

	dbus_message_iter_close_container(&iter, &dict);

	if (!g_dbus_send_message_with_reply(conn, msg, &call, -1)) {
		dbus_message_unref(msg);
		return;
	}

	dbus_pending_call_set_notify(call, register_external_service_reply,
								NULL, NULL);

	dbus_pending_call_unref(call);
}
开发者ID:AlanApter,项目名称:steamlink-sdk,代码行数:35,代码来源:gatt-service.c


示例20: finalize_call

static void finalize_call(DBusPendingCall *call)
{
	if (!dbus_pending_call_get_completed(call))
		dbus_pending_call_cancel(call);

	dbus_pending_call_unref(call);
}
开发者ID:dmp0x7c5,项目名称:test-repo,代码行数:7,代码来源:bluetooth.c



注:本文中的dbus_pending_call_unref函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dbus_send函数代码示例发布时间:2022-05-30
下一篇:
C++ dbus_pending_call_steal_reply函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap