Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-05-08 17:44:25 +0400
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>2006-05-08 17:44:25 +0400
commitfc71db5a36f6d8ebe8d8e259b18c74cdf6d0181f (patch)
treecaee644570a6c627ce53b164e86c0ce72ed5254a /mcs/class/System/System.IO.Ports/SerialPort.cs
parent083ccb79d8b9ab80822ce8c762a78e810fc3a8f0 (diff)
* SerialPort.cs:
* WinSerialStream.cs: Actually plug the Win serial stream in the SerialPort and use it if we are on Windows (use std stream otherwise). 2005-05-08 Carlos Alberto Cortez <calberto.cortez@gmail.com> svn path=/trunk/mcs/; revision=60402
Diffstat (limited to 'mcs/class/System/System.IO.Ports/SerialPort.cs')
-rw-r--r--mcs/class/System/System.IO.Ports/SerialPort.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/mcs/class/System/System.IO.Ports/SerialPort.cs b/mcs/class/System/System.IO.Ports/SerialPort.cs
index 168e3cc81dd..5d7514fe822 100644
--- a/mcs/class/System/System.IO.Ports/SerialPort.cs
+++ b/mcs/class/System/System.IO.Ports/SerialPort.cs
@@ -426,13 +426,25 @@ namespace System.IO.Ports
throw new NotImplementedException ("Detection of ports is not implemented for this platform yet.");
}
+ static bool IsWindows {
+ get {
+ PlatformID id = Environment.OSVersion.Platform;
+ return id == PlatformID.Win32Windows || id == PlatformID.Win32NT; // WinCE not supported
+ }
+ }
+
public void Open ()
{
if (is_open)
throw new InvalidOperationException ("Port is already open");
- stream = new SerialPortStream (port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
+ if (IsWindows) // Use windows kernel32 backend
+ stream = new WinSerialStream (port_name, baud_rate, data_bits, parity, stop_bits,
+ handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);
+ else // Use standard unix backend
+ stream = new SerialPortStream (port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);
+
is_open = true;
}