trx_interface: implement built-in timeslot filter
There is a dedicated block named 'Burst Timeslot Filter', which
could be used, but one doesn't expose the API to change the
timeslot index 'on fly'.
This change implements built-in timeslot filter in 'TRX Interface'
block, which will be used until the proper block expose API.
diff --git a/lib/trx_interface/trx_impl.cc b/lib/trx_interface/trx_impl.cc
index 8847278..2068da3 100644
--- a/lib/trx_interface/trx_impl.cc
+++ b/lib/trx_interface/trx_impl.cc
@@ -87,6 +87,9 @@
// Bind DATA interface handler
d_data_sock->udp_rx_handler = boost::bind(
&trx_impl::handle_ul_burst, this, _1, _2);
+
+ // Init timeslot filter
+ d_ts_filter_tn = -1;
}
/*
@@ -100,6 +103,21 @@
}
/*
+ * Timeslot filter API (getter and setter)
+ */
+ void
+ trx_impl::ts_filter_set_tn(int tn)
+ {
+ d_ts_filter_tn = (tn >= 0 && tn <= 7) ? tn : -1;
+ }
+
+ int
+ trx_impl::ts_filter_get_tn(void)
+ {
+ return d_ts_filter_tn;
+ }
+
+ /*
* Check if burst is a RACH burst
*/
bool trx_impl::detect_rach(uint8_t *burst)
@@ -192,6 +210,10 @@
// 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);
}