RMCLink COM Component RMCLink.WriteImage Method |
Writes the specified controller image to the controller and applies it to the controller. By default, the image will be saved to flash and the controller will be restarted. The controller image must be obtained using the ReadImage 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) |
Sub WriteImage ( _ flags As Long, _ data As Variant _ ) |
Visual Basic (Usage) |
Dim instance As RMCLink Dim flags As Long Dim data As Variant
instance.WriteImageflags, data |
flags
Options to use when applying the image. Refer to the RMCTools documentation on the Image Area for a current list of options. As of this writing, a single option has been defined. Specify zero (0) to use default options.
+0 |
Save Image to Flash, and Restart Controller to Apply |
+16 |
Apply Image Immediately and Save To Flash (not supported by RMC200) |
data
This variant must be a single-dimension array of Long data type elements that was created using the ReadImage method.
This method is synchronous, which means that it will not return until the write 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. |
rmcEImageResetFailed = 1040 |
Unable to reset Image Area for download. |
rmcEImageDownloadFailed = 1041 |
Unable to download controller image. |
rmcEImageInvalid = 1042 |
Timeout applying downloaded image. |
rmcEImageApplyTimeout = 1043 |
Image format is invalid. |
rmcEImageApplyState = 1044 |
Unexpected state encountered while applying image. |
rmcEImageApplyResetReq = 1045 |
Image not applied because restart required. |
rmcEImageApplyFlashError = 1046 |
Error writing to flash memory while applying image. |
rmcEImageApplyRunMode = 1047 |
Image cannot be applied without restart while in RUN mode. |
rmcEImageApplyHWMismatch = 1048 |
Image not applied because of hardware mismatch. |
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. |
The following code example illustrates the use of the WriteImage method in copying a controller image from one controller to another.
Visual Basic 6 / VBA |
Option Explicit
Public Sub Sample()
Dim image As Variant
' Declare and create the RMCLinkServer COM object.
Dim srv As New RMCLinkServer
' Create a new RMCLink object for the first controller.
Dim rmc As RMCLink
Set rmc = srv.CreateUSBLink(dtRMC70, "7573091001")
' Connect to the controller.
rmc.Connect
' Read the image into our variable.
image = rmc.ReadImage(0)
' Close the connection.
rmc.Disconnect
' Create a new RMCLink object for the second controller.
Dim rmc2 As RMCLink
Set rmc2 = srv.CreateUSBLink(dtRMC70, "7573091002")
' Connect to the controller.
rmc2.Connect
' Read the image into our variable.
rmc2.WriteImage 0, image
' Close the connection.
rmc2.Disconnect
End Sub
|
VBScript |
Option Explicit
Dim srv, rmc, rmc2, image
' First we need to create the RMCLinkServer COM object.
Set srv = CreateObject("RMCLink.RMCLinkServer")
' Create a new RMCLink object for the first controller.
' NOTE: VBScript does not support enumerations, so we use the literal value (dtRMC70=2).
Set rmc = srv.CreateUSBLink(2, "7573091001")
' Connect to the controller.
rmc.Connect
' Read the image into our variable.
image = rmc.ReadImage(0)
' Close the connection.
rmc.Disconnect
' Create a new RMCLink object for the second controller.
Set rmc2 = srv.CreateUSBLink(2, "7573091002")
' Connect to the controller.
rmc2.Connect
' Read the image into our variable.
rmc2.WriteImage 0, image
' Close the connection.
rmc2.Disconnect
|
JScript |
// First we need to create the RMCLinkServer COM object.
var srv = new ActiveXObject("RMCLink.RMCLinkServer");
// Create a new RMCLink object for the first controller.
// NOTE: JScript does not support enumerations, so we use the literal value (dtRMC70=2).
var rmc = srv.CreateUSBLink(2, "7573091001");// Connect to the controller.
rmc.Connect();
// Read the image into our variable.
var image = rmc.ReadImage(0);
// Close the connection.
rmc.Disconnect();
// Create a new RMCLink object for the second controller.
var rmc2 = srv.CreateUSBLink(2, "7573091002");
// Connect to the controller.
rmc2.Connect();
// Read the image into our variable.
rmc2.WriteImage(0, image);
// Close the connection.
rmc2.Disconnect();
|
See Also
RMCLinkServer Class | RMCLink Class | RMCLink COM Component | ReadImage | ReadImageToFile | WriteImageFromFile
Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion