diff --git a/client/gatt.c b/client/gatt.c
index 0533854..33e8936 100644
--- a/client/gatt.c
+++ b/client/gatt.c
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
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
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;
"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
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
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
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
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
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]