当前位置: 首页>>代码示例>>C++>>正文


C++ dbus_connection_send_with_reply_and_block函数代码示例

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


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

示例1: test_dbus_call_sync

DBusMessage *
test_dbus_call_sync(DBusConnection *conn, const char *object_path,
                    const char *interface, const char *method,
                    DBusError *error, int first_arg_type, ...)
{
    DBusMessage *message;
    DBusMessage *reply;
    va_list va;

    message = dbus_message_new_method_call(NULL, object_path, interface, method);
    verify_neq(message, NULL);

    va_start(va, first_arg_type);
    verify_eq(dbus_message_append_args_valist(message, first_arg_type, va), TRUE);
    va_end(va);

    reply = dbus_connection_send_with_reply_and_block(conn, message, -1, error);
    dbus_message_unref(message);

    return reply;
}
开发者ID:mmsrubar,项目名称:thesis,代码行数:21,代码来源:common_dbus.c

示例2: asdbus_LogoutGNOME

static Bool asdbus_LogoutGNOME (int mode, int timeout)
{
	Bool requested = False;
#ifdef HAVE_DBUS_CONTEXT
	if (ASDBus.session_conn) {
		DBusMessage *message =
				dbus_message_new_method_call (SESSIONMANAGER_NAME,
																			SESSIONMANAGER_PATH,
																			SESSIONMANAGER_INTERFACE,
																			"Logout");
		if (message) {
			DBusMessage *replay;
			DBusError error;
			DBusMessageIter iter;
			dbus_uint32_t ui32_mode = mode;

			dbus_message_iter_init_append (message, &iter);
			dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &ui32_mode);
			dbus_error_init (&error);
			replay =
					dbus_connection_send_with_reply_and_block (ASDBus.session_conn,
																										 message, timeout,
																										 &error);
			dbus_message_unref (message);

			if (!replay) {
				show_error
						("Failed to request Logout with the Gnome Session Manager. DBus error: %s",
						 dbus_error_is_set (&error) ? error.message : "unknown error");
			} else {										/* nothing is returned in replay to this message */
				dbus_message_unref (replay);
				requested = True;
			}
			if (dbus_error_is_set (&error))
				dbus_error_free (&error);
		}
	}
#endif
	return requested;
}
开发者ID:afterstep,项目名称:afterstep,代码行数:40,代码来源:dbus.c

示例3: select_network

static int select_network(struct supplicant_task *task)
{
	DBusMessage *message, *reply;
	DBusError error;

	_DBG_SUPPLICANT("task %p", task);

	if (task->netpath == NULL)
		return -EINVAL;

	message = dbus_message_new_method_call(SUPPLICANT_NAME, task->path,
				SUPPLICANT_INTF ".Interface", "selectNetwork");
	if (message == NULL)
		return -ENOMEM;

	dbus_message_set_auto_start(message, FALSE);

	dbus_message_append_args(message, DBUS_TYPE_OBJECT_PATH, &task->netpath,
							DBUS_TYPE_INVALID);

	dbus_error_init(&error);

	reply = dbus_connection_send_with_reply_and_block(connection,
							message, -1, &error);
	if (reply == NULL) {
		if (dbus_error_is_set(&error) == TRUE) {
			connman_error("%s", error.message);
			dbus_error_free(&error);
		} else
			connman_error("Failed to select network");
		dbus_message_unref(message);
		return -EIO;
	}

	dbus_message_unref(message);

	dbus_message_unref(reply);

	return 0;
}
开发者ID:wenhann,项目名称:chromiumos,代码行数:40,代码来源:supplicant.c

示例4: unregister_daemon_in_session

