Possible errors: org.bluez.Error.Failed
- bool IsConnected() {deprecated}
-
- Returns the connection status.
-
dict GetProperties()
Returns all properties for the interface. See the
properties section for available properties.
-Signals void Connected(string device, string uuid) {deprecated}
-
- void Disconnected(string device) {deprecated}
-
- PropertyChanged(string name, variant value)
+Signals PropertyChanged(string name, variant value)
This signal indicates a changed value of the given
property.
struct network_conn *nc = data;
if (connection != NULL) {
- const char *device = nc->dev;
gboolean connected = FALSE;
const char *property = "";
- g_dbus_emit_signal(connection, nc->peer->path,
- NETWORK_PEER_INTERFACE, "Disconnected",
- DBUS_TYPE_STRING, &device,
- DBUS_TYPE_INVALID);
emit_property_changed(connection, nc->peer->path,
NETWORK_PEER_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
DBUS_TYPE_INVALID);
connected = TRUE;
- g_dbus_emit_signal(connection, nc->peer->path,
- NETWORK_PEER_INTERFACE, "Connected",
- DBUS_TYPE_STRING, &pdev,
- DBUS_TYPE_STRING, &uuid,
- DBUS_TYPE_INVALID);
emit_property_changed(connection, nc->peer->path,
NETWORK_PEER_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
return not_connected(msg);
}
-static DBusMessage *is_connected(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- struct network_peer *peer = data;
- GSList *l;
- dbus_bool_t up = FALSE;
-
- for (l = peer->connections; l; l = l->next) {
- struct network_conn *nc = l->data;
-
- if (nc->state != CONNECTED)
- continue;
-
- up = TRUE;
- }
-
- return g_dbus_create_reply(msg, DBUS_TYPE_BOOLEAN, &up,
- DBUS_TYPE_INVALID);
-}
-
static DBusMessage *connection_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
{ "Connect", "s", "s", connection_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", connection_disconnect },
- { "IsConnected", "", "b", is_connected,
- G_DBUS_METHOD_FLAG_DEPRECATED },
{ "GetProperties", "", "a{sv}",connection_get_properties },
{ }
};
static GDBusSignalTable connection_signals[] = {
- { "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
- { "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
{ "PropertyChanged", "sv" },
{ }
};