RMCLink COM Component 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 with firmware 3.34.0 or newer.
Visual Basic (Declaration) |
Sub ReadImageToFile ( _ flags As Long, _ fileName As String _ ) |
Visual Basic (Usage) |
Dim instance As RMCLink Dim flags As Long Dim fileName As String
instance.ReadImageToFileflags, 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.
Error Code |
Description |
rmcEOutOfMemory = 5 |
Out of memory. |
rmcEInvalidArg = 7 |
The flags parameter has an unsupported value. |
rmcEDisconnecting = 1002 |
Link is being disconnected by another thread. |
rmcEDisconnected = 1005 |
The link has not been connected. |
rmcESocketInternal = 1008 |
Internal socket error. |
rmcECancelled = 1010 |
Operation cancelled by call to CancelRequest. |
rmcETimeout = 1011 |
Operation timed out. |
rmcESocketGracefullyClosed = 1014 |
TCP/IP connection closed by remote device. |
rmcESocketReadError = 1015 |
Connection error while waiting for response from the remote device. |
rmcESocketInvReadLen = 1016 |
Connection error while waiting for response from the remote device. |
rmcESocketWriteError = 1017 |
Connection error while sending request to the remote device. |
rmcESocketInvWriteLen = 1018 |
Connection error while sending request to the remote device. |
rmcEConnectionBroken = 1028 |
Connection broken. |
rmcEPartialWrite = 1029 |
Unable to send full request to the remote device. |
rmcEBadAddress = 1032 |
Attempt to read beyond the end of a file. |
rmcENotSupported = 1035 |
Operation not supported on this controller type. The controller must be an RMC75E, RMC150E, or RMC200 with firmware supporting the image read/write. |
rmcEBuildImgTimeout = 1036 |
Timeout waiting for image to be built. |
rmcEBuildImgError = 1037 |
Controller unable to build image. |
rmcEBuildImgState = 1038 |
Unexpected state encountered while building image. |
rmcEImageUploadFailed = 1039 |
Unable to upload completed image. |
rmcEUSBInternal1 = 1051 |
Internal USB driver error. |
rmcEUSBOperationAborted = 1053 |
Unsuccessful transfer of data between the PC and the controller. Ensure that the physical connection between the PC and controller is still intact. |
rmcEUSBDisconnected = 1054 |
The controller appears to have been disconnected from the USB port. Ensure that the physical connection between the PC and controller is still intact. |
rmcEPathNotFound = 1059 |
Unable the find the specified file path. Check that the drive and folder specified exist. |
rmcEAccessDenied = 1060 |
Access denied to the file or path. Verify that you have access to create files in the specified folder, or if you are saving over an existing file, make sure that the existing file is not read-only or currently open by another application. |
rmcEDriveNotReady = 1061 |
Removable drive not ready. Verify that media has been inserted into the removable drive. |
rmcEBuildImgNotAllowed = 1062 |
Controller unable to build upload image because copy protection is enabled. |
The following code example illustrates the use of the ReadImageToFile method.
Visual Basic 6 / VBA |
Option Explicit
Public Sub Sample()
' Declare and create the RMCLinkServer COM object.
Dim srv As New RMCLinkServer
' Create a new RMCLink object for the controller.
Dim rmc As RMCLink
Set rmc = srv.CreateEthernetLink(dtRMC70, "192.168.0.22")
' Connect to the controller.
rmc.Connect
' Read the image and save it to 'RMCImage.bin'.
rmc.ReadImageToFile 0, "RMCImage.bin"
' Close the connection.
rmc.Disconnect
End Sub
|
VBScript |
Option Explicit
Dim src, rmc
' First we need to create the RMCLinkServer COM object.
Set srv = CreateObject("RMCLink.RMCLinkServer")
' Create a new RMCLink object for the controller.
' NOTE: VBScript does not support enumerations, so we use the literal value (dtRMC70=2).
Set rmc = srv.CreateEthernetLink(2, "192.168.0.22")
' Connect to the controller.
rmc.Connect
' Read the image and save it to 'RMCImage.bin'.
rmc.ReadImageToFile 0, "RMCImage.bin"
' Close the connection.
rmc.Disconnect
|
JScript |
// First we need to create the RMCLinkServer COM object.
var srv = new ActiveXObject("RMCLink.RMCLinkServer");
// Create a new RMCLink object for the controller.
// NOTE: JScript does not support enumerations, so we use the literal value (dtRMC70=2).
var rmc = srv.CreateEthernetLink(2, "192.168.0.22");
// Connect to the controller.
rmc.Connect();
// Read the image and save it to 'RMCImage.bin'.
rmc.ReadImageToFile(0, "RMCImage.bin");
// Close the connection.
rmc.Disconnect();
|
See Also
RMCLinkServer Class | RMCLink Class | RMCLink COM Component | WriteImageFromFile | ReadImage | WriteImage
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion