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

C++ dbus_message_get_type函数代码示例

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

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



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

示例1: g_dbus_send_message

gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
{
	dbus_bool_t result = FALSE;

	if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
		dbus_message_set_no_reply(message, TRUE);
	else if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL) {
		const char *path = dbus_message_get_path(message);
		const char *interface = dbus_message_get_interface(message);
		const char *name = dbus_message_get_member(message);
		const GDBusArgInfo *args;

		if (!check_signal(connection, path, interface, name, &args))
			goto out;
	}

	/* Flush pending signal to guarantee message order */
	g_dbus_flush(connection);

	result = dbus_connection_send(connection, message, NULL);

out:
	dbus_message_unref(message);

	return result;
}
开发者ID:MDomagala,项目名称:bluez,代码行数:26,代码来源:object.c


示例2: client_parse_reply

static
dbus_bool_t
client_parse_reply(DBusMessage *rsp, DBusError *err, int arg, ...)
{
  dbus_bool_t res = 0;

  if( dbus_error_is_set(err) )
  {
    // error is already set -> nop
  }
  else if( dbus_message_get_type(rsp) == DBUS_MESSAGE_TYPE_METHOD_RETURN )
  {
    // try to parse the message
    va_list va;
    va_start(va, arg);
    res = dbus_message_get_args_valist (rsp, err, arg, va);
    va_end(va);
  }
  else if( dbus_set_error_from_message(err, rsp) )
  {
    // it was an error message and error is now set
  }
  else
  {
    dbus_set_error(err, DBUS_ERROR_NO_REPLY, "expected %s, got %s\n",
                   dbus_message_type_to_string(DBUS_MESSAGE_TYPE_METHOD_RETURN),
                   dbus_message_type_to_string(dbus_message_get_type(rsp)));

  }
  return res;
}
开发者ID:tidatida,项目名称:alarmd,代码行数:31,代码来源:client.c


示例3: main

int
main(int argc, const char *argv[])
{
  DBusError error;
  DBusMessage *message = NULL, *reply = NULL;
  const char *str;

  main_context = g_main_context_new ();
  dbus_error_init (&error);
  bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
  if (!bus)
  {
    fprintf(stderr, "Couldn't connect to bus: %s\n", error.name);
    return 1;
  }
  dbus_connection_setup_with_g_main (bus, NULL);
  message = dbus_message_new_method_call ("org.freedesktop.DBus", "/org/freedesktop/DBus", DBUS_INTERFACE_DBUS, "GetId");
  reply = send_and_allow_reentry (bus, message);
  if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
  {
    char *err;
    dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
    fprintf (stderr, "Got error: %s\n", err);
    return 1;
  }
  dbus_message_unref (reply);
  dbus_message_unref (message);
  message = dbus_message_new_method_call ("org.freedesktop.DBus", "/org/freedesktop/DBus", DBUS_INTERFACE_DBUS, "GetId");
  reply = send_and_allow_reentry (bus, message);
  if (!reply)
  {
    fprintf(stderr, "Sorry; dbus wouldn't answer me: %s\n", error.message);
    exit(1);
  }
  if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
  {
    char *err;
    dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
    fprintf (stderr, "Got error: %s\n", err);
    return 1;
  }
  if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
  {
    fprintf(stderr, "Sorry; can't communicate: %s\n", error.message);
    exit(1);
  }

  return 0;
}
开发者ID:pexip,项目名称:os-dbus-glib,代码行数:49,代码来源:30574.c


示例4: register_profile_reply

static void register_profile_reply(DBusPendingCall *pending, void *userdata) {
    DBusMessage *r;
    pa_dbus_pending *p;
    pa_bluetooth_backend *b;
    char *profile;

    pa_assert(pending);
    pa_assert_se(p = userdata);
    pa_assert_se(b = p->context_data);
    pa_assert_se(profile = p->call_data);
    pa_assert_se(r = dbus_pending_call_steal_reply(pending));

    if (dbus_message_is_error(r, BLUEZ_ERROR_NOT_SUPPORTED)) {
        pa_log_info("Couldn't register profile %s because it is disabled in BlueZ", profile);
        goto finish;
    }

    if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) {
        pa_log_error(BLUEZ_PROFILE_MANAGER_INTERFACE ".RegisterProfile() failed: %s: %s", dbus_message_get_error_name(r),
                     pa_dbus_get_error_message(r));
        goto finish;
    }

finish:
    dbus_message_unref(r);

    PA_LLIST_REMOVE(pa_dbus_pending, b->pending, p);
    pa_dbus_pending_free(p);

    pa_xfree(profile);
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:31,代码来源:backend-native.c


示例5: devicelock_unlocked_cb

