GPS.NET blocks forever on SerialStream.Read()

Jun 13, 2011 at 2:24 PM

Hi,

I'm investigating GPS.NET for use on our various handheld fleets across the UK.

But I'm having trouble getting it to work on a Casio DTX-30 (Windows Mobile Classic 6)

In this method, in the background thread:

 

        public override int Read(byte[] buffer, int offset, int count)
        {            
            _Result = NativeMethods.ReadFile(_Handle, buffer, (uint)count, out _BytesTransmitted, IntPtr.Zero);
            if (!_Result) CheckError();
            return (int)_BytesTransmitted;
        }

It blocks forever on NativeMethods.ReadFile().

I've tried changing the timeouts in the SerialStream constructor:

                _Timeouts.ReadIntervalTimeout = 3000;

                // Timeout "multipliers" (per-byte timeouts) are not necessary
                _Timeouts.ReadTotalTimeoutMultiplier = 0;
                _Timeouts.WriteTotalTimeoutMultiplier = 0;

                // Set default read/write timeouts
                //_Timeouts.ReadTotalTimeoutConstant = (uint)SerialDevice.DefaultReadTimeout.TotalMilliseconds;
                //_Timeouts.WriteTotalTimeoutConstant = (uint)SerialDevice.DefaultWriteTimeout.TotalMilliseconds;
                _Timeouts.ReadTotalTimeoutConstant = 10;
                _Timeouts.WriteTotalTimeoutConstant = 10;

But it does nothing.

Using Casio's own internal GPS test app, the device is working correclty and returns a lock.

It uses the intermediate driver.

Can anybody assist is getting this to work please?

Thanks,

James.

 

Jun 15, 2011 at 4:37 PM

Fixed it (sort of)

Ignore the intermediate driver, use GII1: directly.

Works if I hack the SerialStream class to use MS Serial.Ports namespace.

Fails if I use the unhacked code.

So far I've fixed one problem: SetupComm is not supported on WinCE6 (error 50), so I ignore Error 50 on that line

Now ReadFile throws an error 12 (invalid access)