IanosStefanCristian

SensorValue.cs

May 29th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Sensor
  6. {
  7. public enum SensorType
  8. {
  9. None,
  10. SkinTemperature,
  11. HeartRate,
  12. BloodGlucose
  13. }
  14.  
  15. public class SensorValue
  16. {
  17. private SensorType type;
  18. private double value;
  19. private DateTime timeStamp;
  20.  
  21. #region properties
  22. public SensorType Type
  23. {
  24. get { return type; }
  25. set { type = value; }
  26. }
  27. public double Value
  28. {
  29. get { return this.value; }
  30. set { this.value = value; }
  31. }
  32. public DateTime TimeStamp
  33. {
  34. get { return timeStanmp; }
  35. set { timeStamp = value; }
  36. }
  37.  
  38. public string TimpeStampString
  39. {
  40. get { return timeStamp.ToString("dd-MMM-yy HH:mm:ss"); }
  41. set { timeStamp = DateTime.ParseExact(value, "dd-MMM-yy HH:mm:ss", CultureInfo.InvariantCulture); }
  42. }
  43. #endregion
  44.  
  45. #region constructors
  46. public SensorValue()
  47. {
  48. type = SensorType.None;
  49. }
  50.  
  51. public SensorValue(SensorType type, double value, DateTime timeStamp)
  52. {
  53. this.type = type;
  54. this.value = value;
  55. this.timeStamp = timeStamp;
  56. }
  57.  
  58. public SensorValue(SensorType type, double value, string timeStamp)
  59. {
  60. this.type = type;
  61. this.value = value;
  62. this.timeStampString = timeStamp;
  63. }
  64. #endregion
  65. }
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment