#include <pv/data/signalbase.hpp>
#include <pv/data/decodesignal.hpp>
-using pv::data::DecodeChannel;
using std::map;
using std::string;
shown_(true),
decoder_inst_(nullptr)
{
+ // Query the decoder outputs
+ uint32_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()
return decoder_;
}
+const char* Decoder::name() const
+{
+ return decoder_->name;
+}
+
bool Decoder::shown() const
{
return shown_;
options_[id] = value;
// If we have a decoder instance, apply option value immediately
+ apply_all_options();
+}
+
+void Decoder::apply_all_options()
+{
if (decoder_inst_) {
GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
- g_variant_ref(value);
- g_hash_table_insert(opt_hash, (void*)g_strdup(id), value);
+ for (const auto& option : options_) {
+ GVariant *const value = option.second;
+ g_variant_ref(value);
+ g_hash_table_replace(opt_hash, (void*)g_strdup(
+ option.first.c_str()), value);
+ }
srd_inst_option_set(decoder_inst_, opt_hash);
g_hash_table_destroy(opt_hash);
decoder_inst_ = nullptr;
}
+uint32_t Decoder::get_binary_class_count() const
+{
+ return bin_classes_.size();
+}
+
+const DecodeBinaryClassInfo* Decoder::get_binary_class(uint32_t id) const
+{
+ return &(bin_classes_.at(id));
+}
+
} // namespace decode
} // namespace data
} // namespace pv