ReadByte


Node Information
Reads one byte from the input buffer.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
SerialPort IN SerialPort ONE FALSE FALSE
Value OUT Int32 MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.SerialPort
{
    [IsNode("ReadByte")]
    public class ReadByte : Node
    {
        Port serial = new Port(PortType.IN, typeof(System.IO.Ports.SerialPort), AcceptsLinks.ONE, "SerialPort");
        Port outdata = new Port(PortType.OUT, typeof(int), AcceptsLinks.MULTIPLE, "Value");
        public ReadByte()
        {
            Name = "ReadByte";
            AddPort(serial);
            AddPort(outdata);
            Information = "Reads one byte from the input buffer.";
        }
        public override void UpdateResults()
        {
            if (!serial.IsConnected)
            {
                ErrorMessage = "No Serial Port is connected.";
                Status = NodeStatus.ERROR;
                return;
            }
            else
            {
                Status = NodeStatus.OK;
            }
            outdata.Instructions = GetValue(serial) + ".ReadByte()";
        }
    }
}