public PrinterInfo() { con = Main.conn; InitializeComponent(); RegMemory.RestoreWindowPos("printerInfoWindow", this); timer_Tick(null, null); }
public Main() { repetierKey = Registry.CurrentUser.CreateSubKey("Software\\Repetier"); main = this; generator = new GCodeGenerator(); globalSettings = new GlobalSettings(); conn = new PrinterConnection(); printerSettings = new FormPrinterSettings(); threeDSettings = new ThreeDSettings(); InitializeComponent(); conn.eventConnectionChange += OnPrinterConnectionChange; conn.eventPrinterAction += OnPrinterAction; conn.eventJobProgress += OnJobProgress; printPanel = new PrintPanel(); printPanel.Dock = DockStyle.Fill; splitContainerPrinterGraphic.Panel1.Controls.Add(printPanel); logView = new LogView(); logView.Dock = DockStyle.Fill; splitVert.Panel2.Controls.Add(logView); skeinforge = new Skeinforge(); PrinterChanged(printerSettings.currentPrinterKey, true); printerSettings.eventPrinterChanged += PrinterChanged; // GCode print preview printPreview = new ThreeDControl(); printPreview.Dock = DockStyle.Fill; splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview); printPreview.SetEditor(false); printPreview.AutoUpdateable = true; printVisual = new GCodeVisual(conn.analyzer); printPreview.models.AddLast(printVisual); basicTitle = Text; }
private void AddSecurePrinterForConnection(PrinterConnection connection) { try { LocalPrintServer pServer = new LocalPrintServer(); bool exists = false; foreach (PrintQueue queue in pServer.GetPrintQueues()) { if (queue.Name == connection.secureName) { exists = true; } } if (!exists) { pServer.InstallPrintQueue(connection.secureName, MyDLPDriver, new String[] { "MyDLP" }, "winprint", PrintQueueAttributes.Direct); } printerConnections.Add(connection); } catch (Exception ex) { Logger.GetInstance().Error("AddSecurePrinterForConnection: " + connection + " " + ex.Message + " " + ex.StackTrace); } }
public BootloaderController(int bootloader_version, PrinterConnection base_printer, PrinterInfo info, Logger logger, ThreadSafeVariable <bool> shared_shutdown, IBroadcastServer broadcastserver, InternalPrinterProfile printerProfile) : base(base_printer, info, logger, broadcastserver, printerProfile) { PersistantDetails.bootloader_version = bootloader_version; if (bootloader_version >= 1 && bootloader_version <= 5) { mInterfaceVersion = BootloaderController.BootloaderInterfaceVersion.V1; } else { if (bootloader_version < 6 || bootloader_version > 8) { throw new Exception(string.Format("Unsupported Bootloader Interface - {0}", bootloader_version)); } mInterfaceVersion = BootloaderController.BootloaderInterfaceVersion.V2; } mCheckedFirmwareStatus = new Dictionary <char, BootloaderController.FirmwareStatus>(); foreach (KeyValuePair <char, FirmwareDetails> firmware in MyPrinterProfile.ProductConstants.FirmwareList) { mCheckedFirmwareStatus.Add(firmware.Key, BootloaderController.FirmwareStatus.Unknown); } StartBootloaderMode(); }
private void RemovePrinterHelper(PrinterConnection printerToRemove) { try { if (printerToRemove.SerialPort != null) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field LogEventHandler?.Invoke(this, new LogMessageEventArgs("Disconnecting from printer " + printerToRemove.SerialNumber + " on port " + printerToRemove.ComPort + "...")); printerToRemove.SerialPort.Dispose(); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field LogEventHandler?.Invoke(this, new LogMessageEventArgs("Disconnected from printer " + printerToRemove.SerialNumber + " on port " + printerToRemove.ComPort ?? "")); } } catch (Exception ex) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field LogEventHandler?.Invoke(this, new LogMessageEventArgs("Error: " + ex.Message)); } // ISSUE: reference to a compiler-generated field if (PrinterDisconnectedEventHandler == null) { return; } // ISSUE: reference to a compiler-generated field PrinterDisconnectedEventHandler(this, new PrinterConnEventArgs(printerToRemove)); }
private void NewPrinterHelper(PrinterConnEventArgs e) { var comPort = e.com_port; var printer = new PrinterConnection(comPort); lock (printer.SerialPort.ThreadSync) { if (!printer.ConnectTo()) { // ISSUE: reference to a compiler-generated field if (LogEventHandler == null) { return; } // ISSUE: reference to a compiler-generated field LogEventHandler(this, new LogMessageEventArgs("Could not connect to printer on port " + comPort)); } else { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field LogEventHandler?.Invoke(this, new LogMessageEventArgs("Successfully connected to printer on port " + comPort)); printers.TryAdd(comPort, printer); // ISSUE: reference to a compiler-generated field if (PrinterConnectedEventHandler == null) { return; } // ISSUE: reference to a compiler-generated field PrinterConnectedEventHandler(this, new PrinterConnEventArgs(printer, comPort, e.vid_pid)); } } }
public PrintPanel() { InitializeComponent(); con = Main.conn; ann = con.analyzer; con.eventConnectionChange += ConnectionChanged; ann.fanVoltage = trackFanVoltage.Value; // ann.eventPosChanged += coordUpdate; ann.eventChange += analyzerChange; UpdateConStatus(false); float volt = 100f * trackFanVoltage.Value / 255; labelVoltage.Text = Trans.T1("L_OUTPUT_PERCENT", volt.ToString("0.0")); //"Output " + volt.ToString("0.0") + "%"; labelLaserVoltage.Text = Trans.T1("L_OUTPUT_PERCENT", volt.ToString("0.0")); //"Output " + volt.ToString("0.0") + "%"; arrowButtonXMinus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonXMinus.PossibleValues); arrowButtonXPlus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonXPlus.PossibleValues); arrowButtonYMinus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonYMinus.PossibleValues); arrowButtonYPlus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonYPlus.PossibleValues); if (Custom.GetBool("noPowerControlButton", false)) { switchPower.Visible = false; } timer.Start(); if (Main.main != null) { translate(); Main.main.languageChanged += translate; } }
public BaseController(PrinterConnection base_printer, PrinterInfo info, Logger logger, IBroadcastServer broadcastserver, InternalPrinterProfile printerProfile) { this.printerProfile = printerProfile; this.base_printer = base_printer; this.logger = logger; printerInfo = info; this.broadcastserver = broadcastserver; }
public void Run(PrinterConnection printerConnection) { if (printerConnection.IsConnected) { printerConnection.MacroStart(); printerConnection.QueueLine(GCode); } }
public static void Run(this GCodeMacro macro, PrinterConnection printerConnection) { if (printerConnection.IsConnected) { printerConnection.MacroStart(); printerConnection.QueueLine(macro.GCode); } }
public PrinterInfo() { con = Main.conn; InitializeComponent(); RegMemory.RestoreWindowPos("printerInfoWindow", this); timer_Tick(null, null); translate(); Main.main.languageChanged += translate; }
public void Dispose() { // Unregister event listeners printerConnection.ConnectionFailed -= Instance_ConnectionFailed; printerConnection.LineReceived -= Printer_LineReceived; printerConnection.LineSent -= Printer_LineSent; printerConnection = null; }
public void Save(PrinterConnection printerConnection) { lock (eePromSettingsList) { foreach (EePromRepetierParameter p in eePromSettingsList.Values) { p.Save(printerConnection); } } }
public PrinterConnEventArgs(PrinterConnection printer) { this.printer = printer; if (printer == null || printer.SerialPort == null) { return; } com_port = printer.ComPort; }
private void ParseTempAndValidate(string gcodeString, double?extruder0, double?extruder1, double?extruder2, double?bedTemp) { double[] extruders = new double[16]; double bed = 0; PrinterConnection.ParseTemperatureString(gcodeString, extruders, null, ref bed, null); Assert.IsTrue(extruders[0] == extruder0); Assert.IsTrue(extruders[1] == extruder1); Assert.IsTrue(extruders[2] == extruder2); Assert.IsTrue(bed == bedTemp); }
public TerminalLog(PrinterConnection printerConnection) { printerConnection.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents); printerConnection.CommunicationUnconditionalFromPrinter.RegisterEvent(FromPrinter, ref unregisterEvents); printerConnection.CommunicationUnconditionalToPrinter.RegisterEvent(ToPrinter, ref unregisterEvents); if (Is32Bit) { // About 10 megs worth. Average line length in gcode file is about 14 and we store strings as chars (16 bit) so 450,000 lines. maxLinesToBuffer = 450000; } }
public override bool Equals(object obj) { if (!(obj is PrinterConnection)) { return(false); } PrinterConnection pObj = (PrinterConnection)obj; return((this.name == pObj.name) && (this.server == pObj.server)); }
public void Run(PrinterConnection printerConnection) { if (printerConnection.IsConnected) { printerConnection.MacroStart(); printerConnection.QueueLine(GCode); if (GCode.Contains(MacroProcessingStream.MacroPrefix)) { printerConnection.QueueLine("\n" + MacroProcessingStream.MacroPrefix + "close()"); } } }
private void RemoveSecurePrinterForConnection(PrinterConnection connection) { try { LocalPrintServer pServer = new LocalPrintServer(); MyDLPEP.PrinterUtils.RemovePrinter(connection.secureName); } catch (Exception ex) { Logger.GetInstance().Error("RemoveSecurePrinterForConnection: " + connection + " " + ex.Message + " " + ex.StackTrace); } }
public void SmoothieDualExtruderM105Response() { double[] extruders = new double[16]; double bed = 0; // As of 2018-11-29 with an unknown users config string smoothieDualExtruderM105Response = "ok T:220.1 /220.0 @109 T1:222.7 /221.0 @49 B:32.2 /0.0 @0"; PrinterConnection.ParseTemperatureString(smoothieDualExtruderM105Response, extruders, null, ref bed, null); Assert.AreEqual("220.1", extruders[0].ToString("0.#"), "Incorrect Extruder 0 result"); Assert.AreEqual("222.7", extruders[1].ToString("0.#"), "Incorrect Extruder 1 result"); }
public GCodeSwitcher(string gcodeFilename, PrinterConnection printerConnection, int startLine = 0) { this.printerConnection = printerConnection; var fileStreaming = GCodeFile.Load(gcodeFilename, new Vector4(), new Vector4(), new Vector4(), Vector4.One, CancellationToken.None); this.GCodeFile = fileStreaming; LineIndex = startLine; }
public TerminalLog(PrinterConnection printerConnection) { printerConnection.ConnectionFailed += Instance_ConnectionFailed; printerConnection.Disposed += (s, e) => printerConnection.ConnectionFailed -= Instance_ConnectionFailed; printerConnection.LineReceived += Printer_LineReceived; printerConnection.LineSent += Printer_LineSent; if (Is32Bit) { // About 10 megs worth. Average line length in gcode file is about 14 and we store strings as chars (16 bit) so 450,000 lines. maxLinesToBuffer = 450000; } }
public PrintPanel() { InitializeComponent(); con = Main.conn; ann = con.analyzer; con.eventConnectionChange += ConnectionChanged; con.eventTempChange += tempUpdate; ann.eventPosChanged += coordUpdate; ann.eventChange += analyzerChange; UpdateConStatus(false); float volt = 100f * trackFanVoltage.Value / 255; labelVoltage.Text = "Output " + volt.ToString("0.0") + "%"; }
private static void EnumSchemaRequest(EnumSchemaOptions options) { using (var connection = new PrinterConnection()) { var access = options.Admin ? BIDI_ACCESS.BIDI_ACCESS_ADMINISTRATOR : BIDI_ACCESS.BIDI_ACCESS_USER; connection.Bind(options.PrinterName, access); var result = connection.SendRequest("\\Printer", RequestType.EnumSchema); foreach (var datum in result) { Console.WriteLine(datum.Value); } } }
private static void GetRequest(Options options, RequestType requestType) { using (var connection = new PrinterConnection()) { var access = options.Admin ? BIDI_ACCESS.BIDI_ACCESS_ADMINISTRATOR : BIDI_ACCESS.BIDI_ACCESS_USER; connection.Bind(options.PrinterName, access); var result = connection.SendRequest("\\Printer", requestType); foreach (var datum in result) { Console.WriteLine($"{datum.Key} = {datum.Value}"); } } }
public FormPrinterSettings() { InitializeComponent(); RegMemory.RestoreWindowPos("printerSettingsWindow", this); repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier"); printerKey = repetierKey.CreateSubKey("printer"); con = Main.conn; conToForm(); comboPrinter.Items.Clear(); foreach (string s in printerKey.GetSubKeyNames()) { comboPrinter.Items.Add(s); } con.printerName = (string)repetierKey.GetValue("currentPrinter", "default"); load(con.printerName); formToCon(); UpdateDimensions(); if (Custom.GetBool("simpleConnectionsConfig", false)) { comboParity.Visible = false; comboStopbits.Visible = false; labelStopbits.Visible = false; labelParity.Visible = false; } if (Custom.GetBool("noDisposeArea", false)) { labelDumpAreaDepth.Visible = false; labelDumpAreaFront.Visible = false; labelDumpAreaLeft.Visible = false; labelDumpAreaWidth.Visible = false; labelDumpUnit1.Visible = false; labelDumpUnit2.Visible = false; labelDumpUnit3.Visible = false; labelDumpUnit4.Visible = false; checkHasDumpArea.Visible = false; textDumpAreaDepth.Visible = false; textDumpAreaFront.Visible = false; textDumpAreaLeft.Visible = false; textDumpAreaWidth.Visible = false; } if (Custom.GetBool("noMaxHoming", false)) { checkHomeXMax.Visible = false; checkHomeYMax.Visible = false; checkHomeZMax.Visible = false; } Main.main.languageChanged += translate; translate(); }
/// <summary> /// 프린터 커넥션 비활성화 /// </summary> public static void PrinterConnectionClose() { try { if (PrinterConnection.Connected) { PrinterConnection.Close(); } } catch (Exception ex) { FileUtils.WriteLog("[" + ex.Source + "]" + ex.Message); MessageBox.Show(ex.Message, "에러", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public TerminalLog(PrinterConnection printerConnection) { // Register event listeners printerConnection.ConnectionFailed += Instance_ConnectionFailed; printerConnection.LineReceived += Printer_LineReceived; printerConnection.LineSent += Printer_LineSent; this.printerConnection = printerConnection; if (Is32Bit) { // About 10 megs worth. Average line length in gcode file is about 14 and we store strings as chars (16 bit) so 450,000 lines. maxLinesToBuffer = 450000; } }
private void buttonContinuePrinting_Click(object sender, EventArgs e) { GCodeAnalyzer a = Main.conn.analyzer; PrinterConnection c = Main.conn; c.injectManualCommand("G90"); c.injectManualCommand("G1 X" + x.ToString(GCode.format) + " Y" + y.ToString(GCode.format) + " F" + c.travelFeedRate.ToString(GCode.format)); c.injectManualCommand("G1 Z" + z.ToString(GCode.format) + " F" + c.maxZFeedRate.ToString(GCode.format)); c.injectManualCommand("G92 E" + PauseInfo.e.ToString(GCode.format)); if (a.relative != relative) { c.injectManualCommand(relative ? "G91" : "G90"); } c.injectManualCommand("G1 F" + f.ToString(GCode.format)); // Reset old speed Main.conn.paused = false; Hide(); }
public TcpipSerialPort(PrinterConnection printerConnection, string name) { this.printerConnection = printerConnection; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); if (int.TryParse(ActiveSliceSettings.Instance.GetValue("ip_port"), out port) && IPAddress.TryParse(ActiveSliceSettings.Instance.GetValue("ip_address"), out ipAddress)) { ipEndPoint = new IPEndPoint(ipAddress, port); readBuffer = new byte[1024]; bufferIndex = 0; } else { this.IsValid = false; } }
public void HandlePrinterConnectionChange() { bool change = false; lock (this) { if (handlingConnectionChange) { return; } else handlingConnectionChange = true; } try { Logger.GetInstance().Debug("HandlePrinterConnectionChange started"); RegistryKey connectionsKey = Registry.Users.OpenSubKey(currentSid + "\\Printers\\Connections"); ArrayList newConnectionList = new ArrayList(); foreach (String connection in connectionsKey.GetSubKeyNames()) { try { string[] list = connection.Split(','); PrinterConnection newConnection = new PrinterConnection(list[3], list[2]); //Keep track of recent connections newConnectionList.Add(newConnection); //Add only if there is not already such secure printer if (!printerConnections.Contains(newConnection)) { AddSecurePrinterForConnection(newConnection); change = true; } } catch (Exception ex) { Logger.GetInstance().Error("ListenPrinterConnections:" + ex.Message + " " + ex.StackTrace); continue; } } //Remove old outdated connections for (int i = 0; i < printerConnections.Count; i++) { PrinterConnection connection = (PrinterConnection)printerConnections[i]; if (!newConnectionList.Contains(connection)) { Logger.GetInstance().Debug("Removing old connection" + connection); RemoveSecurePrinterForConnection(connection); printerConnections.Remove(connection); i--; change = true; } } Logger.GetInstance().Debug("HandlePrinterConnectionChange ended"); if (change) { //Give windows time to update default printer Thread.Sleep(2000); UpdateDefaultPrinter(); } } catch (Exception ex) { Logger.GetInstance().Error("ListenPrinterConnections:" + ex.Message + " " + ex.StackTrace); } lock (this) { handlingConnectionChange = false; } }