rtl_tcp port for Android

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Мартин Маринов martintzvetomirov at gmail.com
Wed Jan 30 12:37:53 UTC 2013


I am pleased to announce I have released an RTL2832U driver for android for
the benefit of all of the developers working on SDR.

The app could be found here

https://play.google.com/store/apps/details?id=marto.rtl_tcp_andro

And the sources are released under GPL2+ here

https://github.com/martinmarinov/rtl_tcp_andro-

So how do you use it in case you want to develop your own Android
application that uses rtl_tcp_andro?

It's quite simple, you need to add just one line of code to your existing
Android app (assuming the user has the driver installed).

*startActivityForResult(new
Intent(Intent.ACTION_VIEW).setData(Uri.parse("iqsrc://-a 127.0.0.1 -p 123",
START_REQ_CODE);*


Where START_REQ_CODE is a random number you assign. This will start
rtl_tcp_andro on the localhost at port 123. As you see the thing after
iqsrc:// is just the command line arguments you pass to a regular rtl_tcp.

If you want to be more fancy and do error capture, you should override this
method in your Android activity and perform error detection as so:

*@Override*
* protected void onActivityResult(final int requestCode, final int
resultCode, final Intent data) {*
*
*
* runOnUiThread(new Runnable() {*
*
*
* @Override*
* public void run() {*
* if (requestCode == START_REQ_CODE) {*
* if (resultCode == RESULT_OK) { // rtl_tcp_andro has been started
successfully!}*
* else {*
*
*
* try {*
* switch (data.getIntExtra("marto.rtl_tcp_andro.RtlTcpExceptionId", -1)) {*
* case 0:*
* // exception - permission denied*
* break;*
* case 1:*
* // exception - root required*
* break;*
* case 2:*
* // exception - no devices found*
* break;*
* case 4:*
* // exception - the user needs to reconnect the device*
* break;*
* default:*
* // unknown exception*
* break;*
* }*
* } catch (Exception e) {}*
* }*
* }*
* }*
* });*
* }*


It is that simple! rtl_tcp_andro will take care of showing different
dialogs to the user for device selection. It will also take care of
non-rooted devices by communicating with rtl_tcp_androi and sending the
appropriate file descriptors, etc. You don't need to worry about all of the
magic that is happening in the background - you only need to monitor the
result of your intent request.

If you get *RESULT_OK* then you are ready to go. Now what remains is to
implement your own TCP client that connects to the appropriate host/port
number and communicates using the *rtl_tcp* protocol. Make sure you send
the additional "exit" command that rtl_tcp_andro has in order not to leave
zombie services behind.

That's all if you have any questions, feel free to contact me! Sorry for
the bad state of the source code of rtl_tcp_andro, I will add comments as
time passes by.

Hope to see great new projects on the Android platform :)

Thanks,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20130130/3ec0a501/attachment.htm>


More information about the osmocom-sdr mailing list