Exemple #1
0
	while (uuids) {
		serial_probe(device, uuids->data);
		uuids = uuids->next;
	}

	return 0;
}

static void port_remove(struct btd_device *device)
{
	return serial_remove(device);
}

static struct btd_device_driver serial_port_driver = {
	.name	= "serial-port",
	.uuids	= BTD_UUIDS(RFCOMM_UUID_STR),
	.probe	= port_probe,
	.remove	= port_remove,
};

static int proxy_probe(struct btd_adapter *adapter)
{
	const char *path = adapter_get_path(adapter);

	DBG("path %s", path);

	return proxy_register(connection, adapter);
}

static void proxy_remove(struct btd_adapter *adapter)
{
Exemple #2
0
	if (l == NULL)
		return -EINVAL;

	tattr = l->data;

	return thermometer_register(connection, device, tattr);
}

static void thermometer_driver_remove(struct btd_device *device)
{
	thermometer_unregister(device);
}

static struct btd_device_driver thermometer_device_driver = {
	.name	= "thermometer-device-driver",
	.uuids	= BTD_UUIDS(HEALTH_THERMOMETER_UUID),
	.probe	= thermometer_driver_probe,
	.remove	= thermometer_driver_remove
};

int thermometer_manager_init(DBusConnection *conn)
{
	int ret;

	ret = btd_register_device_driver(&thermometer_device_driver);
	if (ret < 0)
                return ret;

	connection = dbus_connection_ref(conn);
	return 0;
}
Exemple #3
0
	return server_register(adapter);
}

static void network_server_remove(struct btd_adapter *adapter)
{
	const gchar *path = adapter_get_path(adapter);

	DBG("path %s", path);

	server_unregister(adapter);
}

static struct btd_device_driver network_panu_driver = {
	.name	= "network-panu",
	.uuids	= BTD_UUIDS(PANU_UUID),
	.probe	= panu_probe,
	.remove	= panu_remove,
};

static struct btd_device_driver network_gn_driver = {
	.name	= "network-gn",
	.uuids	= BTD_UUIDS(GN_UUID),
	.probe	= gn_probe,
	.remove	= gn_remove,
};

static struct btd_device_driver network_nap_driver = {
	.name	= "network-nap",
	.uuids	= BTD_UUIDS(NAP_UUID),
	.probe	= nap_probe,
Exemple #4
0
static void hid_server_remove(struct btd_adapter *adapter)
{
	bdaddr_t src;

	adapter_get_address(adapter, &src);

	server_stop(&src);

	adapters = g_slist_remove(adapters, adapter);
	btd_adapter_unref(adapter);
}

static struct btd_device_driver input_hid_driver = {
	.name	= "input-hid",
	.uuids	= BTD_UUIDS(HID_UUID),
	.probe	= hid_device_probe,
	.remove	= hid_device_remove,
};

static struct btd_device_driver input_headset_driver = {
	.name	= "input-headset",
	.uuids	= BTD_UUIDS(HSP_HS_UUID),
	.probe	= headset_probe,
	.remove	= headset_remove,
};

static struct btd_adapter_driver input_server_driver = {
	.name   = "input-server",
	.probe  = hid_server_probe,
	.remove = hid_server_remove,
Exemple #5
0
	return hog_device_register(device, path);
}

static void hog_device_remove(struct btd_device *device)
{
	const gchar *path = device_get_path(device);

	DBG("path %s", path);

	hog_device_unregister(path);
}

static struct btd_device_driver hog_driver = {
	.name	= "input-hog",
	.uuids	= BTD_UUIDS(HOG_UUID),
	.probe	= hog_device_probe,
	.remove	= hog_device_remove,
};

static int hog_manager_init(void)
{
	return btd_register_device_driver(&hog_driver);
}

static void hog_manager_exit(void)
{
	btd_unregister_device_driver(&hog_driver);
}

static int hog_init(void)
Exemple #6
0
static int hid_server_probe(struct btd_profile *p, struct btd_adapter *adapter)
{
	return server_start(adapter_get_address(adapter));
}

static void hid_server_remove(struct btd_profile *p,
						struct btd_adapter *adapter)
{
	server_stop(adapter_get_address(adapter));
}

static struct btd_profile input_profile = {
	.name		= "input-hid",
	.local_uuid	= HID_UUID,
	.remote_uuids	= BTD_UUIDS(HID_UUID),

	.auto_connect	= true,
	.connect	= input_device_connect,
	.disconnect	= input_device_disconnect,

	.device_probe	= hid_device_probe,
	.device_remove	= hid_device_remove,