static void
unregister_daemon_in_session (DBusConnection *conn)
{
	DBusMessageIter args;
	DBusMessage *msg;
	DBusMessage *reply;
	DBusError derr = { 0 };

	if (client_session_rule) {
		dbus_bus_remove_match (conn, client_session_rule, NULL);
		g_free (client_session_rule);
		client_session_rule = NULL;
	}

	if (!client_session_path)
		return;

	msg = dbus_message_new_method_call (SERVICE_SESSION_MANAGER,
	                                    PATH_SESSION_MANAGER,
	                                    IFACE_SESSION_MANAGER,
	                                    "UnregisterClient");
	g_return_if_fail (msg);

	dbus_message_iter_init_append (msg, &args);
	if (!dbus_message_iter_append_basic (&args, DBUS_TYPE_OBJECT_PATH, &client_session_path))
		g_return_if_reached ();

	reply = dbus_connection_send_with_reply_and_block (conn, msg, 1000, &derr);
	dbus_message_unref (msg);

	if (!reply) {
		g_message ("dbus failure unregistering from session: %s", derr.message);
		return;
	}

	dbus_message_unref (reply);

	g_free (client_session_path);
	client_session_path = NULL;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:40,代码来源:gkd-dbus-session.c

示例5: set_pimd_rp_candidate

u_int32 set_pimd_rp_candidate(u_int32 flag, char *addr, u_int32 priority, u_int32 time)
{
	DBusMessage *query = NULL, *reply = NULL;
	DBusError err = {0};
	u_int32 op_ret = 0;
	u_int32 enable = 1;

	query = dbus_message_new_method_call(PIMD_DBUS_BUSNAME, 
									PIMD_DBUS_OBJPATH, 
									PIMD_DBUS_INTERFACE, 
									PIMD_DBUS_INTERFACE_METHOD_SET_RP_CANDIDATE);
	dbus_error_init(&err);
	dbus_message_append_args(query,
                            DBUS_TYPE_UINT32, &flag,
							DBUS_TYPE_STRING, &addr,
							DBUS_TYPE_UINT32,&priority,
							DBUS_TYPE_UINT32,&time,
							DBUS_TYPE_INVALID);
	reply = dbus_connection_send_with_reply_and_block(dcli_dbus_connection,query,-1, &err);
	dbus_message_unref(query);
	if (NULL == reply) {
		printf("failed get reply.\n");
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
		return 1;
	}
	if (!dbus_message_get_args(reply, &err,
		DBUS_TYPE_UINT32, &op_ret,
		DBUS_TYPE_INVALID)) 
	{
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
	} 

	dbus_message_unref(reply);
	return op_ret;

}
开发者ID:ECYBTech,项目名称:chanos,代码行数:40,代码来源:man_pim.c

示例6: get_pim_mrt_state

u_int32 get_pim_mrt_state()
{
	DBusMessage *query = NULL, *reply = NULL;
	DBusError err = {0};
	u_int32  op_ret = 0;
	
	query = dbus_message_new_method_call(PIMD_DBUS_BUSNAME, 
									PIMD_DBUS_OBJPATH, 
									PIMD_DBUS_INTERFACE, 
									PIMD_DBUS_INTERFACE_METHOD_IPMRT_GETSTATE);
	dbus_error_init(&err);
	reply = dbus_connection_send_with_reply_and_block(dcli_dbus_connection,query,-1, &err);
	dbus_message_unref(query);
	
	if (NULL == reply) {
                  printf("failed get reply.\n");
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
		return 1;
	}
	
	if (dbus_message_get_args(reply, &err,
		DBUS_TYPE_UINT32, &op_ret,
		DBUS_TYPE_INVALID)) 
	{
		dbus_message_unref(reply);
	} 
	else 
        {       
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
		
		dbus_message_unref(reply);
		return 1;
	}
	
	return op_ret;
}
开发者ID:ECYBTech,项目名称:chanos,代码行数:40,代码来源:man_pim.c

示例7: check_authorization

static int check_authorization(DBusConnection *conn)
{
    DBusMessage *msg, *reply;
    DBusMessageIter iter;
    DBusError err;

    msg = dbus_message_new_method_call(AUTHORITY_DBUS, AUTHORITY_PATH,
                                       AUTHORITY_INTF, "CheckAuthorization");
    if (!msg) {
        fprintf(stderr, "Can't allocate new method call\n");
        return -ENOMEM;
    }

    dbus_message_iter_init_append(msg, &iter);
    add_arguments(conn, &iter);

    dbus_error_init(&err);

    reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);

    dbus_message_unref(msg);

    if (!reply) {
        if (dbus_error_is_set(&err)) {
            fprintf(stderr, "%s\n", err.message);
            dbus_error_free(&err);
        } else
            fprintf(stderr, "Can't check authorization\n");
        return -EIO;
    }

    if (dbus_message_has_signature(reply, "(bba{ss})") == TRUE) {
        dbus_message_iter_init(reply, &iter);
        print_arguments(&iter);
    }

    dbus_message_unref(reply);

    return 0;
}
开发者ID:rtiemann,项目名称:connman,代码行数:40,代码来源:polkit-test.c

