SIMATIC Automation Tool API for .NET framework
6.7 The IProfinetDevice interface
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC
87
IProfinetDevice methods
6.7.2.1
In This method opens a legitimized connec-
tion to the device. Therefore, a password
When the IProfinetDeviceCollection collection is created by calling the
ScanNetworkDevices method, only a minimal amount of information is learned about each
device. In order to get all the available information for the device, it is necessary to call the
RefreshStatus method. This method makes a connection to the device, queries for various
information, and then disconnects from the device.
The following code will call
RefreshStatus for each device on the network.
IProfinetDeviceCollection scannedDevices = new IProfinetDeviceCollection();
Result retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
if (retVal.Succeeded)
{
foreach (IProfinetDevice dev in scannedDevices)
{
Result retVal = networkDevice.RefreshStatus(new EncryptedString(""));
if (retVal.Succeeded)
{
//--------------------------------------------------
// Operation successful and the data can be trusted.
//--------------------------------------------------
}
}
}
The
RefreshStatus method connects to the device to read information. The device may be
password-protected against such access. Therefore, this method (and all methods that
internally connect with the device) requires a password parameter. The example above
passes an empty password to the method. This would only be appropriate for a device with
no password protection. The example shows the
EncryptedString class. This class is
provided by the API to correctly encrypt a plain-text password before using it to legitimize the
connection with the device.
The EncryptedString class (Page 71)