首页 > android > 蓝牙UUID

蓝牙UUID

最近准备过年了,各种在外面跑,都没怎么静下心来看些东西。在研究一下蓝牙方面的东西,发现有一个叫UUID的东西不是很了解,就找了一些资料,下面就说一下我的见解吧。我如果有什么讲得不对的,还请各位进行指正~

UUID应该就是全球唯一标识符的意思吧,很多地方都会用到这个概念。而在蓝牙中,它就是用来标识每个服务的。它里面的每一个标识符在时空上是唯一的,怎么说呢,就是在同一时间、同一个地方,不可能有两个相同的UUID标识的服务。它的形式是这样的:00001000-0000-1000-8000-00805F9B34FB,至于具体格式是怎么样的,这里就不详细说了,很容易找到。

它的用法应该是这样的(只能说应该,手上没有两台蓝牙手机,无法测试): 在android上打开蓝牙串口协议(SPP)的socket的代码:

BluetoothDevice bluetoothDevice;
//....获得device对象,可以通过BluetoothAdapter的getRemoteDevice(String address)方法等方式进行
BluetoothSocket socket = bluetoothDevice.createRfcommSocketToServiceRecord(uuid);  //这里的UUID就是设备提供的蓝牙服务
socket.connect();
//创建了socket之后就可以像操作其它socket那样进行了

