Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
int connection_register(struct btd_service *service)
{
	struct btd_device *device = btd_service_get_device(service);
	struct network_peer *peer;
	struct network_conn *nc;
	uint16_t id = get_service_id(service);

	DBG("%s id %u", device_get_path(device), id);

	peer = find_peer(peers, device);
	if (!peer) {
		peer = create_peer(device);
		if (!peer)
			return -1;
		peers = g_slist_append(peers, peer);
	}

	nc = g_new0(struct network_conn, 1);
	nc->id = id;
	nc->service = btd_service_ref(service);
	nc->state = DISCONNECTED;
	nc->peer = peer;

	btd_service_set_user_data(service, nc);

	DBG("id %u registered", id);

	peer->connections = g_slist_append(peer->connections, nc);

	return 0;
}
Exemplo n.º 3
0
int control_init_remote(struct btd_service *service)
{
	struct control *control;

	control = control_init(service);
	if (control == NULL)
		return -EINVAL;

	control->remote = btd_service_ref(service);

	btd_service_set_user_data(service, control);

	return 0;
}
Exemplo n.º 4
0
Arquivo: sink.c Projeto: Thread974/bz
struct sink *sink_init(struct audio_device *dev, struct btd_service *service)
{
	struct sink *sink;

	DBG("%s", device_get_path(dev->btd_dev));

	sink = g_new0(struct sink, 1);

	sink->dev = dev;
	sink->service = btd_service_ref(service);

	sink->avdtp_callback_id = avdtp_add_state_cb(dev, avdtp_state_callback);

	return sink;
}
Exemplo n.º 5
0
int sink_init(struct btd_service *service)
{
	struct btd_device *dev = btd_service_get_device(service);
	struct sink *sink;

	DBG("%s", device_get_path(dev));

	sink = g_new0(struct sink, 1);

	sink->service = btd_service_ref(service);

	sink->avdtp_callback_id = avdtp_add_state_cb(dev, avdtp_state_callback,
									sink);

	btd_service_set_user_data(service, sink);

	return 0;
}