Skip to content

Instantly share code, notes, and snippets.

@nocarryr
Created July 26, 2016 22:50
Show Gist options
  • Save nocarryr/73d57c41eb25703b0f9b809d2bd7bd05 to your computer and use it in GitHub Desktop.
Save nocarryr/73d57c41eb25703b0f9b809d2bd7bd05 to your computer and use it in GitHub Desktop.
Simple test of RtlSdrTcpClient on Android
import os
os.environ['RTLSDR_CLIENT_MODE'] = 'true'
from rtlsdr import RtlSdrTcpClient
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty, BooleanProperty, ObjectProperty
kv = '''
BoxLayout:
TextInput:
text: app.log_text
size_hint_y: .9
BoxLayout:
orientation: 'horizontal'
size_hint_y: .1
Button:
text: 'Start'
on_release: app.build_client()
Button:
text: 'Exit'
on_release: app.stop()
'''
class MyApp(App):
sdr_client = ObjectProperty(None)
log_text = StringProperty('')
def build(self):
return Builder.load_string(kv)
def add_log_text(self, s):
self.log_text = '\n'.join([self.log_text, s])
def build_client(self, *args):
if self.sdr_client is not None:
return
self.add_log_text('connecting to 192.168.1.119')
c = self.sdr_client = RtlSdrTcpClient(hostname='192.168.1.119')
c.center_freq = 2e6
self.add_log_text('center_freq={}'.format(c.center_freq))
samples = c.read_samples()
self.add_log_text('read {} samples'.format(len(samples)))
MyApp().run()
from pythonforandroid.recipe import PythonRecipe
class PyRtlSdrRecipe(PythonRecipe):
version = '0.2.3'
url = 'https://github.com/nocarryr/pyrtlsdr/archive/tcpclient.zip'
depends = ['python2', 'numpy', 'setuptools']
site_packages_name = 'rtlsdr'
call_hostpython_via_targetpython = False
recipe = PyRtlSdrRecipe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment