[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/24: digital: Cleaning up some of the pac
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/24: digital: Cleaning up some of the packet parsing code. |
Date: |
Tue, 14 Jun 2016 00:40:55 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch packet2
in repository gnuradio.
commit 95428ed6f5c057003a9a7b875d526e9e44b8cc82
Author: Tom Rondeau <address@hidden>
Date: Mon Apr 4 11:20:30 2016 -0400
digital: Cleaning up some of the packet parsing code.
---
.../gnuradio/digital/packet_formatter_default.h | 3 +-
gr-digital/lib/packet_formatter_counter.cc | 2 --
gr-digital/lib/packet_formatter_default.cc | 40 ++--------------------
3 files changed, 3 insertions(+), 42 deletions(-)
diff --git a/gr-digital/include/gnuradio/digital/packet_formatter_default.h
b/gr-digital/include/gnuradio/digital/packet_formatter_default.h
index f907e92..71355d7 100644
--- a/gr-digital/include/gnuradio/digital/packet_formatter_default.h
+++ b/gr-digital/include/gnuradio/digital/packet_formatter_default.h
@@ -256,7 +256,7 @@ namespace gr {
static sptr make(const std::string &access_code);
protected:
- enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC};
uint64_t d_access_code; //!< register to hold the access code
size_t d_access_code_len; //!< length in bits of the access code
@@ -272,7 +272,6 @@ namespace gr {
int d_pkt_len; //!< Length of the packet to put into the
output buffer
int d_pkt_count; //!< Number of bytes/soft bits already
received
pmt::pmt_t d_info; //!< info captured from the header
- int d_count; //!< count samples since last payload
start
uint16_t d_bps; //!< bits/sec of payload modulation
diff --git a/gr-digital/lib/packet_formatter_counter.cc
b/gr-digital/lib/packet_formatter_counter.cc
index 494f514..e3e73d7 100644
--- a/gr-digital/lib/packet_formatter_counter.cc
+++ b/gr-digital/lib/packet_formatter_counter.cc
@@ -111,8 +111,6 @@ namespace gr {
d_bps = bps;
d_info = pmt::make_dict();
- d_info = pmt::dict_add(d_info, pmt::intern("skip samps"),
- pmt::from_long(d_count));
d_info = pmt::dict_add(d_info, pmt::intern("payload bits"),
pmt::from_long(8*len));
d_info = pmt::dict_add(d_info, pmt::intern("bps"),
diff --git a/gr-digital/lib/packet_formatter_default.cc
b/gr-digital/lib/packet_formatter_default.cc
index 66f4795..6ac5a83 100644
--- a/gr-digital/lib/packet_formatter_default.cc
+++ b/gr-digital/lib/packet_formatter_default.cc
@@ -45,7 +45,6 @@ namespace gr {
throw std::runtime_error("packet_formatter_default: Setting access
code failed");
}
- d_count = 0;
d_pkt_len = 0;
enter_search();
d_threshold = 0;
@@ -132,11 +131,9 @@ namespace gr {
while(count < nbits_in) {
switch(d_state) {
case STATE_SYNC_SEARCH: // Look for the access code correlation
-
while(count < nbits_in) {
// shift in new data
d_data_reg = (d_data_reg << 1) | ((input[count++]) & 0x1);
- d_count++;
// compute hamming distance between desired access code and
current data
uint64_t wrong_bits = 0;
@@ -153,10 +150,8 @@ namespace gr {
break;
case STATE_HAVE_SYNC:
- while(count < nbits_in) { // Shift bits one at a time into header
+ while(count <= nbits_in) { // Shift bits one at a time into header
d_hdr_reg.insert_bit(input[count++]);
- d_count++;
-
if(d_hdr_reg.length() == (header_nbits()-d_access_code_len)) {
// we have a full header, check to see if it has been received
properly
if(header_ok()) {
@@ -171,19 +166,6 @@ namespace gr {
}
}
break;
-
- case STATE_HAVE_HEADER:
- while(count < nbits_in) {
- if(d_pkt_count < d_pkt_len/d_bps) {
- count++;
- d_pkt_count++;
- }
- if(d_pkt_count == d_pkt_len/d_bps) {
- enter_search();
- break;
- }
- }
- break;
}
}
@@ -204,7 +186,6 @@ namespace gr {
while(count < nbits_in) {
// shift in new data
d_data_reg = (d_data_reg << 1) |
(gr::branchless_binary_slicer(input[count++]) & 0x1);
- d_count++;
// compute hamming distance between desired access code and
current data
uint64_t wrong_bits = 0;
@@ -223,7 +204,6 @@ namespace gr {
case STATE_HAVE_SYNC:
while(count < nbits_in) { // Shift bits one at a time into header
d_hdr_reg.insert_bit(gr::branchless_binary_slicer(input[count++]));
- d_count++;
if(d_hdr_reg.length() == (header_nbits()-d_access_code_len)) {
// we have a full header, check to see if it has been received
properly
@@ -239,19 +219,6 @@ namespace gr {
}
}
break;
-
- case STATE_HAVE_HEADER:
- while(count < nbits_in) {
- if(d_pkt_count < d_pkt_len/d_bps) {
- count++;
- d_pkt_count++;
- }
- if(d_pkt_count == d_pkt_len/d_bps) {
- enter_search();
- break;
- }
- }
- break;
}
}
@@ -287,10 +254,9 @@ namespace gr {
inline void
packet_formatter_default::enter_have_header(int payload_len)
{
- d_state = STATE_HAVE_HEADER;
+ d_state = STATE_SYNC_SEARCH;
d_pkt_len = payload_len;
d_pkt_count = 0;
- d_count = 0;
}
bool
@@ -308,8 +274,6 @@ namespace gr {
uint16_t len = d_hdr_reg.extract_field16(0, 16);
d_info = pmt::make_dict();
- d_info = pmt::dict_add(d_info, pmt::intern("skip samps"),
- pmt::from_long(d_count));
d_info = pmt::dict_add(d_info, pmt::intern("payload bits"),
pmt::from_long(8*len));
return static_cast<int>(len);
- [Commit-gnuradio] [gnuradio] branch packet2 created (now 93acb5b), git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 11/24: digital: fixed packet parser QA tests, git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 04/24: digital: Cleaning up some of the packet parsing code.,
git <=
- [Commit-gnuradio] [gnuradio] 12/24: blocks: Adds a multiple (complex only) block that responds to tags., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 13/24: digital: Dealing with scaling issues with corr_est., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 09/24: digital: Removed parse_soft and packet_parse_f., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 15/24: digital: wip: packet formatters specify payload in symbols, not bits., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 03/24: Adding new test block to adjust the sample rate of a stream and make sure tags are being placed in the correct locations., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 06/24: digital: updates to packet_formatter classes and parsing blocks., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 08/24: digital: fixing PFB clock sync block handling of tags., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 23/24: digital: Fixing QA code for testing header formatter/parsers., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 14/24: digital: wip: pfb_clock_sync_ccf tag offset update., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 18/24: digital: fixing up some of the packet formatters since the new base class., git, 2016/06/13