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

C++ device_get_address函数代码示例

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

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



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

示例1: change_state

static void change_state(struct btd_service *service, btd_service_state_t state,
									int err)
{
	btd_service_state_t old = service->state;
	char addr[18];
	GSList *l;

	if (state == old)
		return;

	assert(service->device != NULL);
	assert(service->profile != NULL);

	service->state = state;
	service->err = err;

	ba2str(device_get_address(service->device), addr);
	DBG("%p: device %s profile %s state changed: %s -> %s (%d)", service,
					addr, service->profile->name,
					state2str(old), state2str(state), err);

	for (l = state_callbacks; l != NULL; l = g_slist_next(l)) {
		struct service_state_callback *cb = l->data;

		cb->cb(service, old, state, cb->user_data);
	}
}
开发者ID:mgumiero9,项目名称:bluele4,代码行数:27,代码来源:service.c


示例2: avctp_get_internal

struct avctp *avctp_connect(struct audio_device *device)
{
	struct avctp *session;
	GError *err = NULL;
	GIOChannel *io;

	session = avctp_get_internal(device->btd_dev);
	if (!session)
		return NULL;

	if (session->state > AVCTP_STATE_DISCONNECTED)
		return session;

	avctp_set_state(session, AVCTP_STATE_CONNECTING);

	io = bt_io_connect(avctp_connect_cb, session, NULL, &err,
				BT_IO_OPT_SOURCE_BDADDR,
				adapter_get_address(session->server->adapter),
				BT_IO_OPT_DEST_BDADDR,
				device_get_address(session->device),
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_PSM, AVCTP_CONTROL_PSM,
				BT_IO_OPT_INVALID);
	if (err) {
		avctp_set_state(session, AVCTP_STATE_DISCONNECTED);
		error("%s", err->message);
		g_error_free(err);
		return NULL;
	}

	session->control = avctp_channel_create(session, io, NULL);
	g_io_channel_unref(io);

	return session;
}
开发者ID:adityakamath,项目名称:ArduHack,代码行数:35,代码来源:avctp.c


示例3: pincode_cb

static void pincode_cb(struct agent *agent, DBusError *derr,
				const char *pincode, struct btd_device *device)
{
	struct btd_adapter *adapter = device_get_adapter(device);
	bdaddr_t dba;
	int err;
	size_t len;
	char rawpin[16];

	device_get_address(device, &dba);

	len = decode_pin(pincode, rawpin);
	if (derr || !len) {
		err = btd_adapter_pincode_reply(adapter, &dba, NULL, 0);
		if (err < 0)
			goto fail;
		return;
	}

	err = btd_adapter_pincode_reply(adapter, &dba, rawpin, len);
	if (err < 0)
		goto fail;

	return;

fail:
	error("Sending PIN code reply failed: %s (%d)", strerror(-err), -err);
}
开发者ID:aristeu,项目名称:bluez,代码行数:28,代码来源:event.c


示例4: btd_device_get_gatt_db

struct btd_gatt_client *btd_gatt_client_new(struct btd_device *device)
{
	struct btd_gatt_client *client;
	struct gatt_db *db;

	if (!device)
		return NULL;

	db = btd_device_get_gatt_db(device);
	if (!db)
		return NULL;

	client = new0(struct btd_gatt_client, 1);
	if (!client)
		return NULL;

	client->services = queue_new();
	if (!client->services) {
		free(client);
		return NULL;
	}

	client->device = device;
	ba2str(device_get_address(device), client->devaddr);

	client->db = gatt_db_ref(db);

	return client;
}
开发者ID:LGSInnovations,项目名称:edison-debian-image,代码行数:29,代码来源:gatt-client.c


示例5: hdp_establish_mcl

gboolean hdp_establish_mcl(struct hdp_device *device,
						hdp_continue_proc_f func,
						gpointer data,
						GDestroyNotify destroy,
						GError **err)
{
	struct conn_mcl_data *conn_data;
	const bdaddr_t *src;
	const bdaddr_t *dst;
	uuid_t uuid;

	src = btd_adapter_get_address(device_get_adapter(device->dev));
	dst = device_get_address(device->dev);

	conn_data = g_new0(struct conn_mcl_data, 1);
	conn_data->refs = 1;
	conn_data->func = func;
	conn_data->data = data;
	conn_data->destroy = destroy;
	conn_data->dev = health_device_ref(device);

	bt_string2uuid(&uuid, HDP_UUID);
	if (bt_search_service(src, dst, &uuid, search_cb, conn_data,
					destroy_con_mcl_data, 0) < 0) {
		g_set_error(err, HDP_ERROR, HDP_CONNECTION_ERROR,
						"Can't get remote SDP record");
		g_free(conn_data);
		return FALSE;
	}

	return TRUE;
}
开发者ID:ghent360,项目名称:bluez,代码行数:32,代码来源:hdp_util.c


