diff --git a/doc/network-api.txt b/doc/network-api.txt
index 4dd3e58..b640b9a 100644
--- a/doc/network-api.txt
+++ b/doc/network-api.txt
Interface org.bluez.Network
Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
-Methods string Connect(string uuid)
-
- Connect to the network device and return the network
- interface name. Examples of the interface name are
- bnep0, bnep1 etc.
-
- uuid can be either one of "gn", "panu" or "nap" (case
- insensitive) or a traditional string representation of
- UUID or a hexadecimal number.
-
- The connection will be closed and network device
- released either upon calling Disconnect() or when
- the client disappears from the message bus.
-
- Possible errors: org.bluez.Error.AlreadyConnected
- org.bluez.Error.ConnectionAttemptFailed
-
- void Disconnect()
-
- Disconnect from the network device.
-
- To abort a connection attempt in case of errors or
- timeouts in the client it is fine to call this method.
-
- Possible errors: org.bluez.Error.Failed
-
- dict GetProperties()
-
- Returns all properties for the interface. See the
- properties section for available properties.
-
-Signals PropertyChanged(string name, variant value)
-
- This signal indicates a changed value of the given
- property.
-
Properties boolean Connected [readonly]
Indicates if the device is connected.
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 8769986..2403446 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
cancel_connection(nc, -EIO);
}
-static void local_connect_cb(struct btd_device *device, int err,
- const char *pdev, void *data)
-{
- DBusMessage *msg = data;
- DBusMessage *reply;
-
- if (err < 0) {
- reply = btd_error_failed(msg, strerror(-err));
- g_dbus_send_message(btd_get_dbus_connection(), reply);
- dbus_message_unref(msg);
- return;
- }
-
- g_dbus_send_reply(btd_get_dbus_connection(), msg,
- DBUS_TYPE_STRING, &pdev,
- DBUS_TYPE_INVALID);
-
- dbus_message_unref(msg);
-}
-
-static DBusMessage *local_connect(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- struct network_peer *peer = data;
- const char *svc;
- uint16_t id;
- int err;
-
- if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &svc,
- DBUS_TYPE_INVALID) == FALSE)
- return btd_error_invalid_args(msg);
-
- id = bnep_service_id(svc);
-
- err = connection_connect(peer->device, id, dbus_message_get_sender(msg),
- local_connect_cb, msg);
- if (err < 0)
- return btd_error_failed(msg, strerror(-err));
-
- dbus_message_ref(msg);
-
- return NULL;
-}
-
/* Connect and initiate BNEP session */
int connection_connect(struct btd_device *device, uint16_t id,
const char *owner,
return 0;
}
-static DBusMessage *local_disconnect(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- struct network_peer *peer = data;
- const char *caller = dbus_message_get_sender(msg);
- GSList *l;
-
- for (l = peer->connections; l; l = l->next) {
- struct network_conn *nc = l->data;
- int err;
-
- if (nc->state == DISCONNECTED)
- continue;
-
- err = connection_disconnect(peer->device, nc->id, caller);
- if (err < 0)
- return btd_error_failed(msg, strerror(-err));
-
- return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
- }
-
- return btd_error_not_connected(msg);
-}
-
static gboolean
network_property_get_connected(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
peer_free(peer);
}
-static const GDBusMethodTable connection_methods[] = {
- { GDBUS_ASYNC_METHOD("Connect",
- GDBUS_ARGS({"uuid", "s"}),
- GDBUS_ARGS({"interface", "s"}),
- local_connect) },
- { GDBUS_METHOD("Disconnect",
- NULL, NULL, local_disconnect) },
- { }
-};
-
static const GDBusPropertyTable connection_properties[] = {
{ "Connected", "b", network_property_get_connected },
{ "Interface", "s", network_property_get_interface },
if (g_dbus_register_interface(btd_get_dbus_connection(), path,
NETWORK_PEER_INTERFACE,
- connection_methods,
- NULL, connection_properties,
+ NULL, NULL, connection_properties,
peer, path_unregister) == FALSE) {
error("D-Bus failed to register %s interface",
NETWORK_PEER_INTERFACE);