On Wed, Dec 26, 2012 at 7:33 PM, Dominique Rety <span dir="ltr"><<a href="mailto:dominiquerety@hotmail.fr" target="_blank">dominiquerety@hotmail.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>



<div dir="auto" bgcolor="#ffffff">
<div>
<div><font face="Arial">Hi Kate,</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">Thank you for your answer.</font></div>
<div><font face="Arial"></font> </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><font face="Arial"></font> </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><font face="Arial"></font> </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 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="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" bgcolor="#ffffff"><div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">Regards,</font></div>
<div><font face="Arial">Dominique</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </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="im">
  <div style="FONT:10pt arial">----- Original Message ----- </div>
  <div style="BACKGROUND:#e4e4e4;FONT:10pt arial"><b>From:</b> 
  <a title="kate.alhola@gmail.com" href="mailto:kate.alhola@gmail.com" target="_blank">Kate 
  Alhola</a> </div>
  <div style="FONT:10pt arial"><b>To:</b> <a title="dominiquerety@hotmail.fr" href="mailto:dominiquerety@hotmail.fr" target="_blank">Dominique Rety</a> </div>
  </div><div class="im"><div style="FONT:10pt arial"><b>Cc:</b> <a title="necessitas-devel@kde.org" href="mailto:necessitas-devel@kde.org%3E" target="_blank"><necessitas-devel@kde.org></a> 
  </div>
  <div style="FONT:10pt arial"><b>Sent:</b> Wednesday, December 26, 2012 4:36 
  PM</div>
  <div style="FONT:10pt arial"><b>Subject:</b> Re: Crash when using 
  Bluetooth</div>
  <div><br></div>
  </div><div><div class="h5"><div>On 13.12.2012, at 16.41, Dominique Rety <<a href="mailto:dominiquerety@hotmail.fr" target="_blank">dominiquerety@hotmail.fr</a>> 
  wrote:</div>
  <div><br></div>
  <blockquote type="cite">
    <div>
    
    

    <div>
    <div><font face="Arial">Hi,</font></div>
    <div><font face="Arial"></font> </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><font face="Arial"></font> </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><font face="Arial"><font><font face="Arial"></font></font></font> </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><font face="Arial"></font> </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><font face="Arial"></font> </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><font face="Arial"></font> </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><font face="Arial"></font> </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><font face="Arial"></font> </div>
    <div><font face="Arial">Regards,</font></div>
    <div><font face="Arial">Dominique RETY</font></div>
    <div><font face="Arial"><a>dominiquerety@hotmail.fr</a></font></div>
    <div><font face="Arial"></font> </div></div></div></blockquote>
  <blockquote type="cite">
    <div><span>_______________________________________________</span><br><span>Necessitas-devel 
    mailing list</span><br><span><a href="mailto:Necessitas-devel@kde.org" target="_blank">Necessitas-devel@kde.org</a></span><br><span><a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a></span><br>
</div></blockquote></div></div></div></blockquote></div>
</blockquote></div><br>