WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by lars » Fri, 24 Nov 2006 00:59:10


Short Background:
I'm developing an application which connects to a custom hardware unit
via Bluetooth. I'm experiencing different behaviour in the phase of
connecting to the unit depending on which target device I'm selecting
in Visual Studio 2005.

I'm using a HTC P3600 (Bluetooth 2.0) with Windows Mobile 5.0 Pocket
PC. The custom unit is sampling data from a number of channels and
sending the data via Bluetooth (2.0) in a custom format. Coding in
Visual Studio Professional / C#.


An example scenario where the problem happens:

(Preparation)
1. Add the unit to the list of devices in the Bluetooth control panel.
(enter pairing key, select serial port service)
2. Add an outgoing com port.

(Start application)
3. Activate a configure function which opens the com port and sends a
configuration message.
4. Activate a start function which sends a start message to the unit.
The unit now sends sampled data back to me.


The 'problem':
If I have chosen 'Windows Mobile 5.0 Pocket PC Device' as target device
I get a pop up message at step 3 telling me that the unit is trying to
connect to me and asks if I want to add it to my list of devices. I
select 'yes' and I have to enter the paring key and select the serial
port service again. Now the outgoing com port is gone and as well the
unit in the list of devices. So I have to perform step 1 and 2 again.

If I say 'no' to adding the unit to my list of devices the unit and the
com port are left untouched and I can proceed to step 4 with the
configuration message in step 3 beeing recieved nicely by the unit.

If I have chosen 'Windows CE 5.0 Device' as target device I never get
the pop up and step 3 and 4 works like it should.


The question(s):
What's the difference in the two choices of target device that results
in this behaviour? Can I change some settings to avoid the behaviour
when selecting WM 5.0 PPC target device?

Since I'm using a Pocket PC device it seems like I shouldn't be
selecting CE. However, every thing works nice when using CE as target
device (what I can see so far). Am I just lucky that everything works
nicely on CE target device? Will I be unable to access some
functionality in the WM 5.0 sdk when using CE target device?


I hope:
1. I'm posting in an appropriate group.
2. My swedish -> english works for you all out there.
3. I'm not asking something that has been answered several times
already (didn't really know what words to google on).
4. The raining here stops soon...
 
 
 

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by lars » Fri, 24 Nov 2006 01:41:34

EDIT!!

Forgot one part. A quite important part which makes this behaviour
happen. Sorry.

This happens when I have had the unit turned off after adding it as a
device. For example, I perform step 1-4. Collect som data. Exit my
application and turn the unit off. Back from lunch I turn the unit on
again and repeat step 3-4.

So, I guess that the unit loses the pairing information since it's been
reset by me, and this is why I get the pop up. But I still don't have a
clue why this happens in WM 5.0 PPc device target and not in CE 5.0
device target.

 
 
 

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by » Fri, 24 Nov 2006 01:59:08

If I were to guess (and it's only a guess) if you select WM, it sees that
the CF is installed and just deploys the app, so the registry is never
persisted. If you select WINCE, it thinks it needs a new CF version so it
pushes the CAB file down and runs it. That results in the registry being
persisted and your pairing info getting saved.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
 
 
 

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by lars » Fri, 24 Nov 2006 20:51:17

Thank you for the reply Chris Tacke.

What does "the registry is never persisted" mean?

Does your idea mean that the WM targeted application can't see the list
of devices and therefore attempts to add the unit again even though
it's already in the list. And when adding a unit that's already there
results in some strange behaviour which clears the list and virtual com
port? So, by turning off and on the unit it sends a "hello, I'm here"
message and since the application isn't aware of that the unit is
already in the list an attempt to add it is performed, with a strange
result.

But WCE targeted application is fully aware of the units in the device
list and realizes that a new pairing doesn't have to be performed?

I've noticed that the pop up isn't showing in WM if I uncheck the 'safe
connection' checkbox in the new outgoing port setting. (hope 'safe
connection' was a correct translation)


<ctacke/> skrev:
 
 
 

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by Chris Scot » Wed, 29 Nov 2006 05:18:01

Sorry I can't offer a solution but I do know that CE5 and WM5 PPC devices
*are* different and have different security models implemented. Perhaps
this has something to do with it though I have no idea what... :)
 
 
 

WM 5.0 PPC or CE 5.0 as target device produces different behaviour when using Bluetooth.

Post by lars » Sun, 03 Dec 2006 00:29:03

Ok.

Thanks to both of you for taking time to write down your ideas. If I
manage to find some more info on this matter I'll post it in case some
else has the same problems.


Chris Scott skrev: