GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
zmq_signal_source.h
Go to the documentation of this file.
1/*!
2 * \file zmq_signal_source.h
3 * \brief Signal source which reads from ZeroMQ.
4 * \author Jim Melton, 2022. jim.melton(at)sncorp.com
5 *
6 * -----------------------------------------------------------------------------
7 *
8 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9 * This file is part of GNSS-SDR.
10 *
11 * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
12 * SPDX-License-Identifier: GPL-3.0-or-later
13 *
14 * -----------------------------------------------------------------------------
15 */
16
17#ifndef GNSS_SDR_ZMQ_SIGNAL_SOURCE_H
18#define GNSS_SDR_ZMQ_SIGNAL_SOURCE_H
19
20#include "signal_source_base.h"
21//
22#include "concurrent_queue.h"
23#include <gnuradio/blocks/file_sink.h> // for dump
24#include <gnuradio/blocks/vector_to_stream.h>
25#include <gnuradio/zeromq/sub_source.h>
26#include <pmt/pmt.h>
27#include <string>
28
29/** \addtogroup Signal_Source
30 * \{ */
31/** \addtogroup Signal_Source_adapters
32 * \{ */
33
34//! This class supports the following properties:
35//!
36//! .endpoint - the ZMQ endpoint to be connected to
37//! .vlen - vector length of the input items (default 1, one item)
38//! this must match the size of the publisher!
39//! .pass_tags - boolean flag if tags should be propagated (default false)
40//! .timeout_ms - receive timeout, in milliseconds (default 100)
41//! .hwm - ZMQ high water mark (default -1, ZMQ default)
42//!
43//! .item_type - data type of the samples (default "gr_complex")
44//!
45//! (probably should be abstracted to the base class)
46//!
47//! .dump - whether to archive input data
48//! .dump_filename - if dumping, path to file for output
49//!
50
51class ZmqSignalSource : public SignalSourceBase
52{
53public:
54 ZmqSignalSource(const ConfigurationInterface* configuration,
55 const std::string& role,
56 unsigned int in_stream,
57 unsigned int out_stream,
59
60 ~ZmqSignalSource() = default;
61
62 size_t item_size() override;
63
64 auto connect(gr::top_block_sptr top_block) -> void override;
65 auto disconnect(gr::top_block_sptr top_block) -> void override;
66 auto get_right_block() -> gr::basic_block_sptr override;
67
68private:
69 gr::zeromq::sub_source::sptr d_source_block;
70 gr::blocks::vector_to_stream::sptr d_vec_block;
71 gr::blocks::file_sink::sptr d_dump_sink;
72
73 size_t d_item_size;
74 std::string d_dump_filename;
75 bool d_dump;
76};
77
78/** \} */
79/** \} */
80#endif
This class implements a thread-safe std::queue.
This abstract class represents an interface to configuration parameters.
SignalSourceBase(ConfigurationInterface const *configuration, std::string role, std::string impl)
Constructor.
Interface of a thread-safe std::queue.
Header file of the base class to signal_source GNSS blocks.