[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 9878aa8051 14/32: add adapter parameters in a
From: |
Stefan Kangas |
Subject: |
[elpa] externals/bluetooth 9878aa8051 14/32: add adapter parameters in adapter-properties and devices functions |
Date: |
Mon, 3 Jan 2022 15:11:07 -0500 (EST) |
branch: externals/bluetooth
commit 9878aa805176973255b8cf58245644de1ffc7760
Author: Raffael Stocker <r.stocker@mnet-mail.de>
Commit: Raffael Stocker <r.stocker@mnet-mail.de>
add adapter parameters in adapter-properties and devices functions
---
bluetooth.el | 52 ++++++++++++++++++++++------------------------------
1 file changed, 22 insertions(+), 30 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 8b772cd0e1..f460b1bbc2 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -373,15 +373,10 @@ properties."
(dbus-introspect-get-node-names
bluetooth-bluez-bus bluetooth--service bluetooth--root))
-;; TODO don't return the adapter names, as they are in the devices?
-;; do this per adapter?
-(defun bluetooth--devices ()
- "Return a list of bluetooth adapters and devices connected to them."
- (mapcar (lambda (a)
- (list a (dbus-introspect-get-node-names
- bluetooth-bluez-bus bluetooth--service
- (concat bluetooth--root "/" a))))
- (bluetooth--adapters)))
+(defun bluetooth--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)))
(defun bluetooth--dev-state (key device)
"Return state information regarding KEY for DEVICE."
@@ -391,18 +386,13 @@ properties."
(t "yes"))))
;; TODO extend to multiple adapters
-(defun bluetooth--adapter-properties ()
- "Return the properties of the first bluetooth adapter.
-This function evaluates to a list of the form ‘(ADAPTER
-PROPERTIES)’, where ADAPTER is the name (not the whole path) of
-the first adapter, and PROPERTIES is an alist of attribute/value
-pairs."
- (let ((adapter (cl-first (bluetooth--adapters))))
- (list adapter
- (dbus-get-all-properties bluetooth-bluez-bus
bluetooth--service
- (concat
bluetooth--root "/" adapter)
- (alist-get
:adapter
-
bluetooth--interfaces)))))
+(defun bluetooth--adapter-properties (adapter)
+ "Return the properties of bluetooth ADAPTER.
+This function evaluates to an alist of attribute/value pairs."
+ (dbus-get-all-properties bluetooth-bluez-bus bluetooth--service
+ (concat bluetooth--root "/"
adapter)
+ (alist-get :adapter
+
bluetooth--interfaces)))
(defconst bluetooth--list-format
[("Alias" 24 t) ("Paired" 8 t) ("Connected" 11 t) ("Address" 18 t)
@@ -426,13 +416,13 @@ as they are used to gather the information from Bluez.")
(defun bluetooth--update-device-info ()
"Update the bluetooth devices list."
- (mapc (lambda (devlist)
- (mapc (lambda (dev)
- (puthash dev
- (bluetooth--create-device
(cl-first devlist) dev)
- bluetooth--device-info))
- (cl-second devlist)))
- (bluetooth--devices)))
+ (mapc (lambda (adapter)
+ (mapc (lambda (dev)
+ (puthash dev
+
(bluetooth--create-device adapter dev)
+ bluetooth--device-info))
+ (bluetooth--devices adapter)))
+ (bluetooth--adapters)))
;; This function provides the list entries for the tabulated-list
;; view. It is called from `tabulated-list-print'.
@@ -533,7 +523,8 @@ as they are used to gather the information from Bluez.")
(defun bluetooth--initialize-mode-info ()
"Get the current adapter state and display it.
This function only uses the first adapter reported by Bluez."
- (let* ((props (cl-second (bluetooth--adapter-properties)))
+ (let* ((adapter (cl-first (bluetooth--adapters)))
+ (props (bluetooth--adapter-properties adapter))
(info (--map (list (cl-first it)
(list (cl-rest (assoc
(cl-first it) props))))
bluetooth--mode-state)))
@@ -4225,7 +4216,8 @@ scanning the bus, displaying device info etc."
(defun bluetooth-show-adapter-info ()
"Show detailed information on the (first) bluetooth adapter."
(interactive)
- (-let (((adapter props) (bluetooth--adapter-properties)))
+ (let* ((adapter (cl-first (bluetooth--adapters)))
+ (props (bluetooth--adapter-properties adapter)))
(with-current-buffer-window bluetooth-info-buffer-name nil nil
(bluetooth--ins-heading "Bluetooth adapter info\n\n")
(--map (bluetooth--ins-attr props it)
- [elpa] externals/bluetooth updated (4c7d18c99b -> 7ed3db7260), Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 6aebc228b5 02/32: fix a typo in the info display, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 72cb48584f 01/32: widen address field in tab view to accommodate var-pitch fonts, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 3d0fe7ed9d 09/32: use a struct for the adapter property display in the mode line, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth ada89f2faa 10/32: clean up the signal handler function, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth f971b21d66 03/32: use a structure and hash table for device-info, Stefan Kangas, 2022/01/03
- [elpa] externals/bluetooth 8edeb34f61 05/32: add bluetooth--adapter-properties function, Stefan Kangas, 2022/01/03
- [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 <=
- [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, 2022/01/03
- [elpa] externals/bluetooth c75d2e3495 22/32: handle removal of devices in list view, Stefan Kangas, 2022/01/03