mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
Remove class 'GroupSnapshot'
This commit is contained in:
parent
7dbfbaf9a5
commit
b5b54200ca
@ -269,9 +269,7 @@ set(DSView_SOURCES
|
|||||||
DSView/pv/dock/measuredock.cpp
|
DSView/pv/dock/measuredock.cpp
|
||||||
DSView/pv/dock/searchdock.cpp
|
DSView/pv/dock/searchdock.cpp
|
||||||
DSView/pv/toolbars/logobar.cpp
|
DSView/pv/toolbars/logobar.cpp
|
||||||
DSView/pv/data/groupsnapshot.cpp
|
|
||||||
DSView/pv/view/groupsignal.cpp
|
DSView/pv/view/groupsignal.cpp
|
||||||
DSView/pv/data/group.cpp
|
|
||||||
DSView/pv/dialogs/about.cpp
|
DSView/pv/dialogs/about.cpp
|
||||||
DSView/pv/dialogs/search.cpp
|
DSView/pv/dialogs/search.cpp
|
||||||
DSView/pv/data/dsosnapshot.cpp
|
DSView/pv/data/dsosnapshot.cpp
|
||||||
|
@ -48,6 +48,7 @@ DsoSnapshot::DsoSnapshot() :
|
|||||||
_envelope_en = false;
|
_envelope_en = false;
|
||||||
_envelope_done = false;
|
_envelope_done = false;
|
||||||
_instant = false;
|
_instant = false;
|
||||||
|
_threshold = 0;
|
||||||
|
|
||||||
memset(_envelope_levels, 0, sizeof(_envelope_levels));
|
memset(_envelope_levels, 0, sizeof(_envelope_levels));
|
||||||
}
|
}
|
||||||
@ -478,18 +479,30 @@ uint64_t DsoSnapshot::get_block_size(int block_index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DsoSnapshot::get_max_min_value(uint8_t &maxv, uint8_t &minv)
|
bool DsoSnapshot::get_max_min_value(uint8_t &maxv, uint8_t &minv, int chan_index)
|
||||||
{
|
{
|
||||||
if (this->empty() == false){
|
if (_sample_count == 0){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chan_index < 0 || chan_index >= _ch_data.size()){
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *p = _ch_data[chan_index];
|
||||||
|
maxv = *p;
|
||||||
|
minv = *p;
|
||||||
|
|
||||||
|
for (uint64_t i=1; i<_sample_count; i++){
|
||||||
|
p++;
|
||||||
|
if (*p > maxv)
|
||||||
|
maxv = *p;
|
||||||
|
if (*p < minv)
|
||||||
|
minv = *p;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* DsoSnapshot::get_data(){
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace data
|
} // namespace data
|
||||||
} // namespace pv
|
} // namespace pv
|
||||||
|
@ -102,8 +102,15 @@ public:
|
|||||||
int get_block_num();
|
int get_block_num();
|
||||||
uint64_t get_block_size(int block_index);
|
uint64_t get_block_size(int block_index);
|
||||||
|
|
||||||
bool get_max_min_value(uint8_t &maxv, uint8_t &minv);
|
bool get_max_min_value(uint8_t &maxv, uint8_t &minv, int chan_index);
|
||||||
void* get_data();
|
|
||||||
|
inline void set_threshold(float threshold){
|
||||||
|
_threshold = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float get_threshold(){
|
||||||
|
return _threshold;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void append_data(void *data, uint64_t samples, bool instant);
|
void append_data(void *data, uint64_t samples, bool instant);
|
||||||
@ -119,6 +126,7 @@ private:
|
|||||||
bool _instant;
|
bool _instant;
|
||||||
std::map<int, bool> _ch_enable;
|
std::map<int, bool> _ch_enable;
|
||||||
std::vector<uint8_t*> _ch_data;
|
std::vector<uint8_t*> _ch_data;
|
||||||
|
float _threshold;
|
||||||
|
|
||||||
friend class DsoSnapshotTest::Basic;
|
friend class DsoSnapshotTest::Basic;
|
||||||
};
|
};
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the DSView project.
|
|
||||||
* DSView is based on PulseView.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "group.h"
|
|
||||||
#include "groupsnapshot.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace pv {
|
|
||||||
namespace data {
|
|
||||||
|
|
||||||
Group::Group() :
|
|
||||||
SignalData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Group::push_snapshot(GroupSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
_snapshots.push_back(snapshot);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::deque<GroupSnapshot*>& Group::get_snapshots()
|
|
||||||
{
|
|
||||||
return _snapshots;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Group::clear()
|
|
||||||
{
|
|
||||||
for(auto s : _snapshots){
|
|
||||||
s->clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Group::init()
|
|
||||||
{
|
|
||||||
for(auto s : _snapshots){
|
|
||||||
s->init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace data
|
|
||||||
} // namespace pv
|
|
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the DSView project.
|
|
||||||
* DSView is based on PulseView.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DSVIEW_PV_DATA_GROUP_H
|
|
||||||
#define DSVIEW_PV_DATA_GROUP_H
|
|
||||||
|
|
||||||
#include "signaldata.h"
|
|
||||||
|
|
||||||
#include <deque>
|
|
||||||
|
|
||||||
namespace pv {
|
|
||||||
namespace data {
|
|
||||||
|
|
||||||
class GroupSnapshot;
|
|
||||||
|
|
||||||
class Group : public SignalData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Group();
|
|
||||||
|
|
||||||
void push_snapshot(GroupSnapshot *snapshot);
|
|
||||||
|
|
||||||
std::deque<GroupSnapshot*>& get_snapshots();
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
void init();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::deque<GroupSnapshot*> _snapshots;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace data
|
|
||||||
} // namespace pv
|
|
||||||
|
|
||||||
#endif // DSVIEW_PV_DATA_GROUP_H
|
|
@ -1,274 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the DSView project.
|
|
||||||
* DSView is based on PulseView.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "logicsnapshot.h"
|
|
||||||
#include "groupsnapshot.h"
|
|
||||||
#include "../dsvdef.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace pv {
|
|
||||||
namespace data {
|
|
||||||
|
|
||||||
const int GroupSnapshot::EnvelopeScalePower = 4;
|
|
||||||
const int GroupSnapshot::EnvelopeScaleFactor = 1 << EnvelopeScalePower;
|
|
||||||
const float GroupSnapshot::LogEnvelopeScaleFactor =
|
|
||||||
logf(EnvelopeScaleFactor);
|
|
||||||
const uint64_t GroupSnapshot::EnvelopeDataUnit = 64*1024; // bytes
|
|
||||||
const uint16_t GroupSnapshot::value_mask[16] = {0x1, 0x2, 0x4, 0x8,
|
|
||||||
0x10, 0x20, 0x40, 0x80,
|
|
||||||
0x100, 0x200, 0x400, 0x800,
|
|
||||||
0x1000, 0x2000, 0x4000, 0x8000};
|
|
||||||
|
|
||||||
GroupSnapshot::GroupSnapshot(const LogicSnapshot *_logic_snapshot, std::list<int> index_list)
|
|
||||||
{
|
|
||||||
assert(_logic_snapshot);
|
|
||||||
|
|
||||||
LogicSnapshot *logic_snapshot = const_cast<LogicSnapshot*>(_logic_snapshot);
|
|
||||||
|
|
||||||
|
|
||||||
memset(_envelope_levels, 0, sizeof(_envelope_levels));
|
|
||||||
// _data = logic_snapshot->get_data();
|
|
||||||
_sample_count = logic_snapshot->get_sample_count();
|
|
||||||
_unit_size = logic_snapshot->unit_size();
|
|
||||||
_index_list = index_list;
|
|
||||||
|
|
||||||
_mask = 0;
|
|
||||||
std::list<int>::iterator j = _index_list.begin();
|
|
||||||
while(j != _index_list.end())
|
|
||||||
_mask |= value_mask[(*j++)];
|
|
||||||
|
|
||||||
for (int i=0; i<32; i++) {
|
|
||||||
_bubble_start[i] = -1;
|
|
||||||
_bubble_end[i] = -1;
|
|
||||||
}
|
|
||||||
uint16_t mask = _mask;
|
|
||||||
int i = 0;
|
|
||||||
int k = 0;
|
|
||||||
int zero = 0;
|
|
||||||
int zero_pre = 0;
|
|
||||||
// max bubble count: 31
|
|
||||||
do {
|
|
||||||
if (mask & 0x1) {
|
|
||||||
if (_bubble_start[k] != -1 &&
|
|
||||||
_bubble_end[k] == -1)
|
|
||||||
_bubble_end[k++] = i - zero_pre;
|
|
||||||
} else {
|
|
||||||
if (_bubble_start[k] == -1) {
|
|
||||||
_bubble_start[k] = i - zero;
|
|
||||||
zero_pre = zero;
|
|
||||||
}
|
|
||||||
zero++;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}while(mask >>= 1);
|
|
||||||
|
|
||||||
append_payload();
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupSnapshot::~GroupSnapshot()
|
|
||||||
{
|
|
||||||
for(auto &e : _envelope_levels){
|
|
||||||
free(e.samples);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::init()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::clear()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t GroupSnapshot::get_sample_count()
|
|
||||||
{
|
|
||||||
return _sample_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::append_payload()
|
|
||||||
{
|
|
||||||
|
|
||||||
append_payload_to_envelope_levels();
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint16_t* GroupSnapshot::get_samples(
|
|
||||||
int64_t start_sample, int64_t end_sample)
|
|
||||||
{
|
|
||||||
assert(start_sample >= 0);
|
|
||||||
assert(start_sample < (int64_t)_sample_count);
|
|
||||||
assert(end_sample >= 0);
|
|
||||||
assert(end_sample < (int64_t)_sample_count);
|
|
||||||
assert(start_sample <= end_sample);
|
|
||||||
|
|
||||||
int64_t i;
|
|
||||||
uint16_t tmpl, tmpr;
|
|
||||||
|
|
||||||
uint16_t *const data = new uint16_t[end_sample - start_sample];
|
|
||||||
|
|
||||||
for(i = start_sample; i < end_sample; i++) {
|
|
||||||
if (_unit_size == 2)
|
|
||||||
tmpl = *((uint16_t*)_data + i) & _mask;
|
|
||||||
else
|
|
||||||
tmpl = *((uint8_t*)_data + i) & _mask;
|
|
||||||
for(int j=0; _bubble_start[j] != -1; j++) {
|
|
||||||
tmpr = tmpl & (0xffff >> (16 - _bubble_start[j]));
|
|
||||||
tmpl >>= _bubble_end[j];
|
|
||||||
tmpl <<= _bubble_start[j];
|
|
||||||
tmpl += tmpr;
|
|
||||||
}
|
|
||||||
*(data + i - start_sample) = tmpl;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::get_envelope_section(EnvelopeSection &s,
|
|
||||||
uint64_t start, uint64_t end, float min_length)
|
|
||||||
{
|
|
||||||
assert(end <= _sample_count);
|
|
||||||
assert(start <= end);
|
|
||||||
assert(min_length > 0);
|
|
||||||
|
|
||||||
const unsigned int min_level = max((int)floorf(logf(min_length) /
|
|
||||||
LogEnvelopeScaleFactor) - 1, 0);
|
|
||||||
const unsigned int scale_power = (min_level + 1) *
|
|
||||||
EnvelopeScalePower;
|
|
||||||
start >>= scale_power;
|
|
||||||
end >>= scale_power;
|
|
||||||
|
|
||||||
s.start = start << scale_power;
|
|
||||||
s.scale = 1 << scale_power;
|
|
||||||
s.length = end - start;
|
|
||||||
s.samples = new EnvelopeSample[s.length];
|
|
||||||
memcpy(s.samples, _envelope_levels[min_level].samples + start,
|
|
||||||
s.length * sizeof(EnvelopeSample));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::reallocate_envelope(Envelope &e)
|
|
||||||
{
|
|
||||||
const uint64_t new_data_length = ((e.length + EnvelopeDataUnit - 1) /
|
|
||||||
EnvelopeDataUnit) * EnvelopeDataUnit;
|
|
||||||
if (new_data_length > e.data_length)
|
|
||||||
{
|
|
||||||
e.data_length = new_data_length;
|
|
||||||
e.samples = (EnvelopeSample*)realloc(e.samples,
|
|
||||||
new_data_length * sizeof(EnvelopeSample));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupSnapshot::append_payload_to_envelope_levels()
|
|
||||||
{
|
|
||||||
Envelope &e0 = _envelope_levels[0];
|
|
||||||
uint64_t prev_length;
|
|
||||||
EnvelopeSample *dest_ptr;
|
|
||||||
|
|
||||||
// Expand the data buffer to fit the new samples
|
|
||||||
prev_length = e0.length;
|
|
||||||
e0.length = _sample_count / EnvelopeScaleFactor;
|
|
||||||
|
|
||||||
// Break off if there are no new samples to compute
|
|
||||||
if (e0.length == prev_length)
|
|
||||||
return;
|
|
||||||
|
|
||||||
reallocate_envelope(e0);
|
|
||||||
|
|
||||||
dest_ptr = e0.samples + prev_length;
|
|
||||||
|
|
||||||
// Iterate through the samples to populate the first level mipmap
|
|
||||||
uint16_t group_value[EnvelopeScaleFactor];
|
|
||||||
const uint8_t *const end_src_ptr = (uint8_t*)_data +
|
|
||||||
e0.length * EnvelopeScaleFactor * _unit_size;
|
|
||||||
for (const uint8_t *src_ptr = (uint8_t*)_data +
|
|
||||||
prev_length * EnvelopeScaleFactor * _unit_size;
|
|
||||||
src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor * _unit_size)
|
|
||||||
{
|
|
||||||
uint16_t tmpr;
|
|
||||||
for(int i = 0; i < EnvelopeScaleFactor; i++) {
|
|
||||||
if (_unit_size == 2)
|
|
||||||
group_value[i] = *((uint16_t*)src_ptr + i) & _mask;
|
|
||||||
else
|
|
||||||
group_value[i] = *((uint8_t*)src_ptr + i) & _mask;
|
|
||||||
for(int j=0; _bubble_start[j] != -1; j++) {
|
|
||||||
tmpr = group_value[i] & (0xffff >> (16 - _bubble_start[j]));
|
|
||||||
group_value[i] >>= _bubble_end[j];
|
|
||||||
group_value[i] <<= _bubble_start[j];
|
|
||||||
group_value[i] += tmpr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const EnvelopeSample sub_sample = {
|
|
||||||
*min_element(group_value, group_value + EnvelopeScaleFactor),
|
|
||||||
*max_element(group_value, group_value + EnvelopeScaleFactor),
|
|
||||||
};
|
|
||||||
|
|
||||||
*dest_ptr++ = sub_sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute higher level mipmaps
|
|
||||||
for (unsigned int level = 1; level < ScaleStepCount; level++)
|
|
||||||
{
|
|
||||||
Envelope &e = _envelope_levels[level];
|
|
||||||
const Envelope &el = _envelope_levels[level-1];
|
|
||||||
|
|
||||||
// Expand the data buffer to fit the new samples
|
|
||||||
prev_length = e.length;
|
|
||||||
e.length = el.length / EnvelopeScaleFactor;
|
|
||||||
|
|
||||||
// Break off if there are no more samples to computed
|
|
||||||
if (e.length == prev_length)
|
|
||||||
break;
|
|
||||||
|
|
||||||
reallocate_envelope(e);
|
|
||||||
|
|
||||||
// Subsample the level lower level
|
|
||||||
const EnvelopeSample *src_ptr =
|
|
||||||
el.samples + prev_length * EnvelopeScaleFactor;
|
|
||||||
const EnvelopeSample *const end_dest_ptr = e.samples + e.length;
|
|
||||||
for (dest_ptr = e.samples + prev_length;
|
|
||||||
dest_ptr < end_dest_ptr; dest_ptr++)
|
|
||||||
{
|
|
||||||
const EnvelopeSample *const end_src_ptr =
|
|
||||||
src_ptr + EnvelopeScaleFactor;
|
|
||||||
|
|
||||||
EnvelopeSample sub_sample = *src_ptr++;
|
|
||||||
while (src_ptr < end_src_ptr)
|
|
||||||
{
|
|
||||||
sub_sample.min = min(sub_sample.min, src_ptr->min);
|
|
||||||
sub_sample.max = max(sub_sample.max, src_ptr->max);
|
|
||||||
src_ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*dest_ptr = sub_sample;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace data
|
|
||||||
} // namespace pv
|
|
@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the DSView project.
|
|
||||||
* DSView is based on PulseView.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 DreamSourceLab <support@dreamsourcelab.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DSVIEW_PV_DATA_GROUPSNAPSHOT_H
|
|
||||||
#define DSVIEW_PV_DATA_GROUPSNAPSHOT_H
|
|
||||||
|
|
||||||
#include "../view/signal.h"
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
namespace GroupSnapshotTest {
|
|
||||||
class Basic;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace pv {
|
|
||||||
namespace data {
|
|
||||||
|
|
||||||
class LogicSnapshot;
|
|
||||||
|
|
||||||
class GroupSnapshot
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct EnvelopeSample
|
|
||||||
{
|
|
||||||
uint16_t min;
|
|
||||||
uint16_t max;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EnvelopeSection
|
|
||||||
{
|
|
||||||
uint64_t start;
|
|
||||||
unsigned int scale;
|
|
||||||
uint64_t length;
|
|
||||||
EnvelopeSample *samples;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Envelope
|
|
||||||
{
|
|
||||||
uint64_t length;
|
|
||||||
uint64_t data_length;
|
|
||||||
EnvelopeSample *samples;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
static const unsigned int ScaleStepCount = 16;
|
|
||||||
static const int EnvelopeScalePower;
|
|
||||||
static const int EnvelopeScaleFactor;
|
|
||||||
static const float LogEnvelopeScaleFactor;
|
|
||||||
static const uint64_t EnvelopeDataUnit;
|
|
||||||
static const uint16_t value_mask[16];
|
|
||||||
|
|
||||||
public:
|
|
||||||
GroupSnapshot(const LogicSnapshot *_logic_snapshot, std::list<int> index_list);
|
|
||||||
|
|
||||||
virtual ~GroupSnapshot();
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
void init();
|
|
||||||
|
|
||||||
void append_payload();
|
|
||||||
|
|
||||||
uint64_t get_sample_count();
|
|
||||||
|
|
||||||
const uint16_t* get_samples(int64_t start_sample,
|
|
||||||
int64_t end_sample);
|
|
||||||
|
|
||||||
void get_envelope_section(EnvelopeSection &s,
|
|
||||||
uint64_t start, uint64_t end, float min_length);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void reallocate_envelope(Envelope &l);
|
|
||||||
|
|
||||||
void append_payload_to_envelope_levels();
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Envelope _envelope_levels[ScaleStepCount];
|
|
||||||
|
|
||||||
const void *_data;
|
|
||||||
uint64_t _sample_count;
|
|
||||||
int _unit_size;
|
|
||||||
view::Signal *_signal;
|
|
||||||
std::list<int> _index_list;
|
|
||||||
uint16_t _mask;
|
|
||||||
int _bubble_start[32];
|
|
||||||
int _bubble_end[32];
|
|
||||||
|
|
||||||
friend class GroupSnapshotTest::Basic;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace data
|
|
||||||
} // namespace pv
|
|
||||||
|
|
||||||
#endif // DSVIEW_PV_DATA_GROUPSNAPSHOT_H
|
|
@ -56,7 +56,14 @@ public:
|
|||||||
void setTitle(QString title);
|
void setTitle(QString title);
|
||||||
void reload();
|
void reload();
|
||||||
int exec();
|
int exec();
|
||||||
inline bool IsClickYes(){return _clickYes;}
|
|
||||||
|
inline bool IsClickYes(){
|
||||||
|
return _clickYes;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsAccept(){
|
||||||
|
return _clickYes;
|
||||||
|
}
|
||||||
|
|
||||||
void SetTitleSpace(int h);
|
void SetTitleSpace(int h);
|
||||||
|
|
||||||
|
@ -1683,7 +1683,6 @@ namespace pv
|
|||||||
case DSV_MSG_DEVICE_MODE_CHANGED:
|
case DSV_MSG_DEVICE_MODE_CHANGED:
|
||||||
_sampling_bar->update_sample_rate_selector();
|
_sampling_bar->update_sample_rate_selector();
|
||||||
_view->mode_changed();
|
_view->mode_changed();
|
||||||
_protocol_widget->del_all_protocol();
|
|
||||||
reset_all_view();
|
reset_all_view();
|
||||||
load_device_config();
|
load_device_config();
|
||||||
update_toolbar_view_status();
|
update_toolbar_view_status();
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
#include "data/dsosnapshot.h"
|
#include "data/dsosnapshot.h"
|
||||||
#include "data/logic.h"
|
#include "data/logic.h"
|
||||||
#include "data/logicsnapshot.h"
|
#include "data/logicsnapshot.h"
|
||||||
#include "data/group.h"
|
|
||||||
#include "data/groupsnapshot.h"
|
|
||||||
#include "data/decoderstack.h"
|
#include "data/decoderstack.h"
|
||||||
#include "data/decode/decoder.h"
|
#include "data/decode/decoder.h"
|
||||||
#include "data/decodermodel.h"
|
#include "data/decodermodel.h"
|
||||||
@ -71,7 +69,6 @@ namespace pv
|
|||||||
{
|
{
|
||||||
// TODO: This should not be necessary
|
// TODO: This should not be necessary
|
||||||
_session = this;
|
_session = this;
|
||||||
_group_cnt = 0;
|
|
||||||
|
|
||||||
_map_zoom = 0;
|
_map_zoom = 0;
|
||||||
_repeat_hold_prg = 0;
|
_repeat_hold_prg = 0;
|
||||||
@ -109,8 +106,6 @@ namespace pv
|
|||||||
_logic_data = new data::Logic(new data::LogicSnapshot());
|
_logic_data = new data::Logic(new data::LogicSnapshot());
|
||||||
_dso_data = new data::Dso(new data::DsoSnapshot());
|
_dso_data = new data::Dso(new data::DsoSnapshot());
|
||||||
_analog_data = new data::Analog(new data::AnalogSnapshot());
|
_analog_data = new data::Analog(new data::AnalogSnapshot());
|
||||||
_group_data = new data::Group();
|
|
||||||
_group_cnt = 0;
|
|
||||||
|
|
||||||
_feed_timer.SetCallback(std::bind(&SigSession::feed_timeout, this));
|
_feed_timer.SetCallback(std::bind(&SigSession::feed_timeout, this));
|
||||||
_repeat_timer.SetCallback(std::bind(&SigSession::repeat_capture_wait_timeout, this));
|
_repeat_timer.SetCallback(std::bind(&SigSession::repeat_capture_wait_timeout, this));
|
||||||
@ -217,7 +212,6 @@ namespace pv
|
|||||||
|
|
||||||
clear_all_decoder();
|
clear_all_decoder();
|
||||||
|
|
||||||
RELEASE_ARRAY(_group_traces);
|
|
||||||
init_signals();
|
init_signals();
|
||||||
|
|
||||||
_cur_snap_samplerate = _device_agent.get_sample_rate();
|
_cur_snap_samplerate = _device_agent.get_sample_rate();
|
||||||
@ -338,9 +332,6 @@ namespace pv
|
|||||||
_analog_data->set_samplerate(_cur_snap_samplerate);
|
_analog_data->set_samplerate(_cur_snap_samplerate);
|
||||||
if (_dso_data)
|
if (_dso_data)
|
||||||
_dso_data->set_samplerate(_cur_snap_samplerate);
|
_dso_data->set_samplerate(_cur_snap_samplerate);
|
||||||
// Group
|
|
||||||
if (_group_data)
|
|
||||||
_group_data->set_samplerate(_cur_snap_samplerate);
|
|
||||||
|
|
||||||
// DecoderStack
|
// DecoderStack
|
||||||
for (auto d : _decode_traces)
|
for (auto d : _decode_traces)
|
||||||
@ -412,10 +403,6 @@ namespace pv
|
|||||||
if (_logic_data)
|
if (_logic_data)
|
||||||
_logic_data->init();
|
_logic_data->init();
|
||||||
|
|
||||||
// Group
|
|
||||||
if (_group_data)
|
|
||||||
_group_data->init();
|
|
||||||
|
|
||||||
// Dso
|
// Dso
|
||||||
if (_analog_data)
|
if (_analog_data)
|
||||||
_analog_data->init();
|
_analog_data->init();
|
||||||
@ -475,6 +462,8 @@ namespace pv
|
|||||||
|
|
||||||
_callback->trigger_message(DSV_MSG_START_COLLECT_WORK_PREV);
|
_callback->trigger_message(DSV_MSG_START_COLLECT_WORK_PREV);
|
||||||
|
|
||||||
|
get_dso_data()->set_threshold(0); // Reset threshold value
|
||||||
|
|
||||||
if (exec_capture())
|
if (exec_capture())
|
||||||
{
|
{
|
||||||
_capture_time_id++;
|
_capture_time_id++;
|
||||||
@ -639,11 +628,6 @@ namespace pv
|
|||||||
return _signals;
|
return _signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<view::GroupSignal *> &SigSession::get_group_signals()
|
|
||||||
{
|
|
||||||
return _group_traces;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::set<data::SignalData *> SigSession::get_data()
|
std::set<data::SignalData *> SigSession::get_data()
|
||||||
{
|
{
|
||||||
std::set<data::SignalData *> data;
|
std::set<data::SignalData *> data;
|
||||||
@ -679,82 +663,6 @@ namespace pv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SigSession::add_group()
|
|
||||||
{
|
|
||||||
std::list<int> probe_index_list;
|
|
||||||
|
|
||||||
auto i = _signals.begin();
|
|
||||||
while (i != _signals.end())
|
|
||||||
{
|
|
||||||
if ((*i)->get_type() == SR_CHANNEL_LOGIC && (*i)->selected())
|
|
||||||
probe_index_list.push_back((*i)->get_index());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (probe_index_list.size() > 1)
|
|
||||||
{
|
|
||||||
_group_data->init();
|
|
||||||
_group_data->set_samplerate(_cur_snap_samplerate);
|
|
||||||
auto signal = new view::GroupSignal("New Group", _group_data, probe_index_list, _group_cnt);
|
|
||||||
_group_traces.push_back(signal);
|
|
||||||
_group_cnt++;
|
|
||||||
|
|
||||||
const auto &snapshots = _logic_data->get_snapshots();
|
|
||||||
if (!snapshots.empty())
|
|
||||||
{
|
|
||||||
auto p = new data::GroupSnapshot(snapshots.front(), signal->get_index_list());
|
|
||||||
_group_data->push_snapshot(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
signals_changed();
|
|
||||||
data_updated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SigSession::del_group()
|
|
||||||
{
|
|
||||||
auto i = _group_traces.begin();
|
|
||||||
|
|
||||||
while (i != _group_traces.end())
|
|
||||||
{
|
|
||||||
|
|
||||||
pv::view::GroupSignal *psig = *(i);
|
|
||||||
|
|
||||||
if (psig->selected())
|
|
||||||
{
|
|
||||||
auto j = _group_traces.begin();
|
|
||||||
while (j != _group_traces.end())
|
|
||||||
{
|
|
||||||
if ((*j)->get_sec_index() > psig->get_sec_index())
|
|
||||||
(*j)->set_sec_index((*j)->get_sec_index() - 1);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &snapshots = _group_data->get_snapshots();
|
|
||||||
if (!snapshots.empty())
|
|
||||||
{
|
|
||||||
int dex = psig->get_sec_index();
|
|
||||||
pv::data::GroupSnapshot *pshot = _group_data->get_snapshots().at(dex);
|
|
||||||
delete pshot;
|
|
||||||
|
|
||||||
auto k = snapshots.begin();
|
|
||||||
k += (*i)->get_sec_index();
|
|
||||||
_group_data->get_snapshots().erase(k);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete psig;
|
|
||||||
|
|
||||||
i = _group_traces.erase(i);
|
|
||||||
|
|
||||||
_group_cnt--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals_changed();
|
|
||||||
data_updated();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SigSession::init_signals()
|
void SigSession::init_signals()
|
||||||
{
|
{
|
||||||
@ -766,16 +674,10 @@ namespace pv
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<view::Signal *> sigs;
|
std::vector<view::Signal *> sigs;
|
||||||
view::Signal *signal = NULL;
|
|
||||||
unsigned int logic_probe_count = 0;
|
unsigned int logic_probe_count = 0;
|
||||||
unsigned int dso_probe_count = 0;
|
unsigned int dso_probe_count = 0;
|
||||||
unsigned int analog_probe_count = 0;
|
unsigned int analog_probe_count = 0;
|
||||||
|
|
||||||
_logic_data->clear();
|
|
||||||
_dso_data->clear();
|
|
||||||
_analog_data->clear();
|
|
||||||
_group_data->clear();
|
|
||||||
|
|
||||||
// Detect what data types we will receive
|
// Detect what data types we will receive
|
||||||
if (_device_agent.have_instance())
|
if (_device_agent.have_instance())
|
||||||
{
|
{
|
||||||
@ -802,36 +704,33 @@ namespace pv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the logic probe list
|
|
||||||
RELEASE_ARRAY(_group_traces);
|
|
||||||
|
|
||||||
std::vector<view::GroupSignal *>().swap(_group_traces);
|
|
||||||
|
|
||||||
for (GSList *l = _device_agent.get_channels(); l; l = l->next)
|
for (GSList *l = _device_agent.get_channels(); l; l = l->next)
|
||||||
{
|
{
|
||||||
sr_channel *probe =
|
sr_channel *probe = (sr_channel *)l->data;
|
||||||
(sr_channel *)l->data;
|
|
||||||
assert(probe);
|
assert(probe);
|
||||||
signal = NULL;
|
|
||||||
|
|
||||||
switch (probe->type)
|
switch (probe->type)
|
||||||
{
|
{
|
||||||
case SR_CHANNEL_LOGIC:
|
case SR_CHANNEL_LOGIC:
|
||||||
if (probe->enabled)
|
if (probe->enabled){
|
||||||
signal = new view::LogicSignal(_logic_data, probe);
|
view::Signal *signal = new view::LogicSignal(_logic_data, probe);
|
||||||
|
sigs.push_back(signal);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SR_CHANNEL_DSO:
|
case SR_CHANNEL_DSO:{
|
||||||
signal = new view::DsoSignal(_dso_data, probe);
|
view::Signal *signal = new view::DsoSignal(_dso_data, probe);
|
||||||
|
sigs.push_back(signal);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SR_CHANNEL_ANALOG:
|
case SR_CHANNEL_ANALOG:
|
||||||
if (probe->enabled)
|
if (probe->enabled){
|
||||||
signal = new view::AnalogSignal(_analog_data, probe);
|
view::Signal *signal = new view::AnalogSignal(_analog_data, probe);
|
||||||
|
sigs.push_back(signal);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (signal != NULL)
|
|
||||||
sigs.push_back(signal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE_ARRAY(_signals);
|
RELEASE_ARRAY(_signals);
|
||||||
@ -1261,14 +1160,6 @@ namespace pv
|
|||||||
}
|
}
|
||||||
case SR_DF_END:
|
case SR_DF_END:
|
||||||
{
|
{
|
||||||
if (!_logic_data->snapshot()->empty())
|
|
||||||
{
|
|
||||||
for (auto g : _group_traces)
|
|
||||||
{
|
|
||||||
auto p = new data::GroupSnapshot(_logic_data->get_snapshots().front(), g->get_index_list());
|
|
||||||
_group_data->push_snapshot(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logic_data->snapshot()->capture_ended();
|
_logic_data->snapshot()->capture_ended();
|
||||||
_dso_data->snapshot()->capture_ended();
|
_dso_data->snapshot()->capture_ended();
|
||||||
_analog_data->snapshot()->capture_ended();
|
_analog_data->snapshot()->capture_ended();
|
||||||
@ -2030,7 +1921,6 @@ namespace pv
|
|||||||
GVariant *val = g_variant_new_int16(mode);
|
GVariant *val = g_variant_new_int16(mode);
|
||||||
_device_agent.set_config(NULL, NULL, SR_CONF_DEVICE_MODE, val);
|
_device_agent.set_config(NULL, NULL, SR_CONF_DEVICE_MODE, val);
|
||||||
|
|
||||||
clear_all_decoder();
|
|
||||||
init_signals();
|
init_signals();
|
||||||
dsv_info("%s", "Work mode is changed.");
|
dsv_info("%s", "Work mode is changed.");
|
||||||
broadcast_msg(DSV_MSG_DEVICE_MODE_CHANGED);
|
broadcast_msg(DSV_MSG_DEVICE_MODE_CHANGED);
|
||||||
@ -2064,4 +1954,19 @@ namespace pv
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data::LogicSnapshot* SigSession::get_logic_data()
|
||||||
|
{
|
||||||
|
return _logic_data->snapshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
data::AnalogSnapshot* SigSession::get_analog_data()
|
||||||
|
{
|
||||||
|
return _analog_data->snapshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
data::DsoSnapshot* SigSession::get_dso_data()
|
||||||
|
{
|
||||||
|
return _dso_data->snapshot();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace pv
|
} // namespace pv
|
||||||
|
@ -172,7 +172,6 @@ public:
|
|||||||
bool get_capture_status(bool &triggered, int &progress);
|
bool get_capture_status(bool &triggered, int &progress);
|
||||||
std::set<data::SignalData*> get_data();
|
std::set<data::SignalData*> get_data();
|
||||||
std::vector<view::Signal*>& get_signals();
|
std::vector<view::Signal*>& get_signals();
|
||||||
std::vector<view::GroupSignal*>& get_group_signals();
|
|
||||||
|
|
||||||
bool add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus,
|
bool add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus,
|
||||||
std::list<pv::data::decode::Decoder*> &sub_decoders);
|
std::list<pv::data::decode::Decoder*> &sub_decoders);
|
||||||
@ -203,8 +202,6 @@ public:
|
|||||||
return _math_trace;
|
return _math_trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_group();
|
|
||||||
void del_group();
|
|
||||||
uint16_t get_ch_num(int type);
|
uint16_t get_ch_num(int type);
|
||||||
|
|
||||||
inline bool get_data_lock(){
|
inline bool get_data_lock(){
|
||||||
@ -369,6 +366,10 @@ public:
|
|||||||
bool switch_work_mode(int mode);
|
bool switch_work_mode(int mode);
|
||||||
bool have_new_realtime_refresh(bool keep);
|
bool have_new_realtime_refresh(bool keep);
|
||||||
|
|
||||||
|
data::LogicSnapshot* get_logic_data();
|
||||||
|
data::AnalogSnapshot* get_analog_data();
|
||||||
|
data::DsoSnapshot* get_dso_data();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void set_cur_samplelimits(uint64_t samplelimits);
|
void set_cur_samplelimits(uint64_t samplelimits);
|
||||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||||
@ -435,10 +436,9 @@ private:
|
|||||||
const struct sr_datafeed_packet *packet);
|
const struct sr_datafeed_packet *packet);
|
||||||
|
|
||||||
static void device_lib_event_callback(int event);
|
static void device_lib_event_callback(int event);
|
||||||
|
|
||||||
void on_device_lib_event(int event);
|
void on_device_lib_event(int event);
|
||||||
|
|
||||||
Snapshot* get_signal_snapshot();
|
Snapshot* get_signal_snapshot();
|
||||||
|
|
||||||
void repeat_capture_wait_timeout();
|
void repeat_capture_wait_timeout();
|
||||||
void repeat_wait_prog_timeout();
|
void repeat_wait_prog_timeout();
|
||||||
void realtime_refresh_timeout();
|
void realtime_refresh_timeout();
|
||||||
@ -453,7 +453,6 @@ private:
|
|||||||
uint64_t _cur_samplelimits;
|
uint64_t _cur_samplelimits;
|
||||||
|
|
||||||
std::vector<view::Signal*> _signals;
|
std::vector<view::Signal*> _signals;
|
||||||
std::vector<view::GroupSignal*> _group_traces;
|
|
||||||
std::vector<view::DecodeTrace*> _decode_traces;
|
std::vector<view::DecodeTrace*> _decode_traces;
|
||||||
std::vector<view::DecodeTrace*> _decode_tasks;
|
std::vector<view::DecodeTrace*> _decode_tasks;
|
||||||
pv::data::DecoderModel *_decoder_model;
|
pv::data::DecoderModel *_decoder_model;
|
||||||
@ -464,7 +463,6 @@ private:
|
|||||||
data::Logic *_logic_data;
|
data::Logic *_logic_data;
|
||||||
data::Dso *_dso_data;
|
data::Dso *_dso_data;
|
||||||
data::Analog *_analog_data;
|
data::Analog *_analog_data;
|
||||||
data::Group *_group_data;
|
|
||||||
int _group_cnt;
|
int _group_cnt;
|
||||||
|
|
||||||
DsTimer _feed_timer;
|
DsTimer _feed_timer;
|
||||||
|
@ -38,8 +38,7 @@ namespace toolbars {
|
|||||||
FileBar::FileBar(SigSession *session, QWidget *parent) :
|
FileBar::FileBar(SigSession *session, QWidget *parent) :
|
||||||
QToolBar("File Bar", parent),
|
QToolBar("File Bar", parent),
|
||||||
_session(session),
|
_session(session),
|
||||||
_file_button(this),
|
_file_button(this)
|
||||||
_cvt_button(this)
|
|
||||||
{
|
{
|
||||||
setMovable(false);
|
setMovable(false);
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
@ -84,12 +83,6 @@ FileBar::FileBar(SigSession *session, QWidget *parent) :
|
|||||||
_file_button.setMenu(_menu);
|
_file_button.setMenu(_menu);
|
||||||
addWidget(&_file_button);
|
addWidget(&_file_button);
|
||||||
|
|
||||||
|
|
||||||
_cvt_button.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
|
||||||
_cvt_action = addWidget(&_cvt_button);
|
|
||||||
_cvt_button.setObjectName(QString::fromUtf8("menuSession"));
|
|
||||||
//_cvt_action->setVisible(false);
|
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
connect(_action_load, SIGNAL(triggered()), this, SLOT(on_actionLoad_triggered()));
|
connect(_action_load, SIGNAL(triggered()), this, SLOT(on_actionLoad_triggered()));
|
||||||
@ -123,7 +116,6 @@ void FileBar::retranslateUi()
|
|||||||
_action_save->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_SAVE), "&Save..."));
|
_action_save->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_SAVE), "&Save..."));
|
||||||
_action_export->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_EXPORT), "&Export..."));
|
_action_export->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_EXPORT), "&Export..."));
|
||||||
_action_capture->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_CAPTURE), "&Capture..."));
|
_action_capture->setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_CAPTURE), "&Capture..."));
|
||||||
_cvt_button.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_CONVERT_LOGIC), "Lo&gic"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBar::reStyle()
|
void FileBar::reStyle()
|
||||||
@ -139,7 +131,6 @@ void FileBar::reStyle()
|
|||||||
_action_export->setIcon(QIcon(iconPath+"/export.svg"));
|
_action_export->setIcon(QIcon(iconPath+"/export.svg"));
|
||||||
_action_capture->setIcon(QIcon(iconPath+"/capture.svg"));
|
_action_capture->setIcon(QIcon(iconPath+"/capture.svg"));
|
||||||
_file_button.setIcon(QIcon(iconPath+"/file.svg"));
|
_file_button.setIcon(QIcon(iconPath+"/file.svg"));
|
||||||
_cvt_button.setIcon(QIcon(iconPath+"/la.svg"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBar::on_actionOpen_triggered()
|
void FileBar::on_actionOpen_triggered()
|
||||||
|
@ -68,8 +68,6 @@ private:
|
|||||||
SigSession* _session;
|
SigSession* _session;
|
||||||
|
|
||||||
QToolButton _file_button;
|
QToolButton _file_button;
|
||||||
QToolButton _cvt_button;
|
|
||||||
QAction *_cvt_action;
|
|
||||||
QMenu *_menu;
|
QMenu *_menu;
|
||||||
QMenu *_menu_session; //when the hardware device is connected,it will be enable
|
QMenu *_menu_session; //when the hardware device is connected,it will be enable
|
||||||
QAction *_action_load;
|
QAction *_action_load;
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
#include "../dsvdef.h"
|
#include "../dsvdef.h"
|
||||||
#include "groupsignal.h"
|
#include "groupsignal.h"
|
||||||
#include "../data/group.h"
|
|
||||||
#include "../data/groupsnapshot.h"
|
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -40,10 +38,9 @@ const QColor GroupSignal::SignalColours[4] = {
|
|||||||
|
|
||||||
const float GroupSignal::EnvelopeThreshold = 256.0f;
|
const float GroupSignal::EnvelopeThreshold = 256.0f;
|
||||||
|
|
||||||
GroupSignal::GroupSignal(QString name, data::Group *data,
|
GroupSignal::GroupSignal(QString name,
|
||||||
std::list<int> probe_index_list, int group_index) :
|
std::list<int> probe_index_list, int group_index) :
|
||||||
Trace(name, probe_index_list, SR_CHANNEL_GROUP, group_index),
|
Trace(name, probe_index_list, SR_CHANNEL_GROUP, group_index)
|
||||||
_data(data)
|
|
||||||
{
|
{
|
||||||
_colour = SignalColours[probe_index_list.front() % countof(SignalColours)];
|
_colour = SignalColours[probe_index_list.front() % countof(SignalColours)];
|
||||||
_scale = _totalHeight * 1.0f / std::pow(2.0, static_cast<double>(probe_index_list.size()));
|
_scale = _totalHeight * 1.0f / std::pow(2.0, static_cast<double>(probe_index_list.size()));
|
||||||
@ -60,7 +57,7 @@ bool GroupSignal::enabled()
|
|||||||
|
|
||||||
pv::data::SignalData* GroupSignal::data()
|
pv::data::SignalData* GroupSignal::data()
|
||||||
{
|
{
|
||||||
return _data;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupSignal::set_scale(float scale)
|
void GroupSignal::set_scale(float scale)
|
||||||
@ -70,162 +67,30 @@ void GroupSignal::set_scale(float scale)
|
|||||||
|
|
||||||
void GroupSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor back)
|
void GroupSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor back)
|
||||||
{
|
{
|
||||||
(void)fore;
|
|
||||||
(void)back;
|
|
||||||
assert(_data);
|
|
||||||
assert(_view);
|
|
||||||
assert(right >= left);
|
|
||||||
|
|
||||||
const int y = get_y() + _totalHeight * 0.5;
|
|
||||||
const double scale = _view->scale();
|
|
||||||
assert(scale > 0);
|
|
||||||
const int64_t offset = _view->offset();
|
|
||||||
|
|
||||||
_scale = _totalHeight * 1.0f / std::pow(2.0, static_cast<int>(_index_list.size()));
|
|
||||||
|
|
||||||
const auto &snapshots = _data->get_snapshots();
|
|
||||||
if (snapshots.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto snapshot = snapshots.at(_sec_index);
|
|
||||||
|
|
||||||
const double pixels_offset = offset;
|
|
||||||
const double samplerate = _data->samplerate();
|
|
||||||
const int64_t last_sample = snapshot->get_sample_count() - 1;
|
|
||||||
const double samples_per_pixel = samplerate * scale;
|
|
||||||
const double start = offset * samples_per_pixel;
|
|
||||||
const double end = start + samples_per_pixel * (right - left);
|
|
||||||
|
|
||||||
const int64_t start_sample = min(max((int64_t)floor(start),
|
|
||||||
(int64_t)0), last_sample);
|
|
||||||
const int64_t end_sample = min(max((int64_t)ceil(end) + 1,
|
|
||||||
(int64_t)0), last_sample);
|
|
||||||
|
|
||||||
if (samples_per_pixel < EnvelopeThreshold)
|
|
||||||
paint_trace(p, snapshot, y, left,
|
|
||||||
start_sample, end_sample,
|
|
||||||
pixels_offset, samples_per_pixel);
|
|
||||||
else
|
|
||||||
paint_envelope(p, snapshot, y, left,
|
|
||||||
start_sample, end_sample,
|
|
||||||
pixels_offset, samples_per_pixel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupSignal::paint_trace(QPainter &p,
|
void GroupSignal::paint_trace(QPainter &p,
|
||||||
const pv::data::GroupSnapshot *snapshot,
|
|
||||||
int y, int left, const int64_t start, const int64_t end,
|
int y, int left, const int64_t start, const int64_t end,
|
||||||
const double pixels_offset, const double samples_per_pixel)
|
const double pixels_offset, const double samples_per_pixel)
|
||||||
{
|
{
|
||||||
const int64_t sample_count = end - start;
|
|
||||||
|
|
||||||
pv::data::GroupSnapshot *pshot = const_cast<pv::data::GroupSnapshot*>(snapshot);
|
|
||||||
|
|
||||||
const uint16_t *samples = pshot->get_samples(start, end);
|
|
||||||
assert(samples);
|
|
||||||
|
|
||||||
p.setPen(_colour);
|
|
||||||
|
|
||||||
QPointF *points = new QPointF[sample_count];
|
|
||||||
QPointF *point = points;
|
|
||||||
|
|
||||||
for (int64_t sample = start; sample != end; sample++) {
|
|
||||||
const float x = (sample / samples_per_pixel -
|
|
||||||
pixels_offset) + left;
|
|
||||||
*point++ = QPointF(x,
|
|
||||||
y - samples[sample - start] * _scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
p.drawPolyline(points, point - points);
|
|
||||||
|
|
||||||
delete[] samples;
|
|
||||||
delete[] points;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupSignal::paint_envelope(QPainter &p,
|
void GroupSignal::paint_envelope(QPainter &p,
|
||||||
const pv::data::GroupSnapshot *snapshot,
|
|
||||||
int y, int left, const int64_t start, const int64_t end,
|
int y, int left, const int64_t start, const int64_t end,
|
||||||
const double pixels_offset, const double samples_per_pixel)
|
const double pixels_offset, const double samples_per_pixel)
|
||||||
{
|
{
|
||||||
using namespace Qt;
|
|
||||||
using pv::data::GroupSnapshot;
|
|
||||||
|
|
||||||
GroupSnapshot::EnvelopeSection e;
|
|
||||||
|
|
||||||
pv::data::GroupSnapshot *pshot = const_cast<pv::data::GroupSnapshot*>(snapshot);
|
|
||||||
pshot->get_envelope_section(e, start, end, samples_per_pixel);
|
|
||||||
|
|
||||||
if (e.length < 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p.setPen(QPen(NoPen));
|
|
||||||
p.setBrush(_colour);
|
|
||||||
|
|
||||||
QRectF *const rects = new QRectF[e.length];
|
|
||||||
QRectF *rect = rects;
|
|
||||||
|
|
||||||
for(uint64_t sample = 0; sample < e.length-1; sample++) {
|
|
||||||
const float x = ((e.scale * sample + e.start) /
|
|
||||||
samples_per_pixel - pixels_offset) + left;
|
|
||||||
const GroupSnapshot::EnvelopeSample *const s =
|
|
||||||
e.samples + sample;
|
|
||||||
|
|
||||||
// We overlap this sample with the next so that vertical
|
|
||||||
// gaps do not appear during steep rising or falling edges
|
|
||||||
const float b = y - max(s->max, (s+1)->min) * _scale;
|
|
||||||
const float t = y - min(s->min, (s+1)->max) * _scale;
|
|
||||||
|
|
||||||
float h = b - t;
|
|
||||||
if(h >= 0.0f && h <= 1.0f)
|
|
||||||
h = 1.0f;
|
|
||||||
if(h <= 0.0f && h >= -1.0f)
|
|
||||||
h = -1.0f;
|
|
||||||
|
|
||||||
*rect++ = QRectF(x, t, 1.0f, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
p.drawRects(rects, e.length);
|
|
||||||
|
|
||||||
delete[] rects;
|
|
||||||
delete[] e.samples;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore)
|
void GroupSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore)
|
||||||
{
|
{
|
||||||
(void)pt;
|
|
||||||
|
|
||||||
int y = get_y();
|
|
||||||
const QRectF group_index_rect = get_rect(CHNLREG, y, right);
|
|
||||||
QString index_string;
|
|
||||||
int last_index;
|
|
||||||
p.setPen(QPen(fore, 1, Qt::DashLine));
|
|
||||||
p.drawLine(group_index_rect.bottomLeft(), group_index_rect.bottomRight());
|
|
||||||
std::list<int>::iterator i = _index_list.begin();
|
|
||||||
last_index = (*i);
|
|
||||||
index_string = QString::number(last_index);
|
|
||||||
while (++i != _index_list.end()) {
|
|
||||||
if ((*i) == last_index + 1 && index_string.indexOf("-") < 3 && index_string.indexOf("-") > 0)
|
|
||||||
index_string.replace(QString::number(last_index), QString::number((*i)));
|
|
||||||
else if ((*i) == last_index + 1)
|
|
||||||
index_string = QString::number((*i)) + "-" + index_string;
|
|
||||||
else
|
|
||||||
index_string = QString::number((*i)) + "," + index_string;
|
|
||||||
last_index = (*i);
|
|
||||||
}
|
|
||||||
p.setPen(fore);
|
|
||||||
p.drawText(group_index_rect, Qt::AlignRight | Qt::AlignVCenter, index_string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF GroupSignal::get_rect(GroupSetRegions type, int y, int right)
|
QRectF GroupSignal::get_rect(GroupSetRegions type, int y, int right)
|
||||||
{
|
{
|
||||||
const QSizeF name_size(right - get_leftWidth() - get_rightWidth(), SquareWidth);
|
|
||||||
|
|
||||||
if (type == CHNLREG)
|
|
||||||
return QRectF(
|
|
||||||
get_leftWidth() + name_size.width() + Margin,
|
|
||||||
y - SquareWidth / 2,
|
|
||||||
SquareWidth * SquareNum, SquareWidth);
|
|
||||||
else
|
|
||||||
return QRectF(0, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace view
|
} // namespace view
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#define DSVIEW_SV_GROUPSIGNAL_H
|
#define DSVIEW_SV_GROUPSIGNAL_H
|
||||||
|
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "../data/groupsnapshot.h"
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -33,8 +32,6 @@ namespace pv {
|
|||||||
namespace data {
|
namespace data {
|
||||||
class Logic;
|
class Logic;
|
||||||
class Analog;
|
class Analog;
|
||||||
class Group;
|
|
||||||
class GroupSnapshot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace view {
|
namespace view {
|
||||||
@ -54,7 +51,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GroupSignal(QString name,
|
GroupSignal(QString name,
|
||||||
pv::data::Group *data,
|
|
||||||
std::list<int> probe_index_list, int group_index);
|
std::list<int> probe_index_list, int group_index);
|
||||||
|
|
||||||
virtual ~GroupSignal();
|
virtual ~GroupSignal();
|
||||||
@ -83,17 +79,14 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void paint_trace(QPainter &p,
|
void paint_trace(QPainter &p,
|
||||||
const pv::data::GroupSnapshot *snapshot,
|
|
||||||
int y, int left, const int64_t start, const int64_t end,
|
int y, int left, const int64_t start, const int64_t end,
|
||||||
const double pixels_offset, const double samples_per_pixel);
|
const double pixels_offset, const double samples_per_pixel);
|
||||||
|
|
||||||
void paint_envelope(QPainter &p,
|
void paint_envelope(QPainter &p,
|
||||||
const pv::data::GroupSnapshot *snapshot,
|
|
||||||
int y, int left, const int64_t start, const int64_t end,
|
int y, int left, const int64_t start, const int64_t end,
|
||||||
const double pixels_offset, const double samples_per_pixel);
|
const double pixels_offset, const double samples_per_pixel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pv::data::Group *_data;
|
|
||||||
float _scale;
|
float _scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,9 +51,7 @@ namespace view {
|
|||||||
|
|
||||||
Header::Header(View &parent) :
|
Header::Header(View &parent) :
|
||||||
QWidget(&parent),
|
QWidget(&parent),
|
||||||
_view(parent),
|
_view(parent)
|
||||||
_action_add_group(new QAction(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_GROUP), "Add Group"), this)),
|
|
||||||
_action_del_group(new QAction(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_DEL_GROUP), "Del Group"), this))
|
|
||||||
{
|
{
|
||||||
_moveFlag = false;
|
_moveFlag = false;
|
||||||
_colorFlag = false;
|
_colorFlag = false;
|
||||||
@ -66,11 +64,6 @@ Header::Header(View &parent) :
|
|||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
connect(_action_del_group, SIGNAL(triggered()),
|
|
||||||
this, SLOT(on_action_del_group_triggered()));
|
|
||||||
connect(_action_add_group, SIGNAL(triggered()),
|
|
||||||
this, SLOT(on_action_add_group_triggered()));
|
|
||||||
|
|
||||||
connect(nameEdit, SIGNAL(editingFinished()),
|
connect(nameEdit, SIGNAL(editingFinished()),
|
||||||
this, SLOT(on_action_set_name_triggered()));
|
this, SLOT(on_action_set_name_triggered()));
|
||||||
|
|
||||||
@ -446,16 +439,6 @@ void Header::on_action_set_name_triggered()
|
|||||||
header_updated();
|
header_updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Header::on_action_add_group_triggered()
|
|
||||||
{
|
|
||||||
_view.session().add_group();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Header::on_action_del_group_triggered()
|
|
||||||
{
|
|
||||||
_view.session().del_group();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Header::header_resize()
|
void Header::header_resize()
|
||||||
{
|
{
|
||||||
//if (nameEdit->isVisible()) {
|
//if (nameEdit->isVisible()) {
|
||||||
|
@ -72,10 +72,6 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void on_action_set_name_triggered();
|
void on_action_set_name_triggered();
|
||||||
|
|
||||||
void on_action_add_group_triggered();
|
|
||||||
|
|
||||||
void on_action_del_group_triggered();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void traces_moved();
|
void traces_moved();
|
||||||
void header_updated();
|
void header_updated();
|
||||||
@ -98,9 +94,6 @@ private:
|
|||||||
std::list<std::pair<Trace*, int> > _drag_traces;
|
std::list<std::pair<Trace*, int> > _drag_traces;
|
||||||
|
|
||||||
Trace *_context_trace;
|
Trace *_context_trace;
|
||||||
|
|
||||||
QAction *_action_add_group;
|
|
||||||
QAction *_action_del_group;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace view
|
} // namespace view
|
||||||
|
@ -334,7 +334,6 @@ void View::get_traces(int type, std::vector<Trace*> &traces)
|
|||||||
assert(_session);
|
assert(_session);
|
||||||
|
|
||||||
auto &sigs = _session->get_signals();
|
auto &sigs = _session->get_signals();
|
||||||
const auto &groups = _session->get_group_signals();
|
|
||||||
|
|
||||||
const auto &decode_sigs = _session->get_decode_signals();
|
const auto &decode_sigs = _session->get_decode_signals();
|
||||||
|
|
||||||
@ -350,11 +349,6 @@ void View::get_traces(int type, std::vector<Trace*> &traces)
|
|||||||
traces.push_back(t);
|
traces.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto t : groups) {
|
|
||||||
if (type == ALL_VIEW || _trace_view_map[t->get_type()] == type)
|
|
||||||
traces.push_back(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(auto t : spectrums) {
|
for(auto t : spectrums) {
|
||||||
if (type == ALL_VIEW || _trace_view_map[t->get_type()] == type)
|
if (type == ALL_VIEW || _trace_view_map[t->get_type()] == type)
|
||||||
traces.push_back(t);
|
traces.push_back(t);
|
||||||
|
@ -646,5 +646,9 @@
|
|||||||
{
|
{
|
||||||
"id": "IDS_DLG_SAMPLES_CAPTURED",
|
"id": "IDS_DLG_SAMPLES_CAPTURED",
|
||||||
"text": "捕获样本!"
|
"text": "捕获样本!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "IDS_DLG_FILE_THRESHOLD",
|
||||||
|
"text": "阈值: "
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -350,5 +350,9 @@
|
|||||||
{
|
{
|
||||||
"id": "IDS_MSG_BOX_CONFIRM",
|
"id": "IDS_MSG_BOX_CONFIRM",
|
||||||
"text": "确认"
|
"text": "确认"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "IDS_MSG_NO_DATA",
|
||||||
|
"text": "没有数据!"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -646,5 +646,9 @@
|
|||||||
{
|
{
|
||||||
"id": "IDS_DLG_SAMPLES_CAPTURED",
|
"id": "IDS_DLG_SAMPLES_CAPTURED",
|
||||||
"text": "Samples Captured!"
|
"text": "Samples Captured!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "IDS_DLG_FILE_THRESHOLD",
|
||||||
|
"text": "Threshold: "
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -351,5 +351,9 @@
|
|||||||
{
|
{
|
||||||
"id": "IDS_MSG_BOX_CONFIRM",
|
"id": "IDS_MSG_BOX_CONFIRM",
|
||||||
"text": "Confirm"
|
"text": "Confirm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "IDS_MSG_NO_DATA",
|
||||||
|
"text": "Have no data!"
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user