mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: load and save fingerprints to XML
We always use the global fingerprint table - maybe this should just not be a parameter of the accessor functions? The syntax is very simple - the raw data is encoded as a hex string, the rest of the components are hex numbers. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
33527cb9e5
commit
2b1db9da82
4 changed files with 67 additions and 0 deletions
|
@ -607,6 +607,16 @@ static void save_one_device(struct membuffer *b, const struct device *d)
|
|||
put_format(b, "/>\n");
|
||||
}
|
||||
|
||||
static void save_one_fingerprint(struct membuffer *b, int i)
|
||||
{
|
||||
put_format(b, "<fingerprint model='%08x' serial='%08x' deviceid='%08x' diveid='%08x' data='%s'/>\n",
|
||||
fp_get_model(&fingerprint_table, i),
|
||||
fp_get_serial(&fingerprint_table, i),
|
||||
fp_get_deviceid(&fingerprint_table, i),
|
||||
fp_get_diveid(&fingerprint_table, i),
|
||||
fp_get_data(&fingerprint_table, i));
|
||||
}
|
||||
|
||||
int save_dives(const char *filename)
|
||||
{
|
||||
return save_dives_logic(filename, false, false);
|
||||
|
@ -676,6 +686,10 @@ static void save_dives_buffer(struct membuffer *b, bool select_only, bool anonym
|
|||
if (!select_only || device_used_by_selected_dive(d))
|
||||
save_one_device(b, d);
|
||||
}
|
||||
/* save the fingerprint data */
|
||||
for (int i = 0; i < nr_fingerprints(&fingerprint_table); i++)
|
||||
save_one_fingerprint(b, i);
|
||||
|
||||
if (autogroup)
|
||||
put_format(b, " <autogroup state='1' />\n");
|
||||
put_format(b, "</settings>\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue