« Close

Datasheets and User Guides

App Notes

Software & Driver

 

4.2.9 - GetFirstResult() and GetNextResult()

Calling either Go function creates a list of results that matches the list of requests. Use GetFirstResult() and GetNextResult() to step through the list of results in order. When either function returns LJE_NO_MORE_DATA_AVAILABLE, there are no more items in the list of results. Items can be read more than once by calling GetFirstResult() to move back to the beginning of the list.

UserData is provided for tracking information, or whatever else the user might need.

None of the Get functions clear results from the list. The first AddRequest() call subsequent to a Go call will clear the internal lists of requests and results for a particular device.

When processing raw in/out or stream data requests, the call to a Get function does not actually cause the data arrays to be filled. The arrays are filled during the Go call (if data is available), and the Get call is used to find out many elements were placed in the array.

It is acceptable to pass NULL (or 0) for any pointer that is not required.

The parameter lists are the same for the GetFirstResult() and GetNextResult() declarations.

Declaration:

LJ_ERROR _stdcall GetFirstResult (  LJ_HANDLE Handle,
                                    long *pIOType,
                                    long *pChannel,
                                    double *pValue,
                                    long *px1,
                                    double *pUserData)

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:

  • Handle – Handle returned by OpenLabJack().

Outputs:

  • pIOType – A pointer to the IOType of this item in the list.
  • pChannel – A pointer to the channel number of this item in the list.
  • pValue – A pointer to the result value.
  • px1 – A pointer to the x1 parameter of this item in the list.
  • pUserData – A pointer to data that is simply passed along with the request, and returned unmodified. Can be used to store any sort of information with the request, to allow a generic parser to determine what should be done when the results are received.