示例6: gap_accept

static int gap_accept(struct btd_service *service)
{
	struct btd_device *device = btd_service_get_device(service);
	struct gatt_db *db = btd_device_get_gatt_db(device);
	struct bt_gatt_client *client = btd_device_get_gatt_client(device);
	struct gas *gas = btd_service_get_user_data(service);
	char addr[18];
	bt_uuid_t gap_uuid;

	ba2str(device_get_address(device), addr);
	DBG("GAP profile accept (%s)", addr);

	if (!gas) {
		error("GAP service not handled by profile");
		return -1;
	}

	gas->db = gatt_db_ref(db);
	gas->client = bt_gatt_client_ref(client);

	/* Handle the GAP services */
	bt_uuid16_create(&gap_uuid, GAP_UUID16);
	gatt_db_foreach_service(db, &gap_uuid, foreach_gap_service, gas);

	if (!gas->attr) {
		error("GAP attribute not found");
		gas_reset(gas);
		return -1;
	}

	btd_service_connecting_complete(service, 0);

	return 0;
}
开发者ID:jomarmar,项目名称:bluez-experimental,代码行数:34,代码来源:gas.c


示例7: mcap_establish_mcl

gboolean mcap_establish_mcl(struct mcap_device *device,
						mcap_continue_proc_f func,
						gpointer data,
						GDestroyNotify destroy,
						GError **err)
{ DBG("");
		DBG("");
	struct conn_mcl_data *conn_data;
	bdaddr_t dst, src;
	uuid_t uuid;

	device_get_address(device->dev, &dst,NULL);
	adapter_get_address(device_get_adapter(device->dev), &src);

	conn_data = g_new0(struct conn_mcl_data, 1);
	conn_data->refs = 1;
	conn_data->func = func;
	conn_data->data = data;
	conn_data->destroy = destroy;
	conn_data->dev = mcap_device_ref(device);
	sdp_uuid32_create(&uuid, 0x001e);

	//bt_string2uuid(&uuid, 0x001e);
	if (bt_search_service(&src, &dst, &uuid, search_cb, conn_data,
						destroy_con_mcl_data)) {
		g_set_error(err, MCAP_ERROR, MCAP_CONNECTION_ERROR,
						"Can't get remote SDP record");
		g_free(conn_data);
		return FALSE;
	}

	return TRUE;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:33,代码来源:mcap_utils.c


示例8: hid_device_probe

static int hid_device_probe(struct btd_device *device, GSList *uuids)
{
	struct btd_adapter *adapter = device_get_adapter(device);
	const gchar *path = device_get_path(device);
	const sdp_record_t *rec = btd_device_get_record(device, uuids->data);
	bdaddr_t src, dst;
	sdp_data_t *pdlist;

	DBG("path %s", path);

	if (!rec)
		return -1;

	adapter_get_address(adapter, &src);
	device_get_address(device, &dst);
	if (rec)
		pdlist = sdp_data_get(rec, SDP_ATTR_HID_SDP_DISABLE);

	if (pdlist && pdlist->val.uint8) {
		DBG("cancel discovery is issued");
		bt_cancel_discovery(&src, &dst);
	}

	return input_device_register(connection, device, path, &src, &dst,
				HID_UUID, rec->handle, idle_timeout * 60);
}
开发者ID:OmarBizreh,项目名称:Sliding_XZ,代码行数:26,代码来源:manager.c


示例9: hid_device_probe

static int hid_device_probe(struct btd_device *device, GSList *uuids)
{
	struct btd_adapter *adapter = device_get_adapter(device);
	const gchar *path = device_get_path(device);
	const sdp_record_t *rec = btd_device_get_record(device, uuids->data);
	bdaddr_t src, dst;

	DBG("path %s", path);

#ifndef BT_ALT_STACK
	if (!rec)
		return -1;
#endif

	adapter_get_address(adapter, &src);
	device_get_address(device, &dst);

#ifdef BT_ALT_STACK
	return input_device_register(connection, device, path, &src, &dst,
				HID_UUID, 0 /* rec->handle */, idle_timeout * 60);
#else
	return input_device_register(connection, device, path, &src, &dst,
				HID_UUID, rec->handle, idle_timeout * 60);
#endif
}
开发者ID:sloanyang,项目名称:android_external_bluetooth_bluez,代码行数:25,代码来源:manager.c


示例10: sixaxis_sdp_cb

static void sixaxis_sdp_cb(struct btd_device *dev, int err, void *user_data)
{
	struct sixaxis_data *data = user_data;
	const bdaddr_t *src;

	DBG("err %d (%s)", err, strerror(-err));

	if (err < 0)
		goto fail;

	src = btd_adapter_get_address(device_get_adapter(dev));

	if (input_device_set_channel(src, device_get_address(dev), data->psm,
								data->chan) < 0)
		goto fail;

	g_io_channel_unref(data->chan);
	g_free(data);

	return;

fail:
	g_io_channel_shutdown(data->chan, TRUE, NULL);
	g_io_channel_unref(data->chan);
	g_free(data);
}
开发者ID:LegacySlimXperia,项目名称:android_hardware_semc,代码行数:26,代码来源:server.c


示例11: hdp_get_mdep

gboolean hdp_get_mdep(struct hdp_device *device, struct hdp_application *app,
				hdp_continue_mdep_f func, gpointer data,
				GDestroyNotify destroy, GError **err)
{
	struct get_mdep_data *mdep_data;
	const bdaddr_t *src;
	const bdaddr_t *dst;
	uuid_t uuid;

	src = btd_adapter_get_address(device_get_adapter(device->dev));
	dst = device_get_address(device->dev);

	mdep_data = g_new0(struct get_mdep_data, 1);
	mdep_data->app = hdp_application_ref(app);
	mdep_data->func = func;
	mdep_data->data = data;
	mdep_data->destroy = destroy;

	bt_string2uuid(&uuid, HDP_UUID);
	if (bt_search_service(src, dst, &uuid, get_mdep_cb, mdep_data,
						free_mdep_data, 0) < 0) {
		g_set_error(err, HDP_ERROR, HDP_CONNECTION_ERROR,
						"Can't get remote SDP record");
		g_free(mdep_data);
		return FALSE;
	}

	return TRUE;
}
开发者ID:ghent360,项目名称:bluez,代码行数:29,代码来源:hdp_util.c


示例12: hdp_get_dcpsm

gboolean hdp_get_dcpsm(struct hdp_device *device, hdp_continue_dcpsm_f func,
							gpointer data,
							GDestroyNotify destroy,
							GError **err)
{
	struct get_dcpsm_data *dcpsm_data;
	bdaddr_t dst, src;
	uuid_t uuid;

	device_get_address(device->dev, &dst, NULL);
	adapter_get_address(device_get_adapter(device->dev), &src);

	dcpsm_data = g_new0(struct get_dcpsm_data, 1);
	dcpsm_data->func = func;
	dcpsm_data->data = data;
	dcpsm_data->destroy = destroy;

	bt_string2uuid(&uuid, HDP_UUID);
	if (bt_search_service(&src, &dst, &uuid, get_dcpsm_cb, dcpsm_data,
							free_dcpsm_data)) {
		g_set_error(err, HDP_ERROR, HDP_CONNECTION_ERROR,
						"Can't get remote SDP record");
		g_free(dcpsm_data);
		return FALSE;
	}

	return TRUE;
}
开发者ID:DroidModderXtreme,项目名称:Novathor_xperia_u8500,代码行数:28,代码来源:hdp_util.c


示例13: gap_driver_probe

static int gap_driver_probe(struct btd_service *service)
{
	struct btd_device *device = btd_service_get_device(service);
	struct gas *gas;
	GSList *l;
	char addr[18];

	ba2str(device_get_address(device), addr);
	DBG("GAP profile probe (%s)", addr);

	/* Ignore, if we were probed for this device already */
	l = g_slist_find_custom(devices, device, cmp_device);
	if (l) {
		error("Profile probed twice for the same device!");
		return -1;
	}

	gas = g_new0(struct gas, 1);
	if (!gas)
		return -1;

	gas->device = btd_device_ref(device);
	devices = g_slist_append(devices, gas);

	return 0;
}
开发者ID:LGSInnovations,项目名称:edison-debian-image,代码行数:26,代码来源:gas.c


示例14: connection_connect

/* Connect and initiate BNEP session */
int connection_connect(struct btd_service *service)
{
	struct network_conn *nc = btd_service_get_user_data(service);
	struct network_peer *peer = nc->peer;
	uint16_t id = get_service_id(service);
	GError *err = NULL;
	const bdaddr_t *src;
	const bdaddr_t *dst;

	DBG("id %u", id);

	if (nc->state != DISCONNECTED)
		return -EALREADY;

	src = btd_adapter_get_address(device_get_adapter(peer->device));
	dst = device_get_address(peer->device);

	nc->io = bt_io_connect(connect_cb, nc,
				NULL, &err,
				BT_IO_OPT_SOURCE_BDADDR, src,
				BT_IO_OPT_DEST_BDADDR, dst,
				BT_IO_OPT_PSM, BNEP_PSM,
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_OMTU, BNEP_MTU,
				BT_IO_OPT_IMTU, BNEP_MTU,
				BT_IO_OPT_INVALID);
	if (!nc->io)
		return -EIO;

	nc->state = CONNECTING;

	return 0;
}
开发者ID:DaisyPi,项目名称:sensortag,代码行数:34,代码来源:connection.c


示例15: mcap_get_mdep

gboolean mcap_get_mdep(struct mcap_device *device, struct mcap_application *app,
				mcap_continue_mdep_f func, gpointer data,
				GDestroyNotify destroy, GError **err)
{
		DBG("");
	struct get_mdep_data *mdep_data;
	bdaddr_t dst, src;
	uuid_t uuid;

	device_get_address(device->dev, &dst,NULL);
	adapter_get_address(device_get_adapter(device->dev), &src);

	mdep_data = g_new0(struct get_mdep_data, 1);
	mdep_data->app = mcap_application_ref(app);
	mdep_data->func = func;
	mdep_data->data = data;
	mdep_data->destroy = destroy;
	char dd[100] = {};
	ba2str(&dst,dd);
	DBG("dst device = %s",dd);
	sdp_uuid32_create(&uuid, 0x1400);
//	bt_string2uuid(&uuid, 0x1400);
	if (bt_search_service(&src, &dst, &uuid, get_mdep_cb, mdep_data,
							free_mdep_data)) {
		g_set_error(err, MCAP_ERROR, MCAP_CONNECTION_ERROR,
						"Can't get remote SDP record");
		g_free(mdep_data);
		return FALSE;
	}

	return TRUE;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:32,代码来源:mcap_utils.c


示例16: btd_service_connect

int btd_service_connect(struct btd_service *service)
{
	struct btd_profile *profile = service->profile;
	char addr[18];
	int err;

	if (!profile->connect)
		return -ENOTSUP;

	switch (service->state) {
	case BTD_SERVICE_STATE_UNAVAILABLE:
		return -EINVAL;
	case BTD_SERVICE_STATE_DISCONNECTED:
		break;
	case BTD_SERVICE_STATE_CONNECTING:
	case BTD_SERVICE_STATE_CONNECTED:
		return -EALREADY;
	case BTD_SERVICE_STATE_DISCONNECTING:
		return -EBUSY;
	}

	err = profile->connect(service);
	if (err == 0) {
		change_state(service, BTD_SERVICE_STATE_CONNECTING, 0);
		return 0;
	}

	ba2str(device_get_address(service->device), addr);
	error("%s profile connect failed for %s: %s", profile->name, addr,
								strerror(-err));

	return err;
}
开发者ID:mgumiero9,项目名称:bluele4,代码行数:33,代码来源:service.c


示例17: avctp_connect_browsing

int avctp_connect_browsing(struct avctp *session)
{
	GError *err = NULL;
	GIOChannel *io;

	if (session->state != AVCTP_STATE_CONNECTED)
		return -ENOTCONN;

	if (session->browsing != NULL)
		return 0;

	avctp_set_state(session, AVCTP_STATE_BROWSING_CONNECTING);

	io = bt_io_connect(avctp_connect_browsing_cb, session, NULL, &err,
				BT_IO_OPT_SOURCE_BDADDR,
				adapter_get_address(session->server->adapter),
				BT_IO_OPT_DEST_BDADDR,
				device_get_address(session->device),
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_PSM, AVCTP_BROWSING_PSM,
				BT_IO_OPT_MODE, L2CAP_MODE_ERTM,
				BT_IO_OPT_INVALID);
	if (err) {
		error("%s", err->message);
		g_error_free(err);
		return -EIO;
	}

	session->browsing = avctp_channel_create(session, io,
						avctp_destroy_browsing);
	g_io_channel_unref(io);

	return 0;
}
开发者ID:MDomagala,项目名称:bluez,代码行数:34,代码来源:avctp.c


示例18: btd_service_get_device

static struct input_device *input_device_new(struct btd_service *service)
{
    struct btd_device *device = btd_service_get_device(service);
    struct btd_profile *p = btd_service_get_profile(service);
    const char *path = device_get_path(device);
    const sdp_record_t *rec = btd_device_get_record(device, p->remote_uuid);
    struct btd_adapter *adapter = device_get_adapter(device);
    struct input_device *idev;
    char name[HCI_MAX_NAME_LENGTH + 1];

    idev = g_new0(struct input_device, 1);
    bacpy(&idev->src, btd_adapter_get_address(adapter));
    bacpy(&idev->dst, device_get_address(device));
    idev->service = btd_service_ref(service);
    idev->device = btd_device_ref(device);
    idev->path = g_strdup(path);
    idev->handle = rec->handle;
    idev->disable_sdp = is_device_sdp_disable(rec);

    device_get_name(device, name, HCI_MAX_NAME_LENGTH);
    if (strlen(name) > 0)
        idev->name = g_strdup(name);

    /* Initialize device properties */
    extract_hid_props(idev, rec);

    return idev;
}
开发者ID:padelt,项目名称:bluez,代码行数:28,代码来源:device.c


示例19: avctp_control_confirm

static void avctp_control_confirm(struct avctp *session, GIOChannel *chan,
						struct btd_device *dev)
{
	const bdaddr_t *src;
	const bdaddr_t *dst;

	if (session->control != NULL) {
		error("Control: Refusing unexpected connect");
		g_io_channel_shutdown(chan, TRUE, NULL);
		return;
	}

	avctp_set_state(session, AVCTP_STATE_CONNECTING);
	session->control = avctp_channel_create(session, chan, NULL);

	src = adapter_get_address(device_get_adapter(dev));
	dst = device_get_address(dev);

	session->auth_id = btd_request_authorization(src, dst,
							AVRCP_TARGET_UUID,
							auth_cb, session);
	if (session->auth_id == 0)
		goto drop;

	session->control->watch = g_io_add_watch(chan, G_IO_ERR | G_IO_HUP |
						G_IO_NVAL, session_cb, session);
	return;

drop:
	avctp_set_state(session, AVCTP_STATE_DISCONNECTED);
}
开发者ID:MDomagala,项目名称:bluez,代码行数:31,代码来源:avctp.c


示例20: serial_probe

static int serial_probe(struct btd_device *device, const char *uuid)
{
	struct btd_adapter *adapter = device_get_adapter(device);
	const gchar *path = device_get_path(device);
	sdp_list_t *protos;
	int ch;
	bdaddr_t src, dst;
	const sdp_record_t *rec;

	DBG("path %s: %s", path, uuid);

	rec = btd_device_get_record(device, uuid);
	if (!rec)
		return -EINVAL;

	if (sdp_get_access_protos(rec, &protos) < 0)
		return -EINVAL;

	ch = sdp_get_proto_port(protos, RFCOMM_UUID);
	sdp_list_foreach(protos, (sdp_list_func_t) sdp_list_free, NULL);
	sdp_list_free(protos, NULL);

	if (ch < 1 || ch > 30) {
		error("Channel out of range: %d", ch);
		return -EINVAL;
	}

	adapter_get_address(adapter, &src);
	device_get_address(device, &dst);

	return port_register(connection, path, &src, &dst, uuid, ch);
}
开发者ID:Bisheg,项目名称:bluez,代码行数:32,代码来源:manager.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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