private void CheckRedLaserCurrent() { var c09 = new LaserC09Request(); var bytes = serialPortCom.Encode(c09); serialPortCom.SendData(bytes); }
private void EnableRedLaser(bool enable) { var c70 = new LaserC70Request(); var bytes = serialPortCom.Encode(c70); serialPortCom.SendData(bytes); enableRedLaser = enable; }
private void Slider_MouseUp(object sender, MouseEventArgs e) { if (serialPortCom != null) { LaserC72Request c72 = new LaserC72Request(this.sliderPulse.Slider.Value / 10f); var bps = c72.Encode(); List <byte[]> bytes = new List <byte[]>(); foreach (var b in bps) { var data = LaserProtocolFactory.GetInstance().LaserProtocol.EnPackage(b); bytes.Add(data); } //var bytes = serialPortCom.Encode(c72); serialPortCom.SendData(bytes); } }
private void CheckLaserInfo() { LaserC00Request c00 = new LaserC00Request(); var bytes = serialPortCom.Encode(c00); byte[] recData = serialPortCom.SendData(bytes); }
/// <summary> /// Richiede i dati alla seriale quando arriva un messaggio contente il carattere $ al webserver in ascolto /// </summary> private string requestToSerial() { try { _pesata = ""; Logs.WriteLine("Ricevuta richiesta da: " + _user); _spManager.SendData("$"); //Ferma l'esecuzione del thread e attende la lettura completa del dato dalla seriale. //Se la condizione non viene soddisfatta allo scadere del timeOut l'esecuzione andrà avanti. bool notTimeout = SpinWait.SpinUntil(() => _pesata.Length == _lengthPesata, _timeOut); //Logs.WriteLine("Pesata length: " + _pesata.Length + " " + _pesata); if (notTimeout) { Logs.WriteLine("Peso letto: " + _pesata); Logs.WriteLine(); } else { Logs.WriteLine("TIMEOUT"); _pesata = "-1"; } return(_pesata); } catch (Exception ex) { Logs.WriteLine(ex); return(string.Empty); } }
private void CheckLaserInfo() { LaserC00Request c00 = new LaserC00Request(); var bytes = serialPortCom.Encode(c00); byte[] recData = serialPortCom.SendData(bytes); if (recData != null) { LaserBaseResponse baseResponse = serialPortCom.LaserBaseResponse(bytes, recData); if (baseResponse != null) { LaserC00Response c00r = baseResponse as LaserC00Response; if (c00r != null) { lblLaserVersion.Text = c00r.VersionNumber.ToString(); lblWorkingHour.Text = string.Format("{0} : {1}", c00r.Hour, c00r.Month); } } } }
private void sendCmd() { string cmd = ""; cmd += SampleRateValueList[ComboBoxSampleRate.SelectedIndex].ToString() + ","; //================================ if (RadioButtonX1A.Checked == true) { cmd += CHAX1Cmd.ToString() + ","; CHAX = 1; } else if (RadioButtonX10A.Checked == true) { cmd += CHAX10Cmd.ToString() + ","; CHAX = 10; } cmd += GainValue(TrackBarGainA.Value).ToString() + ","; GainA = TrackBarGainA.Value; cmd += (255 - TrackBarOffsetA.Value).ToString() + ","; CHAOffset = 3.3 / 255 * TrackBarOffsetA.Value; //================================= if (RadioButtonX1B.Checked == true) { cmd += CHBX1Cmd.ToString() + ","; CHBX = 1; } else if (RadioButtonX10B.Checked == true) { cmd += CHBX10Cmd.ToString() + ","; CHBX = 10; } cmd += GainValue(TrackBarGainB.Value).ToString() + ","; GainB = TrackBarGainB.Value; cmd += (255 - TrackBarOffsetB.Value).ToString() + ","; CHBOffset = 3.3 / 255 * TrackBarOffsetB.Value; cmd += "@"; Log.Text = cmd; _spManager.clearInBuffer(); _spManager.clearOutBuffer(); _spManager.SendData(cmd); }