SetDateAndTimeRequest.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Edge.Core.Parser.BinaryParser.Attributes;
  2. using Edge.Core.Parser.BinaryParser.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace Censtar_31064V105OrV106_Pump.MessageEntity.Outgoing
  7. {
  8. public class SetDateAndTimeRequest : MessageBase
  9. {
  10. public SetDateAndTimeRequest(DateTime dateTime)
  11. {
  12. base.Cmd = 0x12;
  13. this.Year_Raw = (byte)(dateTime.Year - 2000);
  14. this.Month_Raw = (byte)dateTime.Month;
  15. this.Day_Raw = (byte)dateTime.Day;
  16. this.Hour_Raw = (byte)dateTime.Hour;
  17. this.Minute_Raw = (byte)dateTime.Minute;
  18. this.Second_Raw = (byte)dateTime.Second;
  19. }
  20. [Format(1, EncodingType.BCD, 0)]
  21. public byte Year_Raw { get; set; }
  22. [Format(1, EncodingType.BCD, 1)]
  23. public byte Month_Raw { get; set; }
  24. [Format(1, EncodingType.BCD, 2)]
  25. public byte Day_Raw { get; set; }
  26. [Format(1, EncodingType.BCD, 3)]
  27. public byte Hour_Raw { get; set; }
  28. [Format(1, EncodingType.BCD, 4)]
  29. public byte Minute_Raw { get; set; }
  30. [Format(1, EncodingType.BCD, 5)]
  31. public byte Second_Raw { get; set; }
  32. }
  33. }