- // Create the decoder instance
- srd_decoder_inst *const decoder_inst = srd_inst_new(
- session, _decoder->id, _options);
- if(!decoder_inst)
- return NULL;
-
- // Setup the probes
- GHashTable *const probes = g_hash_table_new_full(g_str_hash,
+ GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
+ g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
+
+ 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);
+ }
+
+ if (decoder_inst_)
+ qDebug() << "WARNING: previous decoder instance" << decoder_inst_ << "exists";
+
+ decoder_inst_ = srd_inst_new(session, decoder_->id, opt_hash);
+ g_hash_table_destroy(opt_hash);
+
+ if (!decoder_inst_)
+ return nullptr;
+
+ // Setup the channels
+ GArray *const init_pin_states = g_array_sized_new(false, true,
+ sizeof(uint8_t), channels_.size());
+
+ g_array_set_size(init_pin_states, channels_.size());
+
+ GHashTable *const channels = g_hash_table_new_full(g_str_hash,