Assembly: Quanser.Targets (in Quanser.Targets.dll)
Syntax
Visual Basic (Declaration) |
---|
Function PutCode ( _ target As Target, _ context As Object, _ buffer_length As Integer, _ buffer As Byte() _ ) As Integer |
C# |
---|
int PutCode( Target target, Object context, int buffer_length, byte[] buffer ) |
Visual C++ |
---|
int PutCode( Target^ target, Object^ context, int buffer_length, array<unsigned char>^ buffer ) |
JavaScript |
---|
function putCode(target, context, buffer_length, buffer); |
Parameters
- target
- Type: Quanser.Targets..::.Target
The target instance.
- context
- Type: System..::.Object
The context passed to the UploadFile(String, IUpload, Object) method.
- buffer_length
- Type: System..::.Int32
The number of bytes in the given buffer.
- buffer
- Type: array<
System..::.Byte
>[]()[]
The next chunk of bytes uploaded from the target.
Return Value
Return the number of bytes on success (any non-negative number is acceptable). A negative error code cancels the upload.Remarks
This method is repeatedly called by the QUARC Target API as each chunk of a file is uploaded from the target, until the entire file has been uploaded. The length of each chunk is passed in the buffer_length parameter.
Once the entire file has been uploaded, this callback will not be invoked again and the UploadFile(String, IUpload, Object) method will return with the total number of bytes that were uploaded.
The return value should be the number of bytes processed by the callback, such as the number of bytes written to a file. If the return value from the callback is negative, then this is interpreted to mean that an error occurred and the upload will be cancelled.
The callback may be used to update a graphical user interface showing the progress of the upload, and allow the user to cancel the upload. The upload is cancelled if the callback returns a negative value.