Assembly: Quanser.Targets (in Quanser.Targets.dll)
Syntax
Visual Basic (Declaration) |
---|
Function GetCode ( _ target As Target, _ context As Object, _ buffer_length As Integer, _ buffer As Byte() _ ) As Integer |
C# |
---|
int GetCode( Target target, Object context, int buffer_length, byte[] buffer ) |
Visual C++ |
---|
int GetCode( Target^ target, Object^ context, int buffer_length, array<unsigned char>^ buffer ) |
JavaScript |
---|
function getCode(target, context, buffer_length, buffer); |
Parameters
- target
- Type: Quanser.Targets..::.Target
The target instance.
- context
- Type: System..::.Object
The context provided to the DownloadModel(String, String, String, IDownload, Object) method.
- buffer_length
- Type: System..::.Int32
The number of bytes that should be stored in the buffer.
- buffer
- Type: array<
System..::.Byte
>[]()[]
The buffer in which to store the bytes.
Return Value
The number of bytes of code stored in the buffer. A negative error code cancels the download. If the number of bytes is less than buffer_length, the download completes successfully.Remarks
The method should use the context value to read the next buffer_length bytes of code and store them in the given buffer. The return value should be the number of bytes actually stored in the buffer.
If this number is less than the buffer_length then the Target API interprets this as meaning that the end of the model code has been reached. In this case, the download will complete and the callback will not be invoked again. The DownloadModel(String, String, String, IDownload, Object) method will return, with the number of bytes in total that were downloaded.
If the return value from the callback is negative then this is interpreted to mean that an error occurred and the download should be canceled.
This callback may be used to update a graphical user interface showing the progress of the download while allowing the user to cancel the download. The download is cancelled if the callback returns a negative value.