[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth fa3761da3c 21/32: add timer to periodically u
From: |
Stefan Kangas |
Subject: |
[elpa] externals/bluetooth fa3761da3c 21/32: add timer to periodically update the device table in discovery mode |
Date: |
Mon, 3 Jan 2022 15:11:08 -0500 (EST) |
branch: externals/bluetooth
commit fa3761da3cda33c59634faa90a16f74945efe10e
Author: Raffael Stocker <r.stocker@mnet-mail.de>
Commit: Raffael Stocker <r.stocker@mnet-mail.de>
add timer to periodically update the device table in discovery mode
* bluetooth.el (bluetooth-update-interval): new customization option
---
bluetooth.el | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index aafd77b98d..51b6e33840 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -58,6 +58,10 @@ This is usually `:system' if bluetoothd runs as a system
service, or
`:session' if it runs as a user service."
:type '(symbol))
+(defcustom bluetooth-update-interval 2
+ "Update interval of the device list view."
+ :type '(natnum))
+
(defgroup bluetooth-faces nil
"Faces used by Bluetooth mode."
:group 'faces)
@@ -221,17 +225,27 @@ profiles."
(command-execute #'bluetooth-disconnect)))
-(defmacro bluetooth-defun-method (method api docstring)
+(defmacro bluetooth-defun-method (method api docstring &rest body)
(declare (doc-string 3) (indent 2))
(let ((name (bluetooth--function-name method)))
`(defun ,(intern name) () ,docstring
(interactive)
- (bluetooth--dbus-method ,method ,api))))
+ (bluetooth--dbus-method ,method ,api)
+ ,@body)))
+
+(defvar bluetooth--update-timer nil
+ "The bluetooth device table update timer.")
(bluetooth-defun-method "StartDiscovery" :adapter
- "Start discovery mode.")
+ "Start discovery mode."
+ (setq bluetooth--update-timer
+ (run-at-time nil bluetooth-update-interval
+ #'bluetooth--update-list)))
+
(bluetooth-defun-method "StopDiscovery" :adapter
- "Stop discovery mode.")
+ "Stop discovery mode."
+ (cancel-timer bluetooth--update-timer))
+
(bluetooth-defun-method "Pair" :device
"Pair with device at point.")
@@ -539,11 +553,13 @@ This function only uses the first adapter reported by
Bluez."
"UnregisterAgent"
:object-path bluetooth--own-path)
(mapc #'dbus-unregister-object bluetooth--method-objects)
- (dbus-unregister-object bluetooth--adapter-signal)))
+ (dbus-unregister-object bluetooth--adapter-signal)
+ (cancel-timer bluetooth--update-timer)))
(defun bluetooth-unload-function ()
"Clean up when the bluetooth feature is unloaded."
(when (buffer-live-p (get-buffer bluetooth-buffer-name))
+ (cancel-timer bluetooth--update-timer)
(kill-buffer bluetooth-buffer-name))
nil)
- [elpa] externals/bluetooth 273306e1e0 25/32: update the list view more intelligently, (continued)
- [elpa] externals/bluetooth 273306e1e0 25/32: update the list view more intelligently, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 9878aa8051 14/32: add adapter parameters in adapter-properties and devices functions, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth f2d43ebab5 16/32: make bluetooth--choose-uuid somewhat more readable, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 5a49391b00 07/32: clean up device property handling (breaks info view code), Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 0627cceab3 08/32: clean up the info view code and add an adapter info view, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth f75ac5e43d 11/32: clean up the method registration function, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth e69e4151ff 12/32: clean things up for readability, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth a411243fbe 17/32: add a function for bluetooth device info access, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 7a78351220 19/32: set tabulated-list-padding to 0, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 1f048b5949 20/32: clean up and drop multiple adapter plans, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth fa3761da3c 21/32: add timer to periodically update the device table in discovery mode,
Stefan Kangas <=
- [elpa] externals/bluetooth c75d2e3495 22/32: handle removal of devices in list view, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth ddad595699 23/32: move command definitions to bottom of file, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 1254ec44d2 24/32: add signal handlers for paired devices, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 7a0ba3c7ea 29/32: update Readme.org, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 1fcdce66f8 31/32: require dash 2.18.1, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 7ed3db7260 32/32: Release 0.3 and bump copyright year, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth ab3a4c9cc5 18/32: move bluetooth--create-device to the other --device functions, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth a20d488f9a 28/32: delete invalid todo, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth b6c501ae6e 04/32: add bluetooth--adapters function, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth cc8f69992d 06/32: adjust initial hash table sizes, Stefan Kangas, 2022/01/03