/// <summary> /// Raises the RaiseXScriptCommand event /// </summary> /// <param name="xScriptCommand">The X-Script command to send to IntuiFace Player</param> private void RaiseXScriptCommand(XScriptCommand xScriptCommand) { if (XScriptCommand != null) { XScriptCommandEventArgs args = new XScriptCommandEventArgs() { FullLine = xScriptCommand.XScript, TYPE = xScriptCommand.TYPE, ADDRESS = xScriptCommand.ADDRESS, FORMAT = xScriptCommand.FORMAT, COMMAND = xScriptCommand.COMMAND }; XScriptCommand(this, args); } }
/// <summary> /// Process a new serial command line /// </summary> /// <param name="newLine"></param> private void processNewSerialCommand(string newLine) { XScriptCommand xScriptCmd = new XScriptCommand(newLine); if (xScriptCmd.IsValid) { RaiseXScriptCommand(xScriptCmd); AddOutputLog("Received X-Script command: " + xScriptCmd.XScript); } else { AddOutputLog("Received an invalid X-Script command: " + newLine); } }
/// <summary> /// Send X-Script Command line /// </summary> /// <param name="XScriptCommand">The a full line X-Script command</param> public void SendXScriptCommand_FullLine(string XScriptCommand) { XScriptCommand xScriptCmd = new XScriptCommand(XScriptCommand); // Check if the X-Script command is valid if (xScriptCmd.IsValid) { // Send the X-Script command to the serial port WriteBytes(StringToBytes(xScriptCmd.XScript + "\r\n")); AddOutputLog("Send X-Script command: " + xScriptCmd.XScript); } else { AddOutputLog("Failed to send X-Script command: " + xScriptCmd.XScript + " is not valid!"); } }