]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decodesignal.hpp
Re-use DecodeTrace::ChannelSelector as DecodeChannel
[pulseview.git] / pv / data / decodesignal.hpp
index 0f3a0330e3ad9029ad742d796294452d091f91ef..f9b866e27e583ce66b593516e6983e55937477ba 100644 (file)
@@ -43,8 +43,20 @@ class Row;
 
 class DecoderStack;
 class Logic;
 
 class DecoderStack;
 class Logic;
+class SignalBase;
 class SignalData;
 
 class SignalData;
 
+struct DecodeChannel
+{
+       uint16_t id;  // Also tells which bit within a sample represents this channel
+       const bool is_optional;
+       const pv::data::SignalBase *assigned_signal;
+       const QString name, desc;
+       int initial_pin_state;
+       const shared_ptr<pv::data::decode::Decoder> decoder_;
+       const srd_channel *pdch_;
+};
+
 class DecodeSignal : public SignalBase
 {
        Q_OBJECT
 class DecodeSignal : public SignalBase
 {
        Q_OBJECT
@@ -63,6 +75,11 @@ public:
 
        QString error_message() const;
 
 
        QString error_message() const;
 
+       const list<data::DecodeChannel> get_channels() const;
+       void assign_signal(const uint16_t channel_id, const SignalBase *signal);
+
+       void set_initial_pin_state(const uint16_t channel_id, const int init_state);
+
        vector<decode::Row> visible_rows() const;
 
        /**
        vector<decode::Row> visible_rows() const;
 
        /**
@@ -73,14 +90,19 @@ public:
                const decode::Row &row, uint64_t start_sample,
                uint64_t end_sample) const;
 
                const decode::Row &row, uint64_t start_sample,
                uint64_t end_sample) const;
 
+private:
+       void update_channel_list();
+
 Q_SIGNALS:
        void new_annotations();
 Q_SIGNALS:
        void new_annotations();
+       void channels_updated();
 
 private Q_SLOTS:
        void on_new_annotations();
 
 private:
        shared_ptr<pv::data::DecoderStack> decoder_stack_;
 
 private Q_SLOTS:
        void on_new_annotations();
 
 private:
        shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       list<data::DecodeChannel> channels_;
 };
 
 } // namespace data
 };
 
 } // namespace data