GetCDMState 10s
This commit is contained in:
+24
-4
@@ -384,6 +384,7 @@ namespace SafeBagDE70
|
||||
}
|
||||
int prevPrinterStatus = -1;
|
||||
int prevSensorStatus = -1;
|
||||
int prevCDMState = -1;
|
||||
private void SensorTimer_Tick(object? sender, EventArgs e)
|
||||
{
|
||||
sensorTimer.IsEnabled = false;
|
||||
@@ -394,10 +395,7 @@ namespace SafeBagDE70
|
||||
if (countSensorTimer % 10 == 0)
|
||||
{
|
||||
GetPrinterStatus();
|
||||
if(!AppData.IsInTransaction)
|
||||
{
|
||||
AppData.GetCDMState();
|
||||
}
|
||||
GetCDMStatus();
|
||||
|
||||
AppData.DeviceStatus.Description = AppData.CDMSTATE.CDMStatus;
|
||||
AppData.DeviceStatus.DeviceTime = DateTime.Now;
|
||||
@@ -423,6 +421,28 @@ namespace SafeBagDE70
|
||||
sensorTimer.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void GetCDMStatus()
|
||||
{
|
||||
if (!AppData.IsInTransaction)
|
||||
{
|
||||
AppData.GetCDMState();
|
||||
if (cCmdRsp.recv_dat.ret != Constants.E_OK)
|
||||
{
|
||||
AppData.CDMSTATE.CDMStatus = "CDM: LỖI";
|
||||
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.DISCONNECT_SERIALPORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.NORMAL;
|
||||
}
|
||||
if (AppData.DeviceStatus.CDMStatus != prevCDMState)
|
||||
{
|
||||
prevCDMState = AppData.DeviceStatus.CDMStatus;
|
||||
APIModels.SendEvent(AppData.DeviceStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPrinterStatus()
|
||||
{
|
||||
var status = printerManager.GetStatus();
|
||||
|
||||
Reference in New Issue
Block a user