[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 98afd71 22/33: add property and uuid function
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bluetooth 98afd71 22/33: add property and uuid functions, update info display |
Date: |
Sat, 19 Sep 2020 08:43:24 -0400 (EDT) |
branch: externals/bluetooth
commit 98afd7130e11fd9bfe35b03d11b3d2bd3900089b
Author: Raffael Stocker <r.stocker@mnet-mail.de>
Commit: Raffael Stocker <r.stocker@mnet-mail.de>
add property and uuid functions, update info display
New functions:
bluetooth--device-properties
bluetooth--device-uuids
---
bluetooth.el | 47 +++++++++++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index da033ff..68d415e 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -486,6 +486,27 @@ adapter reported by Bluez."
(alist-get
:adapter
bluetooth--interfaces)))))
+(defun bluetooth--device-properties (dev-id)
+ "Return all properties of device DEV-ID."
+ (bluetooth--call-method
+ (car (last (split-string dev-id "/"))) :device
+ #'dbus-get-all-properties))
+
+(defun bluetooth--device-uuids (properties)
+ "Return a UUID alist of device DEV-ID.
+Each list element contains a UUID as the key and the
+corresponding description string as the value. If no description
+string is available (e.g. for unknown UUIDs,) the UUID itself is
+the value."
+ (let ((uuids (cdr (assoc "UUIDs" properties)))
+ (uuid-alist))
+ (when uuids
+ (dolist (id uuids)
+ (let ((desc (or (bluetooth--parse-service-class-uuid id)
+ (list id))))
+ (push (list id desc) uuid-alist))))
+ (nreverse uuid-alist)))
+
;;;; mode entry command
@@ -3623,9 +3644,7 @@ scanning the bus, displaying device info etc."
(bluetooth--with-alias dev-id
(with-current-buffer-window
"*Bluetooth device info*" nil nil
- (let ((props (bluetooth--call-method
- (car (last (split-string
dev-id "/"))) :device
- #'dbus-get-all-properties)))
+ (let ((props (bluetooth--device-properties dev-id)))
(ins-heading "Bluetooth device info\n\n")
(ins-attr "Alias" alias)
(when-let (address (cdr (assoc "Address" props)))
@@ -3655,18 +3674,18 @@ scanning the bus, displaying device info etc."
(dolist (elt (cadr x))
(insert (format "%15s %s\n" ""
elt)))
(insert (format "%15s %s\n" "" (cadr
x)))))))
- (when-let (uuids (cdr (assoc "UUIDs" props)))
+ (when (cdr (assoc "UUIDs" props))
(ins-heading "\nSerives (UUIDs)\n")
- (dolist (id uuids)
- (let ((desc (or
(bluetooth--parse-service-class-uuid id)
- (list id))))
- (when (car desc)
- (insert (format "%30s " (car desc))))
- (when (cadr desc)
- (insert (format "%s " (cadr desc))))
- (when (caddr desc)
- (insert (format "(%s)" (caddr desc))))
- (insert "\n")))))
+ (mapc (lambda (id-pair)
+ (let ((desc (cadr id-pair)))
+ (when (car desc)
+ (insert (format "%36s "
(car desc))))
+ (when (cadr desc)
+ (insert (format "%s " (cadr
desc))))
+ (when (caddr desc)
+ (insert (format "(%s)"
(caddr desc))))
+ (insert "\n")))
+ (bluetooth--device-uuids props))))
(special-mode)))))))
(provide 'bluetooth)
- [elpa] externals/bluetooth fba1988 07/33: adds a simple compile/test setup script, (continued)
- [elpa] externals/bluetooth fba1988 07/33: adds a simple compile/test setup script, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 53323b9 09/33: matches case sensitively in bluetooth--function-name, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 8f3dcaa 11/33: move some of the comments into docstrings, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth e86e01f 12/33: add local variable for flycheck mode, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth f107d6f 13/33: Add menu entries to bluetooth-mode-map, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth eb4b158 15/33: Merge commit 'f107d6f', Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth b12caf1 16/33: update author list, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 5d72618 17/33: add page breaks and section headings, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 8e8b6d0 19/33: bump up the copyright year, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 943ddf3 21/33: Clean up the UUID and class descriptions, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 98afd71 22/33: add property and uuid functions, update info display,
Stefan Monnier <=
- [elpa] externals/bluetooth 518ebdf 29/33: update company ids (bluetooth--manufacturer-ids), Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 2746c62 23/33: change connect and disconnect functions to handle single profiles, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 0ca89cf 24/33: clean up the connect and disconnect functions, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 7bb793f 26/33: remove unneeded hydra reference from Makefile, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 950cc77 27/33: add more menu entries, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth b5fc5c2 28/33: correct docstring in bluetooth-disconnect, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 28d16f6 33/33: set version number to 0.2, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth dc4b63b 30/33: correct docstrings, Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 6599093 31/33: update list of member UUIDs (bluetooth--member-uuid-alist)., Stefan Monnier, 2020/09/19
- [elpa] externals/bluetooth 2ae073b 25/33: update readme with single profile connect information, Stefan Monnier, 2020/09/19