remove mandatory pyrtlsdr dependency

This commit is contained in:
Junzi Sun 2020-08-17 01:19:16 +02:00
parent 0ced97e3eb
commit 7a4c465f7d
3 changed files with 10 additions and 12 deletions

View File

@ -1,8 +1,14 @@
import time
import traceback import traceback
import numpy as np import numpy as np
import pyModeS as pms import pyModeS as pms
from rtlsdr import RtlSdr
import time try:
import rtlsdr
except:
print("------------------------------------------------------------------------")
print("! Warining: pyrtlsdr not installed (required for using RTL-SDR devices) ")
print("------------------------------------------------------------------------")
sampling_rate = 2e6 sampling_rate = 2e6
smaples_per_microsec = 2 smaples_per_microsec = 2
@ -21,7 +27,7 @@ class RtlReader(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(RtlReader, self).__init__() super(RtlReader, self).__init__()
self.signal_buffer = [] # amplitude of the sample only self.signal_buffer = [] # amplitude of the sample only
self.sdr = RtlSdr() self.sdr = rtlsdr.RtlSdr()
self.sdr.sample_rate = sampling_rate self.sdr.sample_rate = sampling_rate
self.sdr.center_freq = modes_frequency self.sdr.center_freq = modes_frequency
self.sdr.gain = "auto" self.sdr.gain = "auto"

View File

@ -7,11 +7,6 @@ import pyModeS as pms
import traceback import traceback
import zmq import zmq
if sys.version_info > (3, 0):
PY_VERSION = 3
else:
PY_VERSION = 2
class TcpClient(object): class TcpClient(object):
def __init__(self, host, port, datatype): def __init__(self, host, port, datatype):
@ -265,9 +260,6 @@ class TcpClient(object):
try: try:
received = [i for i in self.socket.recv(4096)] received = [i for i in self.socket.recv(4096)]
if PY_VERSION == 2:
received = [ord(i) for i in received]
self.buffer.extend(received) self.buffer.extend(received)
# print(''.join(x.encode('hex') for x in self.buffer)) # print(''.join(x.encode('hex') for x in self.buffer))

View File

@ -43,7 +43,7 @@ details = dict(
], ],
keywords="Mode-S ADS-B EHS ELS Comm-B", keywords="Mode-S ADS-B EHS ELS Comm-B",
packages=find_packages(exclude=["contrib", "docs", "tests"]), packages=find_packages(exclude=["contrib", "docs", "tests"]),
install_requires=["numpy", "pyzmq", "pyrtlsdr"], install_requires=["numpy", "pyzmq"],
package_data={"pyModeS": ["*.pyx", "*.pxd"]}, package_data={"pyModeS": ["*.pyx", "*.pxd"]},
scripts=["pyModeS/streamer/modeslive"], scripts=["pyModeS/streamer/modeslive"],
) )