API de la SIMATIC Automation Tool para .NET framework
7.14 Interfaz IHMI
El siguiente ejemplo busca la
específica. Cuando la encuentra, comprueba que la HMI soporta la función de restauración
y llama al método
Network myNetwork = new Network();
ulong targetMACAddress = 0x112233445566; // 11:22:33:44:55:66
IProfinetDeviceCollection scannedDevices;
IScanErrorCollection scanResult = myNetwork.ScanNetworkDevices(out scannedDevices);
if (!scanResult.Succeeded)
{
}
248
:
Restore
IHMI hmi = scannedDevices.FindDeviceByMAC(targetMACAddress) as IHMI;
if (hmi != null && hmi.RestoreAllowed == true)
{
// Seleccionar CPU a actualizar
hmi.Selected = true;
retVal = hmi.SetBackupFile(@"C:\MyFolder\Backup.s7pbkp");
if (retVal.Failed == true)
return;
// ¿Dirección IP unívoca?
if (hmi.DuplicateIP == true)
return;
// ¿Se soporta el dispositivo?
if (hmi.Supported == false)
return;
// Restaurar
retVal = hmi.Restore();
}
IProfinetDeviceCollection
Guía del usuario de SIMATIC Automation Tool V3.1 SP2
Manual de producto, V3.1 SP2, 11/2018, A5E45044281-AA
para una HMI en una dirección IP