const srd_proto_data_logic *const pdl = (const srd_proto_data_logic*)pdata->data;
assert(pdl);
+ assert(pdl->logic_group == 0); // FIXME Only one group supported for now
+
shared_ptr<Logic> output_logic = ds->output_logic_.at(decc);
vector< shared_ptr<Segment> > segments = output_logic->segments();
output_logic->push_segment(last_segment);
}
- vector<uint8_t> data;
- for (unsigned int i = pdata->start_sample; i < pdata->end_sample; i++)
- data.emplace_back(*((uint8_t*)pdl->data));
+ if (pdata->start_sample < pdata->end_sample) {
+ vector<uint8_t> data;
+ data.reserve(pdl->repeat_count + 1); // FIXME Include unit size in calculation
+ for (unsigned int i = 0; i <= pdl->repeat_count; i++)
+ // FIXME Currently only supports 8 channels as we ignore the unit size
+ data.emplace_back(*((uint8_t*)pdl->data));
+
+ last_segment->append_payload(data.data(), data.size());
- last_segment->append_subsignal_payload(pdl->logic_class, data.data(),
- data.size(), ds->output_logic_muxed_data_.at(decc));
+ qInfo() << "Received logic output state change for group" << pdl->logic_group << "from decoder" \
+ << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample << ":" << *((uint8_t*)pdl->data);
- qInfo() << "Received logic output state change for class" << pdl->logic_class << "from decoder" \
- << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample;
+ } else
+ qWarning() << "Ignoring malformed logic output state change for group" << pdl->logic_group << "from decoder" \
+ << QString::fromUtf8(decc->name) << "from" << pdata->start_sample << "to" << pdata->end_sample;
}
void DecodeSignal::on_capture_state_changed(int state)