Hello object developers,
I created object+interface+peripheral for a device which provides heartbeat (alive) Bit. I read this bit in OnEcUpdateIntputs of my peripheral object and now I would like to display an error event if the alive Bit is not changing.
I have some idea how to deal with that, but I am not sure what is the right way. So here is my proposal:
Is it right or should I do that differently?
Solved! Go to Solution.
You can set the error directly in your peripheral with method SetDeviceError.
If you using SetDeviceError method you must clear the error in the base to.
SUPER^.ClearError();
In your unit you check for example in the method OnUnitOperational is the error set in peripheral and than you set wit the method SetExtEvent the error on HMI and bring your unit to state ERROR.
VAR
_deviceError : OpconDeviceError;
END_VAR
_deviceError := YourInterfaceToPeripheral.LastError;
SetExtEvent(OpconEventClass.Error,_deviceError.Number,_deviceError.AddText,_deviceError.ObjectId,TRUE/FALSE);
Thanks for the very useful hint.
I have additional question to SetDeviceError. What is usual place for call of this method? Should I place it directly to OnEcUpdateInputs where I am receiving information about missing heartbeat? Or to OnEcOnline?
And what is the meaning of EventStdFlags of SetDeviceError?