X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fdecoder.h;h=72ccd2ec58622a9119f6e3f15ddbd2d1fa45e831;hb=ce94e4fd5d7ab666259231d21759613f1f2b93ee;hp=ddcf6674ba15c0d5bb59dc6abd37ae81a7683e33;hpb=708c552391bc942e91bc09bc808577e2564347bd;p=pulseview.git diff --git a/pv/data/decoder.h b/pv/data/decoder.h index ddcf667..72ccd2e 100644 --- a/pv/data/decoder.h +++ b/pv/data/decoder.h @@ -26,32 +26,102 @@ #include #include +#include + +#include +#include + +#include struct srd_decoder; struct srd_probe; +struct srd_proto_data; + +namespace DecoderTest { +class TwoDecoder; +} namespace pv { namespace view { -class Signal; +class LogicSignal; + +namespace decode { +class Annotation; +} + } namespace data { -class Decoder : public SignalData +class Logic; + +class Decoder : public QObject, public SignalData { + Q_OBJECT + +private: + static const double DecodeMargin; + static const double DecodeThreshold; + static const int64_t DecodeChunkLength; + public: - Decoder(const srd_decoder *const dec, std::map > probes); + Decoder(const srd_decoder *const decoder); + + virtual ~Decoder(); + + const srd_decoder* decoder() const; + + const std::map >& + probes() const; + void set_probes(std::map > probes); - const srd_decoder* get_decoder() const; + const GHashTable* options() const; + + void set_option(const char *id, GVariant *value); + + const std::vector< boost::shared_ptr > + annotations() const; + + QString error_message(); void clear_snapshots(); private: + void begin_decode(); + + void decode_proc(boost::shared_ptr data); + + static void annotation_callback(srd_proto_data *pdata, + void *decoder); + +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 > + std::map > _probes; + GHashTable *_options; + + mutable boost::mutex _mutex; + std::vector< boost::shared_ptr > + _annotations; + QString _error_message; + + boost::thread _decode_thread; + + friend class DecoderTest::TwoDecoder; }; } // namespace data