Reputation: 11
I'm writing a C# program that reads data from a USB GPS logger, which acts like a new COM port when i plug it in. I've managed to write some code that listens to the COM port and fires an event when it receives data, but i have a few problems with this approach :
The event listener is way to slow : i get like only 1 result per second which takes forever if there are thousands of tracks on the logger.
Since i don't know how much data the logger contains, how do i know when i should stop the event listener, without losing data? I would also like to write all the data to a csv file, but since i dont know when to stop listening, i also don't know when to call my writer function.
I actually don't understand why this happens over a COM port, since the logger already contains all the data i need? I just want to extract it all at once. Is there a way to accomplish this? Thanks in advance!
Upvotes: 1
Views: 582
Reputation: 142
I believe there is not much you can do about this. You can't change the behavior of the USB device, since this is a driver issue. The reason it is recognized as a COM port is probably because the manufacturer who made the device didn't want to have to deal with the devious task of writing drivers for the device.
So instead he used a chip that translates the data from the microchip to "Serial communiation", to emulate RS-232 communication. Which is far easier to handle. Also for you, because you probably wouldn't be able to read the data or interact with a Custom USB device without proper documentation..
The normal baud rate for RS-232 is usual 9600. This would be minimal 9600 Bits per Second. So thinking it could be a 8 or 16 bit device, this would result in 1200 or 600 integers per minute. So depending on the data you read per result, i think 1 result/second is rather slow.
Hope this is of any help.
Upvotes: 1