System.IO.Ports.SerialPort.ReadByte C# (CSharp) Méthode

ReadByte() public méthode

public ReadByte ( ) : int
Résultat int
		public int ReadByte ()
		{
			CheckOpen ();
			return read_byte ();
		}

Usage Example

		bool IsPVC(SerialPort port)
		{
			string returnMessage = "";
			try {
				if (port.IsOpen)
					port.Close ();

				port.Open ();

				Thread.Sleep (1500); // Fails if this delay is any shorter

				port.Write ("#");
				port.Write (port.NewLine);

				Thread.Sleep (500); // Fails if this delay is any shorter

				int count = port.BytesToRead;
				int intReturnASCII = 0;
				while (count > 0) {
					intReturnASCII = port.ReadByte ();
					returnMessage = returnMessage + Convert.ToChar (intReturnASCII);
					count--;
				}
			} catch {
			} finally {
				port.Close ();
			}
			if (returnMessage.Contains (Identifier)) {
				return true;
			} else {
				return false;
			}
		}
All Usage Examples Of System.IO.Ports.SerialPort::ReadByte