public virtual IFrostedSerialPort Create(string serialPortName) { #if __ANDROID__ //Create an instance of a FrostedSerialPort IFrostedSerialPort newPort = null; newPort = new FrostedSerialPort(serialPortName); return(newPort); #else IFrostedSerialPort newPort = null; // if we can find a mac helper class (to get us 250k) string appBundle = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); if (File.Exists(Path.Combine(appBundle, "libFrostedSerialHelper.dylib"))) { // use it newPort = new FrostedSerialPort(serialPortName); } else // use the c# native serial port { #if USE_STANDARD_SERIAL newPort = new CSharpSerialPortWrapper(serialPortName); #endif } return(newPort); #endif // ANDROID }
public virtual bool SerialPortIsAvailable(string serialPortName, PrinterSettings settings) { try { return(FrostedSerialPort.GetPortNames().Any(portName => string.Compare(portName, serialPortName, true) == 0)); } catch { return(false); } }
public static string GetDefaultPortName() { string[] ports = FrostedSerialPort.GetPortNames(); if (ports.Length > 0) { return(ports[0]); } else { int p = (int)Environment.OSVersion.Platform; if (p == 4 || p == 128 || p == 6) { return("ttyS0"); // Default for Unix } else { return("COM1"); // Default for Windows } } }
public FrostedSerialPort() : this(FrostedSerialPort.GetDefaultPortName(), DefaultBaudRate, DefaultParity, DefaultDataBits, DefaultStopBits) { }
public static IFrostedSerialPort Create(string serialPortName) { IFrostedSerialPort newPort = null; // if we can find a mac helper class (to get us 250k) string appBundle = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); if (File.Exists(Path.Combine(appBundle, "libFrostedSerialHelper.dylib"))) { // use it newPort = new FrostedSerialPort(serialPortName); } else // use the c# native serial port { newPort = new CSharpSerialPortWrapper(serialPortName); } return newPort; }
public virtual IFrostedSerialPort Create(string serialPortName) { #if __ANDROID__ //Create an instance of a FrostedSerialPort IFrostedSerialPort newPort = null; newPort = new FrostedSerialPort(serialPortName); return newPort; #else IFrostedSerialPort newPort = null; // if we can find a mac helper class (to get us 250k) string appBundle = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); if (File.Exists(Path.Combine(appBundle, "libFrostedSerialHelper.dylib"))) { // use it newPort = new FrostedSerialPort(serialPortName); } else // use the c# native serial port { #if USE_STANDARD_SERIAL newPort = new CSharpSerialPortWrapper(serialPortName); #endif } return newPort; #endif // ANDROID }