diff options
author | ptrkrysik <ptrkrysik@gmail.com> | 2014-10-30 09:05:30 +0100 |
---|---|---|
committer | ptrkrysik <ptrkrysik@gmail.com> | 2014-10-30 09:05:30 +0100 |
commit | 6bb450daca4d59267395c4a05a32fbbfdfdac59e (patch) | |
tree | c7f26d5c964c75f3b72b12afea3b09b138a7b3ff | |
parent | 58213797c17bc5fe397f067152363eb95f596b92 (diff) | |
parent | 7f61c6440c9b05802f3add9cb4007e12aac7122f (diff) |
Merge branch 'master' of github.com:Jakotako/gr-gsm
-rw-r--r-- | lib/decoding/control_channels_decoder_impl.cc | 24 | ||||
-rw-r--r-- | lib/misc_utils/message_printer_impl.cc | 7 | ||||
-rw-r--r-- | lib/receiver/receiver_impl.cc | 3 |
3 files changed, 22 insertions, 12 deletions
diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc index e9d1146..de1dc02 100644 --- a/lib/decoding/control_channels_decoder_impl.cc +++ b/lib/decoding/control_channels_decoder_impl.cc @@ -37,7 +37,7 @@ namespace gr { } /* - * The private constructor + * Constructor */ control_channels_decoder_impl::control_channels_decoder_impl() : gr::block("control_channels_decoder", @@ -53,16 +53,16 @@ namespace gr { j = 2 * ((49 * k) % 57) + ((k % 8) / 4); interleave_trans[k] = B * 114 + j; //114=57 + 57 } - + + //initialize decoder FC_init(&fc_ctx, 40, 184); + + //setup input/output ports message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&control_channels_decoder_impl::decode, this, _1)); message_port_register_out(pmt::mp("msgs")); } - /* - * Our virtual destructor. - */ control_channels_decoder_impl::~control_channels_decoder_impl() { } @@ -131,8 +131,18 @@ namespace gr { //send message with header of the first burst pmt::pmt_t header_blob = pmt::car(d_bursts[0]); - pmt::pmt_t msg_binary_blob = pmt::make_blob(outmsg,23); - pmt::pmt_t msg_out = pmt::cons(header_blob, msg_binary_blob); + gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_blob); + header->type = GSMTAP_TYPE_UM; + header->sub_type = GSMTAP_CHANNEL_BCCH; + int8_t * header_content = (int8_t *)pmt::blob_data(header_blob); + + int8_t header_plus_data[16+23]; + memcpy(header_plus_data, header_content, 16); + memcpy(header_plus_data+16, outmsg, 23); + + pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,23+16); + pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); + message_port_pub(pmt::mp("msgs"), msg_out); } return; diff --git a/lib/misc_utils/message_printer_impl.cc b/lib/misc_utils/message_printer_impl.cc index 36bd964..0e55233 100644 --- a/lib/misc_utils/message_printer_impl.cc +++ b/lib/misc_utils/message_printer_impl.cc @@ -24,6 +24,7 @@ #include <gnuradio/io_signature.h> #include "message_printer_impl.h" +#include "gsm/gsmtap.h" namespace gr { namespace gsm { @@ -35,9 +36,9 @@ namespace gr { size_t message_len=pmt::blob_length(message); // pmt::pmt_t header_blob = pmt::car(msg); -// gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_blob); - - for(int ii=0; ii<message_len; ii++) + gsmtap_hdr * header = (gsmtap_hdr *)message_elements; + + for(int ii=(header->hdr_len*4); ii<message_len; ii++) { printf(" %02x", message_elements[ii]); } diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc index de3438c..77d41a4 100644 --- a/lib/receiver/receiver_impl.cc +++ b/lib/receiver/receiver_impl.cc @@ -801,11 +801,10 @@ int receiver_impl::get_norm_chan_imp_resp(const gr_complex *input, gr_complex * void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * burst_binary, burst_type b_type) { - boost::scoped_ptr<gsmtap_hdr> tap_header(new gsmtap_hdr()); tap_header->version = GSMTAP_VERSION; - tap_header->hdr_len = BURST_SIZE/4; + tap_header->hdr_len = sizeof(gsmtap_hdr)/4; tap_header->type = GSMTAP_TYPE_UM_BURST; tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr()); tap_header->frame_number = d_burst_nr.get_frame_nr(); |