B
Brandon
Platform is WM2K3 (not SE) with compact framework 2.0.
I have a thread that is using SerialPort.Readline() to read raw GPS data
from an RS232 GPS device (the RS232 port that the GPS device is plugged into
is on the vehicle cradle that the device is in). If I just open the serial
port and then repeatedly call SerialPort.Readline(), I seem to continue to
get data off of the serial port for a period of time after I have un-cradled
the device (effectively disconnecting it from the RS232 port). The length of
the period of time seems to be directly related to the lenght of time that
this thread is successfully reading from the port (for example, I put the
device in the cradle and read for 5 seconds, then uncradle, I continue to get
data from the SerialPort for X seconds...If I put the device in the cradle
and read for 50 seconds, then uncradle, I continue to get data from the
SerialPort for 10x seconds...not sure what the exact numbers are, just trying
to give a clear example).
The basics of this method looks something like:
SerialPort.Open();
while(!shutdown)
{
data = SerialPort.Readline();
...
}
SerialPort.Close();
If I instead repeatedly open the SerialPort, read until I get a parseable
update that has an acceptable quality value, and then close the SerialPort, I
do not have this issue, but instead I just get updates very slowly (there is
a lot of trash in the data for the first few reads, then you get a bunch of
initilization sentances, then you start getting position updates), and they
seem to jump around a lot.
The basics of this method look something like:
while(!shutdown)
{
SerialPort.Open()
Until(gotAGoodRead)
{
data = SerialPort.Readline();
...
}
SerialPort.Close()
}
I'd like to be able to keep the port open so I can read faster, but the
caching behavior is a serious problem...any ideas?
I have a thread that is using SerialPort.Readline() to read raw GPS data
from an RS232 GPS device (the RS232 port that the GPS device is plugged into
is on the vehicle cradle that the device is in). If I just open the serial
port and then repeatedly call SerialPort.Readline(), I seem to continue to
get data off of the serial port for a period of time after I have un-cradled
the device (effectively disconnecting it from the RS232 port). The length of
the period of time seems to be directly related to the lenght of time that
this thread is successfully reading from the port (for example, I put the
device in the cradle and read for 5 seconds, then uncradle, I continue to get
data from the SerialPort for X seconds...If I put the device in the cradle
and read for 50 seconds, then uncradle, I continue to get data from the
SerialPort for 10x seconds...not sure what the exact numbers are, just trying
to give a clear example).
The basics of this method looks something like:
SerialPort.Open();
while(!shutdown)
{
data = SerialPort.Readline();
...
}
SerialPort.Close();
If I instead repeatedly open the SerialPort, read until I get a parseable
update that has an acceptable quality value, and then close the SerialPort, I
do not have this issue, but instead I just get updates very slowly (there is
a lot of trash in the data for the first few reads, then you get a bunch of
initilization sentances, then you start getting position updates), and they
seem to jump around a lot.
The basics of this method look something like:
while(!shutdown)
{
SerialPort.Open()
Until(gotAGoodRead)
{
data = SerialPort.Readline();
...
}
SerialPort.Close()
}
I'd like to be able to keep the port open so I can read faster, but the
caching behavior is a serious problem...any ideas?