EasyManua.ls Logo

Siemens SIMATIC S7 - Iprofinetdevice Events; Datachanged Event

Siemens SIMATIC S7
134 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SIMATIC Automation Tool API for .NET framework
6.7 The IProfinetDevice interface
SIMATIC Automation Tool V2.1 user guide
94 Manual, V2.1.1 07/2016, A5E33042676-AC
6.7.3
IProfinetDevice events
6.7.3.1
DataChanged event
The DataChanged event is supported on the IProfinetDevice interface.
This event allows the program to monitor whether changes have occurred to a given device
on the network, due to other operations through the API. For example, if the program keeps
a reference to a specific IProfinetDevice, it is possible to "listen" for certain changes to the
device.
In the following example, the code attaches to the DataChanged event for every device on
the network.
private void AttachEvents(IProfinetDeviceCollection devices)
{
foreach (IProfinetDevice dev in devices)
{
dev.DataChanged += new DataChangedEventHandler(Dev_DataChanged);
}
}
private void Dev_DataChanged(object sender, DataChangedEventArgs e)
{
if (e.Type == DataChangedType.OperatingState)
{
}
}
Now, when any actions by the API cause a device to change operating mode, the method
Dev_DataChanged will be called.
Note
This does not actively monitor the li
ve network, but monitors the properties of the
IProfinetDevice
. The state of this object must change in order to trigger the event.
The DataChangedEventArgs class
The DataChanged event handler will be passed a DataChangedEventArgs object. As shown in
the above example, this class has a single property (Type) of type
DataChangedType.
See also
DataChangedType enumeration (Page 116)

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals