You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					76 lines
				
				1.8 KiB
			
		
		
			
		
	
	
					76 lines
				
				1.8 KiB
			| 
								 
											2 years ago
										 
									 | 
							
								namespace JiLinApp.Docking.FenceAlarm;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public class SectorState
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    #region Fields
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public int DeviceId { get; set; }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public int Id { get; set; }//防区号
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /// <summary>
							 | 
						||
| 
								 | 
							
								    /// 0: 防区未使用
							 | 
						||
| 
								 | 
							
								    /// 1: 防区撤防
							 | 
						||
| 
								 | 
							
								    /// 2: 防区布防
							 | 
						||
| 
								 | 
							
								    /// 3: 防区旁路
							 | 
						||
| 
								 | 
							
								    /// 4: 防区报警
							 | 
						||
| 
								 | 
							
								    /// 5: 无线防区欠压
							 | 
						||
| 
								 | 
							
								    /// 6: 防区掉线(与主线总线脱离)
							 | 
						||
| 
								 | 
							
								    /// </summary>
							 | 
						||
| 
								 | 
							
								    public int State { get; set; }//防区状态
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public string StateStr
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        get
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            return State switch
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                0 => "防区未使用",
							 | 
						||
| 
								 | 
							
								                1 => "防区撤防",
							 | 
						||
| 
								 | 
							
								                2 => "防区布防",
							 | 
						||
| 
								 | 
							
								                3 => "防区旁路",
							 | 
						||
| 
								 | 
							
								                4 => "防区报警",
							 | 
						||
| 
								 | 
							
								                5 => "无线防区欠压",
							 | 
						||
| 
								 | 
							
								                6 => "防区掉线",
							 | 
						||
| 
								 | 
							
								                _ => "未知状态:" + State,
							 | 
						||
| 
								 | 
							
								            };
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /// <summary>
							 | 
						||
| 
								 | 
							
								    /// 0: 普通防区,无特殊参数
							 | 
						||
| 
								 | 
							
								    /// 1: 张力防区需要单独查询因为这个防区显示张力线值每条线状态
							 | 
						||
| 
								 | 
							
								    /// 2: 脉冲围栏
							 | 
						||
| 
								 | 
							
								    /// 3: 振动光纤
							 | 
						||
| 
								 | 
							
								    /// 4: 泄漏电缆
							 | 
						||
| 
								 | 
							
								    /// 5: 网络或总线多子防区模块
							 | 
						||
| 
								 | 
							
								    /// </summary>
							 | 
						||
| 
								 | 
							
								    public int Type { get; set; }//防区类型,特殊参数需单独查询
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public string TypeStr
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        get
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            return Type switch
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                0 => "普通防区",
							 | 
						||
| 
								 | 
							
								                1 => "张力防区",
							 | 
						||
| 
								 | 
							
								                2 => "脉冲围栏",
							 | 
						||
| 
								 | 
							
								                3 => "振动光纤",
							 | 
						||
| 
								 | 
							
								                4 => "泄漏电缆",
							 | 
						||
| 
								 | 
							
								                5 => "网络或总线多子防区模块",
							 | 
						||
| 
								 | 
							
								                _ => "未知类型:" + Type,
							 | 
						||
| 
								 | 
							
								            };
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    #endregion Fields
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public SectorState(int deviceId, int id, byte data)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        DeviceId = deviceId;
							 | 
						||
| 
								 | 
							
								        Id = id;
							 | 
						||
| 
								 | 
							
								        State = data & 0x0F;
							 | 
						||
| 
								 | 
							
								        Type = data >> 4;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |