<div dir="ltr"><div>Thanks, the fix seems to be working properly.</div><div><br></div><div>miika<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 16, 2018 at 4:21 PM, Rainer Mohr <span dir="ltr"><<a href="mailto:mail@divelogs.de" target="_blank">mail@divelogs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Sent via personal mail to Miika<span class=""><br>
    <br>
    Rainer<br>
    <br>
    <div class="m_-6870667130250157373moz-cite-prefix">Am 16.06.18 um 02:15 schrieb Miika
      Turkia:<br>
    </div>
    </span><blockquote type="cite">
      <div dir="ltr">
        <div>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.)</div>
        <div><br>
        </div>
        <div>miika<br>
        </div>
      </div><div><div class="h5">
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Jun 15, 2018 at 12:32 AM, Miika
          Turkia <span dir="ltr"><<a href="mailto:miika.turkia@gmail.com" target="_blank">miika.turkia@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I will try
            to take a look into this within a few days<br>
            <span class="m_-6870667130250157373HOEnZb"><font color="#888888"><br>
                miika<br>
              </font></span>
            <div class="m_-6870667130250157373HOEnZb">
              <div class="m_-6870667130250157373h5"><br>
                > On 8 Jun 2018, at 0.25, Dirk Hohndel <<a href="mailto:dirk@hohndel.org" target="_blank">dirk@hohndel.org</a>>
                wrote:<br>
                > <br>
                > Miika is the wunderkind-slash-madman who maintains
                our importers and deals with the XSLT...<br>
                > <br>
                > /D<br>
                > <br>
                >> On Jun 7, 2018, at 1:58 AM, Rainer Mohr <<a href="mailto:mail@divelogs.de" target="_blank">mail@divelogs.de</a>>
                wrote:<br>
                >> <br>
                >> Gentlemen,<br>
                >> <br>
                >> 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.<br>
                >> Suunto has once again changed their data
                structures in the profile part of DM5. Noticed after
                quite a few broken profiles popped up on <a href="http://divelogs.de" rel="noreferrer" target="_blank">divelogs.de</a><br>
                >> Now the 'SampleBlob' can contain not only
                blocks of 16, 23 and 26 Bytes, but new: 30 Bytes
                (detectable by first Byte being '5')<br>
                >> <br>
                >> 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:<br>
                >> <br>
                >> <?php<br>
                >> // $databaserow contains the data from one
                dive, queried from the database<br>
                >> $data = $databaserow['SampleBlob'];<br>
                >> $samples = Array();<br>
                >> <br>
                >> // Depending on first Byte: Samples are in
                blocks of 23 or 16 or 26 or 30 bytes<br>
                >> if (ord($data[0])==3) { // 23 Bytes per sample<br>
                >>    $data = substr($data,1,strlen($data));<br>
                >>    for($i = 0; $i < strlen($data)/23; ++$i)
                {<br>
                >>        $s = unpack("f",$data[$i*23+2].$dat<wbr>a[$i*23+3].$data[$i*23+4].$dat<wbr>a[$i*23+5]);<br>
                >>        if ($s[1] < 200) $samples[] =
                round($s[1],1);<br>
                >>    }<br>
                >> } elseif (ord($data[0])==4) { // 26 Bytes per
                sample<br>
                >>    $data = substr($data,1,strlen($data));<br>
                >>    for($i = 0; $i < strlen($data)/26; ++$i)
                {<br>
                >>        $s = unpack("f",$data[$i*26+2].$dat<wbr>a[$i*26+3].$data[$i*26+4].$dat<wbr>a[$i*26+5]);<br>
                >>        if ($s[1] < 200) $samples[] =
                round($s[1],1);<br>
                >>    }<br>
                >> } elseif (ord($data[0])==5) { // 30 Bytes per
                sample<br>
                >>    $data = substr($data,1,strlen($data));<br>
                >>    for($i = 0; $i < strlen($data)/30; ++$i)
                {<br>
                >>        $s = unpack("f",$data[$i*30+2].$dat<wbr>a[$i*30+3].$data[$i*30+4].$dat<wbr>a[$i*30+5]);<br>
                >>        if ($s[1] < 200) $samples[] =
                round($s[1],1);<br>
                >>    }<br>
                >> } else { // 16 Bytes per sample<br>
                >>    for($i = 0; $i < strlen($data)/16; ++$i)
                {<br>
                >>        $s = unpack("f",$data[$i*16+3].$dat<wbr>a[$i*16+4].$data[$i*16+5].$dat<wbr>a[$i*16+6]);<br>
                >>        if ($s[1] < 200) $samples[] =
                round($s[1],1);<br>
                >>    }<br>
                >> }<br>
                >> <br>
                >> // in case Dives from imported DM4 are
                available<br>
                >> if (count($samples)==0) {<br>
                >>    $data = $databaserow['ProfileBlob'];<br>
                >>    for($i = 0; $i < strlen($data)/4; ++$i) {<br>
                >>        $s = unpack("f",$data[$i*4].$data[$<wbr>i*4+1].$data[$i*4+2].$data[$i*<wbr>4+3]);<br>
                >>        if ($s[1] < 200) $samples[] =
                round($s[1],1);<br>
                >>    }<br>
                >> }<br>
                >> ?><br>
                >> <br>
                >> Rainer<br>
                >> <br>
                >> <br>
                >> ______________________________<wbr>_________________<br>
                >> subsurface mailing list<br>
                >> <a href="mailto:subsurface@subsurface-divelog.org" target="_blank">subsurface@subsurface-divelog.<wbr>org</a><br>
                >> <a href="http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface" rel="noreferrer" target="_blank">http://lists.subsurface-divelo<wbr>g.org/cgi-bin/mailman/listinfo<wbr>/subsurface</a><br>
                > <br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </div></div></blockquote>
    <br>
  </div>

</blockquote></div><br></div>