blob: 4fdb37360538ecccaf91b8b6446945b2ca84dd02 [file] [log] [blame]
piotr6c692872014-02-08 14:16:26 +01001/* -*- 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 "bursts_printer_impl.h"
27
28namespace gr {
29 namespace gsm {
30 void bursts_printer_impl::bursts_print(pmt::pmt_t burst)
31 {
32 int ii;
33 size_t burst_len;
34 int8_t *burst_elements = pmt::s8vector_writable_elements(burst, burst_len);
35
36 for(ii=0; ii<burst_len; ii++)
37 {
38 std::cout << std::setprecision(1) << static_cast<int>(burst_elements[ii]) << "";
39 }
40 std::cout << std::endl;
41 }
42
43 bursts_printer::sptr
44 bursts_printer::make()
45 {
46 return gnuradio::get_initial_sptr
47 (new bursts_printer_impl());
48 }
49
50 /*
51 * The private constructor
52 */
53 bursts_printer_impl::bursts_printer_impl()
54 : gr::block("bursts_printer",
55 gr::io_signature::make(0, 0, 0),
56 gr::io_signature::make(0, 0, 0))
57 {
58 message_port_register_in(pmt::mp("bursts"));
59 set_msg_handler(pmt::mp("bursts"), boost::bind(&bursts_printer_impl::bursts_print, this, _1));
60 }
61
62 /*
63 * Our virtual destructor.
64 */
65 bursts_printer_impl::~bursts_printer_impl()
66 {
67 }
68
69
70 } /* namespace gsm */
71} /* namespace gr */
72