AnswerWriteUnsolicitedMessageIn.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Edge.Core.Parser.BinaryParser.Attributes;
  2. using System.Collections.Generic;
  3. namespace PetroChinaOnlineWatchPlugin.MessageEntity.Incoming
  4. {
  5. public class IfsfMessageDataIn
  6. {
  7. [Format(1, EncodingType.BIN, -9890)]
  8. public byte DataIdentifier { get; set; }
  9. [Format(1, EncodingType.BIN, -9880)]
  10. public int DataLength { get; set; }
  11. [EnumerableFormat("%cascade", -9870)]
  12. public List<byte> Data { get; set; }
  13. public override string ToString()
  14. {
  15. return $"{DataIdentifier} {DataLength}";
  16. }
  17. }
  18. public class AnswerWriteUnsolicitedMessageIn : MessageBase
  19. {
  20. [Format(2, EncodingType.BIN, -9930)]
  21. public int MessageLength { get; set; }
  22. [Format(1, EncodingType.BIN, -9920)]
  23. public int DatabaseAddressLength { get; set; }
  24. [EnumerableFormat("DatabaseAddressLength", -9910)]
  25. public List<byte> DatabaseAddress { get; set; }
  26. public int DataListLength { get { return MessageLength - 1 - DatabaseAddress.Count; } }
  27. [EnumerableFormat("DataListLength", -9900)]
  28. public List<IfsfMessageDataIn> DataList { get; set; }
  29. public override string ToString()
  30. {
  31. string dbAddress = string.Empty;
  32. foreach (byte ad in DatabaseAddress)
  33. { dbAddress += " " + ad.ToString(); }
  34. string dtList = string.Empty;
  35. foreach (var dt in DataList)
  36. { dtList += " " + dt.ToString(); }
  37. return $"{MessageLength} {DatabaseAddressLength} {dbAddress} {dtList}";
  38. }
  39. }
  40. }