static DBusHandlerResult devicelock_unlocked_cb(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
  DBusHandlerResult   result    = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
  const char         *interface = dbus_message_get_interface(msg);
  const char         *member    = dbus_message_get_member(msg);
  const char         *object    = dbus_message_get_path(msg);
  int                 type      = dbus_message_get_type(msg);
  int ret=0, ret1 = 0;

  (void) user_data;

  // sanity checks
  if( !interface || !member || !object ) goto cleanup;
  if( type != DBUS_MESSAGE_TYPE_SIGNAL ) goto cleanup;
  if( strcmp(interface, DEVICELOCK_REQUEST_IF) ) goto cleanup;
  if( strcmp(object, DEVICELOCK_REQUEST_PATH) )  goto cleanup;

  // handle known signals
  else if( !strcmp(member, "stateChanged") )
  {
        dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &ret1, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
  	log_debug("Devicelock state changed. New state = %d\n", ret);
  	if(ret == 0 && get_usb_connection_state() == 1 )
  	{	
         	if(!strcmp(get_usb_mode(), MODE_UNDEFINED) || !strcmp(get_usb_mode(), MODE_CHARGING))
			set_usb_connected_state();
  	}
  }
  result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

cleanup:
  return result;
}
开发者ID:d0b3rm4n,项目名称:usb-moded,代码行数:33,代码来源:usb_moded-devicelock.c


示例6: main

int main()
{
       DBusMessage* msg;
	
	msg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
	
	if(!msg)
	{
		std_log(LOG_FILENAME_LINE,"Fail to create Message");
		create_xml(1);
		return 1;
	}
	
	if(DBUS_MESSAGE_TYPE_METHOD_CALL != dbus_message_get_type(msg))
	{
		std_log(LOG_FILENAME_LINE,"Mismatch in Message type.");
		create_xml(1);
		return 1;
	}
	
	std_log(LOG_FILENAME_LINE,"Test Successful");
	create_xml(0);
	return 0;

}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:25,代码来源:dbus_message_type0.c


示例7: got_metadata

/* MafwSource::get_metadata */
static void got_metadata(DBusPendingCall *pendelum, RequestReplyInfo *info)
{
	GError *error;
	DBusMessage *reply;

	reply = dbus_pending_call_steal_reply(pendelum);
	if (!(error = mafw_dbus_is_error(reply, MAFW_SOURCE_ERROR))) {
		GHashTable *metadata;

		g_assert(dbus_message_get_type(reply) ==
                         DBUS_MESSAGE_TYPE_METHOD_RETURN);
		mafw_dbus_parse(reply,
				MAFW_DBUS_TYPE_METADATA, &metadata);
		info->got_metadata_cb(info->src,
				      info->objectid, metadata,
				      info->cbdata, NULL);
		mafw_metadata_release(metadata);
	} else {
		info->got_metadata_cb(info->src,
				      info->objectid, NULL,
				      info->cbdata, error);
		g_error_free(error);
	}
	dbus_message_unref(reply);
	dbus_pending_call_unref(pendelum);
}
开发者ID:community-ssu,项目名称:mafw,代码行数:27,代码来源:mafw-proxy-source.c


示例8: xconnman_dbus_filter_cb

/** D-Bus message filter for handling connman related signals
 *
 * @param con       dbus connection
 * @param msg       message to be acted upon
 * @param user_data (not used)
 *
 * @return DBUS_HANDLER_RESULT_NOT_YET_HANDLED (other filters see the msg too)
 */
static DBusHandlerResult xconnman_dbus_filter_cb(DBusConnection *con,
						 DBusMessage *msg,
						 void *user_data)
{
	(void)user_data;

	DBusHandlerResult res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

	if( con != connman_bus )
		goto EXIT;

	if( dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL )
		goto EXIT;

	if( dbus_message_is_signal(msg, DBUS_INTERFACE_DBUS,
				   DBUS_NAME_OWNER_CHANGED_SIG) ) {
		xconnman_handle_name_owner_change(msg);
	}
	else if( dbus_message_is_signal(msg, CONNMAN_INTERFACE,
					CONNMAN_PROPERTY_CHANGED_SIG) ) {
		xconnman_handle_property_changed_signal(msg);
	}

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


示例9: service_method_open_session

static DBusMessage*
service_method_open_session (GkdSecretService *self, DBusMessage *message)
{
	GkdSecretSession *session;
	ServiceClient *client;
	DBusMessage *reply = NULL;
	const gchar *caller;
	const gchar *path;

	if (!dbus_message_has_signature (message, "sv"))
		return NULL;

	caller = dbus_message_get_sender (message);

	/* Now we can create a session with this information */
	session = gkd_secret_session_new (self, caller);
	reply = gkd_secret_session_handle_open (session, message);

	if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_METHOD_RETURN) {
		/* Take ownership of the session */
		client = g_hash_table_lookup (self->clients, caller);
		g_return_val_if_fail (client, NULL);
		path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (session));
		g_return_val_if_fail (!g_hash_table_lookup (client->sessions, path), NULL);
		g_hash_table_replace (client->sessions, (gpointer)path, session);

	} else {
		g_object_unref (session);
	}

	return reply;
}
开发者ID:brianjmurrell,项目名称:mate-keyring,代码行数:32,代码来源:gkd-secret-service.c


示例10: request_lookup_reply

static void request_lookup_reply(DBusPendingCall *call, void *user_data)
{
	DBusMessage *reply = dbus_pending_call_steal_reply(call);
	struct proxy_data *data = user_data;
	const char *proxy;

	DBG("");

	if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
		connman_error("Failed to find URL:%s", data->url);
		proxy = NULL;
		goto done;
	}

	if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &proxy,
						DBUS_TYPE_INVALID) == FALSE)
		proxy = NULL;

done:
	connman_proxy_driver_lookup_notify(data->service, data->url, proxy);

	connman_service_unref(data->service);

	g_free(data->url);
	g_free(data);

	dbus_message_unref(reply);
}
开发者ID:aldebaran,项目名称:connman-stable,代码行数:28,代码来源:pacrunner.c


示例11: 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


示例12: EventFilter

// Called by dbus during WaitForAndDispatchEventNative()
// This function is called on the IOThread
static DBusHandlerResult
EventFilter(DBusConnection *aConn, DBusMessage *aMsg,
            void *aData)
{
  DBusError err;

  dbus_error_init(&err);

  if (dbus_message_get_type(aMsg) != DBUS_MESSAGE_TYPE_SIGNAL) {
    LOG("%s: not interested (not a signal).\n", __FUNCTION__);
    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
  }

  LOG("%s: Received signal %s:%s from %s\n", __FUNCTION__,
      dbus_message_get_interface(aMsg), dbus_message_get_member(aMsg),
      dbus_message_get_path(aMsg));

  // TODO: Parse DBusMessage* on the IOThread and return as a BluetoothEvent so
  // we aren't passing the pointer at all, as well as offloading parsing (not
  // that it's that heavy.)
  nsCOMPtr<DistributeDBusMessageTask> t(new DistributeDBusMessageTask(aMsg));
  if (NS_FAILED(NS_DispatchToMainThread(t))) {
    NS_WARNING("Failed to dispatch to main thread!");
  }

  return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:29,代码来源:BluetoothDBusUtils.cpp


示例13: filter_handle_message

static bool filter_handle_message(Filter* filter, DBusMessage* msg)
{
  switch (dbus_message_get_type(msg)) {

  case DBUS_MESSAGE_TYPE_METHOD_CALL:
    // TODO: add logging
  break;

  case DBUS_MESSAGE_TYPE_SIGNAL:
  break;

  case DBUS_MESSAGE_TYPE_ERROR:
  {
    DBusError error;

    dbus_error_init(&error);
    if (dbus_set_error_from_message(&error, msg)) {
        dsme_log(LOG_DEBUG,
                 "D-Bus: %s: %s",
                 dbus_message_get_error_name(msg),
                 error.message);
    } else {
        dsme_log(LOG_DEBUG, "D-Bus: could not get error message");
    }
    dbus_error_free(&error);
  }
  break;

  default:
    // IGNORE (silently ignore per D-Bus documentation)
    break;
  }

  return false;
}
开发者ID:plundstr,项目名称:dsme,代码行数:35,代码来源:dsme_dbus.c


示例14: thunar_dbus_client_terminate

/**
 * thunar_dbus_client_terminate:
 * @error : Return location for errors or %NULL.
 *
 * Tells a running Thunar instance, connected to the D-BUS
 * session bus, to terminate immediately.
 *
 * Return value: %TRUE if any instance was terminated, else
 *               %FALSE and @error is set.
 **/
gboolean
thunar_dbus_client_terminate (GError **error)
{
  DBusConnection *connection;
  DBusMessage    *message;
  DBusMessage    *result;
  DBusError       derror;

  _thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  /* initialize the DBusError struct */
  dbus_error_init (&derror);

  /* try to connect to the session bus */
  connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
  if (G_UNLIKELY (connection == NULL))
    {
      dbus_set_g_error (error, &derror);
      dbus_error_free (&derror);
      return FALSE;
    }

  /* generate the LaunchFiles() method (disable activation!) */
  message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.Thunar", "Terminate");
  dbus_message_set_auto_start (message, FALSE);

  /* send the message and release our references on connection and message */
  result = dbus_connection_send_with_reply_and_block (connection, message, -1, &derror);
  dbus_message_unref (message);

  /* check if no reply was received */
  if (G_UNLIKELY (result == NULL))
    {
      /* check if there was nothing to terminate */
      if (dbus_error_has_name (&derror, DBUS_ERROR_NAME_HAS_NO_OWNER))
        {
          dbus_error_free (&derror);
          return TRUE;
        }

      /* Looks like there was a real error */
      dbus_set_g_error (error, &derror);
      dbus_error_free (&derror);
      return FALSE;
    }

  /* but maybe we received an error */
  if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
    {
      dbus_set_error_from_message (&derror, result);
      dbus_set_g_error (error, &derror);
      dbus_message_unref (result);
      dbus_error_free (&derror);
      return FALSE;
    }

  /* let's asume that it worked */
  dbus_message_unref (result);
  return TRUE;
}
开发者ID:fibernet-us,项目名称:Thunar_sort_files_by_extension,代码行数:70,代码来源:thunar-dbus-client.c


示例15:

static char *get_property_value(DBusMessage *reply)
{
	DBusMessageIter iter, val;
	const char *ptr;
	char *property = NULL;

	if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
		ofono_error("%s: ERROR reply to Get", __func__);
		goto done;
	}

	if (dbus_message_iter_init(reply, &iter) == FALSE) {
		ofono_error("%s: error initializing array iter", __func__);
		goto done;
	}

	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) {
		ofono_error("%s: type != VARIANT!", __func__);
		goto done;
	}

	dbus_message_iter_recurse(&iter, &val);

	if (dbus_message_iter_get_arg_type(&val) != DBUS_TYPE_STRING) {
		ofono_error("%s: type != STRING!", __func__);
		goto done;
	}

	dbus_message_iter_get_basic(&val, &ptr);

	property = g_strdup(ptr);

done:
	return property;
}
开发者ID:alfonsosanchezbeato,项目名称:ofono,代码行数:35,代码来源:accounts-settings.c


示例16: pan_connect_cb

static void pan_connect_cb(DBusMessage *message, void *user_data)
{
	const char *path = user_data;
	const char *iface = NULL;
	struct bluetooth_pan *pan;
	DBusMessageIter iter;

	pan = g_hash_table_lookup(networks, path);
	if (pan == NULL) {
		DBG("network already removed");
		return;
	}

	if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
		const char *dbus_error = dbus_message_get_error_name(message);

		DBG("network %p %s", pan->network, dbus_error);

		if (strcmp(dbus_error,
				"org.bluez.Error.AlreadyConnected") != 0) {
			connman_network_set_error(pan->network,
				CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL);
			return;
		}
	} else {
		if (dbus_message_iter_init(message, &iter) == TRUE &&
				dbus_message_iter_get_arg_type(&iter) ==
				DBUS_TYPE_STRING)
			dbus_message_iter_get_basic(&iter, &iface);
	}

	DBG("network %p interface %s", pan->network, iface);

	pan_connect(pan, iface);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman,代码行数:35,代码来源:bluetooth.c


示例17: _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


示例18: bridge_request_call_dbus_json

int bridge_request_call_dbus_json(bridge_request_t *self, DBusMessage *in_dbus)
{
	DBusMessageIter it;
	DBusError err;
	struct json_object *result = 0;
	int ret = 0;

	if (dbus_message_get_type(in_dbus) == DBUS_MESSAGE_TYPE_ERROR) {
		dbus_error_init(&err);
		(void)dbus_set_error_from_message(&err, in_dbus);
		bridge_request_error(self, err.message ? err.message : err.name);
		dbus_error_free(&err);
		ret = EINVAL;
		goto finish;
	}

	if (dbus_message_iter_init(in_dbus, &it)) {
		if ((ret = bridge_request_json_params(self, &it, &result, dbus_message_iter_has_next(&it))) != 0)
			goto finish;
	}

	if ((ret = bridge_request_send_response(self, 0, result)) != 0) {
		bridge_request_error(self, "Out of memory.");
	}

finish:
	if (result)
		json_object_put(result);
	dbus_message_unref(in_dbus);

	FCGX_Finish_r(&self->request);
	self->next = self->bridge->head;
	self->bridge->head = self;
	return ret;
}
开发者ID:elrafoon,项目名称:json-dbus-bridge,代码行数:35,代码来源:bridge_request.c


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ dbus_message_is_method_call函数代码示例发布时间:2022-05-30
下一篇:
C++ dbus_message_get_signature函数代码示例发布时间: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