* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PULSEVIEW_PV_DATA_SIGNALBASE_HPP
#include <QColor>
#include <QObject>
+#include <QSettings>
#include <QString>
#include <libsigrokcxx/libsigrokcxx.hpp>
+using std::shared_ptr;
namespace sigrok {
class Channel;
-class ChannelType;
}
namespace pv {
namespace data {
class Analog;
+class DecoderStack;
class Logic;
class SignalData;
{
Q_OBJECT
+public:
+ enum ChannelType {
+ AnalogChannel = 1,
+ LogicChannel,
+ DecodeChannel,
+ A2LChannel, // Analog converted to logic, joint representation
+ MathChannel
+ };
+
private:
static const int ColourBGAlpha;
public:
- SignalBase(std::shared_ptr<sigrok::Channel> channel);
+ SignalBase(shared_ptr<sigrok::Channel> channel, ChannelType channel_type);
virtual ~SignalBase() {}
public:
/**
* Returns the underlying SR channel.
*/
- std::shared_ptr<sigrok::Channel> channel() const;
+ shared_ptr<sigrok::Channel> channel() const;
/**
* Returns enabled status of this channel.
/**
* Gets the type of this channel.
*/
- const sigrok::ChannelType *type() const;
+ ChannelType type() const;
/**
* Gets the index number of this channel.
*/
QString name() const;
+ /**
+ * Gets the internal name of this signal, i.e. how the device calls it.
+ */
+ QString internal_name() const;
+
/**
* Sets the name of the signal.
*/
/**
* Sets the internal data object.
*/
- void set_data(std::shared_ptr<pv::data::SignalData> data);
+ void set_data(shared_ptr<pv::data::SignalData> data);
/**
* Get the internal data as analog data object in case of analog type.
*/
- std::shared_ptr<pv::data::Analog> analog_data() const;
+ shared_ptr<pv::data::Analog> analog_data() const;
/**
* Get the internal data as logic data object in case of logic type.
*/
- std::shared_ptr<pv::data::Logic> logic_data() const;
+ shared_ptr<pv::data::Logic> logic_data() const;
+#ifdef ENABLE_DECODE
+ bool is_decode_signal() const;
+
+ shared_ptr<pv::data::DecoderStack> decoder_stack() const;
+
+ void set_decoder_stack(shared_ptr<pv::data::DecoderStack> decoder_stack);
+#endif
+
+ void save_settings(QSettings &settings) const;
+
+ void restore_settings(QSettings &settings);
Q_SIGNALS:
void enabled_changed(const bool &value);
void colour_changed(const QColor &colour);
private:
- std::shared_ptr<sigrok::Channel> channel_;
- std::shared_ptr<pv::data::SignalData> data_;
+ shared_ptr<sigrok::Channel> channel_;
+ ChannelType channel_type_;
+ shared_ptr<pv::data::SignalData> data_;
+
+#ifdef ENABLE_DECODE
+ shared_ptr<pv::data::DecoderStack> decoder_stack_;
+#endif
- QString name_;
+ QString internal_name_, name_;
QColor colour_, bgcolour_;
};