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


C++ connman_error函数代码示例

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


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

示例1: add_adapter

static void add_adapter(DBusConnection *conn, const char *path)
{
	DBusMessage *message;
	DBusPendingCall *call;

	DBG("path %s", path);

	message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
				BLUEZ_ADAPTER_INTERFACE, GET_PROPERTIES);
	if (message == NULL)
		return;

	dbus_message_set_auto_start(message, FALSE);

	if (dbus_connection_send_with_reply(conn, message,
						&call, TIMEOUT) == FALSE) {
		connman_error("Failed to get adapter properties for %s", path);
		goto done;
	}

	if (call == NULL) {
		connman_error("D-Bus connection not available");
		goto done;
	}

	dbus_pending_call_set_notify(call, adapter_properties_reply,
						g_strdup(path), g_free);

done:
	dbus_message_unref(message);
}
开发者ID:manjurajv,项目名称:connman,代码行数:31,代码来源:bluetooth_legacy.c

示例2: read_command_complete

static int read_command_complete(int fd, unsigned short opcode)
{
	struct cmd_complete resp;
	int err;

	DBG("");

	err = read_hci_event(fd, (unsigned char *)&resp, sizeof(resp));
	if (err < 0)
		return err;

	DBG("HCI event %d bytes", err);

	if (resp.uart_prefix != HCI_EVENT_PKT) {
		connman_error("Not an event packet");
		return -EIO;
	}

	if (resp.evt != EVT_CMD_COMPLETE) {
	        connman_error("Not a cmd complete event");
		return -EIO;
	}

	if (resp.plen < 4) {
		connman_error("HCI header length %d", resp.plen);
		return -EIO;
	}

	if (resp.opcode != (unsigned short) opcode) {
		connman_error("opcode 0x%04x 0x%04x", resp.opcode, opcode);
		return -EIO;
	}

	return 0;
}
开发者ID:sameo,项目名称:connman-stable,代码行数:35,代码来源:tist.c

示例3: pan_create

static void pan_create(GDBusProxy *network_proxy)
{
	const char *path = g_dbus_proxy_get_path(network_proxy);
	struct bluetooth_pan *pan;

	pan = g_try_new0(struct bluetooth_pan, 1);

	if (!pan) {
		connman_error("Out of memory creating PAN NAP");
		return;
	}

	g_hash_table_replace(networks, g_strdup(path), pan);

	pan->btnetwork_proxy = g_dbus_proxy_ref(network_proxy);
	pan->btdevice_proxy = g_dbus_proxy_new(client, path,
			"org.bluez.Device1");

	if (!pan->btdevice_proxy) {
		connman_error("Cannot create BT PAN watcher %s", path);
		g_hash_table_remove(networks, path);
		return;
	}

	g_dbus_proxy_set_property_watch(pan->btnetwork_proxy,
			btnetwork_property_change, NULL);

	g_dbus_proxy_set_property_watch(pan->btdevice_proxy,
			btdevice_property_change, NULL);

	DBG("pan %p %s role %s", pan, path, proxy_get_role(pan->btdevice_proxy));

	pan_create_nap(pan);
}
开发者ID:igaw,项目名称:connman,代码行数:34,代码来源:bluetooth.c

示例4: nmcompat_init

static int nmcompat_init(void)
{
	DBG("");

	connection = connman_dbus_get_connection();
	if (connection == NULL)
		return -1;

	if (g_dbus_request_name(connection, NM_SERVICE, NULL) == FALSE) {
		connman_error("nmcompat: failed register service\n");
		return -1;
	}

	if (connman_notifier_register(&notifier) < 0) {
		connman_error("nmcompat: failed to register notifier");
		return -1;
	}

	if (g_dbus_register_interface(connection, NM_PATH,
				DBUS_PROPERTIES_INTERFACE,
				methods, signals, NULL, NULL, NULL) == FALSE) {
		connman_error("nmcompat: failed to register "
						DBUS_PROPERTIES_INTERFACE);
		return -1;
	}

	return 0;
}
开发者ID:connectivity,项目名称:connman-stable,代码行数:28,代码来源:nmcompat.c

示例5: add_network

static void add_network(const char *path)
{
	DBusMessage *message;
	DBusPendingCall *call;

	DBG("path %s", path);

	message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
				BLUEZ_DEVICE_INTERFACE, GET_PROPERTIES);
	if (!message)
		return;

	dbus_message_set_auto_start(message, FALSE);

	if (!dbus_connection_send_with_reply(connection, message,
						&call, TIMEOUT)) {
		connman_error("Failed to get network properties for %s", path);
		goto done;
	}

	if (!call) {
		connman_error("D-Bus connection not available");
		goto done;
	}

	dbus_pending_call_set_notify(call, network_properties_reply,
						g_strdup(path), g_free);

