]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoder.h
Moved decoder config into the popup
[pulseview.git] / pv / data / decoder.h
index 264920a723422c9bf51f5e1fb6947e9f5e03f759..72ccd2ec58622a9119f6e3f15ddbd2d1fa45e831 100644 (file)
 #include <boost/thread.hpp>
 
 #include <QObject>
+#include <QString>
 
 #include <glib.h>
 
 struct srd_decoder;
-struct srd_decoder_inst;
 struct srd_probe;
 struct srd_proto_data;
-struct srd_session;
+
+namespace DecoderTest {
+class TwoDecoder;
+}
 
 namespace pv {
 
 namespace view {
-class Signal;
+class LogicSignal;
 
 namespace decode {
 class Annotation;
@@ -63,25 +66,31 @@ private:
        static const int64_t DecodeChunkLength;
 
 public:
-       Decoder(const srd_decoder *const decoder,
-               std::map<const srd_probe*,
-                       boost::shared_ptr<pv::view::Signal> > probes,
-               GHashTable *options);
+       Decoder(const srd_decoder *const decoder);
 
        virtual ~Decoder();
 
-       const srd_decoder* get_decoder() const;
+       const srd_decoder* decoder() const;
+
+       const std::map<const srd_probe*, boost::shared_ptr<view::LogicSignal> >&
+               probes() const;
+       void set_probes(std::map<const srd_probe*,
+               boost::shared_ptr<view::LogicSignal> > probes);
+
+       const GHashTable* options() const;
+
+       void set_option(const char *id, GVariant *value);
 
        const std::vector< boost::shared_ptr<pv::view::decode::Annotation> >
                annotations() const;
 
+       QString error_message();
+
        void clear_snapshots();
 
 private:
        void begin_decode();
 
-       bool init_decoder();
-
        void decode_proc(boost::shared_ptr<data::Logic> data);
 
        static void annotation_callback(srd_proto_data *pdata,
@@ -91,19 +100,28 @@ signals:
        void new_decode_data();
 
 private:
+
+       /**
+        * This mutex prevents more than one decode operation occuring
+        * concurrently.
+        * @todo A proper solution should be implemented to allow multiple
+        * decode operations.
+        */
+       static boost::mutex _global_decode_mutex;
+
        const srd_decoder *const _decoder;
-       std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
+       std::map<const srd_probe*, boost::shared_ptr<view::LogicSignal> >
                _probes;
        GHashTable *_options;
 
-       srd_session *_session;
-       srd_decoder_inst *_decoder_inst;
-
-       mutable boost::mutex _annotations_mutex;
+       mutable boost::mutex _mutex;
        std::vector< boost::shared_ptr<pv::view::decode::Annotation> >
                _annotations;
+       QString _error_message;
 
        boost::thread _decode_thread;
+
+       friend class DecoderTest::TwoDecoder;
 };
 
 } // namespace data