aboutsummaryrefslogtreecommitdiffstats
path: root/dives
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2021-08-16 12:50:11 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-08-18 13:22:02 -0700
commit6c4e890960036b127eab513ca967e9454bc63d54 (patch)
tree48295d3854ba576f5d9c4cd2e6297d96bbaae66d /dives
parent61524f9b2ddfda16688890d1a9cf05d050174a9b (diff)
downloadsubsurface-6c4e890960036b127eab513ca967e9454bc63d54.tar.gz
Clean up divecomputer 'device' handling
We have this odd legacy notion of a divecomputer 'device', that was originally just basically the libdivecomputer 'EVENT_DEVINFO' report that was associated with each dive. So it had firmware version, deviceid, and serial number. It had also gotten extended to do 'nickname' handling, and it was all confusing, ugly and bad. It was particularly bad because it wasn't actually a 'per device' thing at all: due to the firmware field, a dive computer that got a firmware update forced a new 'device'. To make matters worse, the 'deviceid' was also almost random, because we've calculated it a couple of different ways, and libdivecomputer itself has changed how the legacy 32-bit 'serial number' is expressed. Finally, because of all these issues, we didn't even try to make the thing unique, so it really ended up being a random snapshot of the state of the dive computer at the time of a dive, and sometimes we'd pick one, and sometimes another, since they weren't really well-defined. So get rid of all this confusion. The new rules: - the actual random dive computer state at the time of a dive is kept in the dive data. So if you want to know the firmware version, it should be in the 'extra data' - the only serial number that matters is the string one in the extra data, because that's the one that actually matches what the dive computer reports, and isn't some random 32-bit integer with ambiguous formatting. - the 'device id' - the thing we match with (together with the model name, eg "Suunto EON Steel") is purely a hash of the real serial number. The device ID that libdivecomputer reports in EVENT_DEVINFO is ignored, as is the device ID we've saved in the XML or git files. If we have a serial number, the device ID will be uniquely associated with that serial number, and if we don't have one, the device ID will be zero (for 'match anything'). So now 'deviceid' is literally just a shorthand for the serial number string, and the two are joined at the hip. - the 'device' managament is _only_ used to track devices that have serial numbers _and_ nicknames. So no more different device structures just because one had a nickname and the other didn't etc. Without a serial number, the device is 'anonymous' and fundamentally cannot be distinguished from other devices of the same model, so a nickname is meaningless. And without a nickname, there is no point in creating a device data structure, since all the data is in the dive itself and the device structure wouldn't add any value.. These rules mean that we no longer have ambiguous 'device' structures, and we can never have duplicates that can confuse us. This does mean that you can't give a nickname to a device that cannot be uniquely identified with a serial number, but those are happily fairly rare (and mostly older ones). Dirk said he'd look at what it takes to give more dive computers proper serial numbers, and I already did it for the Garmin Descent family yesterday. (Honesty in advertizing: right now you can't add a nickname to a dive computer that doesn't already have one, because such a dive computer will not have a device structure. But that's a UI issue, and I'll sort that out separately) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'dives')
-rw-r--r--dives/DL7.xml6
-rw-r--r--dives/TestDiveDM4.xml1
-rw-r--r--dives/TestDiveDM5.xml1
-rw-r--r--dives/TestDiveSeabearHUDC.xml2
-rw-r--r--dives/TestDiveSeabearNewFormat.xml18
-rw-r--r--dives/mergedVyperOstc.xml10
-rw-r--r--dives/test40-42.xml12
7 files changed, 23 insertions, 27 deletions
diff --git a/dives/DL7.xml b/dives/DL7.xml
index 869da0022..f538c3634 100644
--- a/dives/DL7.xml
+++ b/dives/DL7.xml
@@ -5,12 +5,12 @@
</divesites>
<dives>
<dive number='1' date='2018-01-01' time='10:10:00'>
- <divecomputer model='Imported from CSV' deviceid='ffffffff'>
+ <divecomputer model='Imported from CSV'>
<temperature air='27.0 C' water='25.0 C' />
</divecomputer>
</dive>
<dive number='2' date='2018-01-02' time='10:10:00' duration='60:00 min'>
- <divecomputer model='Imported from CSV' deviceid='ffffffff'>
+ <divecomputer model='Imported from CSV'>
<depth max='10.0 m' mean='9.508 m' />
<temperature air='27.0 C' water='25.0 C' />
<sample time='0:00 min' depth='1.0 m' />
@@ -20,7 +20,7 @@
</divecomputer>
</dive>
<dive number='3' date='2018-01-03' time='10:10:00'>
- <divecomputer model='Imported from CSV' deviceid='ffffffff'>
+ <divecomputer model='Imported from CSV'>
<temperature air='28.0 C' water='26.0 C' />
</divecomputer>
</dive>
diff --git a/dives/TestDiveDM4.xml b/dives/TestDiveDM4.xml
index fd34100b2..246a0b209 100644
--- a/dives/TestDiveDM4.xml
+++ b/dives/TestDiveDM4.xml
@@ -1,6 +1,5 @@
<divelog program='subsurface' version='3'>
<settings>
-<divecomputerid model='Vyper Air' deviceid='ffffffff' serial='20400612'/>
</settings>
<divesites>
</divesites>
diff --git a/dives/TestDiveDM5.xml b/dives/TestDiveDM5.xml
index fdbcd6393..1cbd58256 100644
--- a/dives/TestDiveDM5.xml
+++ b/dives/TestDiveDM5.xml
@@ -1,6 +1,5 @@
<divelog program='subsurface' version='3'>
<settings>
-<divecomputerid model='Vyper Air' deviceid='013749e4' serial='20400612'/>
</settings>
<divesites>
</divesites>
diff --git a/dives/TestDiveSeabearHUDC.xml b/dives/TestDiveSeabearHUDC.xml
index c0ccce23e..4b94cacef 100644
--- a/dives/TestDiveSeabearHUDC.xml
+++ b/dives/TestDiveSeabearHUDC.xml
@@ -5,7 +5,7 @@
</divesites>
<dives>
<dive otu='4' cns='1%' date='2009-10-10' time='05:32:41' duration='7:32 min'>
- <divecomputer model='DC text' deviceid='ffffffff'>
+ <divecomputer model='DC text'>
<depth max='40.0 m' mean='22.32 m' />
<temperature water='1.0 C' />
<sample time='0:01 min' depth='1.0 m' temp='1.0 C' ndl='0:01 min' />
diff --git a/dives/TestDiveSeabearNewFormat.xml b/dives/TestDiveSeabearNewFormat.xml
index 36643540a..3a9a58a61 100644
--- a/dives/TestDiveSeabearNewFormat.xml
+++ b/dives/TestDiveSeabearNewFormat.xml
@@ -5,7 +5,7 @@
</divesites>
<dives>
<dive number='2' date='2012-10-01' time='06:22:00' duration='16:25 min'>
- <divecomputer model='Seabear H3' deviceid='ffffffff' dctype='CCR'>
+ <divecomputer model='Seabear H3' dctype='CCR'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -212,7 +212,7 @@
</divecomputer>
</dive>
<dive number='3' otu='14' cns='8%' date='2012-10-01' time='06:49:00' duration='16:25 min'>
- <divecomputer model='Seabear H3' deviceid='ffffffff'>
+ <divecomputer model='Seabear H3'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -419,7 +419,7 @@
</divecomputer>
</dive>
<dive number='4' otu='14' cns='16%' date='2012-10-01' time='07:07:00' duration='16:17 min'>
- <divecomputer model='Seabear H3' deviceid='ffffffff' dctype='Freedive'>
+ <divecomputer model='Seabear H3' dctype='Freedive'>
<depth max='70.1 m' mean='33.197 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -1352,7 +1352,7 @@
</divecomputer>
</dive>
<dive number='5' otu='14' cns='24%' date='2012-10-01' time='07:24:00' duration='16:25 min'>
- <divecomputer model='Seabear H3' deviceid='ffffffff'>
+ <divecomputer model='Seabear H3'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -1560,7 +1560,7 @@
<dive number='1' otu='16' cns='5%' date='2012-10-01' time='06:02:00' duration='16:25 min'>
<cylinder description='oxygen' o2='100.0%' use='oxygen' />
<cylinder description='diluent' use='diluent' />
- <divecomputer model='Seabear T1' deviceid='ffffffff' dctype='CCR' no_o2sensors='3'>
+ <divecomputer model='Seabear T1' dctype='CCR' no_o2sensors='3'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -1767,7 +1767,7 @@
</divecomputer>
</dive>
<dive number='2' cns='5%' date='2012-10-01' time='06:22:00' duration='16:25 min'>
- <divecomputer model='Seabear T1' deviceid='ffffffff' dctype='CCR'>
+ <divecomputer model='Seabear T1' dctype='CCR'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -1974,7 +1974,7 @@
</divecomputer>
</dive>
<dive number='3' otu='14' cns='12%' date='2012-10-01' time='06:49:00' duration='16:25 min'>
- <divecomputer model='Seabear T1' deviceid='ffffffff'>
+ <divecomputer model='Seabear T1'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -2181,7 +2181,7 @@
</divecomputer>
</dive>
<dive number='4' otu='14' cns='20%' date='2012-10-01' time='07:07:00' duration='16:17 min'>
- <divecomputer model='Seabear T1' deviceid='ffffffff' dctype='Freedive'>
+ <divecomputer model='Seabear T1' dctype='Freedive'>
<depth max='70.1 m' mean='33.197 m' />
<temperature water='24.0 C' />
<extradata key='Firmware version' value='1.31' />
@@ -3114,7 +3114,7 @@
</divecomputer>
</dive>
<dive number='5' otu='14' cns='28%' date='2012-10-01' time='07:24:00' duration='16:25 min'>
- <divecomputer model='Seabear T1' deviceid='ffffffff'>
+ <divecomputer model='Seabear T1'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
<extradata key='Firmware version' value='1.31' />
diff --git a/dives/mergedVyperOstc.xml b/dives/mergedVyperOstc.xml
index 98f059c3a..99a6d7807 100644
--- a/dives/mergedVyperOstc.xml
+++ b/dives/mergedVyperOstc.xml
@@ -1,7 +1,5 @@
<divelog program='subsurface' version='3'>
<settings>
-<divecomputerid model='Suunto Vyper Air' deviceid='11223344' serial='99999999'/>
-<divecomputerid model='Heinrichs Weikamp OSTC Sport' deviceid='abcdef00' serial='10000' firmware='10.31'/>
</settings>
<divesites>
</divesites>
@@ -12,7 +10,7 @@
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='31.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
- <divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='abcdef00' diveid='b4ffa0ce'>
+ <divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='8e8f3f68' diveid='b4ffa0ce'>
<depth max='26.32 m' mean='16.594 m' />
<temperature water='26.0 C' />
<surface pressure='1.008 bar' />
@@ -109,7 +107,7 @@
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='31.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
- <divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='ae480b5b' diveid='7ab00781'>
+ <divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='8e8f3f68' diveid='7ab00781'>
<depth max='27.44 m' mean='14.427 m' />
<temperature water='26.2 C' />
<surface pressure='1.009 bar' />
@@ -196,7 +194,7 @@
</dive>
<dive number='1' sac='9.026 l/min' otu='54' cns='17%' date='2017-02-03' time='06:59:41' duration='71:40 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
- <divecomputer model='Suunto Vyper Air' deviceid='11223344' diveid='c51cb31b'>
+ <divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='c51cb31b'>
<depth max='26.72 m' mean='16.837 m' />
<temperature air='28.0 C' water='27.0 C' />
<extradata key='Serial' value='99312861' />
@@ -422,7 +420,7 @@
</dive>
<dive number='2' sac='9.173 l/min' otu='41' cns='17%' date='2017-02-03' time='10:25:16' duration='65:40 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
- <divecomputer model='Suunto Vyper Air' deviceid='20993833' diveid='5372ae57'>
+ <divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='5372ae57'>
<depth max='27.8 m' mean='14.594 m' />
<temperature air='29.0 C' water='27.0 C' />
<extradata key='Serial' value='99312861' />
diff --git a/dives/test40-42.xml b/dives/test40-42.xml
index 727aa5475..29f31f8c3 100644
--- a/dives/test40-42.xml
+++ b/dives/test40-42.xml
@@ -9,7 +9,7 @@
<dive number='1' otu='9' cns='5%' date='2013-10-01' time='10:34:00' duration='45:00 min'>
<buddy>Dirk</buddy>
<suit>wet, 5mm</suit>
- <divecomputer model='csv' last-manual-time='45:00 min' deviceid='ffffffff'>
+ <divecomputer model='csv' last-manual-time='45:00 min'>
<depth max='18.0 m' mean='16.0 m' />
<sample time='0:00 min' depth='0.0 m' />
<sample time='2:00 min' depth='18.0 m' />
@@ -22,7 +22,7 @@
<dive number='2' otu='5' cns='7%' date='2013-10-01' time='12:13:00' duration='41:00 min'>
<buddy>Linus</buddy>
<suit>wet, shorty, 3mm</suit>
- <divecomputer model='csv' last-manual-time='41:00 min' deviceid='ffffffff'>
+ <divecomputer model='csv' last-manual-time='41:00 min'>
<depth max='16.2 m' mean='13.5 m' />
<sample time='0:00 min' depth='0.0 m' />
<sample time='1:48 min' depth='16.2 m' />
@@ -35,7 +35,7 @@
<dive number='3' date='2014-10-01' time='10:02:00' duration='48:00 min'>
<buddy>Tomaz</buddy>
<suit>none</suit>
- <divecomputer model='csv' last-manual-time='48:00 min' deviceid='ffffffff'>
+ <divecomputer model='csv' last-manual-time='48:00 min'>
<depth max='13.3 m' mean='11.5 m' />
<sample time='0:00 min' depth='0.0 m' />
<sample time='1:29 min' depth='13.3 m' />
@@ -48,7 +48,7 @@
<dive number='4' otu='13' cns='5%' date='2014-10-01' time='14:19:00' duration='34:00 min'>
<buddy>Don</buddy>
<suit>dry, Whites Fusion</suit>
- <divecomputer model='csv' last-manual-time='34:00 min' deviceid='ffffffff'>
+ <divecomputer model='csv' last-manual-time='34:00 min'>
<depth max='24.9 m' mean='20.1 m' />
<sample time='0:00 min' depth='0.0 m' />
<sample time='2:46 min' depth='24.9 m' />
@@ -775,7 +775,7 @@
<notes>CCR dive</notes>
<cylinder size='2.0 l' workpressure='232.0 bar' description='Oxy2' o2='100.0%' start='190.0 bar' end='130.0 bar' use='oxygen' />
<cylinder size='2.0 l' workpressure='232.0 bar' description='Dil2' start='185.0 bar' end='130.0 bar' use='diluent' />
- <divecomputer model='Heinrichs Weikamp OSTC 3' deviceid='01234567' diveid='76543210' dctype='CCR'>
+ <divecomputer model='Heinrichs Weikamp OSTC 3' diveid='76543210' dctype='CCR'>
<depth max='38.99 m' mean='17.72 m' />
<temperature water='4.3 C' />
<surface pressure='1.02 bar' />
@@ -3272,7 +3272,7 @@
<notes>CCR dive</notes>
<cylinder size='2.0 l' workpressure='232.0 bar' description='Oxy2' o2='100.0%' start='190.0 bar' end='130.0 bar' use='oxygen' />
<cylinder size='2.0 l' workpressure='232.0 bar' description='Dil2' start='185.0 bar' end='130.0 bar' use='diluent' />
- <divecomputer model='Heinrichs Weikamp OSTC 3' deviceid='01234567' diveid='76543210' dctype='CCR'>
+ <divecomputer model='Heinrichs Weikamp OSTC 3' diveid='76543210' dctype='CCR'>
<depth max='38.99 m' mean='17.72 m' />
<temperature water='4.3 C' />
<surface pressure='1.02 bar' />