2016-07-15 22:22:15 +02:00
|
|
|
#! /usr/bin/python
|
|
|
|
#
|
|
|
|
# gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
|
|
|
#
|
2017-07-20 19:05:08 +02:00
|
|
|
# Copyright (C) 2016,2017
|
|
|
|
# Libre Space Foundation <http://librespacefoundation.org/>
|
2016-07-15 22:22:15 +02:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2016-07-24 20:51:36 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-07-15 22:22:15 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
#===============================================================================
|
|
|
|
# Bellow we provide some good and working settings for a large variety of
|
|
|
|
# different SDR hardware. Feel free, to provide additional hardware
|
|
|
|
# configurations
|
|
|
|
#===============================================================================
|
2016-07-24 20:51:36 +02:00
|
|
|
hw_tx_settings = {'usrpb200' : {'rf_gain' : 60.0, 'if_gain' : 0.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 2e6,
|
2016-07-27 20:47:29 +02:00
|
|
|
'antenna' : 'TX/RX', 'dev_arg': 'uhd'},
|
2016-07-24 20:51:36 +02:00
|
|
|
'usrp2' : {'rf_gain' : 20.0, 'samp_rate' : 2e6,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 2e6,
|
2016-07-27 20:47:29 +02:00
|
|
|
'antenna' : 'TX/RX', 'dev_arg': 'uhd'},
|
2016-11-13 17:05:36 +01:00
|
|
|
'hackrf' : {'rf_gain' : 0.0, 'if_gain' : 16.0,
|
|
|
|
'bb_gain' : 20.0, 'samp_rate' : 2e6,
|
2016-07-27 20:47:29 +02:00
|
|
|
'antenna' : '', 'dev_arg': 'hackrf'} }
|
2016-07-15 22:22:15 +02:00
|
|
|
|
2017-03-19 18:34:21 +01:00
|
|
|
hw_rx_settings = {'usrpb200' : {'rf_gain' : 50.0, 'if_gain' : 0.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 5e5,
|
2017-11-01 18:16:25 +01:00
|
|
|
'antenna' : 'TX/RX', 'dev_arg': 'uhd'},
|
2019-03-18 16:12:17 +01:00
|
|
|
'usrp1' : {'rf_gain' : 500.0, 'if_gain' : 30.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 5e5,
|
|
|
|
'antenna' : 'RX', 'dev_arg': 'uhd'},
|
2017-03-19 18:34:21 +01:00
|
|
|
'usrp2' : {'rf_gain' : 50.0, 'if_gain' : 0.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 5e5,
|
2017-11-01 18:16:25 +01:00
|
|
|
'antenna' : 'TX/RX', 'dev_arg': 'uhd'},
|
2018-11-23 23:48:07 +01:00
|
|
|
'usrpx3x0' : {'rf_gain' : 26.0, 'if_gain' : 0.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 2e6,
|
|
|
|
'antenna' : 'TX/RX', 'dev_arg': 'uhd'},
|
2019-07-18 22:49:42 +02:00
|
|
|
'airspy' : {'rf_gain' : 19.0, 'if_gain' : 0.0,
|
2017-03-19 18:34:21 +01:00
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 10e6,
|
2016-07-27 20:47:29 +02:00
|
|
|
'antenna' : '', 'dev_arg': 'airspy'},
|
2017-11-16 10:04:10 +01:00
|
|
|
'airspymini' : {'rf_gain' : 15.0, 'if_gain' : 0.0,
|
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 3e6,
|
|
|
|
'antenna' : '', 'dev_arg': 'airspy'},
|
2017-03-19 18:34:21 +01:00
|
|
|
'hackrf' : {'rf_gain' : 14.0, 'if_gain' : 16.0,
|
|
|
|
'bb_gain' : 20.0, 'samp_rate' : 8e6,
|
2016-10-11 18:39:37 +02:00
|
|
|
'antenna' : '', 'dev_arg': 'hackrf'},
|
2017-04-30 19:14:57 +02:00
|
|
|
'rtlsdr' : {'rf_gain' : 32.8, 'if_gain' : 0.0,
|
2017-05-02 02:03:29 +02:00
|
|
|
'bb_gain' : 0.0, 'samp_rate' : 1e6,
|
2017-07-20 19:05:08 +02:00
|
|
|
'antenna' : '', 'dev_arg' : 'rtl,buffers=32,buflen=16384' }}
|
2017-07-20 21:37:14 +02:00
|
|
|
|
|
|
|
#===============================================================================
|
|
|
|
# Default values indicating that the user does not passed any custom value
|
|
|
|
#===============================================================================
|
|
|
|
not_set_rx_rf_gain = -1.0
|
|
|
|
not_set_rx_if_gain = -1.0
|
|
|
|
not_set_rx_bb_gain = -1.0
|
2018-08-10 08:32:48 +02:00
|
|
|
not_set_samp_rate_rx = -1.0
|
2017-07-20 21:37:14 +02:00
|
|
|
not_set_antenna = ''
|
|
|
|
not_set_dev_args = ''
|
|
|
|
|
2018-08-10 08:32:48 +02:00
|
|
|
def handle_samp_rate_rx(device, samp_rate):
|
|
|
|
"""
|
|
|
|
Handles the RX sampling rate.
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
2018-08-16 19:53:31 +02:00
|
|
|
:param samp_rate: the user defined RX sampling rate value
|
|
|
|
:type samp_rate: float
|
2018-08-10 08:32:48 +02:00
|
|
|
"""
|
|
|
|
if(samp_rate == not_set_samp_rate_rx):
|
|
|
|
return hw_rx_settings[device]['samp_rate']
|
|
|
|
else:
|
|
|
|
return samp_rate
|
|
|
|
|
2017-07-20 21:37:14 +02:00
|
|
|
def handle_rx_dev_args(device, dev_args):
|
|
|
|
"""
|
|
|
|
Handles the RX device arguments.
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
|
|
|
:param dev_args: the device arguments. Emtpy string for no or default
|
|
|
|
device arguements
|
|
|
|
:type dev_args: string
|
|
|
|
"""
|
|
|
|
if(len(dev_args) == 0):
|
|
|
|
return hw_rx_settings[device]['dev_arg']
|
|
|
|
else:
|
|
|
|
return dev_args
|
|
|
|
|
|
|
|
def handle_rx_rf_gain(device, gain):
|
|
|
|
"""
|
|
|
|
Handles the RX RF gain. If this parameter is not set from the user
|
|
|
|
the default settings are returned, otherwise the user setting itself
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
|
|
|
:param gain: the user defined gain value
|
|
|
|
:type gain: float
|
|
|
|
"""
|
|
|
|
if(gain == not_set_rx_rf_gain):
|
|
|
|
return hw_rx_settings[device]['rf_gain']
|
|
|
|
else:
|
|
|
|
return gain
|
|
|
|
|
|
|
|
def handle_rx_if_gain(device, gain):
|
|
|
|
"""
|
|
|
|
Handles the IF RF gain. If this parameter is not set from the user
|
|
|
|
the default settings are returned, otherwise the user setting itself
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
|
|
|
:param gain: the user defined gain value
|
|
|
|
:type gain: float
|
|
|
|
"""
|
|
|
|
if(gain == not_set_rx_if_gain):
|
|
|
|
return hw_rx_settings[device]['if_gain']
|
|
|
|
else:
|
|
|
|
return gain
|
|
|
|
|
|
|
|
|
|
|
|
def handle_rx_bb_gain(device, gain):
|
|
|
|
"""
|
|
|
|
Handles the RX BB gain. If this parameter is not set from the user
|
|
|
|
the default settings are returned, otherwise the user setting itself
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
|
|
|
:param gain: the user defined gain value
|
|
|
|
:type gain: float
|
|
|
|
"""
|
|
|
|
if(gain == not_set_rx_bb_gain):
|
|
|
|
return hw_rx_settings[device]['bb_gain']
|
|
|
|
else:
|
|
|
|
return gain
|
|
|
|
|
|
|
|
def handle_rx_antenna(device, antenna):
|
|
|
|
"""
|
|
|
|
Handles the RX antenna. If this parameter is not set from the user
|
|
|
|
the default settings are returned, otherwise the user setting itself
|
|
|
|
:param device: the device name
|
|
|
|
:type device: string
|
|
|
|
:param gain: the user defined antenna
|
|
|
|
:type gain: string
|
|
|
|
"""
|
|
|
|
if(len(antenna) == 0):
|
|
|
|
return hw_rx_settings[device]['antenna']
|
|
|
|
else:
|
|
|
|
return antenna
|
2018-08-10 08:32:48 +02:00
|
|
|
|