/// <summary> /// The start call is used to populate a list of available com ports on the /// system. The correct port can then be selected via the respective guitext /// or a call to UpdateComPort(); /// </summary> void Start() { // Register for a notification of the SerialDataParseEvent SerialDataParseEvent += new SerialDataParseEventHandler(UnitySerialPort_SerialDataParseEvent); // Register for a notification of the open port event SerialPortOpenEvent += new SerialPortOpenEventHandler(UnitySerialPort_SerialPortOpenEvent); // Register for a notification of the close port event SerialPortCloseEvent += new SerialPortCloseEventHandler(UnitySerialPort_SerialPortCloseEvent); // Population of comport list via system.io.ports PopulateComPorts(); // If set to true then open the port. You must // ensure that the port is valid etc. for this! if (OpenPortOnStart) { OpenSerialPort(); } }
/// <summary> /// The start call is used to populate a list of available com ports on the /// system. The correct port can then be selected via the respective guitext /// or a call to UpdateComPort(); /// </summary> void Start() { // Population of comport list via system.io.ports PopulateComPorts(); // If set to true then open the port. You must // ensure that the port is valid etc. for this! if (OpenPortOnStart) { OpenSerialPort(); } // Register for a notification of the SerialDataParseEvent SerialDataParseEvent += new SerialDataParseEventHandler(UnitySerialPort_SerialDataParseEvent); // Register for a notification of the open port event SerialPortOpenEvent += new SerialPortOpenEventHandler(UnitySerialPort_SerialPortOpenEvent); // Register for a notification of the close port event SerialPortCloseEvent += new SerialPortCloseEventHandler(UnitySerialPort_SerialPortCloseEvent); }