]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decodesignal.hpp
Re-use DecodeTrace::ChannelSelector as DecodeChannel
[pulseview.git] / pv / data / decodesignal.hpp
index 23ab209b73a2faa784806fe5d24b68abd6683e96..f9b866e27e583ce66b593516e6983e55937477ba 100644 (file)
 #ifndef PULSEVIEW_PV_DATA_DECODESIGNAL_HPP
 #define PULSEVIEW_PV_DATA_DECODESIGNAL_HPP
 
+#include <vector>
+
+#include <QString>
+
 #include <libsigrokdecode/libsigrokdecode.h>
 
 #include <pv/data/signalbase.hpp>
 
+using std::list;
+using std::vector;
 using std::shared_ptr;
 
 namespace pv {
 namespace data {
 
+namespace decode {
+class Annotation;
+class Decoder;
+class Row;
+}
+
 class DecoderStack;
 class Logic;
+class SignalBase;
 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
@@ -42,20 +66,43 @@ public:
        virtual ~DecodeSignal();
 
        bool is_decode_signal() const;
-       shared_ptr<pv::data::DecoderStack> decoder_stack() const;
+       shared_ptr<data::DecoderStack> decoder_stack() const;
+       const list< shared_ptr<data::decode::Decoder> >& decoder_stack_list() const;
 
        void stack_decoder(srd_decoder *decoder);
        void remove_decoder(int index);
        bool toggle_decoder_visibility(int index);
 
+       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;
+
+       /**
+        * Extracts sorted annotations between two period into a vector.
+        */
+       void get_annotation_subset(
+               vector<pv::data::decode::Annotation> &dest,
+               const decode::Row &row, uint64_t start_sample,
+               uint64_t end_sample) const;
+
+private:
+       void update_channel_list();
+
 Q_SIGNALS:
        void new_annotations();
+       void channels_updated();
 
 private Q_SLOTS:
        void on_new_annotations();
 
 private:
        shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       list<data::DecodeChannel> channels_;
 };
 
 } // namespace data