From 7881fd6001273692d87f18c05e6592232b732b40 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 28 Feb 2018 01:04:51 +0700 Subject: 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 --- src/target/fake_trx/data_msg.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/target') diff --git a/src/target/fake_trx/data_msg.py b/src/target/fake_trx/data_msg.py index 5ee8ed59..045e281e 100644 --- a/src/target/fake_trx/data_msg.py +++ b/src/target/fake_trx/data_msg.py @@ -32,9 +32,11 @@ class DATAMSG: 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 @@ class DATAMSG_L12TRX(DATAMSG): # 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 @@ -315,14 +310,6 @@ class DATAMSG_TRX2L1(DATAMSG): 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): # Validate common fields -- cgit v1.2.3