您好,我想从我的计算机检测外部蓝牙设备的串行端口蓝牙服务,因为我正在使用 Bluecove API 和以下代码:
BluetoothDeviceDiscovery bluetoothDeviceDiscovery=new BluetoothDeviceDiscovery();
//display local device address and name
LocalDevice localDevice = LocalDevice.getLocalDevice();
System.out.println("Address: "+localDevice.getBluetoothAddress());
System.out.println("Name: "+localDevice.getFriendlyName());
//find devices
DiscoveryAgent agent = localDevice.getDiscoveryAgent();
UUID uuid = new UUID("SPP", true);
String ServiceURL = agent.selectService(uuid,ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);//"btspp://localhost:"+rd.getBluetoothAddress()+";name=SPP";
if( ServiceURL == null) {
System.out.println("Connection failed: "+ uuid +"\n");
return;
}
但我一直在行中出现“java.lang.NumberFormatException:对于输入字符串:“0S””异常:
UUID uuid = new UUID("SPP", true);
谢谢您的帮助