Diff between 706f9cb68fedb05b963c32d26c264c31d2f551f6 and c89618370dce83aa561ef733179a0b62ad927e93

Changed Files

File Additions Deletions Status
client/gatt.c +10 -0 modified
client/gatt.h +1 -0 modified
client/main.c +12 -0 modified
doc/gatt-api.txt +12 -9 modified

Full Patch

diff --git a/client/gatt.c b/client/gatt.c
index 0533854..33e8936 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -842,6 +842,16 @@ void gatt_acquire_notify(GDBusProxy *proxy, const char *arg)
 	notify_proxy = proxy;
 }
 
+void gatt_release_notify(GDBusProxy *proxy, const char *arg)
+{
+	if (proxy != notify_proxy || !notify_io) {
+		rl_printf("Write not acquired\n");
+		return;
+	}
+
+	notify_io_destroy();
+}
+
 static void notify_reply(DBusMessage *message, void *user_data)
 {
 	bool enable = GPOINTER_TO_UINT(user_data);
diff --git a/client/gatt.h b/client/gatt.h
index 5dba26b..9bab429 100644
--- a/client/gatt.h
+++ b/client/gatt.h
@@ -42,6 +42,7 @@ void gatt_acquire_write(GDBusProxy *proxy, const char *arg);
 void gatt_release_write(GDBusProxy *proxy, const char *arg);
 
 void gatt_acquire_notify(GDBusProxy *proxy, const char *arg);
+void gatt_release_notify(GDBusProxy *proxy, const char *arg);
 
 void gatt_add_manager(GDBusProxy *proxy);
 void gatt_remove_manager(GDBusProxy *proxy);
diff --git a/client/main.c b/client/main.c
index e0a265d..8f75f0e 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1829,6 +1829,16 @@ static void cmd_acquire_notify(const char *arg)
 	gatt_acquire_notify(default_attr, arg);
 }
 
+static void cmd_release_notify(const char *arg)
+{
+	if (!default_attr) {
+		rl_printf("No attribute selected\n");
+		return;
+	}
+
+	gatt_release_notify(default_attr, arg);
+}
+
 static void cmd_notify(const char *arg)
 {
 	dbus_bool_t enable;
@@ -2310,6 +2320,8 @@ static const struct {
 					"Release Write file descriptor" },
 	{ "acquire-notify", NULL, cmd_acquire_notify,
 					"Acquire Notify file descriptor" },
+	{ "release-notify", NULL, cmd_release_notify,
+					"Release Notify file descriptor" },
 	{ "notify",       "<on/off>", cmd_notify, "Notify attribute value" },
 	{ "register-application", "[UUID ...]", cmd_register_app,
 						"Register profile to connect" },
diff --git a/doc/gatt-api.txt b/doc/gatt-api.txt
index 3f4a3ca..c0ad1de 100644
--- a/doc/gatt-api.txt
+++ b/doc/gatt-api.txt
@@ -93,8 +93,9 @@ Methods		array{byte} ReadValue(dict options)
 
 		fd, uint16 AcquireWrite() [experimental] (Client only)
 
-			Acquire write file descriptor and MTU and lock
-			write access to the characteristic.
+			Acquire file descriptor and MTU for writing. Usage of
+			WriteValue will be locked causing it to return
+			NotPermitted error.
 
 			Only works with characteristic that has
 			WriteAcquired property which relies on
@@ -115,8 +116,9 @@ Methods		array{byte} ReadValue(dict options)
 
 		fd, uint16 AcquireNotify() [experimental] (Client only)
 
-			Acquire notify file descriptor and MTU and lock
-			notifications to the characteristic.
+			Acquire file descriptor and MTU for notify. Usage of
+			StartNotify will be locked causing it to return
+			NotPermitted error.
 
 			Only works with characteristic that has NotifyAcquired
 			which relies on notify Flag and no other client have
@@ -125,7 +127,7 @@ Methods		array{byte} ReadValue(dict options)
 			Notification are enabled during this procedure so
 			StartNotify shall not be called, any notification
 			will be dispatched via file descriptor therefore the
-			Value property is no affected during the time where
+			Value property is not affected during the time where
 			notify has been acquired.
 
 			To release the lock the client shall close the file
@@ -147,6 +149,7 @@ Methods		array{byte} ReadValue(dict options)
 			if it supports value notifications or indications.
 
 			Possible Errors: org.bluez.Error.Failed
+					 org.bluez.Error.NotPermitted
 					 org.bluez.Error.InProgress
 					 org.bluez.Error.NotSupported
 
@@ -177,15 +180,15 @@ Properties	string UUID [read-only]
 
 		boolean WriteAcquired [read-only, optional]
 
-			True, if this characteristic has been acquire by any
+			True, if this characteristic has been acquired by any
 			client using AcquireWrite. This properties is ommited
-			in case write-without-response flag is not set.
+			in case 'write-without-response' flag is not set.
 
 		boolean NotifyAcquired [read-only, optional]
 
-			True, if this characteristic has been acquire by any
+			True, if this characteristic has been acquired by any
 			client using AcquireNotify. This properties is ommited
-			in case notify flag is not set.
+			in case 'notify' flag is not set.
 
 		boolean Notifying [read-only, optional]