LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-HWS API limitations

I want to be able to read an HWS file that represents 24 hours of data at 50 kSamps/sec.
 
Here is a sample of the code I 'm using:

status = niHWS_GetWfmReference(*myHWSFile, "", "", myHWSRef);

status = niHWS_Seek (*myHWSRef, niHWS_Val_Start, startPt);

status = niHWS_ReadAnalogF64(*myHWSRef, numToRead, myBuff, totalSize);

The problem is that the numToRead has to be a long (as well as startPt). The minimum size of a long integer is 4 bytes (This minimum size gets bigger on 64-bit machines, I believe). That means I have 31 bits to represent numToRead and startPt (32 minus 1 bit for the sign). That means the largest number of samples and the largest sample offset I can have is 2,147,483,648. That's pretty big, right? I can get just under twelve hours of data that I can access if I sample of 50 kSamps/sec. (I find this somewhat ironic, as the foundation of the HWS format, HDF5 was set up for the express purpose, among others, to be able to hold really really big numbers. What does this have to do with addressing? Well, perhaps a data type could be created that pastes a couple of long ints together to allow for much larger numbers. Isn't this a technique used in HDF5?)

It's possible I have an old version of the library. It would make sense to have totalSize and startPt be unsigned, since files don't have negative indexes (am I mistaken?). (Even with this I wouldn't technically be able to parse 24 hours of data, but very nearly so).

Am I stuck? Is there a reason a long was used instead of an unsigned long? Does NI have any plans to update the library? Any ideas?

0 Kudos
Message 1 of 2
(2,924 Views)
Here's the solution to my problem.
 
It turns out that the solution is to use the niHWS_Seek function.
 
Here's how it works:
You create a reference for a file, which keeps track, with some sort of pointer, of where you are in the file (I imagine it uses the current address).
 
To get a bigger offset than what a long int will allow, simply use niHWS_Seek to keep repositioning the pointer by increments of the maximum positive value of a long. Doing this, any point in the file can be reached.
0 Kudos
Message 2 of 2
(2,900 Views)