trx_toolkit/burst_fwd.py: inherit trx list API from TRXList
Change-Id: I1c589888991add435d88517094c7b4a7db93cbae
This commit is contained in:
parent
9d24c54f82
commit
bb0155d0e7
|
@ -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 @@ class BurstForwarder:
|
|||
|
||||
"""
|
||||
|
||||
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
|
||||
|
|
|
@ -31,8 +31,8 @@ class TRXList:
|
|||
|
||||
"""
|
||||
|
||||
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]
|
||||
|
|
Loading…
Reference in New Issue