]> sigrok.org Git - pulseview.git/blobdiff - pv/data/signalbase.hpp
Channels: Let "Enable all changing" also check for sample data
[pulseview.git] / pv / data / signalbase.hpp
index fd7c38f5ea627d768830170db4768d46ad81fd69..3356af5b786ad3fefeace38f7d42fe32dc7bdfa7 100644 (file)
@@ -30,6 +30,7 @@
 #include <QObject>
 #include <QSettings>
 #include <QString>
+#include <QTimer>
 #include <QVariant>
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
@@ -50,8 +51,10 @@ namespace pv {
 namespace data {
 
 class Analog;
+class AnalogSegment;
 class DecoderStack;
 class Logic;
+class LogicSegment;
 class SignalData;
 
 class SignalBase : public QObject
@@ -85,6 +88,7 @@ public:
 private:
        static const int ColourBGAlpha;
        static const uint64_t ConversionBlockSize;
+       static const uint32_t ConversionDelay;
 
 public:
        SignalBase(shared_ptr<sigrok::Channel> channel, ChannelType channel_type);
@@ -136,6 +140,12 @@ public:
         */
        QString internal_name() const;
 
+       /**
+        * Produces a string for this signal that can be used for display,
+        * i.e. it contains one or both of the signal/internal names.
+        */
+       QString display_name() const;
+
        /**
         * Sets the name of the signal.
         */
@@ -171,6 +181,17 @@ public:
         */
        shared_ptr<pv::data::Logic> logic_data() const;
 
+       /**
+        * Determines whether a given segment is complete (i.e. end-of-frame has
+        * been seen). It only considers the original data, not the converted data.
+        */
+       bool segment_is_complete(uint32_t segment_id) const;
+
+       /**
+        * Determines whether this signal has any sample data at all.
+        */
+       bool has_samples() const;
+
        /**
         * Queries the kind of conversion performed on this channel.
         */
@@ -255,7 +276,7 @@ public:
 
        virtual void restore_settings(QSettings &settings);
 
-       void start_conversion();
+       void start_conversion(bool delayed_start=false);
 
 private:
        bool conversion_is_a2l() const;
@@ -264,7 +285,11 @@ private:
        uint8_t convert_a2l_schmitt_trigger(float lo_thr, float hi_thr,
                float value, uint8_t &state);
 
-       void conversion_thread_proc(QObject* segment);
+       void convert_single_segment_range(AnalogSegment *asegment,
+               LogicSegment *lsegment, uint64_t start_sample, uint64_t end_sample);
+       void convert_single_segment(pv::data::AnalogSegment *asegment,
+               pv::data::LogicSegment *lsegment);
+       void conversion_thread_proc();
 
        void stop_conversion();
 
@@ -279,9 +304,11 @@ Q_SIGNALS:
 
        void samples_cleared();
 
-       void samples_added(QObject* segment, uint64_t start_sample,
+       void samples_added(uint64_t segment_id, uint64_t start_sample,
                uint64_t end_sample);
 
+       void min_max_changed(float min, float max);
+
 private Q_SLOTS:
        void on_samples_cleared();
 
@@ -292,6 +319,8 @@ private Q_SLOTS:
 
        void on_capture_state_changed(int state);
 
+       void on_delayed_conversion_start();
+
 protected:
        shared_ptr<sigrok::Channel> channel_;
        ChannelType channel_type_;
@@ -306,6 +335,7 @@ protected:
        atomic<bool> conversion_interrupt_;
        mutex conversion_input_mutex_;
        condition_variable conversion_input_cond_;
+       QTimer delayed_conversion_starter_;
 
        QString internal_name_, name_;
        QColor colour_, bgcolour_;