AnsweredAssumed Answered

Connect to SPBT2632C2A.AT2

Question asked by zabelin.sergey on Jul 17, 2014
Latest reply on Jul 21, 2014 by panvini.gaetano

Hello!

I'm trying to connect to SPBT2632C2A.AT2 of mobile applications for Android. I need SPP profile.

I took as the basis for this example http://www.pclviewer.com/android/
Mobile device creates a couple with SPBT2632C2A.AT2 successfully.

But connection fails, an exception occurs.
Here's the code:

function ConnectDvc(Address:String) : Boolean;
var
  BA : JBluetoothAdapter;
  Dvc : JBluetoothDevice;
  Sock : JBluetoothSocket;
  UID : JUUID;                
begin
  Result := false;
  BA := TJBluetoothAdapter.JavaClass.getDefaultAdapter;
  Dvc := BA.getRemoteDevice(StringToJString(Address));
  // This is the well known SPP UUID for connection to a Bluetooth serial device
  UID := TJUUID.JavaClass.fromString(stringtojstring('00001101-0000-1000-8000-00805F9B34FB'));
  Sock := Dvc.createRfcommSocketToServiceRecord(UID);
  try
      Sock.connect;
      Result := true;
    except
      Result := false;
  end;
end;

What am I doing wrong?  The correctGUIDthat I use?

Outcomes