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
89
Using the FirmwareUpdate method, it is also possible to update the firmware for a module on
a central station. The following code shows how to search for a CPU at a specific address
and then searches the modules on that CPU for a specific article number. The firmware is
then updated in modules that match the search criteria.
Result retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
uint targetIPAddress = 0xC0A80001; // 192.168.0.1
string targetModule = @"6ES7 221-1BF32-0XB0";
string updateFile = @"c:\myUpdates\6ES7 221-1BF32-0XB0 V02.00.00.upd";
if (!retVal.Succeeded)
return;
IProfinetDevice dev = scannedDevices.FindDeviceByIP(targetIPAddress);
if (dev != null)
{
retVal = dev.RefreshStatus(new EncryptedString(""));
if (!retVal.Succeeded)
return;
//-------------------------------
// Search the modules on the CPU.
//-------------------------------
IModuleCollection mods = dev.Modules;
foreach (IModule mod in mods)
{
if (mod.ArticleNumber == targetModule)
{
//---------------------------------------
// Update firmware for matching module(s)
//---------------------------------------
dev.FirmwareUpdate(new EncryptedString(""),
updateFile, mod.ID, true);
}
}
}
Notice that the FirmwareUpdate method is still called on the CPU. But the hardwareID
passed to the method indicates which module should be updated.