123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ProjectManagementSystem.Device.CasunBox
- {
- public class InfoBox : InfoBase
- {
- public int Route { get; set; }
- public int Status { get; set; }
- public int LightStatus { get; set; }
- public bool Called { get { return Status == 0x41; } }
- public bool CancelCall { get { return Status == 0x42; } }
- public override InfoBase Deserialize(byte[] data)
- {
- if (data[0] == 0x10 && data.Length == 14)
- {
- EBoxDevice = EnumBoxDevice.CallBox;
- byte function = data[1];
- switch (function)
- {
- case 0x41:
- case 0x42:
- Route = (data[6] << 8) + data[7] - 0x3030;
- Status = function;
- break;
- default:
- break;
- }
- LightStatus = 0;
- }
- else if (data[0] == 0x20 && data.Length == 16)
- {
- EBoxDevice = EnumBoxDevice.WarningLight;
- Route = data[14];
- LightStatus = data[4];
- Status = 0;
- }
- LastUpdateTime = DateTime.Now;
- return this;
- }
- }
- }
|