示例8: dbind_send_and_allow_reentry

DBusMessage *
dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusError *error)
{
  DBusPendingCall *pending;
  SpiReentrantCallClosure *closure;
  const char *unique_name = dbus_bus_get_unique_name (bus);
  const char *destination = dbus_message_get_destination (message);
  struct timeval tv;
  DBusMessage *ret;

  if (unique_name && destination &&
      strcmp (destination, unique_name) != 0)
    return dbus_connection_send_with_reply_and_block (bus, message, dbind_timeout, error);

  closure = g_new0 (SpiReentrantCallClosure, 1);
  closure->reply = NULL;
  atspi_dbus_connection_setup_with_g_main(bus, NULL);
  if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout))
      return NULL;
  if (!pending)
    return NULL;
  dbus_pending_call_set_notify (pending, set_reply, (void *) closure, g_free);

  closure->reply = NULL;
  gettimeofday (&tv, NULL);
  dbus_pending_call_ref (pending);
  while (!closure->reply)
    {
      if (!dbus_connection_read_write_dispatch (bus, dbind_timeout) ||
          time_elapsed (&tv) > dbind_timeout)
        {
          dbus_pending_call_unref (pending);
          return NULL;
        }
    }
  
  ret = closure->reply;
  dbus_pending_call_unref (pending);
  return ret;
}
开发者ID:gloob,项目名称:gloob-s-at-spi2-core,代码行数:40,代码来源:dbind.c

示例9: mapi_get_running_cfg_lib

int mapi_get_running_cfg_lib(char *showStr, int index, DBusConnection *dbus_connection, char *DBUS_METHOD)
{	
    DBusMessage *query, *reply;	
	DBusMessageIter	 iter;
	DBusError err;
	char *tmp_str = NULL;
	
    char BUSNAME[PATH_LEN];
	char OBJPATH[PATH_LEN];
	char INTERFACE[PATH_LEN];
	ReInitFemtoDbusPath(localid,index,IUH_DBUS_BUSNAME,BUSNAME);
	ReInitFemtoDbusPath(localid,index,IUH_DBUS_OBJPATH,OBJPATH);
	ReInitFemtoDbusPath(localid,index,IUH_DBUS_INTERFACE,INTERFACE);
	//printf("aaaaa\n");
	query = dbus_message_new_method_call(BUSNAME,OBJPATH,INTERFACE,DBUS_METHOD);
	//printf("bbbbb\n");
	dbus_error_init(&err);
							 
	reply = dbus_connection_send_with_reply_and_block (dbus_connection,query,-1, &err);
	
	dbus_message_unref(query);

    if (NULL == reply){
		printf("<error> failed get reply.\n");
		if (dbus_error_is_set(&err)){
			printf("%s raised: %s",err.name,err.message);
			dbus_error_free(&err);
		}
		return -1;
	}
	
	dbus_message_iter_init(reply,&iter);
	dbus_message_iter_get_basic(&iter,&tmp_str);

	dbus_message_unref(reply);

	strncpy(showStr, tmp_str, strlen(tmp_str));
	
	return 0;	
}
开发者ID:inibir,项目名称:daemongroup,代码行数:40,代码来源:mapi_hnb.c

