Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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
		}