WMData.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using MV485.helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace MV485.model
  9. {
  10. public class WMData : INotifyPropertyChanged
  11. {
  12. public event PropertyChangedEventHandler PropertyChanged;
  13. protected virtual void OnPropertyChanged(string propertyName)
  14. {
  15. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  16. }
  17. //设备SN号
  18. public string DeviceSn { get; set; }
  19. //模块ID
  20. public byte SlaveAddress { get; set; }
  21. //固件版本号(MCU的版本号)
  22. public string McuVer { get; set; }
  23. //public byte DeviceAddress { get; set; }
  24. public ulong TotalFlow { get; set; } // 单位:升
  25. //结果已立方为单位时保留的小数位数
  26. public byte ResultDecimalPlaces { get; set; }
  27. public string SampleResult
  28. {
  29. get
  30. {
  31. double value = TotalFlow / (double)Constant.CUBE_VALUE;
  32. return value.ToString($"F{ResultDecimalPlaces}");
  33. //return (TotalFlow / Constant.CUBE_VALUE).ToString();
  34. }
  35. }
  36. public DateTime SampleTime { get; set; }
  37. public string SampleTimeName => SampleTime.ToString("yyyy-MM-dd HH:mm");
  38. //水表类型及结果说明
  39. public byte ResultType { get; set; }
  40. public string ResultTypeName => Tools.GetResultTypeName(ResultType);
  41. //模块名称
  42. public string ModelName { get; set; }
  43. //485设备波特率
  44. public int BaudRate { get; set; }
  45. }
  46. }