SIMATIC Automation Tool API for .NET framework
6.6 The IProfinetDeviceCollection class
SIMATIC Automation Tool V2.1 user guide
78 Manual, V2.1.1 07/2016, A5E33042676-AC
Filtering items in the collection
6.6.2.1
The collection will contain an item for each device on the industrial Ethernet network. The
collection may contain devices from different multiple product families (i.e S7-1200, S7-1500,
ET200S, etc).
The collection may also contain different "categories" of devices (i.e. CPUs or IO stations).
For different categories of devices, specific operations are available. So it may be useful at
times to "filter" the collection to include only certain devices.
FilterByDeviceFamily method
This method returns a collection that includes only devices of the specified product families.
The filter is first constructed as a list of one or more device families. For example, this
declaration creates a filter for only S7-1200 and S7-1500 devices.
List<DeviceFamily> fams = new List<DeviceFamily> {
DeviceFamily.S71200,DeviceFamily.S71500 };
Pass this "filter" to the
FilterByDeviceFamily method. The result is an
IProfinetDeviceCollection that contains only the devices of the specified product families.
IProfinetDeviceCollection scannedDevices = new IProfinetDeviceCollection();
Result retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
IProfinetDeviceCollection onlyPlus = scannedDevices.FilterByDeviceFamily(fams);
The resulting collection can then be iterated to perform actions only on the included devices.
ssing an empty
ill result in the return of an empty collection.