Single Wire CAN
Compare to LIN and FlexRay
DOWNLOAD WaveBPS Trial Edition
WaveBPS: Loading Custom Data
WaveBPS allows you to create your own support for importing data. Users can do this by creating a Windows DLL that implements two functions. One function allows WaveBPS to get information about the DLL. The other API does the import. All functions in the dll must use the __stdcall calling convention.
First, when the user clicks the open waveform (Figure 1 - bubble 1) button WaveBPS will search its install directory (where the exe is at) for an "import" subdirectory . For all the DLLs in the subdirectory it will call the function "WaveBPSImportGetInfo" (Figure 2) to find out what types of files the DLL supports and a description. The description is listed in the box of possible import types (Figure 1 - bubble 2).
If the user selects the import a file open dialog will be shown. If the user then selects a file the second API will be called - WaveBPSImportData. This is shown in figure 3 below. This function receives the FilePath selected by the users and three function pointers. One function pointer indicates the number of channels and buffer type information. Another function pointer is to set the buffer size required by the import data. The other allows the import to update the progress bar in the WaveBPS application.
The first callback sets up the number of channels (currently up to two channels is supported) and the data type. WaveBPS supports two data types. The first is a struct which defines a floating point time and voltage (iDatatype ==0). The second data type (iDatatype ==1) is a short array which has a constant time and voltage scaling (indicated by arguments dVoltsPerCount and dSampleRateInMicroseconds). The short array is more memory efficient for large data sets. dVoltsPerCount and dSampleRateInMicroseconds are ignored for iData=0.
Also shown in figure 4, one of the callbacks is to get the memory pointer for the data buffer WaveBPS will use. This API called SetBufferSize takes three arguments and returns the pointer to the buffer. The first argument is the channel number. The next argument is the size of the buffer and the other is a flag to indicate whether the existing buffer data should be preseved with the new buffer. It is recommended to use the preserve as little as possible for performance reasons. If for some reason WaveBPS cannot allocate the memory for the import the SetBufferSize function returns null.
The second call back is for updating the progress bar. There are two arguments - one is the an int indicating whether or not to show the progress bar and the other is the progress value from 0-100.
When datatype ==0, The pointer returned from SetBufferSize is a pointer to stWaveFormPoint structures otherwise its a short array. This includes the waveform values in voltages and times in microseconds. When datatype ==1 it is just a short array.
DLL DEF file
DLL Code Listing