How to set UUID in Win CE?

Topics: Bluetooth - Microsoft, Bluetooth - Other
Nov 18, 2013 at 9:58 AM
I'm building an android app to communicate with a Win CE 5 PC(with a bluetooth dongle and C# code) using Bluetooth to transfer messages. To start and learn about how the bluetooth connection works I've started by making a connection between an android tablet and my Win 7 PC. I got this to work and tried to get it to work in WIN CE but It doesn't work.

It seems I can't set de UUID of the device. I use the following code to set the UUID.

Guid mUUID = new Guid("00001101-0000-1000-0000-00005F9B34FB");
BluetoothClient con;
updateUI("Generated UUID is: " + mUUID.ToString());
serverStarted = true;
updateUI("Server started, waiting for clients");
BluetoothListener bluetoothListener = new BluetoothListener(mUUID);
bluetoothListener.Start();
updateUI("UUID used to connect is: " + mUUID.ToString());
con = bluetoothListener.AcceptBluetoothClient();
updateUI("Client has connected");
Stream mStream = con.GetStream();
When I use the same code on Win 7 and search for the bluetooth device using a bluetooth network scanner I can see the bluetooth dongle with the UUID I've set using this code. But this doesn't work on WIn CE. but it doesn't give any errors it jsut runs the code fine but doesn't seem to set the UUID.

Does anyone know why this doesn't work? or what the correct code is?

Thanks in advance and sorry any language errors!
Developer
Nov 18, 2013 at 7:47 PM
A UUID is not something a device has. It is something an application/service running on a device has. A bit like a TCP/IP port number. So it doesn't make sense to say "I can see the bluetooth dongle with the UUID I've set using this code".

The UUID you are using there is the one used for the standard Bluetooth Serial Port SPP service, so likely has been used by the device already when it is creating its virtual COM ports.

Change the UUID to a unique one you have created yourself. See https://32feet.codeplex.com/wikipage?title=Bluetooth%20Server-side&referringTitle=General%20Bluetooth%20Data%20Connections
Nov 19, 2013 at 7:23 AM
Thanks for your reply

I understand more or less how a UUID Works but I didn't know it could already be in use but not be visible using a bluetooth network scanner.
I had tried it before with different UUID's but I've tried it again just now using the link you provided but this didn't solved the problem.
I still get the same unable to connect message on my tablet.
And I get the same error in the bluetooth network scanner i use ( Medieval Bluetooth Network Scanner v1.4.0.0).

The error is in dutch "'(10108) Onbekende service. Kan de service niet vinden in de opgegeven naamruimte" which translates to something like this
"(10108) Unkown Service. Can't find the service in the given namespace"

Normaly with every other device I've tried I can see the UUID's that are associated with that device.
I've googled this error but can't find anything about it.

Is this an error you've seen before? or do you know what might be causing it?

thanks!

Martijn
Nov 22, 2013 at 9:41 AM
Does anyone know what might be the reason this doesn't work?

thanks!

Martijn
Developer
Nov 28, 2013 at 8:34 AM
Please explain again what the situation is? You are running the client where? And where is the server (listener)? And in the two cases, is it always Win7 and replacing Android with CE? Or replacing the Win7?
Nov 28, 2013 at 8:38 AM
I've found my problem, apparently the bluetooth dongle i was using didn't work well with Win CE.
After trying a board with an onboard bluetooth receiver I got it to work!

Thanks for your reply!

Martijn
Marked as answer by alanjmcf on 11/29/2013 at 12:35 AM