X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fdecoder.h;h=72ccd2ec58622a9119f6e3f15ddbd2d1fa45e831;hp=228aedabe1a03899b6adc5c1dccbe219cf678309;hb=4e5a4405482a296ebb6014e627298ad156c78d55;hpb=119aff65d8ad0c4cdaff32d9b68cee00d90a5f35 diff --git a/pv/data/decoder.h b/pv/data/decoder.h index 228aedab..72ccd2ec 100644 --- a/pv/data/decoder.h +++ b/pv/data/decoder.h @@ -23,22 +23,105 @@ #include "signaldata.h" +#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 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); + Decoder(const srd_decoder *const decoder); + + virtual ~Decoder(); + + const srd_decoder* decoder() const; - const srd_decoder* get_decoder() const; + const std::map >& + probes() const; + void set_probes(std::map > probes); + + 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 > + _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