Ejemplo n.º 1
0
 public void SubmitNotificationRele([FromBody] NotificationViewModel notification)
 {
     Console.WriteLine($"{notification.Id}");
     SerialCommunication.Inicialize();
     SerialCommunication.Write($"#RELEI{notification.Id}#\n");
     SerialCommunication.Close();
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 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
         {
         }
     }
 }
Ejemplo n.º 6
0
 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;
     }
 }