BlockItemListAll.cs 812 B

12345678910111213141516171819202122232425262728
  1. using Houdar.Core.Communication.Transport;
  2. using Houdar.PLC.Driver.Simenss.Protocol.Common;
  3. namespace Houdar.PLC.Driver.Simenss.Protocol.ListBlocks
  4. {
  5. public class BlockItemListAll
  6. {
  7. public ResultCode Ret { get; set; }
  8. public byte Size { get; set; }
  9. public ushort Length { get; set; }
  10. public BlockItem[] Items;//ÿ¸öBlockItemÕ¼ÓÃ4¸ö×Ö½Ú
  11. public void Build(ByteBuffer buffer)
  12. {
  13. Ret = (ResultCode) buffer.PopByte();
  14. Size = buffer.PopByte();
  15. Length = buffer.PopUshort();
  16. Items = new BlockItem[Length / 4];
  17. for (int i = 0; i < Length / 4; i++)
  18. {
  19. var tmp = new BlockItem();
  20. tmp.Build(buffer);
  21. Items[i] = tmp;
  22. }
  23. }
  24. }
  25. }