[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 1f048b5949 20/32: clean up and drop multiple
From: |
Stefan Kangas |
Subject: |
[elpa] externals/bluetooth 1f048b5949 20/32: clean up and drop multiple adapter plans |
Date: |
Mon, 3 Jan 2022 15:11:08 -0500 (EST) |
branch: externals/bluetooth
commit 1f048b5949431b96ed5bb76f245fdde9e2fdf0e4
Author: Raffael Stocker <r.stocker@mnet-mail.de>
Commit: Raffael Stocker <r.stocker@mnet-mail.de>
clean up and drop multiple adapter plans
* bluetooth.el (bluetooth--query-adapters): renamed from bluetooth--adapters
(bluetooth--query-devices): renamed from bluetooth--devices
---
bluetooth.el | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 3e128a6ed0..aafd77b98d 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -369,12 +369,12 @@ properties."
"Return DEVICE's property PROP-NAME."
(cl-rest (assoc prop-name (bluetooth-device-properties device))))
-(defun bluetooth--adapters ()
+(defun bluetooth--query-adapters ()
"Return a list of bluetooth adapters."
(dbus-introspect-get-node-names
bluetooth-bluez-bus bluetooth--service bluetooth--root))
-(defun bluetooth--devices (adapter)
+(defun bluetooth--query-devices (adapter)
"Return a list of bluetooth devices connected to ADAPTER."
(dbus-introspect-get-node-names bluetooth-bluez-bus bluetooth--service
(concat
bluetooth--root "/" adapter)))
@@ -425,8 +425,8 @@ as they are used to gather the information from Bluez.")
(puthash dev
(bluetooth--create-device adapter dev)
bluetooth--device-info))
- (bluetooth--devices adapter)))
- (bluetooth--adapters)))
+ (bluetooth--query-devices adapter)))
+ (bluetooth--query-adapters)))
;; This function provides the list entries for the tabulated-list
;; view. It is called from `tabulated-list-print'.
@@ -485,7 +485,7 @@ as they are used to gather the information from Bluez.")
((eq :adapter api)
(concat bluetooth--root
"/"
- (cl-first
(bluetooth--adapters))))
+ (cl-first
(bluetooth--query-adapters))))
(t nil)))
(interface (alist-get api bluetooth--interfaces)))
(when path
@@ -496,9 +496,6 @@ as they are used to gather the information from Bluez.")
x))
args)))))
-;; The following functions are the workers for the commands.
-;; They are used by `bluetooth--make-commands'.
-
(defun bluetooth--dbus-method (method api &rest args)
"Invoke METHOD on D-Bus API with ARGS."
(let ((dev-id (tabulated-list-get-id)))
@@ -521,13 +518,10 @@ as they are used to gather the information from Bluez.")
(bluetooth--call-method dev-id api #'dbus-set-property property arg)
(bluetooth--update-list)))
-;; end of worker function definitions
-
-;; TODO extend to multiple adapters
(defun bluetooth--initialize-mode-info ()
"Get the current adapter state and display it.
This function only uses the first adapter reported by Bluez."
- (let* ((adapter (cl-first (bluetooth--adapters)))
+ (let* ((adapter (cl-first (bluetooth--query-adapters)))
(props (bluetooth--adapter-properties adapter))
(info (--map (list (cl-first it)
(list (cl-rest (assoc
(cl-first it) props))))
@@ -587,13 +581,12 @@ update the status display accordingly."
(setf (bluetooth-property-active-p property)
value))))
data)))
-;; TODO extend to multiple adapters
(defun bluetooth--register-signal-handler ()
"Register a signal handler for adapter property changes.
This function registers a signal handler only for the first
adapter reported by Bluez."
- (let ((adapter (cl-first (bluetooth--adapters))))
+ (let ((adapter (cl-first (bluetooth--query-adapters))))
(dbus-register-signal bluetooth-bluez-bus
nil
(concat bluetooth--root "/"
@@ -4199,9 +4192,9 @@ scanning the bus, displaying device info etc."
(defun bluetooth-show-device-info ()
"Show detailed information on the device at point."
(interactive)
- (when-let (dev-id (bluetooth--device (tabulated-list-get-id)))
+ (when-let (device (bluetooth--device (tabulated-list-get-id)))
(with-current-buffer-window bluetooth-info-buffer-name nil nil
- (let ((props (bluetooth-device-properties dev-id)))
+ (let ((props (bluetooth-device-properties device)))
(bluetooth--ins-heading "Bluetooth device info\n\n")
(mapc (lambda (it) (bluetooth--ins-attr props it))
'("Alias" "Address" "AddressType" "Paired" "Trusted"
@@ -4214,11 +4207,10 @@ scanning the bus, displaying device info etc."
props)
(special-mode)))))
-;; TODO extend this to multiple adapters
(defun bluetooth-show-adapter-info ()
"Show detailed information on the (first) bluetooth adapter."
(interactive)
- (let* ((adapter (cl-first (bluetooth--adapters)))
+ (let* ((adapter (cl-first (bluetooth--query-adapters)))
(props (bluetooth--adapter-properties adapter)))
(with-current-buffer-window bluetooth-info-buffer-name nil nil
(bluetooth--ins-heading "Bluetooth adapter info\n\n")
- [elpa] externals/bluetooth bd95b1ca0b 15/32: revert to mapc instead of --map when used for side-effects only, (continued)
- [elpa] externals/bluetooth bd95b1ca0b 15/32: revert to mapc instead of --map when used for side-effects only, Stefan Kangas, 2022/01/03
- [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 <=
- [elpa] externals/bluetooth fa3761da3c 21/32: add timer to periodically update the device table in discovery mode, Stefan Kangas, 2022/01/03
- [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