Serial Port Enable

In a NETMF project I can check if a SerialPort is open or not observing the IsOpen property.

I notice there is an Enable() and Disable() method on the new UartController. Is this the same as opening and closing the port? Is there any way to detect the status or do I need to track it myself somewhere?


from the examples, it appears that Enable() is used instead of Open().

What would be the situation, in an embedded program, where you would not know if a serial port was open or not?

Hi Mike,

I worked out that Enable/Disable behaved like Open/Close, thanks.

The reason I wanted to know if the port was open is so that during initialisation, any requests to write to the port wouldn’t happen until the port was open. With NETMF it was easy, just wrap each command with a check in that property.

I guess now I will need to manually track this, block the ability for a thread to write until I’m ready or just assume the port is open and hope everything just works. This is what I’m doing currently with my port.

I really would have expected a way to read back the state though especially as the state can be changed.