GNU Radio's HNCHIIO Package
hnchboard2_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_HNCHBOARD2_SOURCE_H
24#define INCLUDED_HNCHIIO_HNCHBOARD2_SOURCE_H
25
27#include <gnuradio/hier_block2.h>
28#include <gnuradio/sync_block.h>
29
30#include "flexi_source.h"
31
32namespace gr {
33 namespace hnchiio {
34
35 /*!
36 * \brief <+description of block+>
37 * \ingroup hnchiio
38 *
39 */
40 class IIO_API hnchboard2_source : virtual public gr::sync_block
41 {
42 public:
43 typedef std::shared_ptr<hnchboard2_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 samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size);
54
55 static sptr make_from(struct iio_context *ctx, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size);
56
57 virtual void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value) = 0;
58 };
59
60 class IIO_API hnchboard2_source_f32c : virtual public gr::hier_block2
61 {
62 public:
63 typedef std::shared_ptr<hnchboard2_source_f32c> sptr;
64
65 static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
66 {
67 hnchboard2_source::sptr block = hnchboard2_source::make(uri, samplerate, lo_freq, gain_value, buffer_size);
68
69 return gnuradio::get_initial_sptr(
70 new hnchboard2_source_f32c(block));
71 }
72
73 void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value)
74 {
75 hnchboard2_block->set_params(samplerate, lo_freq, gain_value);
76 }
77 private:
78 hnchboard2_source::sptr hnchboard2_block;
79
80 protected:
82 };
83
84 } // namespace hnchiio
85} // namespace gr
86
87#endif /* INCLUDED_HNCHIIO_HNCHBOARD2_SOURCE_H */
#define IIO_API
Definition api.h:19
hnchboard2_source_f32c(hnchboard2_source::sptr block)
std::shared_ptr< hnchboard2_source_f32c > sptr
Definition hnchboard2_source.h:63
static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
Definition hnchboard2_source.h:65
void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value)
Definition hnchboard2_source.h:73
<+description of block+>
Definition hnchboard2_source.h:41
virtual void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value)=0
static sptr make_from(struct iio_context *ctx, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
Return a shared_ptr to a new instance of hnchiio::device.
std::shared_ptr< hnchboard2_source > sptr
Definition hnchboard2_source.h:43
Definition device_sink.h:36
Definition device_sink.h:35