//void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e) //{ // byte[] data = new byte[ComPort.BytesToRead]; // for (int i = 0; i < data.Length; i++) // { // data[i] = (byte)ComPort.ReadByte(); // } // this.HandleByte(data); // //throw new Exception("The method or operation is not implemented."); //} private void comboPorts_SelectedIndexChanged(object sender, EventArgs e) { if (ComPort != null) { ComPort.Close(); OnConnectedChanged(); } int idx = comboPorts.SelectedIndex; if (idx <= 0) { ComPort = null; butEditSerial.Enabled = false; return; } string portName = comboPorts.SelectedItem.ToString(); ComPort = new SerialPort(portName); //ComPort.DataReceived += new SerialDataReceivedEventHandler(ComPort_DataReceived); butEditSerial.Enabled = true; ComPort.Open(); OnConnectedChanged(); iSerial = new BoxdorferSerial(ComPort, this); atmelVersion.Read(iSerial); SynchronizeRead(); }
public void Write(BoxdorferSerial theChannel) { if (theChannel != null) { theChannel.AddCommand(this); } }
public void Read(BoxdorferSerial theChannel) { //iLogger.Debug(String.Format("BoxdorferLong Read {0:X}", iReceiveCommand)); if (theChannel != null) { isWriting = false; theChannel.AddCommand(this); } }
public void Write(BoxdorferSerial theChannel) { //iLogger.Debug(String.Format("BoxdorferLong Write {0:X}", iSendCommand)); if (theChannel != null) { isWriting = true; theChannel.AddCommand(this); } }
public void SendCommand(BoxdorferSerial aPort) { if (Check) { aPort.SendByte(iOnCommand); } else { aPort.SendByte(iOffCommand); } }
public void SendCommand(BoxdorferSerial aPort) { if (isWriting) { aPort.SendLong(iValue); aPort.SendByte(iSendCommand); count = 4; } else { aPort.SendByte(iReceiveCommand); count = 0; iValue = 0; } }
public void SendCommand(BoxdorferSerial aPort) { aPort.SendByte(iCmd); }
/** * @brief * Send the command to the controler * * @param theChannel * The serial connection to the controler */ public void Send(BoxdorferSerial theChannel) { theChannel.AddCommand(this); }
public void Read(BoxdorferSerial theChannel) { // Do nothing }