<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Sent via personal mail to Miika<br>
    <br>
    Rainer<br>
    <br>
    <div class="moz-cite-prefix">Am 16.06.18 um 02:15 schrieb Miika
      Turkia:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEB307PmuHhrd35uPyzde9ZTZzfS_X7vyNtiWo8b1oPD1VX3-A@mail.gmail.com">
      <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 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"
              moz-do-not-send="true">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="HOEnZb"><font color="#888888"><br>
                miika<br>
              </font></span>
            <div class="HOEnZb">
              <div class="h5"><br>
                > On 8 Jun 2018, at 0.25, Dirk Hohndel <<a
                  href="mailto:dirk@hohndel.org" moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">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].$<wbr>data[$i*23+3].$data[$i*23+4].$<wbr>data[$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].$<wbr>data[$i*26+3].$data[$i*26+4].$<wbr>data[$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].$<wbr>data[$i*30+3].$data[$i*30+4].$<wbr>data[$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].$<wbr>data[$i*16+4].$data[$i*16+5].$<wbr>data[$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"
                  moz-do-not-send="true">subsurface@subsurface-divelog.<wbr>org</a><br>
                >> <a
href="http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.subsurface-<wbr>divelog.org/cgi-bin/mailman/<wbr>listinfo/subsurface</a><br>
                > <br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>