示例10: mapi_femto_service_switch

int mapi_femto_service_switch(unsigned int index, int islocal, int slot_id, unsigned int service_type, unsigned int service_switch, DBusConnection *dbus_connection, char *DBUS_METHOD)
{
    DBusMessage *query, *reply; 
    DBusMessageIter  iter;
    DBusError err;
    int ret = 0;
        
    query = dbus_message_new_method_call(HMD_DBUS_BUSNAME,HMD_DBUS_OBJPATH,HMD_DBUS_INTERFACE,DBUS_METHOD);
    
    dbus_error_init(&err);

    dbus_message_append_args(query,
                             DBUS_TYPE_UINT32,&service_type,
                             DBUS_TYPE_UINT32,&service_switch,
                             DBUS_TYPE_UINT32,&index,
                             DBUS_TYPE_UINT32,&islocal,
                             DBUS_TYPE_UINT32,&slot_id,
                             DBUS_TYPE_INVALID);
    
    reply = dbus_connection_send_with_reply_and_block (dbus_connection,query,-1, &err);
    
    dbus_message_unref(query);
    
    if (NULL == reply) {
        printf("<error> failed get reply.\n");
        if (dbus_error_is_set(&err)) {
            printf("%s raised: %s",err.name,err.message);
            dbus_error_free(&err);
        }
        return -1;
    }
    
    dbus_message_iter_init(reply,&iter);
    dbus_message_iter_get_basic(&iter,&ret);

    dbus_message_unref(reply);

    return ret;

}
开发者ID:inibir,项目名称:daemongroup,代码行数:40,代码来源:mapi_hnb.c

示例11: rdc_log_all_sockclient

int
rdc_log_all_sockclient( DBusConnection *connection,
							int hansitype,int insid)
{
	DBusMessage *query = NULL;
	DBusMessage *reply = NULL;
	DBusError err = {0};
	int iRet = 0;

	rdc_dbus_path_reinit(hansitype,insid);
	query = dbus_message_new_method_call(
									RDC_DBUS_NAME,
									RDC_DBUS_OBJPATH,
									RDC_DBUS_INTERFACE,
									RDC_DBUS_METHOD_LOG_ALL_SOCKCLIENT);

	dbus_error_init(&err);
	dbus_message_append_args(	query,
								DBUS_TYPE_INVALID );

	reply = dbus_connection_send_with_reply_and_block (
						connection, query, -1, &err );

	dbus_message_unref(query);
	
	if ( NULL == reply ){	
		if (dbus_error_is_set(&err)){
			dbus_error_free(&err);
		}
		return EAG_ERR_DBUS_FAILED;
	}else{
		dbus_message_get_args( reply,
								&err,
								DBUS_TYPE_INT32, &iRet,
								DBUS_TYPE_INVALID );
	}
	
	dbus_message_unref(reply);	
	return iRet;
}
开发者ID:inibir,项目名称:daemongroup,代码行数:40,代码来源:rdc_interface.c

示例12: ibus_connection_send_with_reply_and_block

IBusMessage *
ibus_connection_send_with_reply_and_block (IBusConnection   *connection,
        IBusMessage      *message,
        gint              timeout_milliseconds,
        IBusError        **error)
{
    g_assert (IBUS_IS_CONNECTION (connection));
    g_assert (message != NULL);
    g_assert (timeout_milliseconds > 0 || timeout_milliseconds == -1);

    IBusError *_error;
    IBusMessage *reply;
    IBusConnectionPrivate *priv;
    priv = IBUS_CONNECTION_GET_PRIVATE (connection);

    _error = ibus_error_new ();

    reply = dbus_connection_send_with_reply_and_block (priv->connection,
            message,
            timeout_milliseconds,
            _error);

    if (reply != NULL) {
        g_signal_emit (connection,
                       connection_signals[IBUS_MESSAGE_SENT],
                       0,
                       message);
        ibus_error_free (_error);
    }
    else {
        if (error != NULL) {
            *error = _error;
        }
        else {
            ibus_error_free (_error);
        }
    }

    return reply;
}
开发者ID:XueWei,项目名称:ibus,代码行数:40,代码来源:ibusconnection.c

