#include "dbus-common.h"
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "error.h"
#include "common.h"
{ }
};
-void connection_unregister(struct btd_device *device)
+void connection_unregister(struct btd_profile *p, struct btd_device *device)
{
struct network_peer *peer;
+ uint16_t id = bnep_service_id(p->remote_uuid);
+
+ DBG("%s id %u", device_get_path(device), id);
peer = find_peer(peers, device);
if (!peer)
return peer;
}
-int connection_register(struct btd_device *device, uint16_t id)
+int connection_register(struct btd_profile *p, struct btd_device *device)
{
struct network_peer *peer;
struct network_conn *nc;
+ uint16_t id = bnep_service_id(p->remote_uuid);
- DBG("id %u", id);
+ DBG("%s id %u", device_get_path(device), id);
peer = find_peer(peers, device);
if (!peer) {
conf_security ? "true" : "false");
}
-static int panu_probe(struct btd_profile *p, struct btd_device *device)
-{
- DBG("path %s", device_get_path(device));
-
- return connection_register(device, BNEP_SVC_PANU);
-}
-
-static void network_remove(struct btd_profile *p, struct btd_device *device)
-{
- DBG("path %s", device_get_path(device));
-
- connection_unregister(device);
-}
-
static int panu_connect(struct btd_device *dev, struct btd_profile *profile)
{
return connection_connect(dev, BNEP_SVC_PANU);
server_unregister(adapter, BNEP_SVC_PANU);
}
-static int gn_probe(struct btd_profile *p, struct btd_device *device)
-{
- DBG("path %s", device_get_path(device));
-
- return connection_register(device, BNEP_SVC_GN);
-}
-
static int gn_connect(struct btd_device *dev, struct btd_profile *profile)
{
return connection_connect(dev, BNEP_SVC_GN);
server_unregister(adapter, BNEP_SVC_GN);
}
-static int nap_probe(struct btd_profile *p, struct btd_device *device)
-{
- DBG("path %s", device_get_path(device));
-
- return connection_register(device, BNEP_SVC_NAP);
-}
-
static int nap_connect(struct btd_device *dev, struct btd_profile *profile)
{
return connection_connect(dev, BNEP_SVC_NAP);
.name = "network-panu",
.local_uuid = NAP_UUID,
.remote_uuid = PANU_UUID,
- .device_probe = panu_probe,
- .device_remove = network_remove,
+ .device_probe = connection_register,
+ .device_remove = connection_unregister,
.connect = panu_connect,
.disconnect = panu_disconnect,
.adapter_probe = panu_server_probe,
.name = "network-gn",
.local_uuid = PANU_UUID,
.remote_uuid = GN_UUID,
- .device_probe = gn_probe,
- .device_remove = network_remove,
+ .device_probe = connection_register,
+ .device_remove = connection_unregister,
.connect = gn_connect,
.disconnect = gn_disconnect,
.adapter_probe = gn_server_probe,
.name = "network-nap",
.local_uuid = PANU_UUID,
.remote_uuid = NAP_UUID,
- .device_probe = nap_probe,
- .device_remove = network_remove,
+ .device_probe = connection_register,
+ .device_remove = connection_unregister,
.connect = nap_connect,
.disconnect = nap_disconnect,
.adapter_probe = nap_server_probe,