#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
#
from math import pi
-import Numeric
-
from gnuradio import gr, packet_utils
import gnuradio.gr.gr_threading as _threading
Send packets by calling send_pkt
"""
- def __init__(self, fg, modulator, access_code=None, msgq_limit=2, pad_for_usrp=True):
+ def __init__(self, fg, modulator, access_code=None, msgq_limit=2, pad_for_usrp=True, use_whitener_offset=False):
"""
Hierarchical block for sending packets
@param msgq_limit: maximum number of messages in message queue
@type msgq_limit: int
@param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
-
+ @param use_whitener_offset: If true, start of whitener XOR string is incremented each packet
+
See gmsk_mod for remaining parameters
"""
self._modulator = modulator
self._pad_for_usrp = pad_for_usrp
-
+ self._use_whitener_offset = use_whitener_offset
+ self._whitener_offset = 0
+
if access_code is None:
access_code = packet_utils.default_access_code
if not packet_utils.is_1_0_string(access_code):
else:
# print "original_payload =", string_to_hex_list(payload)
pkt = packet_utils.make_packet(payload,
- self._modulator.samples_per_baud(),
- self._modulator.bits_per_baud(),
+ self._modulator.samples_per_symbol(),
+ self._modulator.bits_per_symbol(),
self._access_code,
- self._pad_for_usrp)
+ self._pad_for_usrp,
+ self._whitener_offset)
#print "pkt =", string_to_hex_list(pkt)
msg = gr.message_from_string(pkt)
+ if self._use_whitener_offset is True:
+ self._whitener_offset = (self._whitener_offset + 1) % 16
+
self._pkt_input.msgq().insert_tail(msg)
def run(self):
while self.keep_running:
msg = self.rcvd_pktq.delete_head()
- ok, payload = packet_utils.unmake_packet(msg.to_string())
+ ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
if self.callback:
self.callback(ok, payload)