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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bluetooth 3c25a8c 23/57: adds basic service class UUID


From: Stefan Monnier
Subject: [elpa] externals/bluetooth 3c25a8c 23/57: adds basic service class UUID parsing
Date: Thu, 7 Nov 2019 23:28:52 -0500 (EST)

branch: externals/bluetooth
commit 3c25a8cb7677e09da3148d4a829996518491882e
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>

    adds basic service class UUID parsing
---
 bluetooth.el | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index ab2f281..dfadbd7 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -44,6 +44,7 @@
 (require 'cl-lib)
 (require 'let-alist)
 (require 'dash)
+(require 'rx)
 
 (defconst bluetooth-buffer-name "*Bluetooth*"
   "Name of the buffer in which to list bluetooth devices.")
@@ -516,6 +517,99 @@ This function only uses the first adapter reported by 
Bluez."
                      :object-path bluetooth--own-path)
     (mapc #'dbus-unregister-object bluetooth--method-objects)))
 
+;;; Application layer
+
+(defconst bluetooth--service-class-uuid-alist
+  '((#x1000 . ("ServiceDiscoveryServerServiceClassID" "Bluetooth Core 
Specification"))
+    (#x1001 . ("BrowseGroupDescriptorServiceClassID" "Bluetooth Core 
Specification"))
+    (#x1101 . ("SerialPort" "Serial Port Profile (SPP)"))
+    (#x1102 . ("LANAccessUsingPPP" "LAN Access Profile"))
+    (#x1103 . ("DialupNetworking" "Dial-up Networking Profile (DUN)"))
+    (#x1104 . ("IrMCSync" "Synchronization Profile (SYNC)"))
+    (#x1105 . ("OBEXObjectPush" "Object Push Profile (OPP)"))
+    (#x1106 . ("OBEXFileTransfer" "File Transfer Profile (FTP)"))
+    (#x1107 . ("IrMCSyncCommand" "Synchronization Profile (SYNC)"))
+    (#x1108 . ("Headset" "Headset Profile (HSP)"))
+    (#x1109 . ("CordlessTelephony" "Cordless Telephony Profile (CTP)"))
+    (#x110A . ("AudioSource" "Advanced Audio Distribution Profile (A2DP)"))
+    (#x110B . ("AudioSink" "Advanced Audio Distribution Profile (A2DP)"))
+    (#x110C . ("A/V_RemoteControlTarget" "Audio/Video Remote Control Profile 
(AVRCP)"))
+    (#x110D . ("AdvancedAudioDistribution" "Advanced Audio Distribution 
Profile (A2DP)"))
+    (#x110E . ("A/V_RemoteControl" "Audio/Video Remote Control Profile 
(AVRCP)"))
+    (#x110F . ("A/V_RemoteControlController" "Audio/Video Remote Control 
Profile (AVRCP)"))
+    (#x1110 . ("Intercom" "Intercom Profile (ICP)"))
+    (#x1111 . ("Fax" "Fax Profile (FAX)"))
+    (#x1112 . ("Headset - Audio Gateway (AG)" "Headset Profile (HSP)"))
+    (#x1113 . ("WAP" "Interoperability Requirements for Bluetooth technology 
as a WAP, Bluetooth SIG "))
+    (#x1114 . ("WAP_CLIENT" "Interoperability Requirements for Bluetooth 
technology as a WAP, Bluetooth SIG "))
+    (#x1115 . ("PANU" "Personal Area Networking Profile (PAN)"))
+    (#x1116 . ("NAP" "Personal Area Networking Profile (PAN)"))
+    (#x1117 . ("GN" "Personal Area Networking Profile (PAN)"))
+    (#x1118 . ("DirectPrinting" "Basic Printing Profile (BPP)"))
+    (#x1119 . ("ReferencePrinting" "See Basic Printing Profile (BPP)"))
+    (#x111A . ("Basic Imaging Profile" "Basic Imaging Profile (BIP)"))
+    (#x111B . ("ImagingResponder" "Basic Imaging Profile (BIP)"))
+    (#x111C . ("ImagingAutomaticArchive" "Basic Imaging Profile (BIP)"))
+    (#x111D . ("ImagingReferencedObjects" "Basic Imaging Profile (BIP)"))
+    (#x111E . ("Handsfree" "Hands-Free Profile (HFP)"))
+    (#x111F . ("HandsfreeAudioGateway" "Hands-free Profile (HFP)"))
+    (#x1120 . ("DirectPrintingReferenceObjectsService" "Basic Printing Profile 
(BPP)"))
+    (#x1121 . ("ReflectedUI" "Basic Printing Profile (BPP)"))
+    (#x1122 . ("BasicPrinting" "Basic Printing Profile (BPP)"))
+    (#x1123 . ("PrintingStatus" "Basic Printing Profile (BPP)"))
+    (#x1124 . ("HumanInterfaceDeviceService" "Human Interface Device (HID)"))
+    (#x1125 . ("HardcopyCableReplacement" "Hardcopy Cable Replacement Profile 
(HCRP)"))
+    (#x1126 . ("HCR_Print" "Hardcopy Cable Replacement Profile (HCRP)"))
+    (#x1127 . ("HCR_Scan" "Hardcopy Cable Replacement Profile (HCRP)"))
+    (#x1128 . ("Common_ISDN_Access" "Common ISDN Access Profile (CIP)"))
+    (#x112D . ("SIM_Access" "SIM Access Profile (SAP)"))
+    (#x112E . ("Phonebook Access - PCE" "Phonebook Access Profile (PBAP)"))
+    (#x112F . ("Phonebook Access - PSE" "Phonebook Access Profile (PBAP)"))
+    (#x1130 . ("Phonebook Access" "Phonebook Access Profile (PBAP)"))
+    (#x1131 . ("Headset - HS" "Headset Profile (HSP)"))
+    (#x1132 . ("Message Access Server" "Message Access Profile (MAP)"))
+    (#x1133 . ("Message Notification Server" "Message Access Profile (MAP)"))
+    (#x1134 . ("Message Access Profile" "Message Access Profile (MAP)"))
+    (#x1135 . ("GNSS" "Global Navigation Satellite System Profile (GNSS)"))
+    (#x1136 . ("GNSS_Server" "Global Navigation Satellite System Profile 
(GNSS)"))
+    (#x1137​ . ("​3D Display" "​3D Synchronization Profile (3DSP)"))
+    (​#x1138 . ("​3D Glasses" "​3D Synchronization Profile (3DSP)"))
+    (#x1139​ . ("​3D Synchronization" "​3D Synchronization Profile (3DSP)"))
+    (​#x113A . ("​MPS Profile UUID" "​Multi-Profile Specification (MPS)"))
+    (​#x113B . ("​MPS SC UUID" "​Multi-Profile Specification (MPS)"))
+    (​#x113C​ . ("​CTN Access Service​" "​Calendar, Task, and Notes (CTN) 
Profile"))
+    (​#x113D . ("​CTN Notification Service​" "​​Calendar Tasks and Notes (CTN) 
Profile"))
+    (​#x113E . ("​CTN Profile" "​​Calendar Tasks and Notes (CTN) Profile"))
+    (#x1200 . ("PnPInformation" "Device Identification (DID)"))
+    (#x1201 . ("GenericNetworking" "N/A"))
+    (#x1202 . ("GenericFileTransfer" "N/A"))
+    (#x1203 . ("GenericAudio" "N/A"))
+    (#x1204 . ("GenericTelephony" "N/A"))
+    (#x1205 . ("UPNP_Service" "Enhanced Service Discovery Profile (ESDP)"))
+    (#x1206 . ("UPNP_IP_Service" "Enhanced Service Discovery Profile (ESDP)"))
+    (#x1300 . ("ESDP_UPNP_IP_PAN" "Enhanced Service Discovery Profile (ESDP)"))
+    (#x1301 . ("ESDP_UPNP_IP_LAP" "Enhanced Service Discovery Profile (ESDP)"))
+    (#x1302 . ("ESDP_UPNP_L2CAP" "Enhanced Service Discovery Profile (ESDP)"))
+    (#x1303 . ("VideoSource" "Video Distribution Profile (VDP)"))
+    (#x1304 . ("VideoSink" "Video Distribution Profile (VDP)"))
+    (#x1305 . ("VideoDistribution" "Video Distribution Profile (VDP)"))
+    (#x1400 . ("HDP" "Health Device Profile"))
+    (#x1401 . ("HDP Source" "Health Device Profile (HDP)"))
+    (#x1402 . ("HDP Sink" "Health Device Profile (HDP)")))
+  "Bluetooth service class UUIDs.")
+
+(defconst bluetooth--base-uuid "0000-1000-8000-00805f9b34fb"
+  "Bluetooth base UUID.")
+
+(defun bluetooth--parse-service-class-uuid (uuid)
+  "Parse UUID and return short and long service class names."
+  (let ((uuid-re (rx (seq bos (submatch (= 8 xdigit))
+                         "-" (eval bluetooth--base-uuid) eos))))
+    (save-match-data
+      (when (string-match uuid-re uuid)
+       (alist-get (string-to-number (match-string 1 uuid) 16)
+                  bluetooth--service-class-uuid-alist)))))
+
 (provide 'bluetooth)
 
 ;;; bluetooth.el ends here



reply via email to

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