jjzjj

createRfcommSocketToServiceRecord

全部标签

android - 只有一个特定的蓝牙SPP模块,.createRfcommSocketToServiceRecord()突然不再有效,但反射方法有效

我的应用程序通过建立和处理连接(如theAndroidBluetoothdocumentation中所述)连接到蓝牙spp模块。也就是说,在我的连接线程中,我习惯于使用以下方法进行连接:socket=device.createRfcommSocketToServiceRecord(MY_UUID)其中uuid是“众所周知”的sppuuid,00001101-0000-1000-8000-00805F9B34FB。我正在连接的蓝牙设备是小型蓝牙/串行适配器。我用了三个来做测试。其中两个是“linvor”蓝牙到ttl级别的串行pcb,目前ebay上到处都是,它们是相同的;第三个是制造商未知

android - createRfcommSocketToServiceRecord 和 createRfcommSocket 的区别

以下两种连接蓝牙设备的方式有什么区别:1)UUIDuuid=UUID.fromString(Values.SPP_UUID);//StandardSerialPortServiceIDmmSocket=mmDevice.createRfcommSocketToServiceRecord(uuid);2)Methodm=mmDevice.getClass().getMethod("createRfcommSocket",newClass[]{int.class});mmSocket=(BluetoothSocket)m.invoke(mmDevice,1);我发现第一种方法总是不能工作,