I have created a graphical view of some slaves in a flexpendant appl. I want to show the current state of each slave in this window, but I can?_Tt figure out how to read the state of the units.
So my question is:
Is there’s a way to read the state of an I/O unit (Running,Deactivated,Stoped)?
FlexPendant SDK does not a have an API for working with units and buses.
For anyone interested in doing it with PC SDK you can dolike this:
Controller c = new Controller(...);
Unit unit = c.IOSystem.GetUnit("MyUnit");
unit.StateChanged += new EventHandler<UnitStateChangedEventArgs>(unit_StateChanged);
void unit_StateChanged(object sender, UnitStateChangedEventArgs e)
{
IOUnitPhysState state = e.NewUnitState.PhysicalState;
/// Do stuff with the state information...
}
Unfortunately the e.NewUnitState.PhysicalState returns a type that belongs to an internal namespace. So you must add
using ABB.Robotics.Internal;
Formally that means that this code is not supported as internal types can change without notice between releases of the API.
The fact that the type is located in the internal namespace is most likely a a bug and and will be corrected.