1

Hello i'want to detect the serial port bluetooth service of an external bluetooth device from my computer, for that i'm using the Bluecove API and the following code :

 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;
         }

But i keep having the "java.lang.NumberFormatException: For input string: "0S" " exception in the line :

 UUID uuid = new UUID("SPP", true);

thank you for your help

Tarik Mokafih
  • 1,247
  • 7
  • 19
  • 38

1 Answers1

0

From bluecove's documentation

"Creates a UUID object from the string provided. The characters in the string must be from the hexadecimal set [0-9, a-f, A-F]."

"SPP" is not a valid hex number.

Thomas
  • 5,074
  • 1
  • 16
  • 12
  • thank you i see now what is the problem, but i don't know what is exactly a uuid and what should i pass as an argument to the UUID constructor, all what i know is the adress of the bluetooth device. – Tarik Mokafih Dec 11 '11 at 16:04