[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth fe926e9 28/57: puts functions before the long
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bluetooth fe926e9 28/57: puts functions before the long uuid defconsts for readability |
Date: |
Thu, 7 Nov 2019 23:28:53 -0500 (EST) |
branch: externals/bluetooth
commit fe926e959b6c2a87aef8a83f52e6256e7e3e4809
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>
puts functions before the long uuid defconsts for readability
---
bluetooth.el | 93 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 46 insertions(+), 47 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 53c7ca7..63f24a1 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -599,6 +599,52 @@ This function only uses the first adapter reported by
Bluez."
"Get the minor field spec for FIELD using DATA as specification."
(symbol-value (cdr (alist-get field data))))
+(defun bluetooth-show-device-info ()
+ "Show detail information on the device at point."
+ (interactive)
+ (bluetooth--show-device-info (tabulated-list-get-id)))
+
+(defun bluetooth--show-device-info (device)
+ "Show information about DEVICE in a temp buffer"
+ (bluetooth--with-alias device
+ (with-current-buffer-window
+ "*Bluetooth device info*" nil nil
+ (let ((address (bluetooth--call-method
+ (car (last (split-string device "/"))) :device
+ #'dbus-get-property "Address"))
+ (rssi (bluetooth--call-method
+ (car (last (split-string device "/"))) :device
+ #'dbus-get-property "RSSI"))
+ (class (bluetooth--call-method
+ (car (last (split-string device "/"))) :device
+ #'dbus-get-property "Class"))
+ (uuids (bluetooth--call-method
+ (car (last (split-string device "/"))) :device
+ #'dbus-get-property "UUIDs")))
+ (insert "Alias:\t\t" alias "\n")
+ (when address
+ (insert "Address:\t" address "\n"))
+ (when rssi
+ (insert "RSSI:\t\t" (number-to-string rssi) "\n"))
+ (when class
+ (let ((p-class (bluetooth--parse-class class)))
+ (insert "\nService and device classes:\n")
+ (mapc (lambda (x)
+ (insert (car x) ":\n")
+ (if (listp (cadr x))
+ (dolist (elt (cadr x))
+ (insert "\t" elt "\n"))
+ (insert "\t" (cadr x) "\n")))
+ p-class)))
+ (when uuids
+ (insert "\nServices (UUIDs):\n")
+ (dolist (id uuids)
+ (insert (mapconcat #'identity
+ (or (bluetooth--parse-service-class-uuid id)
+ (list id))
+ " -- ")
+ "\n")))))))
+
;;; The following constants define the meaning of the Bluetooth
;;; CLASS property, which is made up of a number of fields.
;;; The following components are used:
@@ -812,52 +858,6 @@ This function only uses the first adapter reported by
Bluez."
(#xf . "Personal Mobility Device"))))
"Bluetooth health minor classes.")
-(defun bluetooth-show-device-info ()
- "Show detail information on the device at point."
- (interactive)
- (bluetooth--show-device-info (tabulated-list-get-id)))
-
-(defun bluetooth--show-device-info (device)
- "Show information about DEVICE in a temp buffer"
- (bluetooth--with-alias device
- (with-current-buffer-window
- "*Bluetooth device info*" nil nil
- (let ((address (bluetooth--call-method
- (car (last (split-string device "/"))) :device
- #'dbus-get-property "Address"))
- (rssi (bluetooth--call-method
- (car (last (split-string device "/"))) :device
- #'dbus-get-property "RSSI"))
- (class (bluetooth--call-method
- (car (last (split-string device "/"))) :device
- #'dbus-get-property "Class"))
- (uuids (bluetooth--call-method
- (car (last (split-string device "/"))) :device
- #'dbus-get-property "UUIDs")))
- (insert "Alias:\t\t" alias "\n")
- (when address
- (insert "Address:\t" address "\n"))
- (when rssi
- (insert "RSSI:\t\t" (number-to-string rssi) "\n"))
- (when class
- (let ((p-class (bluetooth--parse-class class)))
- (insert "\nService and device classes:\n")
- (mapc (lambda (x)
- (insert (car x) ":\n")
- (if (listp (cadr x))
- (dolist (elt (cadr x))
- (insert "\t" elt "\n"))
- (insert "\t" (cadr x) "\n")))
- p-class)))
- (when uuids
- (insert "\nServices (UUIDs):\n")
- (dolist (id uuids)
- (insert (mapconcat #'identity
- (or (bluetooth--parse-service-class-uuid id)
- (list id))
- " -- ")
- "\n")))))))
-
(defconst bluetooth--service-class-uuid-alist
'((#x1000 . ("ServiceDiscoveryServerServiceClassID"
"Bluetooth Core Specification"))
@@ -1406,7 +1406,6 @@ This function only uses the first adapter reported by
Bluez."
(#xFD87 . "Google LLC"))
"Bluetooth manufacturer UUIDs.")
-
(provide 'bluetooth)
;;; bluetooth.el ends here
- [elpa] externals/bluetooth 325febd 16/57: adds Imenu integration to Readme feature list, (continued)
- [elpa] externals/bluetooth 325febd 16/57: adds Imenu integration to Readme feature list, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth f0e5047 18/57: removes unnecessary quotes before lambdas and corrects indentation, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 738347b 19/57: adds TAGS to .gitignore, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 28e9eb2 21/57: wraps @body in progn in bluetooth--maybe-cancel-reject, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 4133a10 13/57: makes mode idempotent, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 3c25a8c 23/57: adds basic service class UUID parsing, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 5219f05 31/57: fixes a compile error and adds customization, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 0108cbd 32/57: uses `read-from-minibuffer' instead of `read-passwd', Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 1ec2997 22/57: uses the correct bus (:system) for the callback methods, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 83344c8 20/57: cleans up display code, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth fe926e9 28/57: puts functions before the long uuid defconsts for readability,
Stefan Monnier <=
- [elpa] externals/bluetooth c473128 40/57: adds repository URL to mode (entry) command docstring, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth eb1d4ea 25/57: adds UUID and service/device class parsing and display, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth f9bfd26 39/57: fixes a grammatical mistake in Readme.org, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 565cfec 38/57: adds more elaborate usage information, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 7714f6b 45/57: updates Readme, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 1f3b244 47/57: makes checkdoc and package-lint happy, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 9d79f61 46/57: puts the key bindings in their own defvar (as is usual), Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth fd39a17 50/57: cleans up movement to beginning/end of list, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 5387639 52/57: adds path loss to device info, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth ea7ccf7 53/57: fixes mode line update, Stefan Monnier, 2019/11/07