devices: create device nodes in parsers

So far, we added a non-global device table to the parser states.
Now, create device nodes in that table instead of in the global
table. Thus, on undo of dive-import, the new device nodes will
be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-18 23:42:17 +02:00 committed by Dirk Hohndel
parent 255f561aff
commit 8c65558b5c
6 changed files with 23 additions and 14 deletions

View file

@ -830,7 +830,8 @@ static void try_to_fill_dc(struct divecomputer *dc, const char *name, char *buf,
if (MATCH("model", utf8_string, &dc->model))
return;
if (MATCH("deviceid", hex_value, &deviceid)) {
set_dc_deviceid(dc, deviceid, &device_table);
set_dc_deviceid(dc, deviceid, &device_table); // prefer already known serial/firmware over those from the loaded log
set_dc_deviceid(dc, deviceid, state->devices);
return;
}
if (MATCH("diveid", hex_value, &dc->diveid))