From 2adbee48bf323a980a585da3a832ce053bb43a9c Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Fri, 10 Aug 2018 00:51:36 +0700 Subject: apps/grgsm_trx: print bind / remote address and port Change-Id: If750d476f3972f1ab5c5b637438d14d40b1e3d87 --- python/trx/ctrl_if_bb.py | 3 ++- python/trx/radio_if.py | 4 +++- python/trx/udp_link.py | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/python/trx/ctrl_if_bb.py b/python/trx/ctrl_if_bb.py index f5a9fa3..fe0002e 100644 --- a/python/trx/ctrl_if_bb.py +++ b/python/trx/ctrl_if_bb.py @@ -27,10 +27,11 @@ from ctrl_if import ctrl_if class ctrl_if_bb(ctrl_if): def __init__(self, remote_addr, remote_port, bind_addr, bind_port, tb, pm): - print("[i] Init CTRL interface") ctrl_if.__init__(self, remote_addr, remote_port, bind_addr, bind_port) + print("[i] Init CTRL interface (%s)" % self.desc_link()) + # Set link to the follow graph (top block) self.tb = tb # Power measurement diff --git a/python/trx/radio_if.py b/python/trx/radio_if.py index 1c7f003..d2afcf6 100644 --- a/python/trx/radio_if.py +++ b/python/trx/radio_if.py @@ -84,7 +84,9 @@ class radio_if(gr.top_block): trx_bind_addr, trx_remote_addr, trx_base_port): - print("[i] Init Radio interface") + print("[i] Init Radio interface (L:%s:%u <-> R:%s:%u)" + % (trx_bind_addr, trx_base_port + 2, + trx_remote_addr, trx_base_port + 102)) # PHY specific variables self.sample_rate = phy_sample_rate diff --git a/python/trx/udp_link.py b/python/trx/udp_link.py index efa701b..ad84e5a 100644 --- a/python/trx/udp_link.py +++ b/python/trx/udp_link.py @@ -47,6 +47,12 @@ class udp_link: data, addr = self.sock.recvfrom(128) self.handle_rx(data.decode(), addr) + def desc_link(self): + (bind_addr, bind_port) = self.sock.getsockname() + + return "L:%s:%u <-> R:%s:%u" \ + % (bind_addr, bind_port, self.remote_addr, self.remote_port) + def send(self, data, remote = None): if type(data) not in [bytearray, bytes]: data = data.encode() -- cgit v1.2.3