GNU Radio's HNCHIIO Package
hnchbbboard_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 Analog Devices Inc.
4 * Author: Paul Cercueil <paul.cercueil@analog.com>
5 *
6 * This 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 3, or (at your option)
9 * any later version.
10 *
11 * This software 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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this software; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street,
19 * Boston, MA 02110-1301, USA.
20 */
21
22
23#ifndef INCLUDED_HNCHIIO_HNCHBBBOARD_SOURCE_H
24#define INCLUDED_HNCHIIO_HNCHBBBOARD_SOURCE_H
25
27#include <gnuradio/hier_block2.h>
28#include <gnuradio/sync_block.h>
29
30#include "device_source.h"
31
32namespace gr {
33 namespace hnchiio {
34
35 /*!
36 * \brief <+description of block+>
37 * \ingroup hnchiio
38 *
39 */
40 class IIO_API hnchbbboard_source : virtual public gr::sync_block
41 {
42 public:
43 typedef std::shared_ptr<hnchbbboard_source> sptr;
44
45 /*!
46 * \brief Return a shared_ptr to a new instance of hnchiio::device.
47 *
48 * To avoid accidental use of raw pointers, hnchiio::device's
49 * constructor is in a private implementation
50 * class. hnchiio::device::make is the public interface for
51 * creating new instances.
52 */
53 static sptr make(const std::string &uri, unsigned long long frequency,
54 unsigned long samplerate, int stream_id,
55 unsigned long buffer_size, double gain_value);
56
57 static sptr make_from(struct iio_context *ctx,
58 unsigned long long frequency, unsigned long samplerate,
59 int stream_id, unsigned long buffer_size, double gain_value);
60
61 virtual void set_params(unsigned long long frequency,
62 unsigned long samplerate, double gain_value) = 0;
63 };
64
65 class IIO_API hnchbbboard_source_f32c : virtual public gr::hier_block2
66 {
67 public:
68 typedef std::shared_ptr<hnchbbboard_source_f32c> sptr;
69
70 static sptr make(const std::string &uri,
71 unsigned long long frequency, unsigned long samplerate,
72 int stream_id, unsigned long buffer_size, double gain_value)
73 {
75 frequency, samplerate,
76 stream_id, buffer_size, gain_value);
77
78 return gnuradio::get_initial_sptr(
79 new hnchbbboard_source_f32c(stream_id, block));
80 }
81
82 void set_params(unsigned long long frequency,
83 unsigned long samplerate, double gain_value)
84 {
85 hnchbbboard_block->set_params(frequency, samplerate, gain_value);
86 }
87 private:
88 hnchbbboard_source::sptr hnchbbboard_block;
89
90 protected:
91 explicit hnchbbboard_source_f32c(int stream_id,
93 };
94
95 } // namespace hnchiio
96} // namespace gr
97
98#endif /* INCLUDED_HNCHIIO_HNCHBBBOARD_SOURCE_H */
99
#define IIO_API
Definition api.h:19
static sptr make(const std::string &uri, unsigned long long frequency, unsigned long samplerate, int stream_id, unsigned long buffer_size, double gain_value)
Definition hnchbbboard_source.h:70
void set_params(unsigned long long frequency, unsigned long samplerate, double gain_value)
Definition hnchbbboard_source.h:82
std::shared_ptr< hnchbbboard_source_f32c > sptr
Definition hnchbbboard_source.h:68
hnchbbboard_source_f32c(int stream_id, hnchbbboard_source::sptr block)
<+description of block+>
Definition hnchbbboard_source.h:41
static sptr make_from(struct iio_context *ctx, unsigned long long frequency, unsigned long samplerate, int stream_id, unsigned long buffer_size, double gain_value)
virtual void set_params(unsigned long long frequency, unsigned long samplerate, double gain_value)=0
std::shared_ptr< hnchbbboard_source > sptr
Definition hnchbbboard_source.h:43
static sptr make(const std::string &uri, unsigned long long frequency, unsigned long samplerate, int stream_id, unsigned long buffer_size, double gain_value)
Return a shared_ptr to a new instance of hnchiio::device.
Definition device_sink.h:36
Definition device_sink.h:35