Added new block for message printing, removed legacy code from the decoder and bursts printer
diff --git a/grc/gsm_message_printer.xml b/grc/gsm_message_printer.xml
new file mode 100644
index 0000000..2c849dc
--- /dev/null
+++ b/grc/gsm_message_printer.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<block>
+  <name>Message printer</name>
+  <key>gsm_message_printer</key>
+  <category>GSM</category>
+  <import>import gsm</import>
+  <make>gsm.message_printer()</make>
+
+  <sink>
+    <name>msgs</name>
+    <type>message</type>
+  </sink>
+</block>
diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc
index 23ec7fd..e9d1146 100644
--- a/lib/decoding/control_channels_decoder_impl.cc
+++ b/lib/decoding/control_channels_decoder_impl.cc
@@ -73,8 +73,6 @@
         d_bursts[d_collected_bursts_num] = msg;
         d_collected_bursts_num++;
         //get convecutive bursts
-//        pmt::pmt_t header_blob = pmt::car(msg);
-//        gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_blob);
         
         if(d_collected_bursts_num==4)
         {
@@ -109,7 +107,7 @@
                 if (FC_check_crc(&fc_ctx, decoded_data, crc_result) == 0)
                 {
                     //("error: sacch: parity error (errors=%d fn=%d)\n", errors, ctx->fn);
-                    std::cout << "Uncorrectable errors!" << std::endl;
+                    //std::cout << "Uncorrectable errors!" << std::endl;
                     errors = -1;
                 } else {
                     //DEBUGF("Successfully corrected parity bits! (errors=%d fn=%d)\n", errors, ctx->fn);
@@ -125,25 +123,16 @@
            unsigned char sbuf_len=224;
            int i, j, c, pos=0;
            for(i = 0; i < sbuf_len; i += 8) {
-                 for(j = 0, c = 0; (j < 8) && (i + j < sbuf_len); j++){
-                     c |= (!!decoded_data[i + j]) << j;
-                 }
-                 outmsg[pos++] = c & 0xff;
-             }
-            
-           int jj=0;
-             while (jj < 23){
-                 printf(" %02x", outmsg[jj]);//decoded_data[jj]);
-                 jj++;
-               }
-             printf("\n");
-             fflush(stdout);
+                for(j = 0, c = 0; (j < 8) && (i + j < sbuf_len); j++){
+                    c |= (!!decoded_data[i + j]) << j;
+                }
+                outmsg[pos++] = c & 0xff;
+           }
 
            //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);
-
             message_port_pub(pmt::mp("msgs"), msg_out);
         }
         return;
diff --git a/lib/misc_utils/bursts_printer_impl.cc b/lib/misc_utils/bursts_printer_impl.cc
index deedf02..3e7d843 100644
--- a/lib/misc_utils/bursts_printer_impl.cc
+++ b/lib/misc_utils/bursts_printer_impl.cc
@@ -36,8 +36,6 @@
     boost::mutex printer_mutex;
     void bursts_printer_impl::bursts_print(pmt::pmt_t msg)
     {
-        boost::mutex::scoped_lock lock(printer_mutex);
-        
         pmt::pmt_t burst = pmt::cdr(msg);
         int8_t * burst_elements = (int8_t *)pmt::blob_data(burst);
         size_t burst_len=pmt::blob_length(burst);
diff --git a/lib/misc_utils/message_printer_impl.cc b/lib/misc_utils/message_printer_impl.cc
new file mode 100644
index 0000000..36bd964
--- /dev/null
+++ b/lib/misc_utils/message_printer_impl.cc
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/* 
+ * Copyright 2014 <+YOU OR YOUR COMPANY+>.
+ * 
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "message_printer_impl.h"
+
+namespace gr {
+  namespace gsm {
+
+    void message_printer_impl::message_print(pmt::pmt_t msg)
+    {
+        pmt::pmt_t message = pmt::cdr(msg);
+        uint8_t * message_elements = (uint8_t *)pmt::blob_data(message);
+        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++)
+        {
+            printf(" %02x", message_elements[ii]);
+        }
+        std::cout << std::endl;
+    }
+
+    message_printer::sptr
+    message_printer::make()
+    {
+      return gnuradio::get_initial_sptr
+        (new message_printer_impl());
+    }
+
+    /*
+     * The private constructor
+     */
+    message_printer_impl::message_printer_impl()
+      : gr::block("message_printer",
+              gr::io_signature::make(0, 0, 0),
+              gr::io_signature::make(0, 0, 0))
+    {
+        message_port_register_in(pmt::mp("msgs"));
+        set_msg_handler(pmt::mp("msgs"), boost::bind(&message_printer_impl::message_print, this, _1));
+
+    }
+
+    /*
+     * Our virtual destructor.
+     */
+    message_printer_impl::~message_printer_impl()
+    {
+    }
+  } /* namespace gsm */
+} /* namespace gr */
+
diff --git a/lib/misc_utils/message_printer_impl.h b/lib/misc_utils/message_printer_impl.h
new file mode 100644
index 0000000..625a1e6
--- /dev/null
+++ b/lib/misc_utils/message_printer_impl.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/* 
+ * Copyright 2014 <+YOU OR YOUR COMPANY+>.
+ * 
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H
+#define INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H
+
+#include <gsm/message_printer.h>
+
+namespace gr {
+  namespace gsm {
+
+    class message_printer_impl : public message_printer
+    {
+     private:
+      void message_print(pmt::pmt_t msg);
+     public:
+      message_printer_impl();
+      ~message_printer_impl();
+    };
+
+  } // namespace gsm
+} // namespace gr
+
+#endif /* INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H */
+