Not working with Windows CE 5.0

Feb 5, 2010 at 2:41 AM

GPS.NET 3.0 worked with Windows CE 5.0 before and CompactFramework 3.5 - Has something changed in the binary compile for CF35?

Attached is a screenshot of the runtime error I am getting when running the Diagnostics on Windows CE 5.0 with a GPS on COM8: 38400

(hmm no way to attach JPG images...)

Error

Diagnostics.exe

ObjectDisposedExection at System.IO.__Error.WriterClosed() at System.IO.StreamWriter.Flush(BooleanflushStream, Boolean flushEncoder)

 

Do we need a specific binary build for CE?

Feb 16, 2010 at 5:05 AM
Edited Feb 16, 2010 at 5:08 AM

 

I too am struggling to get the open source version of GPS.NET to play nice with WinCE 5 (.NETCF 3.5)

We've been using a previous licensed/paid version of GPS.NET in our WinCE 5 device application without major problems (still having a few minor problems), but it I thought it was time to move to the open source (and maintained) version.

After updating the references and fixing a few compile time errors due to changed method signatures, etc, I am now getting a Win32Exception whenever I call SerialDevice.Open().

I traced it back to this code in SerialStream.cs

 

                 //Open a connection to the port
                _Handle = NativeMethods.CreateFile(
                    portName,
                    access,
                    sharing,
                    0,
                    FileMode.Open,
                    FileAttributes.Normal,
                    IntPtr.Zero);
                 //Open a connection to the port
                _Handle = NativeMethods.CreateFile(
                    portName,
                    access,
                    sharing,
                    0,
                    FileMode.Open,
                    FileAttributes.Normal,
                    IntPtr.Zero);

which is returning a null handle, and Marshal.GetLastWin32Error() is returning error code 87.

To eliminate a bug in my code, I started a fresh Smart Device project with the following code in Form1.cs:

 

using System;
using System.Windows.Forms;

using GeoFramework.Gps.IO;

namespace SmartDeviceProject1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Devices.DeviceDetected += new EventHandler<DeviceEventArgs>(Devices_DeviceDetected);
            Devices.BeginDetection();
        }

        void Devices_DeviceDetected(object sender, DeviceEventArgs e)
        {
            MessageBox.Show("DeviceDetected: " + e.Device.ToString());
        }
    }
}

 

Even though there is a GPS on COM1 at 4800, the DeviceDetected event never fires. I just get:

 

GPS.Net: COM1 is not a valid GPS device
The thread 0xcf39e46a has exited with code 0 (0x0).
GPS.Net: Device detection attempt started for Virtual port COM1
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in GeoFramework.Gps.PocketPC.dll
GPS.Net: Device detection attempt started for Serial Cable on COM4:
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in GeoFramework.Gps.PocketPC.dll
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in GeoFramework.Gps.PocketPC.dll
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in GeoFramework.Gps.PocketPC.dll

 

If I try to setup a SerialDevice directly, using the following code:

 

            SerialDevice sd = new SerialDevice(@"COM1", 4800);
            sd.Open();

I get a Win32Exception.

Has anyone got any ideas? Is anyone successfully using this on a WinCE 5 (not Windows Mobile) device?

Thanks,
Steve 

PS. I get the same errors (and Win32Exception's) that ps30 reported above when I run the Diagnostics example.

 

 

 

 

 

Feb 18, 2010 at 12:05 AM

Hi!

I am having exactly the same problem as ps30 when running Diagnostics.

Did anyone manage to make it work?

Thanks in advance,

Juan M.

Mar 25, 2010 at 9:46 AM
Hi, having same issues with cf 2.0 and winCe 5.0 Solved error code 87 in serialstream with CreateFile ("COM2:"... instead of "COM2" ...but got error code 12 in the very next api call, GetCommState error code 12 means ERROR_INVALID_ACCESS, the port is open with read access, read sharing, open filemode...hope this help! Fabio
May 3, 2010 at 7:25 PM

Check this:

http://gps3.codeplex.com/Thread/View.aspx?ThreadId=85591&ProjectName=gps3