Close Serial Port


Node Information
Closes the specified Serial Port.
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
Close IN RUN MULTIPLE FALSE FALSE
SerialPort IN SerialPort ONE FALSE FALSE

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