#include "decodesignal.hpp"
#include "signaldata.hpp"
-#include <pv/binding/decoder.hpp>
#include <pv/data/decode/decoder.hpp>
#include <pv/data/decode/row.hpp>
#include <pv/globalsettings.hpp>
using std::shared_ptr;
using std::unique_lock;
using pv::data::decode::Annotation;
+using pv::data::decode::DecodeChannel;
using pv::data::decode::Decoder;
using pv::data::decode::Row;
// Make sure that all assigned channels still provide logic data
// (can happen when a converted signal was assigned but the
// conversion removed in the meanwhile)
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal && !(ch.assigned_signal->logic_data() != nullptr))
ch.assigned_signal = nullptr;
return error_message_;
}
-const vector<data::DecodeChannel> DecodeSignal::get_channels() const
+const vector<decode::DecodeChannel> DecodeSignal::get_channels() const
{
return channels_;
}
bool new_assignment = false;
// Try to auto-select channels that don't have signals assigned yet
- for (data::DecodeChannel& ch : channels_) {
+ for (decode::DecodeChannel& ch : channels_) {
// If a decoder is given, auto-assign only its channels
if (dec && (ch.decoder_ != dec))
continue;
void DecodeSignal::assign_signal(const uint16_t channel_id, const SignalBase *signal)
{
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.id == channel_id) {
ch.assigned_signal = signal;
logic_mux_data_invalid_ = true;
{
// Count all channels that have a signal assigned to them
return count_if(channels_.begin(), channels_.end(),
- [](data::DecodeChannel ch) { return ch.assigned_signal; });
+ [](decode::DecodeChannel ch) { return ch.assigned_signal; });
}
void DecodeSignal::set_initial_pin_state(const uint16_t channel_id, const int init_state)
{
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.id == channel_id)
ch.initial_pin_state = init_state;
int64_t count = std::numeric_limits<int64_t>::max();
bool no_signals_assigned = true;
- for (const data::DecodeChannel& ch : channels_)
+ for (const decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal) {
no_signals_assigned = false;
for (unsigned int channel_id = 0; channel_id < channels_.size(); channel_id++) {
auto channel = find_if(channels_.begin(), channels_.end(),
- [&](data::DecodeChannel ch) { return ch.id == channel_id; });
+ [&](decode::DecodeChannel ch) { return ch.id == channel_id; });
if (channel == channels_.end()) {
qDebug() << "ERROR: Gap in channel index:" << channel_id;
for (unsigned int channel_id = 0; channel_id < channels; channel_id++) {
auto channel = find_if(channels_.begin(), channels_.end(),
- [&](data::DecodeChannel ch) { return ch.id == channel_id; });
+ [&](decode::DecodeChannel ch) { return ch.id == channel_id; });
if (channel == channels_.end()) {
qDebug() << "ERROR: Non-existant channel index:" << channel_id;
uint64_t count = std::numeric_limits<uint64_t>::max();
bool no_signals_assigned = true;
- for (const data::DecodeChannel& ch : channels_)
+ for (const decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal) {
no_signals_assigned = false;
{
double samplerate = 0;
- for (const data::DecodeChannel& ch : channels_)
+ for (const decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal) {
const shared_ptr<Logic> logic_data = ch.assigned_signal->logic_data();
if (!logic_data || logic_data->logic_segments().empty())
void DecodeSignal::update_channel_list()
{
- vector<data::DecodeChannel> prev_channels = channels_;
+ vector<decode::DecodeChannel> prev_channels = channels_;
channels_.clear();
uint16_t id = 0;
bool ch_added = false;
// Copy but update ID if this channel was in the list before
- for (data::DecodeChannel& ch : prev_channels)
+ for (decode::DecodeChannel& ch : prev_channels)
if (ch.pdch_ == pdch) {
ch.id = id++;
channels_.push_back(ch);
if (!ch_added) {
// Create new entry without a mapped signal
- data::DecodeChannel ch = {id++, 0, false, nullptr,
+ decode::DecodeChannel ch = {id++, 0, false, nullptr,
QString::fromUtf8(pdch->name), QString::fromUtf8(pdch->desc),
SRD_INITIAL_PIN_SAME_AS_SAMPLE0, decoder, pdch};
channels_.push_back(ch);
bool ch_added = false;
// Copy but update ID if this channel was in the list before
- for (data::DecodeChannel& ch : prev_channels)
+ for (decode::DecodeChannel& ch : prev_channels)
if (ch.pdch_ == pdch) {
ch.id = id++;
channels_.push_back(ch);
if (!ch_added) {
// Create new entry without a mapped signal
- data::DecodeChannel ch = {id++, 0, true, nullptr,
+ decode::DecodeChannel ch = {id++, 0, true, nullptr,
QString::fromUtf8(pdch->name), QString::fromUtf8(pdch->desc),
SRD_INITIAL_PIN_SAME_AS_SAMPLE0, decoder, pdch};
channels_.push_back(ch);
} else {
// Same number but assignment may still differ, so compare all channels
for (size_t i = 0; i < channels_.size(); i++) {
- const data::DecodeChannel& p_ch = prev_channels[i];
- const data::DecodeChannel& ch = channels_[i];
+ const decode::DecodeChannel& p_ch = prev_channels[i];
+ const decode::DecodeChannel& ch = channels_[i];
if ((p_ch.pdch_ != ch.pdch_) ||
(p_ch.assigned_signal != ch.assigned_signal)) {
{
// Submit channel list to every decoder, containing only the relevant channels
for (shared_ptr<decode::Decoder> dec : stack_) {
- vector<data::DecodeChannel*> channel_list;
+ vector<decode::DecodeChannel*> channel_list;
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.decoder_ == dec)
channel_list.push_back(&ch);
// Channel bit IDs must be in sync with the channel's apperance in channels_
int id = 0;
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal)
ch.bit_id = id++;
}
vector<uint8_t> signal_in_bytepos;
vector<uint8_t> signal_in_bitpos;
- for (data::DecodeChannel& ch : channels_)
+ for (decode::DecodeChannel& ch : channels_)
if (ch.assigned_signal) {
const shared_ptr<Logic> logic_data = ch.assigned_signal->logic_data();
disconnect(this, SLOT(on_data_received()));
// Connect the currently used signals to our slot
- for (data::DecodeChannel& ch : channels_) {
+ for (decode::DecodeChannel& ch : channels_) {
if (!ch.assigned_signal)
continue;