RMCLink.Interop .NET Assembly RMCLink.ReadImage Method |
Reads the entire controller image into an integer array. This image can be applied to another controller of the same physical configuration using the WriteImage method. For saving and restoring the controller image using a file, use the ReadImageToFile and WriteImageFromFile methods. This method is only supported on the RMC75E, RMC150E, and RMC200 controllers.
Visual Basic (Declaration) |
Public Function ReadImage ( _ flags As Integer _ ) As Integer() |
Visual Basic (Usage) |
Dim instance As RMCLink Dim flags As Integer Dim returnValue() As Integer
returnValue = instance.ReadImage(flags) |
C# |
public int[] ReadImage ( int flags ) |
Visual C++/CLI |
public: array<int>^ ReadImage ( int flags ) |
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.
The array of Integer elements will contain the image read from the controller. The length of this array will vary depending on the actual contents of the controller.
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 |
ArgumentOutOfRangeException |
The flags parameter is out of range. |
This read was cancelled by a call on another thread to one of the Disconnect and CancelRequest methods. |
|
InvalidOperationException |
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 following code example illustrates the use of the ReadImage method in copying a controller image from one controller to another.
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.CreateUSBLink(DeviceType.RMC70, "7573091001")
' Connect to the controller.
rmc.Connect()
' Read the image into our variable.
image = rmc.ReadImage(0)
' Disconnect from the controller.
rmc.Disconnect()
' Create a new RMCLink object for the second controller.
Dim rmc2 As RMCLink = RMCLink.CreateUSBLink(DeviceType.RMC70, "7573091002")
' Connect to the controller.
rmc2.Connect()
' Apply the image to the second controller.
rmc2.WriteImage(0, image)
' Disconnect from the controller.
rmc2.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.CreateUSBLink(DeviceType.RMC70, "7573091001");
// Connect to the controller.
rmc.Connect();
// Read the image into our variable.
image = rmc.ReadImage(0);
// Disconnect from the controller.
rmc.Disconnect();
// Create a new RMCLink object for the second controller.
RMCLink rmc2 = RMCLink.CreateUSBLink(DeviceType.RMC70, "7573091002");
// Connect to the controller.
rmc2.Connect();
// Apply the image to the second controller.
rmc2.WriteImage(0, image);
// Disconnect from the controller.
rmc2.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::CreateUSBLink(DeviceType::RMC70, "7573091001");
// Connect to the controller.
rmc->Connect();
// Read the image into our variable.
image = rmc->ReadImage(0);
// Disconnect from the controller.
rmc->Disconnect();
// Create a new RMCLink object for the second controller.
RMCLink^ rmc2 = RMCLink::CreateUSBLink(DeviceType::RMC70, "7573091002");
// Connect to the controller.
rmc2->Connect();
// Apply the image to the second controller.
rmc2->WriteImage(0, image);
// Disconnect from the controller.
rmc2->Disconnect();
return 0;
}
|
See Also
RMCLink.Interop .NET Assembly | RMCLinkNET Namespace | RMCLink Class | WriteImage | ReadImageToFile | WriteImageFromFile
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion