Re: clearcommerror native exception?



Hi Guy:

Thanks again for your posts.

I am trying to talk to several different pieces of hardware via pocket pc's
serial bluetooth. That's why I wanted to write an auto baud routine. some
of the hardware talks at 9600 while other talk in 19200 but for some reason,
when when I have used setupcomm to set up the baud to be 9600 on the 19200
hardware I don't get any error from ClearCommError. Here is a simpler look
at my setup:

'hooked up to 19200 baud hardware
createfile
get the dcb
set dcb for 9600 odd 8 1 '<- since BuildCommDCB is not support, the only way
I know how is to do:
DCB.Parity = 1
DCB.BaudRate = 9600
DCB.StopBits = 1
DCB.ByteSize = 8

'of course I instantiated the DCB.
setupComm
..
..
..
'sometime later
readfile <- the hw device continuesly outputs datavalues
'readfile succeeds or timesout either way some data is read
clearCommError(handle,errorFlag,null) <- errorFlag = 0

the data that I got is something like "????????????"
I thought it may have been parity error so I tried the setup for parity none,
odd, even, mark, and space.
but still I get "?????" setting it to 19200 also doesn't help.

This means there is something wrong with my settings but why didn't
clearCommError catch anything? So since I am getting a 0 it means that the
windows serial driver caught the error and handled it? Whether or not I have
the right setting doesn't seem to effect the errorFlag outcome. hmm.

1. Is there anyway to get the error flag short of writing a c lib and
p/invoke to it?
2. have you guys encounter the hair pulling teeth bitting "????" that just
doesn't care about your settings?

Thanks guys, for even reading this post.

*** Grier wrote:
>I am not sure about the Opennetcf.org serial object, you may have to close
>and reopen the port to change speeds or other settings. I do this
>automatically, on change, in my CFSerialIO dll (which you can download from
>my homepage). Since the source code for the SDF is included, why not just
>look there to see what happens?
>
>As to your ClearCommError question... the errCode parameter is non-zero
>when an error is captured by the Windows serial driver. These are
>communications errors, so you would only see a non-zero value for something
>like Framing, Overrun, Parity, etc.
>
>***
>

--
"What if this is as good as it gets?"
.