Sent via personal mail to Miika
Rainer
Am 16.06.18 um 02:15 schrieb Miika Turkia:
I just sent a pull req that should take care of this. However, I do
not possess test data with the new format. Could you Rainer send me a
sample file? (The addition for support for the new format is quite
trivial, but still I would like to test it out.)
miika
On Fri, Jun 15, 2018 at 12:32 AM, Miika Turkia <[email protected]
<mailto:[email protected]>> wrote:
I will try to take a look into this within a few days
miika
> On 8 Jun 2018, at 0.25, Dirk Hohndel <[email protected]
<mailto:[email protected]>> wrote:
>
> Miika is the wunderkind-slash-madman who maintains our importers
and deals with the XSLT...
>
> /D
>
>> On Jun 7, 2018, at 1:58 AM, Rainer Mohr <[email protected]
<mailto:[email protected]>> wrote:
>>
>> Gentlemen,
>>
>> Just noticed, that the Suunto DM5 Import is very broken as it
can't parse the profile data from recent and semi-recent DM5 files
properly.
>> Suunto has once again changed their data structures in the
profile part of DM5. Noticed after quite a few broken profiles
popped up on divelogs.de <http://divelogs.de>
>> Now the 'SampleBlob' can contain not only blocks of 16, 23 and
26 Bytes, but new: 30 Bytes (detectable by first Byte being '5')
>>
>> Here is my PHP code for handling the profile parts from the
SQLite Data, hope someone can translate this into what you need,
as I would be useless at doing so:
>>
>> <?php
>> // $databaserow contains the data from one dive, queried from
the database
>> $data = $databaserow['SampleBlob'];
>> $samples = Array();
>>
>> // Depending on first Byte: Samples are in blocks of 23 or 16
or 26 or 30 bytes
>> if (ord($data[0])==3) { // 23 Bytes per sample
>> $data = substr($data,1,strlen($data));
>> for($i = 0; $i < strlen($data)/23; ++$i) {
>> $s =
unpack("f",$data[$i*23+2].$data[$i*23+3].$data[$i*23+4].$data[$i*23+5]);
>> if ($s[1] < 200) $samples[] = round($s[1],1);
>> }
>> } elseif (ord($data[0])==4) { // 26 Bytes per sample
>> $data = substr($data,1,strlen($data));
>> for($i = 0; $i < strlen($data)/26; ++$i) {
>> $s =
unpack("f",$data[$i*26+2].$data[$i*26+3].$data[$i*26+4].$data[$i*26+5]);
>> if ($s[1] < 200) $samples[] = round($s[1],1);
>> }
>> } elseif (ord($data[0])==5) { // 30 Bytes per sample
>> $data = substr($data,1,strlen($data));
>> for($i = 0; $i < strlen($data)/30; ++$i) {
>> $s =
unpack("f",$data[$i*30+2].$data[$i*30+3].$data[$i*30+4].$data[$i*30+5]);
>> if ($s[1] < 200) $samples[] = round($s[1],1);
>> }
>> } else { // 16 Bytes per sample
>> for($i = 0; $i < strlen($data)/16; ++$i) {
>> $s =
unpack("f",$data[$i*16+3].$data[$i*16+4].$data[$i*16+5].$data[$i*16+6]);
>> if ($s[1] < 200) $samples[] = round($s[1],1);
>> }
>> }
>>
>> // in case Dives from imported DM4 are available
>> if (count($samples)==0) {
>> $data = $databaserow['ProfileBlob'];
>> for($i = 0; $i < strlen($data)/4; ++$i) {
>> $s =
unpack("f",$data[$i*4].$data[$i*4+1].$data[$i*4+2].$data[$i*4+3]);
>> if ($s[1] < 200) $samples[] = round($s[1],1);
>> }
>> }
>> ?>
>>
>> Rainer
>>
>>
>> _______________________________________________
>> subsurface mailing list
>> [email protected]
<mailto:[email protected]>
>>
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
>
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface