I would like a new API like GetDeviceData that returns
not the entire memory in one chunk, but instead a
single packet at a time and that I call repeatedly.
The reason is, I would like to handle my own status bar
while downloading (for user interface reasons), and also
because I want to support additional language locales
(other than English). I have about a dozen languages to
support. The SuppressBoxes API goes a bit towards
this, but still pops up the progress bar, and besides the
GetDeviceData returns everything in one chunk.
As an example, I would like something that looks like:
long dataLen = GetDeviceDataLength();
long maxPacketSize = GetDeviceMaxPacketSize();
byte* packetBuffer [maxPacketSize]
long totalBytesRead = 0;
long bytesRead = GetNextDevicePacket(packetBuffer);
while (bytesRead)
{
totalBytesRead += bytesRead;
double percentCompete = totalBytesRead / dataLen;
// Update progress bar with percent complete and
process data packet
bytesRead = GetNextDevicePacket(packetBuffer);
}
I think the largest packet size is 17 right ?? (Ultimate) -
I am just thinking for the future when there is a new
larger packet.
So the new API would be:
long GetDeviceDataLength()
byte GetDeviceMaxPacketSize()
byte GetNextDevicePacket(byte* pBuffer)
GetNextDevicePacket() will return zero when there is no
more data to read.
I might be able to make these changes to the logger.dll
source, if you could point me to the correct functions ?
Logged In: YES
user_id=1062933
Well, you have a couple of choices:
1. You could modify the code to kill the progress bar completely (or
maybe add another call that supresses just the dialog box).
2. You can use the GetEEPROMData call to read the data out of the
EEPROM database in whatever way you see fit. I think you can read
the data out byte-by-byte even - I'm not sure, I'll have to go back and
look at that call. Anyway, you can create a process that reads the first
byte of the packet and then creates a loop that reads the rest of the
packet and then stops. You may end up with a slow read process, but it
will be custom.
I think Brigg should jump in here for a comment as he knows the DLL
code way better than I do.
-Rick
Logged In: YES
user_id=368106
The code for reading is very interwoven with the code for
processing the packets, so I don't think this is a trivial change.
You might be able to use the ReadData API call and iterate
through the memory. For example, call GetDeviceDataSize
and it returns 500 bytes. Then, divide the memory size by the
number of blocks to read. Lets say 256 bytes. You would
setup your progress bar to have a min value of 0 and a max
value of 2. Read the first packet, set the progress to 1 (50%).
Read the second packet and set progress to 2 (100%). Then,
you can perform your own processing on the data.
If you want to use the filters that are present in the logger,
you could call them after each chunk is read. This should be
the process call.