[PATCH] osmocom-bb[fixeria/trx]: fake_trx/data_msg.py: use a single unified constructor

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Feb 28 09:07:14 UTC 2018


Review at  https://gerrit.osmocom.org/6989

fake_trx/data_msg.py: use a single unified constructor

There are no message specific initialization parts, excepting
the header specific fields setting. Let's us a common constructor,
dropping custom fields from its arguments.

Change-Id: I13a3e4b2f6a1f443ebe7d809df62736e3c43f56f
---
M src/target/fake_trx/data_msg.py
1 file changed, 5 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/89/6989/1

diff --git a/src/target/fake_trx/data_msg.py b/src/target/fake_trx/data_msg.py
index 5ee8ed5..045e281 100644
--- a/src/target/fake_trx/data_msg.py
+++ b/src/target/fake_trx/data_msg.py
@@ -32,9 +32,11 @@
 	fn = None
 	tn = None
 
-	# HACK: Abstract class definition
-	def __init__(self):
-		raise NotImplementedError
+	# Common constructor
+	def __init__(self, fn = None, tn = None, burst = None):
+		self.burst = burst
+		self.fn = fn
+		self.tn = tn
 
 	# Generates message specific header
 	def gen_hdr(self):
@@ -213,13 +215,6 @@
 	# Specific message fields
 	pwr = None
 
-	def __init__(self, fn = None, tn = None, pwr = None, burst = None):
-		# Init local variables
-		self.burst = burst
-		self.pwr = pwr
-		self.fn = fn
-		self.tn = tn
-
 	# Validates the message fields
 	def validate(self):
 		# Validate common fields
@@ -314,14 +309,6 @@
 	# Specific message fields
 	rssi = None
 	toa = None
-
-	def __init__(self, fn = None, tn = None, rssi = None, toa = None, burst = None):
-		# Init local variables
-		self.burst = burst
-		self.rssi = rssi
-		self.toa = toa
-		self.fn = fn
-		self.tn = tn
 
 	# Validates the message fields
 	def validate(self):

-- 
To view, visit https://gerrit.osmocom.org/6989
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13a3e4b2f6a1f443ebe7d809df62736e3c43f56f
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>


More information about the gerrit-log mailing list