done:
	dbus_message_unref(message);
}
开发者ID:HoraceWeebler,项目名称:connman,代码行数:31,代码来源:bluetooth_legacy.c

示例6: run_connect

static int run_connect(struct vpn_provider *provider,
			struct connman_task *task, const char *if_name,
			vpn_provider_connect_cb_t cb, void *user_data)
{
	const char *vpnhost, *vpncookie, *servercert, *mtu;
	int fd, err = 0, len;

	vpnhost = vpn_provider_get_string(provider, "OpenConnect.VPNHost");
	if (vpnhost == NULL)
		vpnhost = vpn_provider_get_string(provider, "Host");
	vpncookie = vpn_provider_get_string(provider, "OpenConnect.Cookie");
	servercert = vpn_provider_get_string(provider,
			"OpenConnect.ServerCert");

	if (vpncookie == NULL || servercert == NULL) {
		err = -EINVAL;
		goto done;
	}

	task_append_config_data(provider, task);

	connman_task_add_argument(task, "--servercert", servercert);

	mtu = vpn_provider_get_string(provider, "VPN.MTU");

	if (mtu != NULL)
		connman_task_add_argument(task, "--mtu", (char *)mtu);

	connman_task_add_argument(task, "--syslog", NULL);
	connman_task_add_argument(task, "--cookie-on-stdin", NULL);

	connman_task_add_argument(task, "--script",
				  SCRIPTDIR "/openconnect-script");

	connman_task_add_argument(task, "--interface", if_name);

	connman_task_add_argument(task, (char *)vpnhost, NULL);

	err = connman_task_run(task, vpn_died, provider,
			       &fd, NULL, NULL);
	if (err < 0) {
		connman_error("openconnect failed to start");
		err = -EIO;
		goto done;
	}

	len = strlen(vpncookie);
	if (write(fd, vpncookie, len) != (ssize_t)len ||
			write(fd, "\n", 1) != 1) {
		connman_error("openconnect failed to take cookie on stdin");
		err = -EIO;
		goto done;
	}

done:
	if (cb != NULL)
		cb(provider, user_data, err);

	return err;
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman,代码行数:60,代码来源:openconnect.c

示例7: disconnect_network

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

	_DBG_SUPPLICANT("task %p", task);

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

	dbus_message_set_auto_start(message, FALSE);

	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 disconnect network");
		dbus_message_unref(message);
		return -EIO;
	}

	dbus_message_unref(message);

	dbus_message_unref(reply);

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

示例8: mk3_init

static int
mk3_init(void) {

	int err;

	DBG("");


	err = connman_network_driver_register(&network_driver);
	if(err < 0) {

		connman_error("Register network driver");
		return err;
	}

	err = connman_device_driver_register(&mk3_driver);
	if(err < 0) {

		connman_error("Register device driver");
		connman_network_driver_unregister(&network_driver);
		return err;
	}

	err = connman_technology_driver_register(&tech_driver);
	if(err < 0) {

		connman_error("Register technology driver");
		connman_network_driver_unregister(&network_driver);
		connman_device_driver_unregister(&mk3_driver);

		return err;
	}

	return 0;
}
开发者ID:roland-wilhelm,项目名称:connman,代码行数:35,代码来源:mk3.c

示例9: mk3_enable

static int mk3_enable(struct connman_device *device) {

	int err = 0;
	struct mk3_data *mk3 = NULL;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	mk3 = connman_device_get_data(device);
	if(!mk3) {

		connman_error("No device data available");
		return -ENODEV;
	}

	DBG("device %p data %p", device, mk3);

	err = connman_inet_ifup(mk3->index);
	if(err < 0) {

		connman_error("QMI device could not getting up with ifup");
		return err;
	}

	add_network(mk3);

	return 0;
}
开发者ID:roland-wilhelm,项目名称:connman,代码行数:29,代码来源:mk3.c

示例10: mk3_disable

static int mk3_disable(struct connman_device *device) {

	int err = 0;
	struct mk3_data *mk3 = NULL;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	mk3 = connman_device_get_data(device);
	if(!mk3) {

		connman_error("Could not get device data");
		return -ENODEV;
	}

	DBG("device %p data %p", device, mk3);
	err = connman_inet_ifdown(mk3->index);
	if(err < 0) {

		connman_error("QMI device could not getting down with ifdown");
		return err;
	}

	delete_network(mk3);

	return 0;
}
开发者ID:roland-wilhelm,项目名称:connman,代码行数:28,代码来源:mk3.c

示例11: signal_handler

