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

[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



reply via email to

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