How to read CTS signal on serial port

  • Thread starter Thread starter Drasko
  • Start date Start date
D

Drasko

I am using OpenNETCF on WinCE. Can't find a way to read status of CTS (or
any other input signal like DSR)!?
OpenNETCF.Serial has enumaeration member CommModemStatusFlags, but I don't
know how to read modem status register of rs232 port?

Thanks

Drasko
 
I cannot see a CTSHolding property either. However you can catch the event
which tells you when CTS changes, is that good enough? If not, you could
pinvoke yourself GetCommModemStatus to get it (make sure the port is open
before doing so and you'll have to modify the source to expose hPort OR use
reflection to get it).

Cheers
Daniel
 
Thanks for the answer, but CTSchange event fires if CTS change and I want to
check its state for example when I open a port before any changes. Also, I
tought that I can avoid pinvoking. It is strange that there is no property
for any of input signals!?

Thanks anyway

Drasko
 
Add that request to the OpenNETCF requests database! The reason is that the
serial driver handles normal operation of the handshaking signals. It's
only strange applications that would ever need to know the current state of
CTS.

Paul T.
 
Hi,

It is easy to add the code to do this.

However, an alternative is to download CFSerial from my homepage. I have
include the properties for the UART hardware handshaking lines (CTS, CD,
DSR, RI for input and DTR and RTS for output).

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
 
Hi Dick,

Must say I swear by your control! I've gone to the Zebra serial control,
then went with the whole new Symbol Printing dealeo and now I'm back to your
control as the control I can depend on to print correctly.
If I could get it working with Bluetooth now....<g>

Thanks!
Harry
 
Hi Harry,

Bluetooth is a peculiar beast. I haven't had any client who have requested
it, so I haven't had the opportunity to work with it.

Dick
--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
 
Thanks for advice!
Btw, some devices doesn't use CTS, CD, DSR (or RI) only for handshaking.
Some of them are used for other purposes.

Drasko
 
Yes, I've done it. But I find your CFSerial very interesting. Nice and
simple, exactly what I need for this puprose.

Thank you

Drasko
 
Yes, and, in fact, ActiveSync is one of those applications. When you plug
the serial cable in, the change in the state of the modem control signals
triggers repllog.exe to be executed on the device. However, the OS handles
doing that, so there doesn't have to be an application program monitoring
it.

Paul T.
 
Back
Top