Account: send MachineEvent, if account can not be read from DC
This commit is contained in:
		@@ -507,11 +507,25 @@ void ATBDeviceControllerPlugin::private_checkAccountData()
 | 
				
			|||||||
            // cannot get accountData within ~10*500ms
 | 
					            // cannot get accountData within ~10*500ms
 | 
				
			||||||
            qCritical() << "checkAccountData() failed";
 | 
					            qCritical() << "checkAccountData() failed";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // simulate:
 | 
					            JSON::setPrettySerialize(false);
 | 
				
			||||||
            this->private_getAccountData();
 | 
					            JSON::JsonObject json = JSON::objectBuilder()
 | 
				
			||||||
 | 
					                      ->set("Error", QString("check account data failed"))
 | 
				
			||||||
 | 
					                      ->set("AccountNumber", this->latestAccountNumber)
 | 
				
			||||||
 | 
					                ->create();
 | 
				
			||||||
 | 
					            QString parameterJsonString = JSON::serialize(json);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // TODO: create and send an HealthEvent...
 | 
					            QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
 | 
				
			||||||
 | 
					            ATBMachineEvent *machineEvent = new ATBMachineEvent(
 | 
				
			||||||
 | 
					                        eventId,                           // id
 | 
				
			||||||
 | 
					                        "DC",                              // device name: PTU/PRINTER/DC/...
 | 
				
			||||||
 | 
					                        EVENT_CLASS::STATE,                // reason of event: Error/Warning/Alarm
 | 
				
			||||||
 | 
					                        "M01000",                          // eventName
 | 
				
			||||||
 | 
					                        1,                                 // state
 | 
				
			||||||
 | 
					                        parameterJsonString,               // parameter
 | 
				
			||||||
 | 
					                        "ACCOUNT"                          // second level info
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					            QCoreApplication::postEvent(this, machineEvent);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user