2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef PULSEVIEW_PV_DATA_SIGNALBASE_HPP
23 #define PULSEVIEW_PV_DATA_SIGNALBASE_HPP
29 #include <libsigrokcxx/libsigrokcxx.hpp>
45 class SignalBase : public QObject
50 static const int ColourBGAlpha;
53 SignalBase(std::shared_ptr<sigrok::Channel> channel);
54 virtual ~SignalBase() {}
58 * Returns the underlying SR channel.
60 std::shared_ptr<sigrok::Channel> channel() const;
63 * Returns enabled status of this channel.
68 * Sets the enabled status of this channel.
69 * @param value Boolean value to set.
71 void set_enabled(bool value);
74 * Gets the type of this channel.
76 const sigrok::ChannelType *type() const;
79 * Gets the index number of this channel.
81 unsigned int index() const;
84 * Gets the name of this signal.
89 * Gets the internal name of this signal, i.e. how the device calls it.
91 QString internal_name() const;
94 * Sets the name of the signal.
96 virtual void set_name(QString name);
99 * Get the colour of the signal.
101 QColor colour() const;
104 * Set the colour of the signal.
106 void set_colour(QColor colour);
109 * Get the background colour of the signal.
111 QColor bgcolour() const;
114 * Sets the internal data object.
116 void set_data(std::shared_ptr<pv::data::SignalData> data);
119 * Get the internal data as analog data object in case of analog type.
121 std::shared_ptr<pv::data::Analog> analog_data() const;
124 * Get the internal data as logic data object in case of logic type.
126 std::shared_ptr<pv::data::Logic> logic_data() const;
129 bool is_decode_signal() const;
131 std::shared_ptr<pv::data::DecoderStack> decoder_stack() const;
133 void set_decoder_stack(std::shared_ptr<pv::data::DecoderStack>
138 void enabled_changed(const bool &value);
140 void name_changed(const QString &name);
142 void colour_changed(const QColor &colour);
145 std::shared_ptr<sigrok::Channel> channel_;
146 std::shared_ptr<pv::data::SignalData> data_;
149 std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
152 QString internal_name_, name_;
153 QColor colour_, bgcolour_;
159 #endif // PULSEVIEW_PV_DATA_SIGNALBASE_HPP