diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-02-28 01:04:51 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-02-28 15:18:16 +0700 |
commit | 7881fd6001273692d87f18c05e6592232b732b40 (patch) | |
tree | 1f81e811048b160f0fdde74cd43e0c043ca10cc2 /src/target | |
parent | d93c1debb0f2b782c7b051c338753508bd6bca23 (diff) |
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
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/fake_trx/data_msg.py | 23 |
1 files changed, 5 insertions, 18 deletions
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 |