	.adapter_probe	= hid_server_probe,
	.adapter_remove = hid_server_remove,
};

void input_manager_device_connected(struct btd_device *dev, int err)
{
	device_profile_connected(dev, &input_profile, err);
							device, NULL) == FALSE)
		return -1;

	return 0;
}

static void serial_remove(struct btd_device *device)
{
	DBG("path %s", device->path);

	g_dbus_unregister_interface(conn, device->path, SERIAL_INTERFACE);
}

static struct btd_device_driver serial_driver = {
	.name	= "serial",
	.uuids	= BTD_UUIDS(SERIAL_PORT_UUID, DIALUP_NET_UUID),
	.probe	= serial_probe,
	.remove	= serial_remove,
};

static int serial_init(void)
{
	conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
	if (conn == NULL)
		return -EIO;

	if (serial_manager_init(conn) < 0) {
		dbus_connection_unref(conn);
		return -EIO;
	}
Exemple #8
0
static void reporter_device_remove(struct btd_device *device)
{
	struct reporter_adapter *radapter;
	struct btd_adapter *adapter = device_get_adapter(device);

	radapter = find_reporter_adapter(adapter);
	if (!radapter)
		return;

	unregister_reporter_device(device, radapter);
}

/* device driver for tracking remote GATT client devices */
static struct btd_device_driver reporter_device_driver = {
	.name = "Proximity GATT Reporter Device Tracker Driver",
	.uuids = BTD_UUIDS(GATT_UUID),
	.probe = reporter_device_probe,
	.remove = reporter_device_remove,
};

int reporter_init(struct btd_adapter *adapter)
{
	struct reporter_adapter *radapter;
	DBusConnection *conn;

	if (!main_opts.gatt_enabled) {
		DBG("GATT is disabled");
		return -ENOTSUP;
	}

	conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
Exemple #9
0
	if (l == NULL)
		return -EINVAL;

	prim = l->data;

	return batterystate_register(connection, device, prim);
}

static void batterystate_driver_remove(struct btd_device *device)
{
	batterystate_unregister(device);
}

static struct btd_device_driver battery_device_driver = {
	.name	= "battery-driver",
	.uuids	= BTD_UUIDS(BATTERY_SERVICE_UUID),
	.probe	= batterystate_driver_probe,
	.remove	= batterystate_driver_remove
};

int batterystate_manager_init(DBusConnection *conn)
{
	int ret;

	ret = btd_register_device_driver(&battery_device_driver);
	if (!ret)
		connection = dbus_connection_ref(conn);

	return ret;
}
	.remove	= hdp_adapter_remove,
};

static int hdp_driver_probe(struct btd_device *device, GSList *uuids)
{
	return hdp_device_register(connection, device);
}

static void hdp_driver_remove(struct btd_device *device)
{
	hdp_device_unregister(device);
}

static struct btd_device_driver hdp_device_driver = {
	.name	= "hdp-device-driver",
	.uuids	= BTD_UUIDS(HDP_UUID, HDP_SOURCE_UUID, HDP_SINK_UUID),
	.probe	= hdp_driver_probe,
	.remove	= hdp_driver_remove
};

int hdp_manager_init(DBusConnection *conn)
{
	if (hdp_manager_start(conn))
		return -1;

	connection = dbus_connection_ref(conn);
	btd_register_adapter_driver(&hdp_adapter_driver);
	btd_register_device_driver(&hdp_device_driver);

	return 0;
}
Exemple #11
0
	const gchar *path = adapter_get_path(adapter);

	DBG("path %s", path);

	adp = find_adapter(adapters, adapter);
	if (!adp)
		return;

	media_unregister(path);
	audio_adapter_unref(adp);
}

static struct btd_device_driver audio_driver = {
	.name	= "audio",
	.uuids	= BTD_UUIDS(HSP_HS_UUID, HFP_HS_UUID, HSP_AG_UUID, HFP_AG_UUID,
			ADVANCED_AUDIO_UUID, A2DP_SOURCE_UUID, A2DP_SINK_UUID,
			AVRCP_TARGET_UUID, AVRCP_REMOTE_UUID),
	.probe	= audio_probe,
	.remove	= audio_remove,
};

static struct btd_adapter_driver headset_server_driver = {
	.name	= "audio-headset",
	.probe	= headset_server_probe,
	.remove	= headset_server_remove,
};

static struct btd_adapter_driver gateway_server_driver = {
	.name	= "audio-gateway",
	.probe	= gateway_server_probe,
	.remove	= gateway_server_remove,