ReadInputData Method

Beta Innovations USB SDK .NET/COM

A non-blocking call which returns input data. The first call to this function initiates a request for input data from the specified module as indicated by the DeviceParam structure and immediately returns form the function. This prevents the main calling application from locking while the module is being polled. The return flag indicate the current status of the request.

Namespace:  BIUSBWrapper
Assembly:  BIUSBWrapper (in BIUSBWrapper.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function ReadInputData ( _
	ByRef iDeviceList As DeviceParam, _
	<OutAttribute> oDataBuffer As Byte(), _
	iFlag As UInteger _
) As Integer
C#
public static int ReadInputData(
	ref DeviceParam iDeviceList,
	byte[] oDataBuffer,
	uint iFlag
)

Parameters

iDeviceList
Type: BIUSBWrapper..::.DeviceParam %
A DeviceParam structure. Must contain valid device information returned from call to DetectHID.
oDataBuffer
Type: array< System..::.Byte >[]()[]
Returns a populated data buffer array. The NumberInputIndices within the DeviceParam structure indicates the required length of this data buffer array specifying the number of detected inputs for the module.
iFlag
Type: System..::.UInt32
Must always be set to falseFalsefalsefalse (False in Visual Basic).

Return Value

DEV_TIMEOUT Device did not respond within 1 second.

DEV_FAILED Failure reading from device.

DEV_WAIT No new data available. Waiting for device response.

DEV_INPUT New data available.

Remarks

A return status of DEV_INPUT indicates new data is available at the location pointed to by oDataBuffer for the module specified in the DeviceParam structure. The NumberInputIndices within the DeviceParam structure indicates the number of input values to be read and size of the required array.

If no new data is available, the previously buffered data will be returned in addition to the DEV_WAIT flag indicating the module has not yet responded to the request for input data.

Depending on the specific module, polling frequency may vary in the range from 10ms to 40ms or more before data is flagged as being available. As a general rule, this function should be polled every 10 ms if real-time input data is required.

If a device should become unplugged or is no longer responding, the DEV_TIMEOUT flag will be returned after 1 second has elapsed.

See Also