<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Welcome back Lauri !</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>BogDan.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span> </span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div
 style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Lauri Laanmets <lauri.laanmets@proekspert.ee><br> <b><span style="font-weight: bold;">To:</span></b> Kate Alhola <kate.alhola@gmail.com> <br><b><span style="font-weight: bold;">Cc:</span></b> necessitas-devel@kde.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, January 3, 2013 5:00 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: Crash when using Bluetooth<br> </font> </div> <br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv1040429815">
  

    
  
  <div>
    <div class="yiv1040429815moz-cite-prefix">Hello, all<br>
      <br>
      I'm sorry that I have been so inactive. Kate, you have done a
      great job, I took a little time to briefly go through the changes
      and gave my humble comments. Hopefully I get my own set-up also up
      and running at some point.<br>
      <br>
      Regards<br>
      Lauri<br>
      <br>
      <br>
      On 3.01.2013 15:59, Kate Alhola wrote:<br>
    </div>
    <blockquote type="cite">On Wed, Dec 26, 2012 at 7:33 PM, Dominique Rety <span dir="ltr"><<a rel="nofollow" ymailto="mailto:dominiquerety@hotmail.fr" target="_blank" href="mailto:dominiquerety@hotmail.fr">dominiquerety@hotmail.fr</a>></span>
      wrote:<br>
      <div class="yiv1040429815gmail_quote">
        <blockquote class="yiv1040429815gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <div>
            <div>
              <div><font face="Arial">Hi Kate,</font></div>
              <div> </div>
              <div><font face="Arial">Thank you for your answer.</font></div>
              <div> </div>
              <div><font face="Arial">I tried some traces and
                  modifications into the lib QtConnectivity without
                  success. It seems to me that functions into the
                  library already contain calls to JNIThreadHelper class
                  that should setup the Java environment by performing
                  jvm->AttachCurrentThread(), but this doesn't solve
                  the problem.</font></div>
              <div> </div>
              <div><font face="Arial">At the same time, I performed some
                  basic bluetooth tests directly through Java Eclipse
                  (BluetoothAdapter.getDefaultAdapter.getName), which
                  work fine on Nexus 7 with Android 4.2.</font></div>
              <div><font face="Arial">However, our project contains some
                  legacy parts that have already been developed in C,
                  and using Qt would be the very best way to integrate
                  them. Therefore I will only envision to implement a
                  direct bridge between Java and C parts as a last
                  resort if I can't find a viable solution with Qt.</font></div>
              <div> </div>
              <div><font face="Arial">Consequently, I am very interested
                  by your patches even before the next release, which
                  could be helpful for us to take a decision for our
                  development. Overriding and deploying the default
                  Necessitas lib QtConnectivity is not a problem for me,
                  at least for test purpose.</font></div>
            </div>
          </div>
        </blockquote>
        <div><br>
          Now patches are on Review board <a rel="nofollow" target="_blank" href="https://git.reviewboard.kde.org/r/108113/">https://git.reviewboard.kde.org/r/108113/</a>
          . I would be happy if you could try them.<br>
          <br>
          Sorry about delays publishing them <br>
          <br>
          <br>
          Kate<br>
           </div>
        <blockquote class="yiv1040429815gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <div>
            <div>
              <div> </div>
              <div><font face="Arial">Regards,</font></div>
              <div><font face="Arial">Dominique</font></div>
              <div> </div>
              <div> </div>
              <div> </div>
            </div>
            <blockquote dir="ltr" style="PADDING-RIGHT:0px;PADDING-LEFT:5px;MARGIN-LEFT:5px;BORDER-LEFT:#000000 2px solid;MARGIN-RIGHT:0px;">
              <div class="yiv1040429815im">
                <div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; ">----- Original Message
                  ----- </div>
                <div style="background-color: rgb(228, 228, 228); font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; background-position: initial initial; background-repeat: initial initial; "><b>From:</b>
                  <a rel="nofollow" title="kate.alhola@gmail.com" ymailto="mailto:kate.alhola@gmail.com" target="_blank" href="mailto:kate.alhola@gmail.com">Kate
                    Alhola</a> </div>
                <div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; "><b>To:</b> <a rel="nofollow" title="dominiquerety@hotmail.fr" ymailto="mailto:dominiquerety@hotmail.fr" target="_blank" href="mailto:dominiquerety@hotmail.fr">Dominique Rety</a> </div>
              </div>
              <div class="yiv1040429815im">
                <div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; "><b>Cc:</b> <a rel="nofollow" title="necessitas-devel@kde.org" ymailto="mailto:necessitas-devel@kde.org%3E" target="_blank" href="mailto:necessitas-devel@kde.org%3E"><necessitas-devel@kde.org></a>
                </div>
                <div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; "><b>Sent:</b> Wednesday,
                  December 26, 2012 4:36 PM</div>
                <div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: arial; "><b>Subject:</b> Re: Crash
                  when using Bluetooth</div>
                <div><br>
                </div>
              </div>
              <div>
                <div class="yiv1040429815h5">
                  <div>On 13.12.2012, at 16.41, Dominique Rety <<a rel="nofollow" ymailto="mailto:dominiquerety@hotmail.fr" target="_blank" href="mailto:dominiquerety@hotmail.fr">dominiquerety@hotmail.fr</a>>
                    wrote:</div>
                  <div><br>
                  </div>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Hi,</font></div>
                        <div> </div>
                        <div><font face="Arial">I am currently
                            developing a telecommunication project
                            involving Blutooth communication between
                            Android devices. For this purpose, I'm
                            trying to use Necessitas Bluetooth support
                            and I experiment very similar problems that
                            are described in the "Crash when using
                            Bluetooth" (Kate Alhola) archive thread.</font></div>
                        <div> </div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>There is several issues in current necessitas
                    libQtConnectivity version. I have hopefully fixed
                    most of them and i have version of libQtConnectivity
                    that least works with my own applocation. I try to
                    deliver patches to necessitas project so that fixes
                    could be included in next release. </div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Environment:</font></div>
                        <div><font face="Arial">Java JDK 1.7.0_09<br>
                            Qt Creator 2.5.83 Based on Qt 4.8.3 running
                            on Linux Suze<br>
                            Kit = Necessitas Qt 4.8.2 for Android armv7a<br>
                            Compiler = Android GCC (arm-4.4.3)<br>
                            Android target SDK = android-16<br>
                            Deploy to Nexus 7 with Android version 4.2.</font></div>
                        <div> </div>
                        <div><font face="Arial">I firstly tried to
                            deploy the btchat sample and I faced the
                            same problem:</font></div>
                        <div><font face="Arial">JNI ERROR (app bug):
                            accessed stale local reference 0xe680001d
                            (index 7 in a table of size 4)<br>
                            VM aborting<br>
                            Fatal signal 11 (SIGSEGV) at 0xdeadd00d
                            (code=1), thread 13965 (.example.btchat)</font></div>
                        <div> </div>
                        <div><font face="Arial">Setting traces in
                            different source files of the connectivity
                            library, I also noticed that the error
                            happens when trying to use some member
                            functions of QBluetoothLocalDevice (btchat
                            sample requests for the local device name
                            from the main function).</font></div>
                        <div> </div>
                        <div><font face="Arial">I tried to bypass this
                            problem by only creating the
                            QBluetoothLocalDevice without requesting for
                            the device name in the btchat application.
                            The program then starts correctly.</font></div>
                        <div> </div>
                        <div><font face="Arial">In the btchat
                            application, the "Connect" button calls the
                            QBluetoothServiceDiscoveryAgent::start
                            function. This function randomly processes
                            the request because it relies on
                            discoveryState and deviceAddress members,
                            which seem not to be initialized : either
                            the discovery process freezes or the program
                            aborts with an error (if luckily
                            discoveryState and deviceAddress members get
                            consistent values). I didn't try any further
                            investigation. It seems to me that the
                            connectivity library is compiled with
                            qbluetoothlocaldevice_p.cpp, which just
                            contains empty functions for the
                            QBluetoothLocalDevice class, instead of a
                            customized source for Android.</font></div>
                        <div> </div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>Yes, that's case. The QBluetoothLocalDevice
                    initializes static handles to java virtual machine
                    that are then referenced by other modules. I have
                    made fixes to several parts of libQtConnectivity</div>
                  <div><br>
                  </div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Is Bluetooth support for
                            Android in Necessitas complete ?</font></div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>Most of, some functions are still missing but
                    there are some bugs in current version</div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Is the btchat sample
                            expected to work properly with Android ?</font></div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>I have not tried that one</div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Is there any specific
                            configuration issue I could miss ?</font></div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>That's good question, what is origin of the bugs,
                    does it work with older android</div>
                  <div>Versions ? The source reason of bugs is JNI
                    handles alocation that conflict with</div>
                  <div>Current thread structure and some that handles
                    are expired when used. I have only tested with</div>
                  <div>Android 4.x</div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">Is there any corrective
                            or complement software I could download ?</font></div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>I could make my patches avaiable before next
                    release  but overriding default necessitas
                    libQtConnectivity requires some tricks</div>
                  <br>
                  <blockquote type="cite">
                    <div>
                      <div>
                        <div><font face="Arial">How can I progress on
                            this issue ? What is the best way to get
                            help and advices ?</font></div>
                      </div>
                    </div>
                  </blockquote>
                  <div><br>
                  </div>
                  This list works fine.
                  <div><br>
                  </div>
                  <div>Kate</div>
                  <div><br>
                    <blockquote type="cite">
                      <div>
                        <div>
                          <div> </div>
                          <div><font face="Arial">Regards,</font></div>
                          <div><font face="Arial">Dominique RETY</font></div>
                          <div><font face="Arial"><a rel="nofollow" href="">dominiquerety@hotmail.fr</a></font></div>
                          <div> </div>
                        </div>
                      </div>
                    </blockquote>
                    <blockquote type="cite">
                      <div><span>_______________________________________________</span><br>
                        <span>Necessitas-devel mailing list</span><br>
                        <span><a rel="nofollow" ymailto="mailto:Necessitas-devel@kde.org" target="_blank" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a></span><br>
                        <span><a rel="nofollow" target="_blank" href="https://mail.kde.org/mailman/listinfo/necessitas-devel">https://mail.kde.org/mailman/listinfo/necessitas-devel</a></span><br>
                      </div>
                    </blockquote>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="yiv1040429815mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
Necessitas-devel mailing list
<a rel="nofollow" class="yiv1040429815moz-txt-link-abbreviated" ymailto="mailto:Necessitas-devel@kde.org" target="_blank" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a>
<a rel="nofollow" class="yiv1040429815moz-txt-link-freetext" target="_blank" href="https://mail.kde.org/mailman/listinfo/necessitas-devel">https://mail.kde.org/mailman/listinfo/necessitas-devel</a>
</pre>
    </blockquote>
    <br>
  </div>

</div><meta http-equiv="x-dns-prefetch-control" content="on"><br>_______________________________________________<br>Necessitas-devel mailing list<br><a ymailto="mailto:Necessitas-devel@kde.org" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br><br><br> </div> </div> </blockquote></div>   </div></body></html>