Review Request 122020: Make a bluetooth backend for Android

Saikrishna Arcot saiarcot895 at gmail.com
Fri Jan 16 19:44:23 UTC 2015


Yes.

Thank you, Philip. I'll likely use some of the logic here in the Android code.

By any chance, if you have two Android devices, could you test the code and see what happens?


I see some possible collaboration here? :D


On Wed, Jan 14, 2015 at 3:25 PM, Philip Cohn-Cort <cliabhach at gmail.com[1]> wrote:






On Wed, Jan 14, 2015 at 11:06 AM, Saikrishna Arcot <saiarcot895 at gmail.com[2]> wrote:



This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/122020/[3] 


On January 13th, 2015, 8:33 a.m. UTC, *Albert Vaca Cintora* wrote: 

*src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLink.java[4] *(Diff revision 2) 


*157*
            Thread thread = null;


*158*
            if (np.hasPayload()) {


*159*
                thread = sendPayload(np);


*160*
                if (thread == null) return false;

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. 
On January 14th, 2015, 2:21 p.m. UTC, *Saikrishna Arcot* wrote: 
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. 
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?
Yes, I think so.

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.

The code is up on my github at https://github.com/Cliabhach/kdeconnect-android/tree/feature/bluetooth[5] and I'd be glad to try to help out.



~Philip  
On January 14th, 2015, 2:19 p.m. UTC, Saikrishna Arcot wrote: 
Review request for kdeconnect.
By Saikrishna Arcot. 
/Updated Jan. 14, 2015, 2:19 p.m./ 
*Repository: *kdeconnect-android 
*Description *
(Note that this isn't ready for merging yet.)
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.
There are several things that need to be worked out.
     1. When requesting permission to enable Bluetooth (if it's not already enabled), startActivityForResult needs to be called. However, this must be called by a class that implements Activity. One possible solution is to call this on the home screen. Another is to just not request it.
     2. I believe starting a discovery session also requires calling startActivityForResult, which has to be called from a class that implements Activity. The same solutions for the previous item exist here.
     3. Options for enabling the Bluetooth backend need to be added to the settings window.
     4. Some sections of code may warrant a new thread being created, as they may take a while to run. 

*Testing *
Installed on my Android 4.1.2, and it correctly detected that there are 2 bonded devices. No crashes.
Note that since the KDE side doesn't have a bluetooth backend, much of the code wasn't executed. 

*Diffs *
     *  AndroidManifest.xml (6cbe4a7830cfe416fe98e42be143c0f26f2bf1e8) 
     *  src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLink.java (PRE-CREATION) 
     *  src/org/kde/kdeconnect/Backends/BluetoothBackend/BluetoothLinkProvider.java (PRE-CREATION) 
     *  src/org/kde/kdeconnect/BackgroundService.java (576425cf568e4b223d9840842803d7adabf6b990) 
View Diff[6] 

KDEConnect at kde.org[7]
https://mail.kde.org/mailman/listinfo/kdeconnect[8]







-- 
Saikrishna Arcot

--------
[1] mailto:cliabhach at gmail.com
[2] mailto:saiarcot895 at gmail.com
[3] https://git.reviewboard.kde.org/r/122020/
[4] https://git.reviewboard.kde.org/r/122020/diff/2/?file=341485#file341485line157
[5] https://github.com/Cliabhach/kdeconnect-android/tree/feature/bluetooth
[6] https://git.reviewboard.kde.org/r/122020/diff/
[7] mailto:KDEConnect at kde.org
[8] https://mail.kde.org/mailman/listinfo/kdeconnect
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20150116/f136f7ae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20150116/f136f7ae/attachment-0001.sig>


More information about the KDEConnect mailing list