Advertisement
IanosStefanCristian

Program.cs

May 29th, 2021
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Sensor
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. Console.WriteLine("Instantierea clasei SensorValue\n\r");
  10. //instantiere folosind constructorul implicit. Valorile de masurare se dau folosind proprietatile
  11. SensorValue sensor1 = new SensorValue();
  12. sensor1.Type = SensorType.BloodGlucose;
  13. sensor1.TimeStamp = DateTime.Now;
  14. sensor1.Value = 100; //mg/dl
  15. DisplaySensorValues("Primul sensor initializat", sensor1);
  16.  
  17. //instantiere folosind constructorul cu parametri
  18. SensorValue sensor2 = new SensorValue(SensorType.SkinTemperature, 36.7, "23-Jan-10 14:56");
  19. DisplaySensorValues("Al doilea sensor initializat", sensor2);
  20. PumpSensorValues sensorValuesPump = new PumpSensorValues("0101", 3);
  21. sensorValuesPump.StartPumping();
  22.  
  23. Console.ReadLine();
  24. sensorValuesPump.StopPumping();
  25.  
  26. internal static void DisplaySensorValues(string headerText,SensorValue sensor)
  27. {
  28. Console.WriteLine("\t" + headerText);
  29. Console.WriteLine("\t\t Type = {0}", sensor.Type.ToString());
  30. Console.WriteLine("\t\t TimeStamp={0}", sensor.TimeStampString);
  31. Console.WriteLine("\t\t Value={0}", sensor.Value.ToString("0.00"));
  32. }
  33.  
  34. PumpSensorValues sensorValuesPump = new PumpSensorValues(3);
  35. sensorValuesPump.StartPumping();
  36.  
  37. Console.ReadLine();
  38. sensorValuesPump.StartPumping();
  39. }
  40. }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement