emacs-elpa-diffs
[Top][All Lists]
Advanced

[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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]