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.

68 lines
1.3 KiB

2 years ago
namespace JiLinApp.Docking.VibrateAlarm;
public class SensorState
2 years ago
{
public int DeviceId { get; set; }
2 years ago
public int Addr { get; set; }
2 years ago
public int OfflineState { get; set; }
public int OnlineState
{
get
{
if (OfflineState == 0) return 1;
else if (OfflineState == 1) return 0;
else return 0;
}
}
public string OnlineStateStr
2 years ago
{
get
{
if (OfflineState == 0)
2 years ago
{
return "在线";
}
else
{
return "离线";
}
}
}
public int AlarmState { get; set; }
2 years ago
public string AlarmStateStr
2 years ago
{
get
{
if (AlarmState == 0)
2 years ago
{
return "消警";
}
else
{
return "报警";
}
}
}
public SensorState(int deviceId, int sensorAddr, int state)
2 years ago
{
DeviceId = deviceId;
Addr = sensorAddr;
OfflineState = state % 2;
AlarmState = state / 2 % 2;
2 years ago
}
public SensorState(int deviceId, int sensorAddr, int offlineState, int alarmState)
2 years ago
{
DeviceId = deviceId;
Addr = sensorAddr;
OfflineState = offlineState;
AlarmState = alarmState;
2 years ago
}
}