Change in osmocom-bb[master]: trx_toolkit/burst_fwd.py: inherit trx list API from TRXList

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Jul 12 12:54:06 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/19222 )


Change subject: trx_toolkit/burst_fwd.py: inherit trx list API from TRXList
......................................................................

trx_toolkit/burst_fwd.py: inherit trx list API from TRXList

Change-Id: I1c589888991add435d88517094c7b4a7db93cbae
---
M src/target/trx_toolkit/burst_fwd.py
M src/target/trx_toolkit/trx_list.py
2 files changed, 5 insertions(+), 24 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/22/19222/1

diff --git a/src/target/trx_toolkit/burst_fwd.py b/src/target/trx_toolkit/burst_fwd.py
index 9fb308f..574c97e 100644
--- a/src/target/trx_toolkit/burst_fwd.py
+++ b/src/target/trx_toolkit/burst_fwd.py
@@ -25,7 +25,9 @@
 
 import logging as log
 
-class BurstForwarder:
+from trx_list import TRXList
+
+class BurstForwarder(TRXList):
 	""" Performs burst forwarding between transceivers.
 
 	BurstForwarder distributes bursts between the list of given
@@ -44,27 +46,6 @@
 
 	"""
 
-	def __init__(self, trx_list = None):
-		# List of Transceiver instances
-		if trx_list is not None:
-			self.trx_list = trx_list
-		else:
-			self.trx_list = []
-
-	def add_trx(self, trx):
-		if trx in self.trx_list:
-			log.error("TRX is already in the list")
-			return
-
-		self.trx_list.append(trx)
-
-	def del_trx(self, trx):
-		if trx not in self.trx_list:
-			log.error("TRX is not in the list")
-			return
-
-		self.trx_list.remove(trx)
-
 	def forward_msg(self, src_trx, rx_msg):
 		# Originating Transceiver may use frequency hopping,
 		# so let's precalculate its Tx frequency in advance
diff --git a/src/target/trx_toolkit/trx_list.py b/src/target/trx_toolkit/trx_list.py
index 8b4013d..4f9eff2 100644
--- a/src/target/trx_toolkit/trx_list.py
+++ b/src/target/trx_toolkit/trx_list.py
@@ -31,8 +31,8 @@
 
 	"""
 
-	def __init__(self):
-		self.trx_list = []
+	def __init__(self, trx_list = None):
+		self.trx_list = trx_list or []
 
 	def __getitem__(self, i):
 		return self.trx_list[i]

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/19222
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I1c589888991add435d88517094c7b4a7db93cbae
Gerrit-Change-Number: 19222
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200712/ea815ad9/attachment.htm>


More information about the gerrit-log mailing list