CommandAlarmLight.cs 806 B

123456789101112131415161718192021222324252627
  1. using ProjectManagementSystem.Device.Core;
  2. using ProjectManagementSystem.Device.Extenions;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ProjectManagementSystem.Device.Command
  9. {
  10. public class CommandAlarmLight : IDeviceCommand
  11. {
  12. private byte[] light_buffer = new byte[16] { 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10 };
  13. public int DeviceId { get; set; }
  14. public byte LightType { get; set; }
  15. public byte[] Serialization()
  16. {
  17. light_buffer[4] = LightType;
  18. light_buffer[14] = (byte)DeviceId;
  19. light_buffer[15] = light_buffer.XOR_Check(15);
  20. return light_buffer;
  21. }
  22. }
  23. }