So I have a few more patches pending for the EON steel, and am parsing a fair amount more data. In particular, I'm parsing things like device ID's now, but the sad part is that I have no really good way to pass the data back.
Why?
Part of it is an EON Steel detail: the firmware version number etc is actually encoded per-dive: yes, you can find a "current firmware version" for the device itself, but I'd *much* rather use the per-dive one, which is stable (ie if I upgrade the firmware, the device firmware version updates, but the dive info still has the firmware version that was active for the dive). That means that the dive data doesn't change if the firmware is updated.
But the
device_event_emit(device, DC_EVENT_DEVINFO, &devinfo);
seems to be meant to be called just once, not once per dive. Whatever - I guess I could just violate that unwritten rule and just do multiple devinfo callbacks, once before each dive.
HOWEVER.
The other issue is that all of this is encoded in the same format that all the sample data is encoded in, so it's really only available when actively *parsing* the file. So I'd *really* like to call that device_event_emit() when I get the set_data() in the parser - but by then I no longer have the "device" struct to send the info to.
Can I parse the damn thing multiple times? Sure. Right now I already parse it twice: once at parser setup time (to get the "fields" data - dive duration, surface pressure etc), and then once for the samples_foreach() case. Can I make the parser and the dive data loading IO side be incestuous and parse it a *third* time early? Yes I can, but yes I'd really prefer not to. It negates the whole principle of separating out the dive parsing from the dive loading that libdivecomputer seems to have.
Jef, comments?
Linus