下面就列一下我找到的关于蓝牙的服务的UUID

 ServiceDiscoveryServerServiceClassID_UUID = '{00001000-0000-1000-8000-00805F9B34FB}'
 BrowseGroupDescriptorServiceClassID_UUID = '{00001001-0000-1000-8000-00805F9B34FB}'
 PublicBrowseGroupServiceClass_UUID = '{00001002-0000-1000-8000-00805F9B34FB}' 

 #蓝牙串口服务
 SerialPortServiceClass_UUID = '{00001101-0000-1000-8000-00805F9B34FB}' 

 LANAccessUsingPPPServiceClass_UUID = '{00001102-0000-1000-8000-00805F9B34FB}' 

 #拨号网络服务
 DialupNetworkingServiceClass_UUID = '{00001103-0000-1000-8000-00805F9B34FB}' 

 #信息同步服务
 IrMCSyncServiceClass_UUID = '{00001104-0000-1000-8000-00805F9B34FB}' 

 SDP_OBEXObjectPushServiceClass_UUID = '{00001105-0000-1000-8000-00805F9B34FB}' 

 #文件传输服务
 OBEXFileTransferServiceClass_UUID = '{00001106-0000-1000-8000-00805F9B34FB}' 

 IrMCSyncCommandServiceClass_UUID = '{00001107-0000-1000-8000-00805F9B34FB}'
 SDP_HeadsetServiceClass_UUID = '{00001108-0000-1000-8000-00805F9B34FB}'
 CordlessTelephonyServiceClass_UUID = '{00001109-0000-1000-8000-00805F9B34FB}'
 SDP_AudioSourceServiceClass_UUID = '{0000110A-0000-1000-8000-00805F9B34FB}'
 SDP_AudioSinkServiceClass_UUID = '{0000110B-0000-1000-8000-00805F9B34FB}'
 SDP_AVRemoteControlTargetServiceClass_UUID = '{0000110C-0000-1000-8000-00805F9B34FB}'
 SDP_AdvancedAudioDistributionServiceClass_UUID = '{0000110D-0000-1000-8000-00805F9B34FB}'
 SDP_AVRemoteControlServiceClass_UUID = '{0000110E-0000-1000-8000-00805F9B34FB}'
 VideoConferencingServiceClass_UUID = '{0000110F-0000-1000-8000-00805F9B34FB}'
 IntercomServiceClass_UUID = '{00001110-0000-1000-8000-00805F9B34FB}' 

 #蓝牙传真服务
 FaxServiceClass_UUID = '{00001111-0000-1000-8000-00805F9B34FB}' 

 HeadsetAudioGatewayServiceClass_UUID = '{00001112-0000-1000-8000-00805F9B34FB}'
 WAPServiceClass_UUID = '{00001113-0000-1000-8000-00805F9B34FB}'
 WAPClientServiceClass_UUID = '{00001114-0000-1000-8000-00805F9B34FB}' 

 #个人局域网服务
 PANUServiceClass_UUID = '{00001115-0000-1000-8000-00805F9B34FB}' 

 #个人局域网服务
 NAPServiceClass_UUID = '{00001116-0000-1000-8000-00805F9B34FB}' 

 #个人局域网服务
 GNServiceClass_UUID = '{00001117-0000-1000-8000-00805F9B34FB}' 

 DirectPrintingServiceClass_UUID = '{00001118-0000-1000-8000-00805F9B34FB}'
 ReferencePrintingServiceClass_UUID = '{00001119-0000-1000-8000-00805F9B34FB}'
 ImagingServiceClass_UUID = '{0000111A-0000-1000-8000-00805F9B34FB}'
 ImagingResponderServiceClass_UUID = '{0000111B-0000-1000-8000-00805F9B34FB}'
 ImagingAutomaticArchiveServiceClass_UUID = '{0000111C-0000-1000-8000-00805F9B34FB}'
 ImagingReferenceObjectsServiceClass_UUID = '{0000111D-0000-1000-8000-00805F9B34FB}'
 SDP_HandsfreeServiceClass_UUID = '{0000111E-0000-1000-8000-00805F9B34FB}'
 HandsfreeAudioGatewayServiceClass_UUID = '{0000111F-0000-1000-8000-00805F9B34FB}'
 DirectPrintingReferenceObjectsServiceClass_UUID = '{00001120-0000-1000-8000-00805F9B34FB}'
 ReflectedUIServiceClass_UUID = '{00001121-0000-1000-8000-00805F9B34FB}'
 BasicPringingServiceClass_UUID = '{00001122-0000-1000-8000-00805F9B34FB}'
 PrintingStatusServiceClass_UUID = '{00001123-0000-1000-8000-00805F9B34FB}' 

 #人机输入服务
 HumanInterfaceDeviceServiceClass_UUID = '{00001124-0000-1000-8000-00805F9B34FB}' 

 HardcopyCableReplacementServiceClass_UUID = '{00001125-0000-1000-8000-00805F9B34FB}' 

 #蓝牙打印服务
 HCRPrintServiceClass_UUID = '{00001126-0000-1000-8000-00805F9B34FB}' 

 HCRScanServiceClass_UUID = '{00001127-0000-1000-8000-00805F9B34FB}'
 CommonISDNAccessServiceClass_UUID = '{00001128-0000-1000-8000-00805F9B34FB}'
 VideoConferencingGWServiceClass_UUID = '{00001129-0000-1000-8000-00805F9B34FB}'
 UDIMTServiceClass_UUID = '{0000112A-0000-1000-8000-00805F9B34FB}'
 UDITAServiceClass_UUID = '{0000112B-0000-1000-8000-00805F9B34FB}'
 AudioVideoServiceClass_UUID = '{0000112C-0000-1000-8000-00805F9B34FB}'
 SIMAccessServiceClass_UUID = '{0000112D-0000-1000-8000-00805F9B34FB}'
 PnPInformationServiceClass_UUID = '{00001200-0000-1000-8000-00805F9B34FB}'
 GenericNetworkingServiceClass_UUID = '{00001201-0000-1000-8000-00805F9B34FB}'
 GenericFileTransferServiceClass_UUID = '{00001202-0000-1000-8000-00805F9B34FB}'
 GenericAudioServiceClass_UUID = '{00001203-0000-1000-8000-00805F9B34FB}'
 GenericTelephonyServiceClass_UUID = '{00001204-0000-1000-8000-00805F9B34FB}'

其实我对蓝牙的了解也不是很多,以上仅是对这两天看到的发表一点见解,而且不详细。如果也有朋友正在研究这方面的,欢迎联系我,我们交流一下~

分类: android 标签:
  1. 学习了