X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fdecode%2Fdecoder.cpp;h=8e7ffb50072b14577c0adce5ef4013d998eb18bd;hp=45a33e4aa56e119405602df41006a49f46cc1447;hb=e77de61fbc19633c77cc196332ae79c26d9ca35d;hpb=163f3499429d7a16fd9d5c536f96fd8c822ccf44 diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 45a33e4a..8e7ffb50 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -41,6 +41,14 @@ Decoder::Decoder(const srd_decoder *const dec) : shown_(true), decoder_inst_(nullptr) { + // Query the decoder outputs + uint8_t i = 0; + for (GSList *l = dec->binary; l; l = l->next) { + char **bin_class = (char**)l->data; + char *name = bin_class[0]; + char *desc = bin_class[1]; + bin_classes_.push_back({i++, name, desc}); + } } Decoder::~Decoder() @@ -54,6 +62,11 @@ const srd_decoder* Decoder::decoder() const return decoder_; } +const char* Decoder::name() const +{ + return decoder_->name; +} + bool Decoder::shown() const { return shown_; @@ -171,6 +184,16 @@ void Decoder::invalidate_decoder_inst() decoder_inst_ = nullptr; } +uint8_t Decoder::get_binary_class_count() const +{ + return bin_classes_.size(); +} + +const DecodeBinaryClassInfo* Decoder::get_binary_class(uint8_t id) const +{ + return &(bin_classes_.at(id)); +} + } // namespace decode } // namespace data } // namespace pv