public void SubmitNotificationRele([FromBody] NotificationViewModel notification) { Console.WriteLine($"{notification.Id}"); SerialCommunication.Inicialize(); SerialCommunication.Write($"#RELEI{notification.Id}#\n"); SerialCommunication.Close(); }
public void SubmitNotificationColor([FromBody] NotificationViewModel notification) { Console.WriteLine($"{notification.R} {notification.G} {notification.B}"); SerialCommunication.Inicialize(); SerialCommunication.Write($"#SETCR{notification.R}G{notification.G}B{notification.B}#\n"); SerialCommunication.Close(); }
/// <summary> /// Disconnects from the Serial Communication /// </summary> public void Disconnect() { serial.Close(); form1.ChangeSaveButtonState(false); processData.sensorAnswer = false; UpdateStatus(this, new UpdateStatusEvent("Die Verbindung wurde getrennt")); form1.Hide(); connectDialog.Show(); connectDialog.BringToFront(); //Finalize EDF-File and end save process EndSave(); }
public string SubmitNotificationHumedad([FromBody] NotificationViewModel notification) { Console.WriteLine($"{notification.Id}"); SerialCommunication.Inicialize(); SerialCommunication.Write($"#HUMEI{notification.Id}#\n"); var lectura = SerialCommunication.ReadLine(); SerialCommunication.Close(); var value = lectura.Substring(0, lectura.Length - 1); return(value); }
void timer_Elapsed(object sender, ElapsedEventArgs e) { elapsedTime += (long)timer.Interval; if (elapsedTime > 500) { connState = CONN_STATE.DISCONNECTED; this.ConnStateChanged(this, EventArgs.Empty); disconnectedTimer.Start(); timer.Stop(); try { serial.Close(); } finally { } } }
private void timer_Elapsed(object sender, ElapsedEventArgs e) { elapsedTime += (long)timer.Interval; if (elapsedTime > 500) { if (this.connState != CONN_STATE.DISCONNECTED) { this.connState = CONN_STATE.DISCONNECTED; this.ConnectionStateChanged(connState); disconnectedTimer.Start(); timer.Stop(); try { serial.Close(); } finally { } } this.connState = CONN_STATE.DISCONNECTED; } }