static void signal_handler(int signo)
{
	void *frames[64];
	char **symbols;
	size_t n_ptrs;
	unsigned int i;

	n_ptrs = backtrace(frames, G_N_ELEMENTS(frames));
	symbols = backtrace_symbols(frames, n_ptrs);
	if (symbols == NULL) {
		connman_error("No backtrace symbols");
		exit(1);
	}

	connman_error("Aborting (signal %d)", signo);
	connman_error("++++++++ backtrace ++++++++");

	for (i = 1; i < n_ptrs; i++)
		connman_error("[%d]: %s", i - 1, symbols[i]);

	connman_error("+++++++++++++++++++++++++++");

	g_free(symbols);
	exit(1);
}
开发者ID:aldebaran,项目名称:connman-stable,代码行数:25,代码来源:log.c

示例12: connect_reply

static void connect_reply(DBusPendingCall *call, void *user_data)
{
	char *path = user_data;
	struct connman_network *network;
	DBusMessage *reply;
	DBusError error;
	const char *interface = NULL;
	int index;

	network = g_hash_table_lookup(bluetooth_networks, path);
	if (!network)
		return;

	DBG("network %p", network);

	reply = dbus_pending_call_steal_reply(call);

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, reply)) {
		connman_error("%s", error.message);
		dbus_error_free(&error);

		goto err;
	}

	if (!dbus_message_get_args(reply, &error, DBUS_TYPE_STRING,
					&interface, DBUS_TYPE_INVALID)) {
		if (dbus_error_is_set(&error)) {
			connman_error("%s", error.message);
			dbus_error_free(&error);
		} else
			connman_error("Wrong arguments for connect");
		goto err;
	}

	if (!interface)
		goto err;

	DBG("interface %s", interface);

	index = connman_inet_ifindex(interface);

	connman_network_set_index(network, index);

	connman_network_set_connected(network, true);

	dbus_message_unref(reply);

	dbus_pending_call_unref(call);

	return;
err:

	connman_network_set_connected(network, false);

	dbus_message_unref(reply);

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

示例13: setup_hostname

static int setup_hostname(void)
{
	char name[HOST_NAME_MAX + 1];

	memset(system_hostname, 0, sizeof(system_hostname));

	if (gethostname(system_hostname, HOST_NAME_MAX) < 0) {
		connman_error("Failed to get current hostname");
		return -EIO;
	}

	if (strlen(system_hostname) > 0 &&
				strcmp(system_hostname, "(none)") != 0)
		connman_info("System hostname is %s", system_hostname);
	else
		create_hostname();

	memset(name, 0, sizeof(name));

	if (getdomainname(name, HOST_NAME_MAX) < 0) {
		connman_error("Failed to get current domainname");
		return -EIO;
	}

	if (strlen(name) > 0 && strcmp(name, "(none)") != 0)
		connman_info("System domainname is %s", name);

	return 0;
}
开发者ID:connectivity,项目名称:connman-stable,代码行数:29,代码来源:loopback.c

示例14: qmi_enable

/**
* @brief Enable qmi device and add network if modem opened
*/
static int qmi_enable(struct connman_device *device)
{
	int err = 0;
	struct qmi_data *qmi = NULL;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	qmi = connman_device_get_data(device);
	if(!qmi) {

		connman_error("No device data available");
		return -ENODEV;
	}

	DBG("device %p data %p", device, qmi);

	/* Add new qmi network interface */
	err = connman_inet_ifup(qmi->index);
	if(err < 0) {

		connman_error("QMI device could not getting up with ifup");
		return err;
	}

	if(qmi->modem_opened == TRUE) {

		add_network(qmi);
	}

	return 0;
}
开发者ID:roland-wilhelm,项目名称:connman,代码行数:36,代码来源:qmi.c

示例15: read_hci_event

static int read_hci_event(int fd, unsigned char *buf, int size)
{
	int prefix_len, param_len;

	if (size <= 0)
		return -EINVAL;

	/* First 3 bytes are prefix, event and param length */
	prefix_len = read(fd, buf, 3);
	if (prefix_len < 0)
		return prefix_len;

	if (prefix_len < 3) {
		connman_error("Truncated HCI prefix %d bytes 0x%x",
						prefix_len, buf[0]);
		return -EIO;
	}

	DBG("type 0x%x event 0x%x param len %d", buf[0], buf[1], buf[2]);

	param_len = buf[2];
	if (param_len > size - 3) {
		connman_error("Buffer is too small %d", size);
		return -EINVAL;
	}

	return read(fd, buf + 3, param_len);
}
开发者ID:sameo,项目名称:connman-stable,代码行数:28,代码来源:tist.c


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