diff options
-rw-r--r-- | network/network-api.txt | 4 | ||||
-rw-r--r-- | network/server.c | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/network/network-api.txt b/network/network-api.txt index 63ac05d2..e5916088 100644 --- a/network/network-api.txt +++ b/network/network-api.txt @@ -99,6 +99,10 @@ Methods string GetUUID() Possible errors: org.bluez.network.Error.Failed + bool IsEnabled() + + Returns the server status. + void SetName(string name) Sets the name attribute. diff --git a/network/server.c b/network/server.c index 702c8fb3..4ac7328f 100644 --- a/network/server.c +++ b/network/server.c @@ -918,6 +918,22 @@ static DBusHandlerResult disable(DBusConnection *conn, return send_message_and_unref(conn, reply); } +static DBusHandlerResult is_enabled(DBusConnection *conn, DBusMessage *msg, + void *data) +{ + struct network_server *ns = data; + DBusMessage *reply; + + reply = dbus_message_new_method_return(msg); + if (!reply) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &ns->enable, + DBUS_TYPE_INVALID); + + return send_message_and_unref(conn, reply); +} + static DBusHandlerResult set_name(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -1090,6 +1106,7 @@ static DBusMethodVTable server_methods[] = { { "GetUUID", get_uuid, "", "s" }, { "Enable", enable, "", "" }, { "Disable", disable, "", "" }, + { "IsEnabled", is_enabled, "", "b" }, { "SetName", set_name, "s", "" }, { "GetName", get_name, "", "s" }, { "SetAddressRange", set_address_range, "ss", "" }, |