<div dir="ltr">I see some possible collaboration here? :D</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 14, 2015 at 3:25 PM, Philip Cohn-Cort <span dir="ltr"><<a href="mailto:cliabhach@gmail.com" target="_blank">cliabhach@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Jan 14, 2015 at 11:06 AM, Saikrishna Arcot <span dir="ltr"><<a href="mailto:saiarcot895@gmail.com" target="_blank">saiarcot895@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



 <div>
  <div style="font-family:Verdana,Arial,Helvetica,sans-serif"><span>
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border:1px solid rgb(201,195,153);border-radius:6px">
    <tbody><tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/122020/" target="_blank">https://git.reviewboard.kde.org/r/122020/</a>
     </td>
    </tr>
   </tbody></table>
   <br>










</span><blockquote style="margin-left:1em;border-left-width:2px;border-left-style:solid;border-left-color:rgb(208,208,208);padding-left:10px"><span>
 <p style="margin-top:0px">On January 13th, 2015, 8:33 a.m. UTC, <b>Albert Vaca Cintora</b> wrote:</p>
 <blockquote style="margin-left:1em;border-left-width:2px;border-left-style:solid;border-left-color:rgb(208,208,208);padding-left:10px">
  


<table width="100%" border="0" bgcolor="white">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(192,192,192);font-size:9pt;padding:4px 8px;text-align:left">
    <a href="https://git.reviewboard.kde.org/r/122020/diff/2/?file=341485#file341485line157" style="color:black;font-weight:bold;text-decoration:underline" target="_blank">src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLink.java</a>
    <span style="font-weight:normal">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px"></pre></td>
    <th bgcolor="#b1ebb0" style="border-left-width:1px;border-left-style:solid;border-left-color:rgb(192,192,192);border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font>157</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px">            <span>Thread</span> <span>thread</span> <span>=</span> <span>null</span><span>;</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px"></pre></td>
    <th bgcolor="#b1ebb0" style="border-left-width:1px;border-left-style:solid;border-left-color:rgb(192,192,192);border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font>158</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px">            <span>if</span> <span>(</span><span>np</span><span>.</span><span>hasPayload</span><span>())</span> <span>{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px"></pre></td>
    <th bgcolor="#b1ebb0" style="border-left-width:1px;border-left-style:solid;border-left-color:rgb(192,192,192);border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font>159</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px">                <span>thread</span> <span>=</span> <span>sendPayload</span><span>(</span><span>np</span><span>);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px"></pre></td>
    <th bgcolor="#b1ebb0" style="border-left-width:1px;border-left-style:solid;border-left-color:rgb(192,192,192);border-right-width:1px;border-right-style:solid;border-right-color:rgb(192,192,192)" align="right"><font>160</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size:8pt;line-height:140%;margin:0px">                <span>if</span> <span>(</span><span>thread</span> <span>==</span> <span>null</span><span>)</span> <span>return</span> <span>false</span><span>;</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space:pre-wrap;word-wrap:break-word"><p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">If the np doesn't have a payload (which is what happens most of the times, payloads are only used when sending binary data like entire files) you are actually not sending anything! Don't worry about payloads yet, and start by implementing sending and receiving simple packages.</p></pre>
 </blockquote>



 </span><span><p>On January 14th, 2015, 2:21 p.m. UTC, <b>Saikrishna Arcot</b> wrote:</p>
 <blockquote style="margin-left:1em;border-left-width:2px;border-left-style:solid;border-left-color:rgb(208,208,208);padding-left:10px">
  <pre style="white-space:pre-wrap;word-wrap:break-word"><p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">Ok. I didn't really understand the distinction between the payload and the (unserialized) message. I've changed the code to send a message and to print an error message if there is a payload.</p></pre>
 </blockquote>







</span></blockquote>
<pre style="margin-left:1em;white-space:pre-wrap;word-wrap:break-word"><p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">According to the KDE code, the network package messages are separated by a newline. Can the newline character be used to indicate the end of a message?</p></pre></div></div></blockquote></span>Yes, I think so.<br><br>If it helps, I started work on a bluetooth backend for android a few months ago. It works for simple pairing, ping, and some sharing on Android 2.3 and up but I couldn't make it reliable - frequently, the acceptor doesn't read anything out of its BluetoothSocket despite the transmission going through properly.<br><br>The code is up on my github at <a href="https://github.com/Cliabhach/kdeconnect-android/tree/feature/bluetooth" target="_blank">https://github.com/Cliabhach/kdeconnect-android/tree/feature/bluetooth</a> and I'd be glad to try to help out.<br><br><div>~Philip  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><div><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><span>
<p>On January 14th, 2015, 2:19 p.m. UTC, Saikrishna Arcot wrote:</p>









</span><table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border:1px solid rgb(136,138,133);border-radius:6px">
 <tbody><tr>
  <td><span>

<div>Review request for kdeconnect.</div>
<div>By Saikrishna Arcot.</div>


</span><p style="color:grey"><i>Updated Jan. 14, 2015, 2:19 p.m.</i></p>









<div style="margin-top:1.5em">
 <b style="color:rgb(87,80,18);font-size:10pt">Repository: </b>
kdeconnect-android
</div><span>


<h1 style="color:rgb(87,80,18);font-size:10pt;margin-top:1.5em">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border:1px solid rgb(184,181,160)">
 <tbody><tr>
  <td>
   <pre style="margin:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word"><p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">(Note that this isn't ready for merging yet.)</p>
<p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">This is an initial implementation of a bluetooth backend. This backend implementation can be run only on Android 4.0.2 or higher. The implementation as-is only looks at already-bonded devices; it does not start a discovery session to see other bluetooth devices nearby.</p>
<p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">There are several things that need to be worked out.</p>
<ol style="padding:0px;margin:0px 0px 0px 2em;line-height:inherit;white-space:normal">
<li style="padding:0px;margin:0px;line-height:inherit;white-space:normal">When requesting permission to enable Bluetooth (if it's not already enabled), <code style="color:rgb(68,68,204);padding:0px;white-space:normal;margin:0px;line-height:inherit">startActivityForResult</code> needs to be called. However, this must be called by a class that implements <code style="color:rgb(68,68,204);padding:0px;white-space:normal;margin:0px;line-height:inherit">Activity</code>. One possible solution is to call this on the home screen. Another is to just not request it.</li>
<li style="padding:0px;margin:0px;line-height:inherit;white-space:normal">I believe starting a discovery session also requires calling <code style="color:rgb(68,68,204);padding:0px;white-space:normal;margin:0px;line-height:inherit">startActivityForResult</code>, which has to be called from a class that implements <code style="color:rgb(68,68,204);padding:0px;white-space:normal;margin:0px;line-height:inherit">Activity</code>. The same solutions for the previous item exist here.</li>
<li style="padding:0px;margin:0px;line-height:inherit;white-space:normal">Options for enabling the Bluetooth backend need to be added to the settings window.</li>
<li style="padding:0px;margin:0px;line-height:inherit;white-space:normal">Some sections of code may warrant a new thread being created, as they may take a while to run.</li>
</ol></pre>
  </td>
 </tr>
</tbody></table>


<h1 style="color:rgb(87,80,18);font-size:10pt;margin-top:1.5em">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border:1px solid rgb(184,181,160)">
 <tbody><tr>
  <td>
   <pre style="margin:0px;padding:0px;white-space:pre-wrap;word-wrap:break-word"><p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">Installed on my Android 4.1.2, and it correctly detected that there are 2 bonded devices. No crashes.</p>
<p style="padding:0px;margin:0px;line-height:inherit;white-space:inherit">Note that since the KDE side doesn't have a bluetooth backend, much of the code wasn't executed.</p></pre>
  </td>
 </tr>
</tbody></table>


<h1 style="color:rgb(87,80,18);font-size:10pt;margin-top:1.5em">Diffs </h1>
<ul style="margin-left:3em;padding-left:0px">

 <li>AndroidManifest.xml <span style="color:grey">(6cbe4a7830cfe416fe98e42be143c0f26f2bf1e8)</span></li>

 <li>src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLink.java <span style="color:grey">(PRE-CREATION)</span></li>

 <li>src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLinkProvider.java <span style="color:grey">(PRE-CREATION)</span></li>

 <li>src/org/kde/kdeconnect/BackgroundService.java <span style="color:grey">(576425cf568e4b223d9840842803d7adabf6b990)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/122020/diff/" style="margin-left:3em" target="_blank">View Diff</a></p>






  </span></td>
 </tr>
</tbody></table>








  </div>
 </div>


<br></span>_______________________________________________<br>
KDEConnect mailing list<br>
<a href="mailto:KDEConnect@kde.org" target="_blank">KDEConnect@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kdeconnect" target="_blank">https://mail.kde.org/mailman/listinfo/kdeconnect</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div>