2 * Copyright 2004,2006 Free Software Foundation, Inc.
4 * This file is part of GNU Radio
6 * GNU Radio is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * GNU Radio is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Radio; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street,
19 * Boston, MA 02110-1301, USA.
26 #include <ezdop_source_c.h>
27 #include <gr_io_signature.h>
29 ezdop_source_c_sptr ezdop_make_source_c()
31 return ezdop_source_c_sptr(new ezdop_source_c());
34 ezdop_source_c::ezdop_source_c() throw (std::runtime_error) :
35 gr_sync_block("ezdop_source_c",
36 gr_make_io_signature(0, 0, 0),
37 gr_make_io_signature(1, 1, sizeof (gr_complex))
40 d_ezdop = new ezdop();
43 throw std::runtime_error("unable to init ezdop hardware");
44 if (!d_ezdop->reset())
45 throw std::runtime_error("unable to reset ezdop hardware");
48 ezdop_source_c::~ezdop_source_c()
55 bool ezdop_source_c::start()
58 bool success = d_ezdop->stream();
60 fprintf(stderr, "ezdop_source_c::start(): unable to start streaming\n");
64 bool ezdop_source_c::stop()
67 bool success = d_ezdop->stop_streaming();
69 fprintf(stderr, "ezdop_source_c::start(): unable to stop streaming\n");
73 int ezdop_source_c::rate()
76 return d_ezdop->rate();
79 bool ezdop_source_c::set_rate(int rate)
82 if (rate <= 0 || rate > 2000)
84 bool success = d_ezdop->set_rate(rate);
88 bool ezdop_source_c::rotate()
91 bool success = d_ezdop->rotate();
93 fprintf(stderr, "ezdop_source_c::rotate(): unable to start rotating\n");
97 bool ezdop_source_c::stop_rotating()
100 bool success = d_ezdop->stop_rotating();
102 fprintf(stderr, "ezdop_source_c::stop_rotating(): unable to stop rotating\n");
106 int ezdop_source_c::work(int noutput_items,
107 gr_vector_const_void_star &input_items,
108 gr_vector_void_star &output_items)
111 float volume = 0.0; // Dummy for now
113 gr_complex *out = (gr_complex *)output_items[0];
114 return d_ezdop->read_iq(out, noutput_items, volume);