On 2017-08-11 15:59, John Van Ostrand wrote:
Should libdivecomputer be able to read other sources of dives other than dive computers? It seems to me that the interface is suitable for reading a dive log file.
The idea would be that instead of passing LDC a serial file, you give it a log file name and instead of a family, model and device you give it a manufacturer, software and file type. LDC opens the file, decodes what it needs to, and starts passing dives to the callback function.
I don't know about other software logs but the Cochran Analyst logs that I've been working with basically stores the log and dive data in the exact same format as was retrieved from the DC. So the parse functions are probably identical.
Trying to integrate an import functionality into libdivecomputer is probably not such a great idea. A dive logbook typically contains a lot of extra data beyond the profile data that a dive computer provides. Things like the dive site, buddies, notes, etc. All this information would get lost because the libdivecomputer api doesn't support this kind of information.
If the data is stored in the same format as downloaded from the dive computer (*), then you can already use the libdivecomputer parser. It's perfectly possible to use the parser on its own. You really don't need the device part to use it!
(*) Storing dive data in the original format is actually a great idea which has several advantages. It's the most compact representation possible and no information is ever lost. If your application implements some new feature (or the parser is improved and supports some new features), then you can apply that retroactively to dives downloaded long time ago.
Jef