public void SetCounter_c1(IController c, int val) { Port1.CounterSet(c, val); }
public void SetRegion(IController c, bool val) { Port1.RegionSet(c, val); Port2.RegionSet(c, val); }
public override void Draw() { if (!activated) { return; } Color GUIBackground = GUI.backgroundColor; GUI.backgroundColor = Style.Color; GUILayout.BeginArea(Rect, Skin.box); GUILayout.Label("Root"); GUILayout.EndArea(); GUI.backgroundColor = GUIBackground; //mandatory if (Port0 != null) { Port0.rect.y = Rect.y + (Rect.height * 0.5f) - Port0.rect.height * 0.5f; Port0.rect.y = Rect.y + Rect.height / 3f; Port0.rect.x = Rect.x - Port0.rect.width + 16f; Port0.Draw(); GUI.Label(new Rect(Port0.rect.xMax, Port0.rect.y, 100, 15), "Mandatory"); } // quality if (Port1 != null) { Port1.rect.y = Rect.y + (Rect.height * 0.5f) - Port1.rect.height * 0.5f; Port1.rect.y = Rect.y + (Rect.height / 3f) * 2; Port1.rect.x = Rect.x - Port1.rect.width + 16f; Port1.Draw(); GUI.Label(new Rect(Port1.rect.xMax, Port1.rect.y, 100, 15), "Quality"); } //action if (Port2 != null) { Port2.rect.y = Rect.y + (Rect.height * 0.66f) - Port2.rect.height * 0.5f; Port2.rect.y = Rect.y + Rect.height / 2f; Port2.rect.x = Rect.x + Rect.width - 16f; Port2.Draw(); GUI.Label(new Rect(Port2.rect.xMax - 55, Port2.rect.y, 50, 15), "Action"); } // update if (Port0 != null) { if (Port0.Connections.Count > 0) { MandatoryID = Port0.Connections[0].outputPort.MyNode.Id; } else { MandatoryID = -1; } } if (Port1 != null) { if (Port1.Connections.Count > 0) { QualityID = Port1.Connections[0].outputPort.MyNode.Id; } else { QualityID = -1; } } if (Port2 != null) { if (Port2.Connections.Count > 0) { Action = (Port2.Connections[0].outputPort.MyNode as ActionShell).Action; } } // sent OnUpdateRoot(MandatoryID, QualityID, Rect.position); }
private void clear(Port1 key) { ports[1] &= (Byte)key; }
public void SendCommandX() { Port1.WriteLine("X-" + tbX.Text); Thread.Sleep(10); Port1.WriteLine("MoveX"); }
public void SendCommandZ() { Port1.WriteLine("Z-" + tbZ.Text); Thread.Sleep(10); Port1.WriteLine("MoveZ"); }
public byte ReadPort1(IController c, bool left_mode) { return(Port1.Read(c, left_mode)); }
public void SetPin_c1(IController c, bool val) { Port1.PinStateSet(c, val); }
public void SyncState(Serializer ser) { ser.BeginSection("Port1"); Port1.SyncState(ser); ser.EndSection(); }
public int ReadPot1(IController c, int pot) { return(Port1.Read_Pot(c, pot)); }
private void bSend_Click(object sender, EventArgs e) { if ((eSend.Text.Length < 1) && (!cbCR.Checked) && (!cbLF.Checked)) { return; } int buff_len = eSend.Text.Length; if (cbCR.Checked) { buff_len++; } if (cbLF.Checked) { buff_len++; } byte[] buff = new byte[buff_len]; int bytes = 0; if (cbAddSent.Checked) { eCon.AppendText(Environment.NewLine + "---- SENT: " + (eSend.Text.Length > 0 ? eSend.Text + " (Len=" + eSend.Text.Length.ToString() + ") " : "") + (cbCR.Checked ? "[0x0d=CR]" : "") + (cbLF.Checked ? "[0x0a=LF]" : "") + Environment.NewLine); } // fill buffer if (eSend.Text.Length > 0) { for (int i = 0; i < eSend.Text.Length; i++) { buff[i] = Convert.ToByte(eSend.Text[i]); bytes++; } } if (cbCR.Checked) { buff[bytes++] = 0x0d; } if (cbLF.Checked) { buff[bytes++] = 0x0a; } if (!Port1.IsOpen) { eCon.AppendText(Environment.NewLine + "!!!!!!!!!!!!!! Port closed. !!!!!!!!!!!!!!!!!!" + Environment.NewLine); return; } try { Port1.Write(buff, 0, bytes); eSend.Clear(); } catch (Exception er) { AddConText(Environment.NewLine + "!!!!!!!! Unable to write to port " + Port1.PortName + ". Error: " + er.ToString() + " !!!!!!!!!!!!!!" + Environment.NewLine); } eCount.Text = (eSend.Text.Length + (cbCR.Checked ? 1 : 0) + (cbLF.Checked ? 1 : 0)).ToString(); }
private void bOpen_Click(object sender, EventArgs e) { if (Port1.IsOpen) { Port1.Close(); } string s; // port Port1.PortName = cbPort.Text; s = Port1.PortName.ToUpper(); // baud rate Port1.BaudRate = Convert.ToInt32(cbBaud.Text, 10); s += "@" + Port1.BaudRate.ToString(); // data bits switch (cbDataBits.SelectedIndex) { case 0: Port1.DataBits = 7; s += ",7"; break; case 1: Port1.DataBits = 8; s += ",8"; break; case 2: Port1.DataBits = 9; s += ",9"; break; } // parity switch (cbParity.SelectedIndex) { case 0: Port1.Parity = System.IO.Ports.Parity.None; s += "N"; break; case 1: Port1.Parity = System.IO.Ports.Parity.Odd; s += "O"; break; case 2: Port1.Parity = System.IO.Ports.Parity.Even; s += "E"; break; case 3: Port1.Parity = System.IO.Ports.Parity.Mark; s += "M"; break; case 4: Port1.Parity = System.IO.Ports.Parity.Space; s += "S"; break; } // stop bits switch (cbStopBits.SelectedIndex) { case 0: Port1.StopBits = System.IO.Ports.StopBits.None; s += "0"; break; case 1: Port1.StopBits = System.IO.Ports.StopBits.One; s += "1"; break; case 2: Port1.StopBits = System.IO.Ports.StopBits.OnePointFive; s += "1.5"; break; case 3: Port1.StopBits = System.IO.Ports.StopBits.Two; s += "2"; break; } try { Port1.Open(); bOpen.Enabled = false; bClose.Enabled = true; bSend.Enabled = true; cbPort.Enabled = false; cbBaud.Enabled = false; cbDataBits.Enabled = false; cbParity.Enabled = false; cbStopBits.Enabled = false; sStatus.Text = s; } catch { MessageBox.Show("Unable to open port: " + Port1.PortName, "Port open error", MessageBoxButtons.OK, MessageBoxIcon.Error); sStatus.Text = "Port not opended"; } }
private void set(Port1 key) { ports[1] |= (Byte)key; }
public byte ReadPort2_c1(IController c) { return(Port1.Read_p2_c1(c)); }
public byte ReadFire1_2x(IController c) { return(Port1.ReadFire2x(c)); }
public bool GetPin_c1(IController c) { return(Port1.PinStateGet(c)); }
public bool Is_2_button1(IController c) { return(Port1.Is_2_button(c)); }
public byte ReadPort1(IController c, bool leftMode, bool updateWheel) { wheel1 = Port1.UpdateWheel(c); return(Port1.Read(c, leftMode, updateWheel, temp_wheel1)); }
public bool Is_LightGun1(IController c, out float lightgun_x, out float lightgun_y) { return(Port1.Is_LightGun(c, out lightgun_x, out lightgun_y)); }
public void SendCommandY() { Port1.WriteLine("Y-" + tbY.Text); Thread.Sleep(10); Port1.WriteLine("MoveY"); }
public ushort ReadAccY1(IController c) { return(Port1.ReadAccY(c)); }
private void Process_when_receive_value(object sender, SerialDataReceivedEventArgs e) { string s = Port1.ReadLine(); this.BeginInvoke(new LineReceivedEvent(LineReceived), s); }
public void SyncState(Serializer ser) { ser.BeginSection(nameof(Port1)); Port1.SyncState(ser); ser.EndSection(); }
public byte ReadPort1(IController c) { return(Port1.Read(c)); }
public Socket(HostI host, Port1 port) { _host = host; _port = port; }