示例13: conf_drp_dbus_method_log_debug

int
conf_drp_dbus_method_log_debug ( DBusConnection *conn, 
									int loglevel)
{
	DBusMessage *query, *reply;
	DBusError err;
	int iRet=DRP_ERR_UNKNOWN;
	query = dbus_message_new_method_call(
									DRP_DBUS_BUSNAME,
									DRP_DBUS_OBJPATH,
									DRP_DBUS_INTERFACE, 
									DRP_DBUS_METHOD_LOG_DEBUG );
	dbus_error_init(&err);
	
	dbus_message_append_args(	query,
								DBUS_TYPE_INT32,  &loglevel,
								DBUS_TYPE_INVALID );

	reply = dbus_connection_send_with_reply_and_block ( conn, query, -1, &err );

	dbus_message_unref(query);
	
	if ( NULL == reply ){	
		if (dbus_error_is_set(&err)){
			dbus_error_free(&err);
		}
		return DRP_ERR_DBUS_FAILED;
	}else{
		dbus_message_get_args(	reply,
								&err,
								DBUS_TYPE_INT32, &iRet,
								DBUS_TYPE_INVALID );
	}

	
	dbus_message_unref(reply);
	
	return iRet;
}
开发者ID:inibir,项目名称:daemongroup,代码行数:39,代码来源:drp_interface.c

示例14: systemd_kodi_init

int systemd_kodi_init(void)
{
    DBusMessage *msg, *response;
    DBusError err;
    const char *unit_name = "kodi.service";
    const char *unit_mode = "replace";

    dbus_error_init(&err);

    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
    if(dbus_error_is_set(&err)) {
        fprintf(stderr, "failed to open dbus: %s\n", err.message);
        return -1;
    }

    msg = dbus_message_new_method_call(
            "org.freedesktop.systemd1",
            "/org/freedesktop/systemd1",
            "org.freedesktop.systemd1.Manager",
            "GetUnit");

    if(!msg) {
        fprintf(stderr, "failed to create dbus message\n");
        return -1;
    }
    dbus_message_append_args(msg, DBUS_TYPE_STRING, &unit_name, DBUS_TYPE_INVALID);

    response = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);

    if(dbus_error_is_set(&err)) {
        fprintf(stderr, "failed to get systemd unit: %s\n", err.message);
        dbus_message_unref(msg);
        return -1;
    }

    dbus_message_unref(msg);
    dbus_message_unref(response);
    return 0;
}
开发者ID:beralt,项目名称:hidmap,代码行数:39,代码来源:systemd_kodi.c

示例15: main

int main() {
    DBusConnection *connection = NULL;
    DBusError error;
    DBusMessage *msgQuery = NULL;
    DBusMessage *msgReply = NULL;
    DBusMessageIter arg;
    const char *busName = "org.jinhui.dbus";
 
    dbus_error_init(&error);
    connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
    check_and_abort(&error);
 
 
    msgQuery = dbus_message_new_method_call(
        busName,
        "/",
        "org.jinhui.iface",
        "hello");

    char *buffer="hello dbus service";

    dbus_message_iter_init_append (msgQuery,&arg);
    if(!dbus_message_iter_append_basic (&arg,DBUS_TYPE_STRING,&buffer)){
        fprintf(stderr,"Out Of Memory!/n");
        return -1;
    }
 
    msgReply = dbus_connection_send_with_reply_and_block(connection, msgQuery, 1000, &error);
    check_and_abort(&error);
    dbus_message_unref(msgQuery);
    
    char *res;
    dbus_message_get_args(msgReply, &error, DBUS_TYPE_STRING, &res);
	printf("Received :  %s\n", res);
     
    dbus_message_unref(msgReply);
     
    return 0;
}
开发者ID:lt66ds,项目名称:learning-dbus,代码行数:39,代码来源:dbus-caller.c


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