misc_utils/trx_burst_if: get rid of built-in timeslot filter
Since the API of 'Timeslot Filter' block was exposed, we can
get rid of built-in timeslot filter and use the proper methods.
diff --git a/include/grgsm/misc_utils/trx_burst_if.h b/include/grgsm/misc_utils/trx_burst_if.h
index 18ceef1..0e7a35a 100644
--- a/include/grgsm/misc_utils/trx_burst_if.h
+++ b/include/grgsm/misc_utils/trx_burst_if.h
@@ -50,10 +50,6 @@
static sptr make(
const std::string &remote_addr,
const std::string &base_port);
-
- /* Expose internal timeslot filter API */
- virtual void ts_filter_set_tn(int tn) = 0;
- virtual int ts_filter_get_tn(void) = 0;
};
} // namespace gsm
diff --git a/lib/misc_utils/trx_burst_if_impl.cc b/lib/misc_utils/trx_burst_if_impl.cc
index 6d63edf..8f458b0 100644
--- a/lib/misc_utils/trx_burst_if_impl.cc
+++ b/lib/misc_utils/trx_burst_if_impl.cc
@@ -85,9 +85,6 @@
// Bind DATA interface handler
d_data_sock->udp_rx_handler = boost::bind(
&trx_burst_if_impl::handle_ul_burst, this, _1, _2);
-
- // Init timeslot filter
- d_ts_filter_tn = -1;
}
/*
@@ -100,21 +97,6 @@
}
/*
- * Timeslot filter API (getter and setter)
- */
- void
- trx_burst_if_impl::ts_filter_set_tn(int tn)
- {
- d_ts_filter_tn = (tn >= 0 && tn <= 7) ? tn : -1;
- }
-
- int
- trx_burst_if_impl::ts_filter_get_tn(void)
- {
- return d_ts_filter_tn;
- }
-
- /*
* Check if burst is a RACH burst
*/
bool trx_burst_if_impl::detect_rach(uint8_t *burst)
@@ -190,10 +172,6 @@
// Compose a new UDP payload with burst
burst_pack(msg, buf);
- // Timeslot filter
- if (d_ts_filter_tn != -1 && buf[0] != d_ts_filter_tn)
- return;
-
// Send a burst
d_data_sock->udp_send(buf, 158);
}
diff --git a/lib/misc_utils/trx_burst_if_impl.h b/lib/misc_utils/trx_burst_if_impl.h
index fd5a42d..35f939c 100644
--- a/lib/misc_utils/trx_burst_if_impl.h
+++ b/lib/misc_utils/trx_burst_if_impl.h
@@ -35,7 +35,6 @@
{
private:
udp_socket *d_data_sock;
- int d_ts_filter_tn;
bool detect_rach(uint8_t *burst);
void burst_pack(pmt::pmt_t msg, uint8_t *buf);
@@ -44,10 +43,6 @@
trx_burst_if_impl(const std::string &remote_addr, int base_port);
~trx_burst_if_impl();
- /* Timeslot filter API */
- void ts_filter_set_tn(int tn);
- int ts_filter_get_tn(void);
-
void handle_dl_burst(pmt::pmt_t msg);
void handle_ul_burst(uint8_t *payload, size_t len);
};
diff --git a/python/trx/ctrl_if_bb.py b/python/trx/ctrl_if_bb.py
index b08f62c..77e02d0 100644
--- a/python/trx/ctrl_if_bb.py
+++ b/python/trx/ctrl_if_bb.py
@@ -22,6 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import grgsm
from ctrl_if import ctrl_if
class ctrl_if_bb(ctrl_if):
@@ -107,14 +108,18 @@
return -1
# Ignore timeslot type for now
- # Value 0 means 'drop all'
- config = -1 if int(request[2]) == 0 else tn
-
+ config = int(request[2])
print("[i] Configure timeslot filter to: %s"
- % ("drop all" if config == -1 else "TS %d" % tn))
+ % ("drop all" if config == 0 else "TS %d" % tn))
- # HACK: configure built-in timeslot filter
- self.tb.gsm_trx_if.ts_filter_set_tn(config)
+ if config == 0:
+ # Value 0 means 'drop all'
+ self.tb.gsm_ts_filter.set_policy(
+ grgsm.FILTER_POLICY_DROP_ALL)
+ else:
+ self.tb.gsm_ts_filter.set_policy(
+ grgsm.FILTER_POLICY_DEFAULT)
+ self.tb.gsm_ts_filter.set_tn(tn)
return 0
diff --git a/python/trx/radio_if.py b/python/trx/radio_if.py
index 661025a..5791f42 100644
--- a/python/trx/radio_if.py
+++ b/python/trx/radio_if.py
@@ -98,6 +98,9 @@
self.gsm_clck_ctrl = grgsm.clock_offset_control(
shift_fc, self.samp_rate, osr = 4)
+ self.gsm_ts_filter = grgsm.burst_timeslot_filter(0)
+ self.gsm_ts_filter.set_policy(grgsm.FILTER_POLICY_DROP_ALL)
+
self.gsm_trx_burst_if = grgsm.trx_burst_if(
self.trx_remote_addr, str(self.trx_base_port))
@@ -115,6 +118,9 @@
(self.gsm_input, 'ctrl_in'))
self.msg_connect((self.gsm_receiver, 'C0'),
+ (self.gsm_ts_filter, 'in'))
+
+ self.msg_connect((self.gsm_ts_filter, 'out'),
(self.gsm_trx_burst_if, 'bursts'))
def check_available(self):