Serial Port DiscardInBuffer


Node Information
Discards data from the serial driver's recieve buffer.
General Information
• This node has other options, you can view them by clicking on the info button, this also means according to the node you might be able to add more ports than what is already listed.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
DiscardInBuffer IN RUN MULTIPLE FALSE FALSE
SerialPort IN SerialPort ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.SerialPort
{
    [IsNode("DiscardInBuffer")]
    public class DiscardInBuffer : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "DiscardInBuffer");
        Port serial = new Port(PortType.IN, typeof(System.IO.Ports.SerialPort), AcceptsLinks.ONE, "SerialPort");
        public DiscardInBuffer()
        {
            Name = "Serial Port DiscardInBuffer";
            AddPort(run);
            AddPort(serial);
            OptionsAvilable = true;
            Information = "Discards data from the serial driver's recieve buffer.";
        }
        public override void UpdateResults()
        {
            if (!serial.IsConnected)
            {
                ErrorMessage = "No Serial Port is connected.";
                Status = NodeStatus.ERROR;
            }
            else
            {
                Status = NodeStatus.OK;
            }
            run.Instructions = GetValue(serial) + ".DiscardInBuffer();";
        }
    }
}