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

namespace JiLinApp.Docking.VibrateAlarm;
public class SensorState
{
public int DeviceId { get; set; }
public int Addr { get; set; }
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
{
get
{
if (OfflineState == 0)
{
return "在线";
}
else
{
return "离线";
}
}
}
public int AlarmState { get; set; }
public string AlarmStateStr
{
get
{
if (AlarmState == 0)
{
return "消警";
}
else
{
return "报警";
}
}
}
public SensorState(int deviceId, int sensorAddr, int state)
{
DeviceId = deviceId;
Addr = sensorAddr;
OfflineState = state % 2;
AlarmState = state / 2 % 2;
}
public SensorState(int deviceId, int sensorAddr, int offlineState, int alarmState)
{
DeviceId = deviceId;
Addr = sensorAddr;
OfflineState = offlineState;
AlarmState = alarmState;
}
}