blob: 36bd964ea66b5d0cc572b8b1fd94e7a8b2723b3b [file] [log] [blame]
piotrab663c82014-08-06 14:14:15 +02001/* -*- c++ -*- */
2/*
3 * Copyright 2014 <+YOU OR YOUR COMPANY+>.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include <gnuradio/io_signature.h>
26#include "message_printer_impl.h"
27
28namespace gr {
29 namespace gsm {
30
31 void message_printer_impl::message_print(pmt::pmt_t msg)
32 {
33 pmt::pmt_t message = pmt::cdr(msg);
34 uint8_t * message_elements = (uint8_t *)pmt::blob_data(message);
35 size_t message_len=pmt::blob_length(message);
36
37// pmt::pmt_t header_blob = pmt::car(msg);
38// gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_blob);
39
40 for(int ii=0; ii<message_len; ii++)
41 {
42 printf(" %02x", message_elements[ii]);
43 }
44 std::cout << std::endl;
45 }
46
47 message_printer::sptr
48 message_printer::make()
49 {
50 return gnuradio::get_initial_sptr
51 (new message_printer_impl());
52 }
53
54 /*
55 * The private constructor
56 */
57 message_printer_impl::message_printer_impl()
58 : gr::block("message_printer",
59 gr::io_signature::make(0, 0, 0),
60 gr::io_signature::make(0, 0, 0))
61 {
62 message_port_register_in(pmt::mp("msgs"));
63 set_msg_handler(pmt::mp("msgs"), boost::bind(&message_printer_impl::message_print, this, _1));
64
65 }
66
67 /*
68 * Our virtual destructor.
69 */
70 message_printer_impl::~message_printer_impl()
71 {
72 }
73 } /* namespace gsm */
74} /* namespace gr */
75