RMCLink.Interop .NET Assembly RMCLink.ReadImageToFile Method |
Reads the entire controller image and saves it to a file. This file can then be written and applied to another controller of the same physical configuration using the WriteImageFromFile method. For saving and restoring the controller image using an array rather than a file, use the ReadImage and WriteImage methods. This method is only supported on the RMC75E, RMC150E, and RMC200 controllers.
Visual Basic (Declaration) |
Public Sub ReadImageToFile ( _ flags As Integer _ ) |
Visual Basic (Usage) |
Dim instance As RMCLink Dim flags As Integer Dim fileName As String
instance.ReadImageToFile(flags, fileName) |
C# |
public void ReadImageToFile ( int flags, string filename ) |
Visual C++/CLI |
public: void ReadImageToFile ( int flags, String^ fileName ) |
flags
Options to use when building the controller image. Refer to the RMCTools documentation on the Image Area for a current list of options. As of this writing no options have been defined. Specify zero (0) to use default options.
fileName
File name and path to save the controller image into.
This method is synchronous, which means that it will not return until the read is completed, which may take several seconds. If this method is called on the main thread, then the application will likely be unresponsive until this method completes. For applications where this is not acceptable, this and other synchronous methods should be called from a worker thread, and may use the CancelRequest method to cancel an in progress request.
Exception Type |
Condition |
The fileName parameter refers to a null (Nothing in Visual Basic) object. |
|
The flags parameter is out of range, or the fileName parameter is blank. |
|
This read was cancelled by a call on another thread to one of the Disconnect and CancelRequest methods. |
|
One of the following circumstances occurred:
Check the Message property of the exception for a description of the exception. |
|
The read failed due to a communication failure. Check that the remote device is powered up, check the communication wiring, and check the communication configuration of both the local and remote devices. Check the Message property of the exception for a description of the communication failure. |
|
The caller does not have the required permission. -or- fileName specified a file that is read-only. |
|
The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. |
|
The specified path is invalid, (for example, it is on an unmapped drive). |
|
An I/O error occurred while creating or writing to the file. |
|
fileName is in an invalid format. |
The following code example illustrates the use of the ReadImageToFile method.
Visual Basic |
Imports RMCLinkNET
Module Example
Sub Main()
Dim image() As Integer
' Create a new RMCLink object for the first controller.
Dim rmc As RMCLink = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.22")
' Connect to the controller.
rmc.Connect()
' Read the image and save it to 'RMCImage.bin'.
rmc.ReadImageToFile(0, "RMCImage.bin")
' Disconnect from the controller.
rmc.Disconnect()
End Sub
End Module
|
C# |
using System;
using RMCLinkNET;
namespace Example
{
public class Program
{
static void Main()
{
int[] image;
// Create a new RMCLink object for the first controller.
RMCLink rmc = RMCLink.CreateEthernetLink(DeviceType.RMC70, "192.168.0.22");
// Connect to the controller.
rmc.Connect();
// Read the image and save it to 'RMCImage.bin'.
rmc.ReadImageToFile(0, "RMCImage.bin");
// Disconnect from the controller.
rmc.Disconnect();
}
}
}
|
Visual C++/CLI |
using namespace System;
using namespace RMCLinkNET;
int main()
{
array <int>^ image;
// Create a new RMCLink object for the first controller.
RMCLink^ rmc = RMCLink::CreateEthernetLink(DeviceType::RMC70, "192.168.0.22");
// Connect to the controller.
rmc->Connect();
// Read the image and save it to 'RMCImage.bin'.
rmc->ReadImageToFile(0, "RMCImage.bin");
// Disconnect from the controller.
rmc->Disconnect();
return 0;
}
|
See Also
RMCLink.Interop .NET Assembly | RMCLinkNET Namespace | RMCLink Class | ReadImage| WriteImage | WriteImageFromFile
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion