python/trx: use CamelCase naming for basic classes
Change-Id: Ica9c56d01191dda38e63b51caba2ec8c63b671c9
This commit is contained in:
parent
bd4daec11c
commit
f237f1a978
|
@ -29,9 +29,9 @@ from argparse import ArgumentParser
|
|||
from argparse import ArgumentTypeError
|
||||
from gnuradio import eng_notation
|
||||
|
||||
from grgsm.trx import ctrl_if_bb
|
||||
from grgsm.trx import radio_if
|
||||
from grgsm.trx import fake_pm
|
||||
from grgsm.trx import CTRLInterfaceBB
|
||||
from grgsm.trx import RadioInterface
|
||||
from grgsm.trx import FakePM
|
||||
|
||||
COPYRIGHT = \
|
||||
"Copyright (C) 2016-2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
|
||||
|
@ -60,7 +60,7 @@ class Application:
|
|||
|
||||
def run(self):
|
||||
# Init Radio interface
|
||||
self.radio = radio_if(self.phy_args, self.phy_sample_rate,
|
||||
self.radio = RadioInterface(self.phy_args, self.phy_sample_rate,
|
||||
self.phy_rx_gain, self.phy_tx_gain, self.phy_ppm,
|
||||
self.phy_rx_antenna, self.phy_tx_antenna,
|
||||
self.phy_freq_offset, self.bind_addr,
|
||||
|
@ -69,10 +69,10 @@ class Application:
|
|||
# Power measurement emulation
|
||||
# Noise: -120 .. -105
|
||||
# BTS: -75 .. -50
|
||||
self.pm = fake_pm(-120, -105, -75, -50)
|
||||
self.pm = FakePM(-120, -105, -75, -50)
|
||||
|
||||
# Init TRX CTRL interface
|
||||
self.server = ctrl_if_bb(
|
||||
self.server = CTRLInterfaceBB(
|
||||
self.remote_addr, self.base_port + 101,
|
||||
self.bind_addr, self.base_port + 1,
|
||||
self.radio, self.pm)
|
||||
|
@ -122,7 +122,7 @@ def parse_argv():
|
|||
help = "Set device arguments")
|
||||
phy_group.add_argument("-s", "--sample-rate",
|
||||
dest = "sample_rate", type = eng_float,
|
||||
default = radio_if.SAMPLE_RATE,
|
||||
default = RadioInterface.SAMPLE_RATE,
|
||||
help = "Set samp_rate (default %(default)s)")
|
||||
phy_group.add_argument("-g", "--rx-gain",
|
||||
dest = "rx_gain", type = float, default = 30,
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
This is a set of helper classes for the grgsm_trx application.
|
||||
'''
|
||||
|
||||
from udp_link import udp_link
|
||||
from ctrl_if import ctrl_if
|
||||
from ctrl_if_bb import ctrl_if_bb
|
||||
from fake_pm import fake_pm
|
||||
from radio_if_grc import radio_if_grc
|
||||
from radio_if import radio_if
|
||||
from udp_link import UDPLink
|
||||
from ctrl_if import CTRLInterface
|
||||
from ctrl_if_bb import CTRLInterfaceBB
|
||||
from fake_pm import FakePM
|
||||
from radio_if_grc import RadioInterfaceGRC
|
||||
from radio_if import RadioInterface
|
||||
|
||||
from dict_toggle_sign import dict_toggle_sign
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from grgsm.trx import udp_link
|
||||
from grgsm.trx import UDPLink
|
||||
|
||||
class ctrl_if(udp_link):
|
||||
class CTRLInterface(UDPLink):
|
||||
def handle_rx(self, data, remote):
|
||||
if self.verify_req(data):
|
||||
request = self.prepare_req(data)
|
||||
|
|
|
@ -23,11 +23,12 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import grgsm
|
||||
from ctrl_if import ctrl_if
|
||||
|
||||
class ctrl_if_bb(ctrl_if):
|
||||
from ctrl_if import CTRLInterface
|
||||
|
||||
class CTRLInterfaceBB(CTRLInterface):
|
||||
def __init__(self, remote_addr, remote_port, bind_addr, bind_port, tb, pm):
|
||||
ctrl_if.__init__(self, remote_addr, remote_port,
|
||||
CTRLInterface.__init__(self, remote_addr, remote_port,
|
||||
bind_addr, bind_port)
|
||||
|
||||
print("[i] Init CTRL interface (%s)" % self.desc_link())
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
from random import randint
|
||||
|
||||
class fake_pm:
|
||||
class FakePM:
|
||||
# Freq. list for good power level
|
||||
bts_list = []
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ from gnuradio.filter import firdes
|
|||
|
||||
from dict_toggle_sign import dict_toggle_sign
|
||||
|
||||
class radio_if(gr.top_block):
|
||||
class RadioInterface(gr.top_block):
|
||||
# PHY specific variables
|
||||
rx_freq = 935e6
|
||||
tx_freq = 890e6
|
||||
|
|
|
@ -24,7 +24,7 @@ import math
|
|||
import time
|
||||
|
||||
|
||||
class radio_if_grc(gr.top_block):
|
||||
class RadioInterfaceGRC(gr.top_block):
|
||||
|
||||
def __init__(self, delay_correction=285.616e-6, osr=4, ppm=-0.799427, rx_freq=935e6+36*0.2e6, rx_gain=40, samp_rate=13e6/12.0, timing_advance=0, trx_base_port="5710", trx_remote_addr="127.0.0.1", tx_freq=935e6+36*0.2e6-45e6, tx_gain=40, uplink_shift=-(6.0/1625000*(156.25)*3)):
|
||||
gr.top_block.__init__(self, "Trx radio interface")
|
||||
|
@ -255,7 +255,7 @@ def argument_parser():
|
|||
return parser
|
||||
|
||||
|
||||
def main(top_block_cls=radio_if_grc, options=None):
|
||||
def main(top_block_cls=RadioInterfaceGRC, options=None):
|
||||
if options is None:
|
||||
options, _ = argument_parser().parse_args()
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
import socket
|
||||
import select
|
||||
|
||||
class udp_link:
|
||||
class UDPLink:
|
||||
def __init__(self, remote_addr, remote_port, bind_addr = '0.0.0.0', bind_port = 0):
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
|
|
Loading…
Reference in New Issue