Issues with StoneStreetOne stack on Motorola MC9500

Topics: Bluetooth - Stonestreet
Jul 20, 2012 at 4:15 AM

I'm using InTheHand v3.5 under WinMo 6/.NETCF 3.5 to communicate with a Bluetooth GPS receiver via RFCOMM.  The code I've written works fine when running on, say, a Juniper Mesa which contains a Socket KwikBlue4 BT module.  I can discover devices, connect, receive NMEA strings via the BluetoothClient's network stream, and shut down cleanly with no problems.

The Moto MC9500, with StoneStreet One stack, is a different matter.  I have several issues:

1. I am seeing the same problems reported in work item 32595, namely (a) PrimaryRadio is reported as null the first time I run my app, but not the second time, and (b) any interaction with the BT stack prevents my app from shutting down.  Because of orphaned threads in an unrelated 3rd-party library, I have always had to call the TerminateProcess API (passing it the current process ID) as the last thing my app does when closing.  But this call is now hanging if my code has touched the Moto's BT stack in any way.  The 'stop debugging' button in VS2008 has no effect.  I have to disconnect and reboot the device to kill my app's process.

2. Device discovery (via BluetoothClient.DiscoverDevicesInRange) takes two or three attempts before it returns any devices on the Moto.  On the Mesa, it works first time.

3. Most serious of all, I cannot reliably receive data via RFCOMM from my GPS device.  I get two or three seconds' worth of data (one NMEA string per second) and then an IOException is thrown by the Stream.Read method, which I am calling in a loop in the DoWork method of an OpenNETCF BackgroundWorker.  The inner exception is a SocketException with message "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" and error code 10060.  Stack trace follows.

at InTheHand.Net.AsyncResultNoResult.EndInvoke()
at InTheHand.Net.AsyncResult`1.EndInvoke()
at InTheHand.Net.Bluetooth.Factory.CommonRfcommStream.EndRead(IAsyncResult asyncResult)
at InTheHand.Net.Bluetooth.Factory.CommonRfcommStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at InTheHand.Net.Bluetooth.Factory.DecoratorNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MyCompanyName.IO.StreamWatcher.BackgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
at OpenNETCF.ComponentModel.BackgroundWorker.DoTheRealWork(Object o)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()

I haven't tried using Moto's own .NET SDK to work with BT on the MC9500.  I was hoping to avoid this.

Developer
Jul 28, 2012 at 3:30 PM

Hmm. Not good. However this looks like it might take a lot of investigation to fix. Have you made any progress on it?

Jul 29, 2012 at 10:41 PM

No.  I haven't tried, because I wouldn't know where to start.  The fact that everything works great on other devices tells me that Motorola has probably tweaked the WM stack to work in 'proprietary' ways on their hardware.  It wouldn't be the first time.

Unfortunately Moto is my company's preferred supplier of rugged devices, so my app will need to support them somehow.  Obviously I'd prefer this to be via InTheHand and device-independent code.  As a last resort I will have to consider writing separate code for Moto devices.

I think the 32feet.NET library is a great piece of work.  I couldn't have got this far on my project without it and I'm very happy to work with you to get to the bottom of these issues.  Feel free to suggest a way forward.

Developer
Aug 1, 2012 at 9:20 PM

What version of software does the device have? What general and what BTPS version?

Does the device have the dual MSFT and BTPS stack installation? (See e.g. http://32feet.codeplex.com/wikipage?title=Stonestreet%20One%20Bluetopia )

Where in the world are you?

Aug 2, 2012 at 1:16 AM

No sign of a dual stack.  I can only find the Stonestreet One stack mentioned in system info, etc.  There's no 'BT Select' control panel widget on this device.

From Settings/System/System Info:

OS: Windows Embedded Handheld 6.5 Classic, CE 5.2.29040 (build 29040.5.3.12)

OEM name: Motorola MC95

OEM version: 04.41.0003

OEM Bluetooth: 5.2.5312.41003, BCM2046 Bluetooth Module

Under BTExplorer/About/Version, all of the following items have a version number of 2.1.1.1 (except BTExplorer which is 2.1.1.27168): A2DP subband codec, Bluetopia, Bluetopia COM driver, Bluetopia driver, COM port library, file transfer profile, AVRCP profile, AVRCP server, GAVD profile, GAVD/A2DP server, HID profile, headset profile, OBEX object push, PAN driver, PAN profile, serial port profile, VCOM port library.

I'm on the east coast of Australia.  It's cold but sunny. :)

Dec 5, 2012 at 4:02 AM

Problem solved.  There is a dual stack on this device, but to swap between them requires a registry hack and a reboot:

http://christian-helle.blogspot.com.au/2010/10/motorola-dual-bluetooth-stack-support.html

Developer
Dec 10, 2012 at 12:42 PM

Ah ha. Thanks for letting us know.