|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|