mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
remove all shared_ptr, remove all boost foreach
This commit is contained in:
parent
c392bf72c1
commit
1d3b8accfd
@ -7,7 +7,7 @@ class MyStyle : public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const {
|
||||
int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) {
|
||||
int s = QProxyStyle::pixelMetric(metric, option, widget);
|
||||
if (metric == QStyle::PM_SmallIconSize) {
|
||||
s = 24;
|
||||
|
@ -262,7 +262,7 @@ const char *ZipMaker::GetError()
|
||||
break;
|
||||
}
|
||||
rdlen += dlen;
|
||||
buf = buf + dlen; //move pointer
|
||||
buf += dlen; //move pointer
|
||||
buflen = inf.dataLen - rdlen;
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,14 @@
|
||||
|
||||
#define MAX_PROTOCOL_FORMAT_LIST 15
|
||||
|
||||
StringPair::StringPair(const string &key, const string &value)
|
||||
StringPair::StringPair(const std::string &key, const std::string &value)
|
||||
{
|
||||
m_key = key;
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
//------------function
|
||||
QString FormatArrayToString(vector<StringPair> &protocolFormats){
|
||||
QString FormatArrayToString(std::vector<StringPair> &protocolFormats){
|
||||
QString str;
|
||||
|
||||
for (StringPair &o : protocolFormats){
|
||||
@ -49,7 +49,7 @@ QString FormatArrayToString(vector<StringPair> &protocolFormats){
|
||||
return str;
|
||||
}
|
||||
|
||||
void StringToFormatArray(const QString &str, vector<StringPair> &protocolFormats){
|
||||
void StringToFormatArray(const QString &str, std::vector<StringPair> &protocolFormats){
|
||||
QStringList arr = str.split(";");
|
||||
for (int i=0; i<arr.size(); i++){
|
||||
QString line = arr[i];
|
||||
@ -218,7 +218,7 @@ void AppConfig::LoadAll()
|
||||
}
|
||||
|
||||
|
||||
void AppConfig::SetProtocolFormat(const string &protocolName, const string &value)
|
||||
void AppConfig::SetProtocolFormat(const std::string &protocolName, const std::string &value)
|
||||
{
|
||||
bool bChange = false;
|
||||
for (StringPair &o : _appOptions.m_protocolFormats){
|
||||
@ -247,7 +247,7 @@ void AppConfig::SetProtocolFormat(const string &protocolName, const string &valu
|
||||
}
|
||||
}
|
||||
|
||||
string AppConfig::GetProtocolFormat(const string &protocolName)
|
||||
std::string AppConfig::GetProtocolFormat(const std::string &protocolName)
|
||||
{
|
||||
for (StringPair &o : _appOptions.m_protocolFormats){
|
||||
if (o.m_key == protocolName){
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
//--------------------api---
|
||||
|
||||
QString GetDirectoryName(QString path);
|
||||
@ -40,9 +39,9 @@ QString GetIconPath();
|
||||
class StringPair
|
||||
{
|
||||
public:
|
||||
StringPair(const string &key, const string &value);
|
||||
string m_key;
|
||||
string m_value;
|
||||
StringPair(const std::string &key, const std::string &value);
|
||||
std::string m_key;
|
||||
std::string m_value;
|
||||
};
|
||||
|
||||
|
||||
@ -52,7 +51,7 @@ struct AppOptions
|
||||
bool warnofMultiTrig;
|
||||
bool originalData;
|
||||
|
||||
vector<StringPair> m_protocolFormats;
|
||||
std::vector<StringPair> m_protocolFormats;
|
||||
};
|
||||
|
||||
struct FrameOptions
|
||||
@ -91,8 +90,8 @@ public:
|
||||
void SaveHistory();
|
||||
void SaveFrame();
|
||||
|
||||
void SetProtocolFormat(const string &protocolName, const string &value);
|
||||
string GetProtocolFormat(const string &protocolName);
|
||||
void SetProtocolFormat(const std::string &protocolName, const std::string &value);
|
||||
std::string GetProtocolFormat(const std::string &protocolName);
|
||||
|
||||
public:
|
||||
AppOptions _appOptions;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "analogsnapshot.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
@ -35,12 +34,12 @@ Analog::Analog() :
|
||||
{
|
||||
}
|
||||
|
||||
void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot)
|
||||
void Analog::push_snapshot(AnalogSnapshot *snapshot)
|
||||
{
|
||||
_snapshots.push_front(snapshot);
|
||||
}
|
||||
|
||||
deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
|
||||
std::deque<AnalogSnapshot*>& Analog::get_snapshots()
|
||||
{
|
||||
return _snapshots;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "signaldata.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace pv {
|
||||
@ -39,17 +39,13 @@ class Analog : public SignalData
|
||||
public:
|
||||
Analog();
|
||||
|
||||
void push_snapshot(
|
||||
boost::shared_ptr<AnalogSnapshot> &snapshot);
|
||||
|
||||
std::deque< boost::shared_ptr<AnalogSnapshot> >&
|
||||
get_snapshots();
|
||||
|
||||
void push_snapshot(AnalogSnapshot *snapshot);
|
||||
std::deque<AnalogSnapshot*>& get_snapshots();
|
||||
void clear();
|
||||
void init();
|
||||
|
||||
private:
|
||||
std::deque< boost::shared_ptr<AnalogSnapshot> > _snapshots;
|
||||
std::deque<AnalogSnapshot*> _snapshots;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
|
@ -214,7 +214,7 @@ void AnalogSnapshot::append_data(void *data, uint64_t samples, uint16_t pitch)
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample) const
|
||||
const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample)
|
||||
{
|
||||
assert(start_sample >= 0);
|
||||
assert(start_sample < (int64_t)get_sample_count());
|
||||
@ -227,7 +227,7 @@ const uint8_t* AnalogSnapshot::get_samples(int64_t start_sample) const
|
||||
}
|
||||
|
||||
void AnalogSnapshot::get_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, int64_t count, float min_length, int probe_index) const
|
||||
uint64_t start, int64_t count, float min_length, int probe_index)
|
||||
{
|
||||
assert(count >= 0);
|
||||
assert(min_length > 0);
|
||||
@ -371,7 +371,7 @@ int AnalogSnapshot::get_ch_order(int sig_index)
|
||||
return order;
|
||||
}
|
||||
|
||||
int AnalogSnapshot::get_scale_factor() const
|
||||
int AnalogSnapshot::get_scale_factor()
|
||||
{
|
||||
return EnvelopeScaleFactor;
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ public:
|
||||
|
||||
void append_payload(const sr_datafeed_analog &analog);
|
||||
|
||||
const uint8_t *get_samples(int64_t start_sample) const;
|
||||
const uint8_t *get_samples(int64_t start_sample);
|
||||
|
||||
void get_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, int64_t count, float min_length, int probe_index) const;
|
||||
uint64_t start, int64_t count, float min_length, int probe_index);
|
||||
|
||||
int get_ch_order(int sig_index);
|
||||
|
||||
int get_scale_factor() const;
|
||||
int get_scale_factor();
|
||||
|
||||
bool has_data(int index);
|
||||
int get_block_num();
|
||||
|
@ -172,26 +172,8 @@ Annotation::~Annotation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint64_t Annotation::start_sample() const
|
||||
{
|
||||
return _start_sample;
|
||||
}
|
||||
|
||||
uint64_t Annotation::end_sample() const
|
||||
{
|
||||
return _end_sample;
|
||||
}
|
||||
|
||||
int Annotation::format() const
|
||||
{
|
||||
return _format;
|
||||
}
|
||||
|
||||
int Annotation::type() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::vector<QString>& Annotation::annotations() const
|
||||
{
|
||||
|
@ -46,10 +46,21 @@ public:
|
||||
|
||||
~Annotation();
|
||||
|
||||
uint64_t start_sample() const;
|
||||
uint64_t end_sample() const;
|
||||
int format() const;
|
||||
int type() const;
|
||||
inline uint64_t start_sample() const{
|
||||
return _start_sample;
|
||||
}
|
||||
|
||||
inline uint64_t end_sample() const{
|
||||
return _end_sample;
|
||||
}
|
||||
|
||||
inline int format() const{
|
||||
return _format;
|
||||
}
|
||||
|
||||
inline int type() const{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public:
|
||||
const std::vector<QString>& annotations() const;
|
||||
|
@ -22,12 +22,9 @@
|
||||
#include <libsigrokdecode4DSL/libsigrokdecode.h>
|
||||
|
||||
#include "decoder.h"
|
||||
#include <assert.h>
|
||||
|
||||
using boost::shared_ptr;
|
||||
using std::set;
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace pv {
|
||||
namespace data {
|
||||
namespace decode {
|
||||
@ -41,44 +38,18 @@ Decoder::Decoder(const srd_decoder *const dec) :
|
||||
|
||||
Decoder::~Decoder()
|
||||
{
|
||||
for (map<string, GVariant*>::const_iterator i = _options_back.begin();
|
||||
for (auto i = _options_back.begin();
|
||||
i != _options_back.end(); i++)
|
||||
if ((*i).second)
|
||||
g_variant_unref((*i).second);
|
||||
}
|
||||
|
||||
const srd_decoder* Decoder::decoder() const
|
||||
{
|
||||
return _decoder;
|
||||
}
|
||||
|
||||
bool Decoder::shown() const
|
||||
{
|
||||
return _shown;
|
||||
}
|
||||
|
||||
void Decoder::show(bool show)
|
||||
{
|
||||
_shown = show;
|
||||
}
|
||||
|
||||
const map<const srd_channel*, int>&
|
||||
Decoder::channels() const
|
||||
{
|
||||
return _probes;
|
||||
}
|
||||
|
||||
void Decoder::set_probes(std::map<const srd_channel *, int> probes)
|
||||
|
||||
void Decoder::set_probes(std::map<const srd_channel*, int> probes)
|
||||
{
|
||||
_probes_back = probes;
|
||||
_setted = true;
|
||||
}
|
||||
|
||||
const std::map<std::string, GVariant*>& Decoder::options() const
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
|
||||
void Decoder::set_option(const char *id, GVariant *value)
|
||||
{
|
||||
assert(value);
|
||||
@ -98,17 +69,7 @@ void Decoder::set_decode_region(uint64_t start, uint64_t end)
|
||||
_decode_end != end)
|
||||
_setted = true;
|
||||
}
|
||||
|
||||
uint64_t Decoder::decode_start() const
|
||||
{
|
||||
return _decode_start;
|
||||
}
|
||||
|
||||
uint64_t Decoder::decode_end() const
|
||||
{
|
||||
return _decode_end;
|
||||
}
|
||||
|
||||
|
||||
//apply setting
|
||||
bool Decoder::commit()
|
||||
{
|
||||
@ -124,7 +85,7 @@ bool Decoder::commit()
|
||||
}
|
||||
}
|
||||
|
||||
bool Decoder::have_required_probes() const
|
||||
bool Decoder::have_required_probes()
|
||||
{
|
||||
for (GSList *l = _decoder->channels; l; l = l->next) {
|
||||
const srd_channel *const pdch = (const srd_channel*)l->data;
|
||||
@ -136,12 +97,12 @@ bool Decoder::have_required_probes() const
|
||||
return true;
|
||||
}
|
||||
|
||||
srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
|
||||
srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session)
|
||||
{
|
||||
GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
|
||||
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
|
||||
|
||||
for (map<string, GVariant*>::const_iterator i = _options.begin();
|
||||
for (auto i = _options.begin();
|
||||
i != _options.end(); i++)
|
||||
{
|
||||
GVariant *const value = (*i).second;
|
||||
@ -161,7 +122,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
|
||||
GHashTable *const probes = g_hash_table_new_full(g_str_hash,
|
||||
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
|
||||
|
||||
for(map<const srd_channel*, int>::
|
||||
for(std::map<const srd_channel*, int>::
|
||||
const_iterator i = _probes.begin();
|
||||
i != _probes.end(); i++)
|
||||
{
|
||||
@ -174,11 +135,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
|
||||
|
||||
return decoder_inst;
|
||||
}
|
||||
|
||||
int Decoder::get_channel_type(const srd_channel *ch)
|
||||
{
|
||||
return ch->type;
|
||||
}
|
||||
|
||||
|
||||
} // decode
|
||||
} // data
|
||||
|
@ -27,9 +27,7 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct srd_decoder;
|
||||
@ -48,29 +46,49 @@ public:
|
||||
|
||||
virtual ~Decoder();
|
||||
|
||||
const srd_decoder* decoder() const;
|
||||
inline const srd_decoder* decoder(){
|
||||
return _decoder;
|
||||
}
|
||||
|
||||
bool shown() const;
|
||||
void show(bool show = true);
|
||||
inline bool shown(){
|
||||
return _shown;
|
||||
}
|
||||
|
||||
inline void show(bool show = true){
|
||||
_shown = show;
|
||||
}
|
||||
|
||||
inline std::map<const srd_channel*, int>& channels(){
|
||||
return _probes;
|
||||
}
|
||||
|
||||
const std::map<const srd_channel*, int>& channels() const;
|
||||
void set_probes(std::map<const srd_channel*, int> probes);
|
||||
|
||||
const std::map<std::string, GVariant*>& options() const;
|
||||
inline std::map<std::string, GVariant*>& options(){
|
||||
return _options;
|
||||
}
|
||||
|
||||
void set_option(const char *id, GVariant *value);
|
||||
|
||||
bool have_required_probes() const;
|
||||
bool have_required_probes();
|
||||
|
||||
srd_decoder_inst* create_decoder_inst(srd_session *session) const;
|
||||
srd_decoder_inst* create_decoder_inst(srd_session *session);
|
||||
|
||||
void set_decode_region(uint64_t start, uint64_t end);
|
||||
uint64_t decode_start() const;
|
||||
uint64_t decode_end() const;
|
||||
|
||||
inline uint64_t decode_start(){
|
||||
return _decode_start;
|
||||
}
|
||||
|
||||
inline uint64_t decode_end(){
|
||||
return _decode_end;
|
||||
}
|
||||
|
||||
bool commit();
|
||||
|
||||
int get_channel_type(const srd_channel* ch);
|
||||
inline int get_channel_type(const srd_channel* ch){
|
||||
return ch->type;
|
||||
}
|
||||
|
||||
private:
|
||||
const srd_decoder *const _decoder;
|
||||
|
@ -40,7 +40,14 @@ Row::Row(const srd_decoder *decoder, const srd_decoder_annotation_row *row, cons
|
||||
{
|
||||
}
|
||||
|
||||
const QString Row::title() const
|
||||
Row::Row(const Row &o)
|
||||
{
|
||||
_decoder = o._decoder;
|
||||
_row = o._row;
|
||||
_order = o._order;
|
||||
}
|
||||
|
||||
QString Row::title() const
|
||||
{
|
||||
if (_decoder && _decoder->name && _row && _row->desc)
|
||||
return QString("%1: %2")
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
const srd_decoder_annotation_row *row = NULL,
|
||||
const int order = -1);
|
||||
|
||||
Row(const Row &o);
|
||||
|
||||
public:
|
||||
|
||||
inline const srd_decoder* decoder() const{
|
||||
@ -52,9 +54,9 @@ public:
|
||||
return _row;
|
||||
}
|
||||
|
||||
const QString title() const;
|
||||
QString title() const;
|
||||
|
||||
bool operator<(const Row &other) const;
|
||||
bool operator<(const Row &other)const;
|
||||
|
||||
private:
|
||||
const srd_decoder *_decoder;
|
||||
|
@ -57,7 +57,7 @@ void RowData::clear()
|
||||
_item_count = 0;
|
||||
}
|
||||
|
||||
uint64_t RowData::get_max_sample() const
|
||||
uint64_t RowData::get_max_sample()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_global_visitor_mutex);
|
||||
|
||||
@ -66,12 +66,12 @@ uint64_t RowData::get_max_sample() const
|
||||
return _annotations.back()->end_sample();
|
||||
}
|
||||
|
||||
uint64_t RowData::get_max_annotation() const
|
||||
uint64_t RowData::get_max_annotation()
|
||||
{
|
||||
return _max_annotation;
|
||||
}
|
||||
|
||||
uint64_t RowData::get_min_annotation() const
|
||||
uint64_t RowData::get_min_annotation()
|
||||
{
|
||||
if (_min_annotation == UINT64_MAX)
|
||||
return 10;
|
||||
@ -80,7 +80,7 @@ uint64_t RowData::get_min_annotation() const
|
||||
}
|
||||
|
||||
void RowData::get_annotation_subset(std::vector<pv::data::decode::Annotation> &dest,
|
||||
uint64_t start_sample, uint64_t end_sample) const
|
||||
uint64_t start_sample, uint64_t end_sample)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_global_visitor_mutex);
|
||||
|
||||
@ -93,7 +93,7 @@ void RowData::get_annotation_subset(std::vector<pv::data::decode::Annotation> &d
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t RowData::get_annotation_index(uint64_t start_sample) const
|
||||
uint64_t RowData::get_annotation_index(uint64_t start_sample)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_global_visitor_mutex);
|
||||
uint64_t index = 0;
|
||||
@ -131,7 +131,7 @@ bool RowData::push_annotation(Annotation *a)
|
||||
}
|
||||
|
||||
|
||||
bool RowData::get_annotation(Annotation &ann, uint64_t index) const
|
||||
bool RowData::get_annotation(Annotation &ann, uint64_t index)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_global_visitor_mutex);
|
||||
|
||||
|
@ -38,26 +38,26 @@ public:
|
||||
~RowData();
|
||||
|
||||
public:
|
||||
uint64_t get_max_sample() const;
|
||||
uint64_t get_max_sample();
|
||||
|
||||
uint64_t get_max_annotation() const;
|
||||
uint64_t get_min_annotation() const;
|
||||
uint64_t get_max_annotation();
|
||||
uint64_t get_min_annotation();
|
||||
|
||||
uint64_t get_annotation_index(uint64_t start_sample) const;
|
||||
uint64_t get_annotation_index(uint64_t start_sample);
|
||||
|
||||
bool push_annotation(Annotation *a);
|
||||
|
||||
inline uint64_t get_annotation_size() const{
|
||||
inline uint64_t get_annotation_size(){
|
||||
return _item_count;
|
||||
}
|
||||
|
||||
bool get_annotation(pv::data::decode::Annotation &ann, uint64_t index) const;
|
||||
bool get_annotation(pv::data::decode::Annotation &ann, uint64_t index);
|
||||
|
||||
/**
|
||||
* Extracts sorted annotations between two period into a vector.
|
||||
*/
|
||||
void get_annotation_subset(std::vector<pv::data::decode::Annotation> &dest,
|
||||
uint64_t start_sample, uint64_t end_sample) const;
|
||||
uint64_t start_sample, uint64_t end_sample);
|
||||
|
||||
void clear();
|
||||
|
||||
|
@ -37,18 +37,13 @@ DecoderModel::DecoderModel(QObject *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void DecoderModel::setDecoderStack(boost::shared_ptr<pv::data::DecoderStack> decoder_stack)
|
||||
void DecoderModel::setDecoderStack(DecoderStack *decoder_stack)
|
||||
{
|
||||
beginResetModel();
|
||||
_decoder_stack = decoder_stack;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
const boost::shared_ptr<pv::data::DecoderStack>& DecoderModel::getDecoderStack() const
|
||||
{
|
||||
return _decoder_stack;
|
||||
}
|
||||
|
||||
|
||||
int DecoderModel::rowCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
if (_decoder_stack)
|
||||
|
@ -22,9 +22,7 @@
|
||||
#define DSVIEW_PV_DATA_DECODERMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include <pv/data/decode/rowdata.h>
|
||||
|
||||
namespace pv {
|
||||
@ -46,14 +44,16 @@ public:
|
||||
int rowCount(const QModelIndex & /*parent*/) const;
|
||||
int columnCount(const QModelIndex & /*parent*/) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,int role) const;
|
||||
|
||||
void setDecoderStack(boost::shared_ptr<pv::data::DecoderStack> decoder_stack);
|
||||
const boost::shared_ptr<pv::data::DecoderStack>& getDecoderStack() const;
|
||||
void setDecoderStack(DecoderStack *decoder_stack);
|
||||
|
||||
inline DecoderStack* getDecoderStack(){
|
||||
return _decoder_stack;
|
||||
}
|
||||
|
||||
private:
|
||||
boost::shared_ptr<pv::data::DecoderStack> _decoder_stack;
|
||||
DecoderStack *_decoder_stack;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
|
@ -35,12 +35,11 @@
|
||||
#include "../sigsession.h"
|
||||
#include "../view/logicsignal.h"
|
||||
#include "../dsvdef.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
#include <assert.h>
|
||||
|
||||
using namespace pv::data::decode;
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
namespace pv {
|
||||
namespace data {
|
||||
@ -57,6 +56,10 @@ DecoderStack::DecoderStack(pv::SigSession *session,
|
||||
const srd_decoder *const dec, DecoderStatus *decoder_status) :
|
||||
_session(session)
|
||||
{
|
||||
assert(session);
|
||||
assert(dec);
|
||||
assert(decoder_status);
|
||||
|
||||
_samples_decoded = 0;
|
||||
_sample_count = 0;
|
||||
_frame_complete = false;
|
||||
@ -75,8 +78,7 @@ DecoderStack::DecoderStack(pv::SigSession *session,
|
||||
connect(_session, SIGNAL(frame_ended()),
|
||||
this, SLOT(on_frame_ended()));
|
||||
|
||||
_stack.push_back(boost::shared_ptr<decode::Decoder>(
|
||||
new decode::Decoder(dec)));
|
||||
_stack.push_back(new decode::Decoder(dec));
|
||||
|
||||
build_row();
|
||||
}
|
||||
@ -97,7 +99,7 @@ DecoderStack::~DecoderStack()
|
||||
_class_rows.clear();
|
||||
}
|
||||
|
||||
void DecoderStack::push(boost::shared_ptr<decode::Decoder> decoder)
|
||||
void DecoderStack::push(decode::Decoder *decoder)
|
||||
{
|
||||
assert(decoder);
|
||||
_stack.push_back(decoder);
|
||||
@ -105,10 +107,10 @@ void DecoderStack::push(boost::shared_ptr<decode::Decoder> decoder)
|
||||
_options_changed = true;
|
||||
}
|
||||
|
||||
void DecoderStack::remove(boost::shared_ptr<Decoder> &decoder)
|
||||
void DecoderStack::remove(Decoder *decoder)
|
||||
{
|
||||
// Find the decoder in the stack
|
||||
list< boost::shared_ptr<Decoder> >::iterator iter = _stack.begin();
|
||||
auto iter = _stack.begin();
|
||||
for(unsigned int i = 0; i < _stack.size(); i++, iter++)
|
||||
if ((*iter) == decoder)
|
||||
break;
|
||||
@ -187,7 +189,7 @@ void DecoderStack::build_row()
|
||||
}
|
||||
}
|
||||
|
||||
int64_t DecoderStack::samples_decoded() const
|
||||
int64_t DecoderStack::samples_decoded()
|
||||
{
|
||||
std::lock_guard<std::mutex> decode_lock(_output_mutex);
|
||||
return _samples_decoded;
|
||||
@ -196,7 +198,7 @@ int64_t DecoderStack::samples_decoded() const
|
||||
void DecoderStack::get_annotation_subset(
|
||||
std::vector<pv::data::decode::Annotation> &dest,
|
||||
const Row &row, uint64_t start_sample,
|
||||
uint64_t end_sample) const
|
||||
uint64_t end_sample)
|
||||
{
|
||||
auto iter = _rows.find(row);
|
||||
if (iter != _rows.end())
|
||||
@ -206,7 +208,7 @@ void DecoderStack::get_annotation_subset(
|
||||
|
||||
|
||||
uint64_t DecoderStack::get_annotation_index(
|
||||
const Row &row, uint64_t start_sample) const
|
||||
const Row &row, uint64_t start_sample)
|
||||
{
|
||||
uint64_t index = 0;
|
||||
auto iter = _rows.find(row);
|
||||
@ -270,7 +272,7 @@ void DecoderStack::set_rows_lshow(const decode::Row row, bool show)
|
||||
}
|
||||
}
|
||||
|
||||
bool DecoderStack::has_annotations(const Row &row) const
|
||||
bool DecoderStack::has_annotations(const Row &row)
|
||||
{
|
||||
auto iter =
|
||||
_rows.find(row);
|
||||
@ -283,13 +285,13 @@ bool DecoderStack::has_annotations(const Row &row) const
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t DecoderStack::list_annotation_size() const
|
||||
uint64_t DecoderStack::list_annotation_size()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_output_mutex);
|
||||
uint64_t max_annotation_size = 0;
|
||||
for (auto i = _rows.begin();
|
||||
i != _rows.end(); i++) {
|
||||
map<const Row, bool>::const_iterator iter = _rows_lshow.find((*i).first);
|
||||
auto iter = _rows_lshow.find((*i).first);
|
||||
if (iter != _rows_lshow.end() && (*iter).second)
|
||||
max_annotation_size = max(max_annotation_size,
|
||||
(*i).second->get_annotation_size());
|
||||
@ -298,11 +300,11 @@ uint64_t DecoderStack::list_annotation_size() const
|
||||
return max_annotation_size;
|
||||
}
|
||||
|
||||
uint64_t DecoderStack::list_annotation_size(uint16_t row_index) const
|
||||
uint64_t DecoderStack::list_annotation_size(uint16_t row_index)
|
||||
{
|
||||
for (auto i = _rows.begin();
|
||||
i != _rows.end(); i++) {
|
||||
map<const Row, bool>::const_iterator iter = _rows_lshow.find((*i).first);
|
||||
auto iter = _rows_lshow.find((*i).first);
|
||||
if (iter != _rows_lshow.end() && (*iter).second)
|
||||
if (row_index-- == 0) {
|
||||
return (*i).second->get_annotation_size();
|
||||
@ -312,11 +314,11 @@ uint64_t DecoderStack::list_annotation_size(uint16_t row_index) const
|
||||
}
|
||||
|
||||
bool DecoderStack::list_annotation(pv::data::decode::Annotation &ann,
|
||||
uint16_t row_index, uint64_t col_index) const
|
||||
uint16_t row_index, uint64_t col_index)
|
||||
{
|
||||
for (auto i = _rows.begin();
|
||||
i != _rows.end(); i++) {
|
||||
map<const Row, bool>::const_iterator iter = _rows_lshow.find((*i).first);
|
||||
auto iter = _rows_lshow.find((*i).first);
|
||||
if (iter != _rows_lshow.end() && (*iter).second) {
|
||||
if (row_index-- == 0) {
|
||||
return (*i).second->get_annotation(ann, col_index);
|
||||
@ -328,11 +330,11 @@ bool DecoderStack::list_annotation(pv::data::decode::Annotation &ann,
|
||||
}
|
||||
|
||||
|
||||
bool DecoderStack::list_row_title(int row, QString &title) const
|
||||
bool DecoderStack::list_row_title(int row, QString &title)
|
||||
{
|
||||
for (auto i = _rows.begin();
|
||||
i != _rows.end(); i++) {
|
||||
map<const Row, bool>::const_iterator iter = _rows_lshow.find((*i).first);
|
||||
auto iter = _rows_lshow.find((*i).first);
|
||||
if (iter != _rows_lshow.end() && (*iter).second) {
|
||||
if (row-- == 0) {
|
||||
title = (*i).first.title();
|
||||
@ -385,8 +387,8 @@ void DecoderStack::stop_decode()
|
||||
|
||||
void DecoderStack::begin_decode()
|
||||
{
|
||||
boost::shared_ptr<pv::view::LogicSignal> logic_signal;
|
||||
boost::shared_ptr<pv::data::Logic> data;
|
||||
pv::view::LogicSignal *logic_signal = NULL;
|
||||
pv::data::Logic *data = NULL;
|
||||
|
||||
if (!_options_changed)
|
||||
return;
|
||||
@ -409,7 +411,7 @@ void DecoderStack::begin_decode()
|
||||
if (dec && !dec->channels().empty()) {
|
||||
for(auto &sig : _session->get_signals()) {
|
||||
if((sig->get_index() == (*dec->channels().begin()).second) &&
|
||||
(logic_signal = dynamic_pointer_cast<view::LogicSignal>(sig)) &&
|
||||
(logic_signal = dynamic_cast<view::LogicSignal*>(sig)) &&
|
||||
(data = logic_signal->logic_data()))
|
||||
break;
|
||||
}
|
||||
@ -422,8 +424,7 @@ void DecoderStack::begin_decode()
|
||||
return;
|
||||
|
||||
// Check we have a snapshot of data
|
||||
const deque< boost::shared_ptr<pv::data::LogicSnapshot> > &snapshots =
|
||||
data->get_snapshots();
|
||||
const auto &snapshots = data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return;
|
||||
_snapshot = snapshots.front();
|
||||
@ -445,7 +446,7 @@ void DecoderStack::begin_decode()
|
||||
_decode_thread = new std::thread(&DecoderStack::decode_proc, this);
|
||||
}
|
||||
|
||||
uint64_t DecoderStack::get_max_sample_count() const
|
||||
uint64_t DecoderStack::get_max_sample_count()
|
||||
{
|
||||
uint64_t max_sample_count = 0;
|
||||
|
||||
@ -596,7 +597,7 @@ void DecoderStack::decode_proc()
|
||||
_decode_state = Stopped;
|
||||
}
|
||||
|
||||
uint64_t DecoderStack::sample_count() const
|
||||
uint64_t DecoderStack::sample_count()
|
||||
{
|
||||
if (_snapshot)
|
||||
return _snapshot->get_sample_count();
|
||||
@ -604,7 +605,7 @@ uint64_t DecoderStack::sample_count() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t DecoderStack::sample_rate() const
|
||||
uint64_t DecoderStack::sample_rate()
|
||||
{
|
||||
return _samplerate;
|
||||
}
|
||||
@ -679,14 +680,14 @@ int DecoderStack::list_rows_size()
|
||||
{
|
||||
int rows_size = 0;
|
||||
for (auto i = _rows.begin(); i != _rows.end(); i++) {
|
||||
map<const Row, bool>::const_iterator iter = _rows_lshow.find((*i).first);
|
||||
auto iter = _rows_lshow.find((*i).first);
|
||||
if (iter != _rows_lshow.end() && (*iter).second)
|
||||
rows_size++;
|
||||
}
|
||||
return rows_size;
|
||||
}
|
||||
|
||||
bool DecoderStack::options_changed() const
|
||||
bool DecoderStack::options_changed()
|
||||
{
|
||||
return _options_changed;
|
||||
}
|
||||
@ -696,7 +697,7 @@ void DecoderStack::set_options_changed(bool changed)
|
||||
_options_changed = changed;
|
||||
}
|
||||
|
||||
bool DecoderStack::out_of_memory() const
|
||||
bool DecoderStack::out_of_memory()
|
||||
{
|
||||
return _no_memory;
|
||||
}
|
||||
@ -706,7 +707,7 @@ void DecoderStack::set_mark_index(int64_t index)
|
||||
_mark_index = index;
|
||||
}
|
||||
|
||||
int64_t DecoderStack::get_mark_index() const
|
||||
int64_t DecoderStack::get_mark_index()
|
||||
{
|
||||
return _mark_index;
|
||||
}
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
||||
#include <QObject>
|
||||
@ -88,17 +87,17 @@ public:
|
||||
|
||||
virtual ~DecoderStack();
|
||||
|
||||
inline std::list< boost::shared_ptr<decode::Decoder> >& stack(){
|
||||
inline std::list<decode::Decoder*>& stack(){
|
||||
return _stack;
|
||||
}
|
||||
|
||||
void push(boost::shared_ptr<decode::Decoder> decoder);
|
||||
void push(decode::Decoder *decoder);
|
||||
|
||||
void remove(boost::shared_ptr<decode::Decoder>& decoder);
|
||||
void remove(decode::Decoder *decoder);
|
||||
|
||||
void build_row();
|
||||
|
||||
int64_t samples_decoded() const;
|
||||
int64_t samples_decoded();
|
||||
|
||||
/**
|
||||
* Extracts sorted annotations between two period into a vector.
|
||||
@ -106,10 +105,10 @@ public:
|
||||
void get_annotation_subset(
|
||||
std::vector<pv::data::decode::Annotation> &dest,
|
||||
const decode::Row &row, uint64_t start_sample,
|
||||
uint64_t end_sample) const;
|
||||
uint64_t end_sample);
|
||||
|
||||
uint64_t get_annotation_index(
|
||||
const decode::Row &row, uint64_t start_sample) const;
|
||||
const decode::Row &row, uint64_t start_sample);
|
||||
|
||||
uint64_t get_max_annotation(const decode::Row &row);
|
||||
uint64_t get_min_annotation(const decode::Row &row); // except instant(end=start) annotation
|
||||
@ -119,24 +118,24 @@ public:
|
||||
void set_rows_gshow(const decode::Row row, bool show);
|
||||
void set_rows_lshow(const decode::Row row, bool show);
|
||||
|
||||
bool has_annotations(const decode::Row &row) const;
|
||||
bool has_annotations(const decode::Row &row);
|
||||
|
||||
uint64_t list_annotation_size() const;
|
||||
uint64_t list_annotation_size(uint16_t row_index) const;
|
||||
uint64_t list_annotation_size();
|
||||
uint64_t list_annotation_size(uint16_t row_index);
|
||||
|
||||
|
||||
bool list_annotation(decode::Annotation &ann,
|
||||
uint16_t row_index, uint64_t col_index) const;
|
||||
uint16_t row_index, uint64_t col_index);
|
||||
|
||||
|
||||
bool list_row_title(int row, QString &title) const;
|
||||
bool list_row_title(int row, QString &title);
|
||||
|
||||
QString error_message();
|
||||
|
||||
void clear();
|
||||
void init();
|
||||
|
||||
uint64_t get_max_sample_count() const;
|
||||
uint64_t get_max_sample_count();
|
||||
|
||||
void begin_decode();
|
||||
|
||||
@ -144,16 +143,16 @@ public:
|
||||
|
||||
int list_rows_size();
|
||||
|
||||
bool options_changed() const;
|
||||
bool options_changed();
|
||||
void set_options_changed(bool changed);
|
||||
|
||||
uint64_t sample_count() const;
|
||||
uint64_t sample_rate() const;
|
||||
uint64_t sample_count();
|
||||
uint64_t sample_rate();
|
||||
|
||||
bool out_of_memory() const;
|
||||
bool out_of_memory();
|
||||
|
||||
void set_mark_index(int64_t index);
|
||||
int64_t get_mark_index() const;
|
||||
int64_t get_mark_index();
|
||||
|
||||
private:
|
||||
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
|
||||
@ -174,9 +173,9 @@ signals:
|
||||
void decode_done();
|
||||
|
||||
private:
|
||||
std::list< boost::shared_ptr<decode::Decoder> > _stack;
|
||||
std::list<decode::Decoder*> _stack;
|
||||
|
||||
boost::shared_ptr<pv::data::LogicSnapshot> _snapshot;
|
||||
pv::data::LogicSnapshot *_snapshot;
|
||||
|
||||
std::map<const decode::Row, decode::RowData*> _rows;
|
||||
std::map<const decode::Row, bool> _rows_gshow;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "dsosnapshot.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
@ -34,12 +33,12 @@ Dso::Dso() :
|
||||
{
|
||||
}
|
||||
|
||||
void Dso::push_snapshot(boost::shared_ptr<DsoSnapshot> &snapshot)
|
||||
void Dso::push_snapshot(DsoSnapshot *snapshot)
|
||||
{
|
||||
_snapshots.push_front(snapshot);
|
||||
}
|
||||
|
||||
deque< boost::shared_ptr<DsoSnapshot> >& Dso::get_snapshots()
|
||||
std::deque<DsoSnapshot*>& Dso::get_snapshots()
|
||||
{
|
||||
return _snapshots;
|
||||
}
|
||||
|
@ -24,8 +24,7 @@
|
||||
#define DSVIEW_PV_DATA_DSO_H
|
||||
|
||||
#include "signaldata.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace pv {
|
||||
@ -38,17 +37,15 @@ class Dso : public SignalData
|
||||
public:
|
||||
Dso();
|
||||
|
||||
void push_snapshot(
|
||||
boost::shared_ptr<DsoSnapshot> &snapshot);
|
||||
void push_snapshot(DsoSnapshot *snapshot);
|
||||
|
||||
std::deque< boost::shared_ptr<DsoSnapshot> >&
|
||||
get_snapshots();
|
||||
std::deque<DsoSnapshot*>& get_snapshots();
|
||||
|
||||
void clear();
|
||||
void init();
|
||||
|
||||
private:
|
||||
std::deque< boost::shared_ptr<DsoSnapshot> > _snapshots;
|
||||
std::deque<DsoSnapshot*> _snapshots;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
|
@ -210,7 +210,7 @@ const uint8_t *DsoSnapshot::get_samples(
|
||||
}
|
||||
|
||||
void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, uint64_t end, float min_length, int probe_index) const
|
||||
uint64_t start, uint64_t end, float min_length, int probe_index)
|
||||
{
|
||||
assert(end <= get_sample_count());
|
||||
assert(start <= end);
|
||||
@ -348,7 +348,7 @@ void DsoSnapshot::append_payload_to_envelope_levels(bool header)
|
||||
_envelope_done = true;
|
||||
}
|
||||
|
||||
double DsoSnapshot::cal_vrms(double zero_off, int index) const
|
||||
double DsoSnapshot::cal_vrms(double zero_off, int index)
|
||||
{
|
||||
assert(index >= 0);
|
||||
//assert(index < _channel_num);
|
||||
@ -383,7 +383,7 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const
|
||||
return vrms;
|
||||
}
|
||||
|
||||
double DsoSnapshot::cal_vmean(int index) const
|
||||
double DsoSnapshot::cal_vmean(int index)
|
||||
{
|
||||
assert(index >= 0);
|
||||
//assert(index < _channel_num);
|
||||
|
@ -95,12 +95,12 @@ public:
|
||||
int64_t end_sample, uint16_t index);
|
||||
|
||||
void get_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, uint64_t end, float min_length, int probe_index) const;
|
||||
uint64_t start, uint64_t end, float min_length, int probe_index);
|
||||
|
||||
void enable_envelope(bool enable);
|
||||
|
||||
double cal_vrms(double zero_off, int index) const;
|
||||
double cal_vmean(int index) const;
|
||||
double cal_vrms(double zero_off, int index);
|
||||
double cal_vmean(int index);
|
||||
|
||||
bool has_data(int index);
|
||||
int get_block_num();
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "groupsnapshot.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
@ -34,12 +33,12 @@ Group::Group() :
|
||||
{
|
||||
}
|
||||
|
||||
void Group::push_snapshot(boost::shared_ptr<GroupSnapshot> &snapshot)
|
||||
void Group::push_snapshot(GroupSnapshot *snapshot)
|
||||
{
|
||||
_snapshots.push_back(snapshot);
|
||||
}
|
||||
|
||||
deque< boost::shared_ptr<GroupSnapshot> >& Group::get_snapshots()
|
||||
std::deque<GroupSnapshot*>& Group::get_snapshots()
|
||||
{
|
||||
return _snapshots;
|
||||
}
|
||||
|
@ -24,8 +24,7 @@
|
||||
#define DSVIEW_PV_DATA_GROUP_H
|
||||
|
||||
#include "signaldata.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace pv {
|
||||
@ -38,17 +37,15 @@ class Group : public SignalData
|
||||
public:
|
||||
Group();
|
||||
|
||||
void push_snapshot(
|
||||
boost::shared_ptr<GroupSnapshot> &snapshot);
|
||||
void push_snapshot(GroupSnapshot *snapshot);
|
||||
|
||||
std::deque< boost::shared_ptr<GroupSnapshot> >&
|
||||
get_snapshots();
|
||||
std::deque<GroupSnapshot*>& get_snapshots();
|
||||
|
||||
void clear();
|
||||
void init();
|
||||
|
||||
private:
|
||||
std::deque< boost::shared_ptr<GroupSnapshot> > _snapshots;
|
||||
std::deque<GroupSnapshot*> _snapshots;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
|
@ -27,12 +27,10 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include "logicsnapshot.h"
|
||||
#include "groupsnapshot.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
@ -48,15 +46,17 @@ const uint16_t GroupSnapshot::value_mask[16] = {0x1, 0x2, 0x4, 0x8,
|
||||
0x100, 0x200, 0x400, 0x800,
|
||||
0x1000, 0x2000, 0x4000, 0x8000};
|
||||
|
||||
GroupSnapshot::GroupSnapshot(const boost::shared_ptr<LogicSnapshot> &_logic_snapshot, std::list<int> index_list)
|
||||
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();
|
||||
_data = logic_snapshot->get_data();
|
||||
_sample_count = logic_snapshot->get_sample_count();
|
||||
_unit_size = logic_snapshot->unit_size();
|
||||
_index_list = index_list;
|
||||
|
||||
_mask = 0;
|
||||
@ -108,7 +108,7 @@ void GroupSnapshot::clear()
|
||||
|
||||
}
|
||||
|
||||
uint64_t GroupSnapshot::get_sample_count() const
|
||||
uint64_t GroupSnapshot::get_sample_count()
|
||||
{
|
||||
return _sample_count;
|
||||
}
|
||||
@ -150,7 +150,7 @@ const uint16_t* GroupSnapshot::get_samples(
|
||||
}
|
||||
|
||||
void GroupSnapshot::get_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, uint64_t end, float min_length) const
|
||||
uint64_t start, uint64_t end, float min_length)
|
||||
{
|
||||
assert(end <= _sample_count);
|
||||
assert(start <= end);
|
||||
|
@ -22,10 +22,7 @@
|
||||
|
||||
#ifndef DSVIEW_PV_DATA_GROUPSNAPSHOT_H
|
||||
#define DSVIEW_PV_DATA_GROUPSNAPSHOT_H
|
||||
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "../view/signal.h"
|
||||
|
||||
#include <utility>
|
||||
@ -75,7 +72,7 @@ private:
|
||||
static const uint16_t value_mask[16];
|
||||
|
||||
public:
|
||||
GroupSnapshot(const boost::shared_ptr<LogicSnapshot> &_logic_snapshot, std::list<int> index_list);
|
||||
GroupSnapshot(const LogicSnapshot *_logic_snapshot, std::list<int> index_list);
|
||||
|
||||
virtual ~GroupSnapshot();
|
||||
|
||||
@ -84,13 +81,13 @@ public:
|
||||
|
||||
void append_payload();
|
||||
|
||||
uint64_t get_sample_count() const;
|
||||
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) const;
|
||||
uint64_t start, uint64_t end, float min_length);
|
||||
|
||||
private:
|
||||
void reallocate_envelope(Envelope &l);
|
||||
@ -103,7 +100,7 @@ private:
|
||||
const void *_data;
|
||||
uint64_t _sample_count;
|
||||
int _unit_size;
|
||||
boost::shared_ptr<view::Signal> _signal;
|
||||
view::Signal *_signal;
|
||||
std::list<int> _index_list;
|
||||
uint16_t _mask;
|
||||
int _bubble_start[32];
|
||||
|
@ -22,8 +22,7 @@
|
||||
|
||||
#include "logic.h"
|
||||
#include "logicsnapshot.h"
|
||||
|
||||
using namespace boost;
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
@ -34,13 +33,12 @@ Logic::Logic() :
|
||||
{
|
||||
}
|
||||
|
||||
void Logic::push_snapshot(
|
||||
boost::shared_ptr<LogicSnapshot> &snapshot)
|
||||
void Logic::push_snapshot(LogicSnapshot *snapshot)
|
||||
{
|
||||
_snapshots.push_front(snapshot);
|
||||
}
|
||||
|
||||
deque< boost::shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
|
||||
std::deque<LogicSnapshot*>& Logic::get_snapshots()
|
||||
{
|
||||
return _snapshots;
|
||||
}
|
||||
|
@ -25,8 +25,7 @@
|
||||
#define DSVIEW_PV_DATA_LOGIC_H
|
||||
|
||||
#include "signaldata.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace pv {
|
||||
@ -39,18 +38,16 @@ class Logic : public SignalData
|
||||
public:
|
||||
Logic();
|
||||
|
||||
void push_snapshot(
|
||||
boost::shared_ptr<LogicSnapshot> &snapshot);
|
||||
void push_snapshot(LogicSnapshot *snapshot);
|
||||
|
||||
std::deque< boost::shared_ptr<LogicSnapshot> >&
|
||||
get_snapshots();
|
||||
std::deque<LogicSnapshot*>& get_snapshots();
|
||||
|
||||
void clear();
|
||||
|
||||
void init();
|
||||
|
||||
private:
|
||||
std::deque< boost::shared_ptr<LogicSnapshot> > _snapshots;
|
||||
std::deque<LogicSnapshot*> _snapshots;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
|
@ -73,8 +73,8 @@ const QString MathStack::vDialDivUnit[MathStack::vDialUnitCount] = {
|
||||
};
|
||||
|
||||
MathStack::MathStack(pv::SigSession *session,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig1,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig2,
|
||||
view::DsoSignal* dsoSig1,
|
||||
view::DsoSignal* dsoSig2,
|
||||
MathType type) :
|
||||
_session(session),
|
||||
_dsoSig1(dsoSig1),
|
||||
@ -117,12 +117,12 @@ void MathStack::init()
|
||||
_envelope_done = false;
|
||||
}
|
||||
|
||||
MathStack::MathType MathStack::get_type() const
|
||||
MathStack::MathType MathStack::get_type()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
uint64_t MathStack::get_sample_num() const
|
||||
uint64_t MathStack::get_sample_num()
|
||||
{
|
||||
return _sample_num;
|
||||
}
|
||||
@ -276,13 +276,13 @@ double MathStack::get_math_scale()
|
||||
return scale;
|
||||
}
|
||||
|
||||
const double* MathStack::get_math(uint64_t start) const
|
||||
const double* MathStack::get_math(uint64_t start)
|
||||
{
|
||||
return _math.data() + start;
|
||||
}
|
||||
|
||||
void MathStack::get_math_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, uint64_t end, float min_length) const
|
||||
uint64_t start, uint64_t end, float min_length)
|
||||
{
|
||||
assert(end <= get_sample_num());
|
||||
assert(start <= end);
|
||||
@ -316,14 +316,12 @@ void MathStack::calc_math()
|
||||
|
||||
_math_state = Running;
|
||||
|
||||
const boost::shared_ptr<pv::data::Dso> data = _dsoSig1->dso_data();
|
||||
const deque< boost::shared_ptr<pv::data::DsoSnapshot> > &snapshots =
|
||||
data->get_snapshots();
|
||||
const auto data = _dsoSig1->dso_data();
|
||||
const auto &snapshots = data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return;
|
||||
|
||||
const boost::shared_ptr<pv::data::DsoSnapshot> &snapshot =
|
||||
snapshots.front();
|
||||
const auto snapshot = snapshots.front();
|
||||
if (snapshot->empty())
|
||||
return;
|
||||
|
||||
|
@ -25,9 +25,8 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
@ -103,16 +102,16 @@ private:
|
||||
|
||||
public:
|
||||
MathStack(pv::SigSession *_session,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig1,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig2, MathType type);
|
||||
view::DsoSignal *dsoSig1,
|
||||
view::DsoSignal *dsoSig2, MathType type);
|
||||
virtual ~MathStack();
|
||||
void clear();
|
||||
void init();
|
||||
void free_envelop();
|
||||
void realloc(uint64_t num);
|
||||
|
||||
MathType get_type() const;
|
||||
uint64_t get_sample_num() const;
|
||||
MathType get_type();
|
||||
uint64_t get_sample_num();
|
||||
|
||||
void enable_envelope(bool enable);
|
||||
|
||||
@ -121,9 +120,9 @@ public:
|
||||
QString get_unit(int level);
|
||||
double get_math_scale();
|
||||
|
||||
const double *get_math(uint64_t start) const;
|
||||
const double *get_math(uint64_t start);
|
||||
void get_math_envelope_section(EnvelopeSection &s,
|
||||
uint64_t start, uint64_t end, float min_length) const;
|
||||
uint64_t start, uint64_t end, float min_length);
|
||||
|
||||
void calc_math();
|
||||
void reallocate_envelope(Envelope &e);
|
||||
@ -132,9 +131,9 @@ public:
|
||||
signals:
|
||||
|
||||
private:
|
||||
pv::SigSession *_session;
|
||||
boost::shared_ptr<view::DsoSignal> _dsoSig1;
|
||||
boost::shared_ptr<view::DsoSignal> _dsoSig2;
|
||||
pv::SigSession *_session;
|
||||
view::DsoSignal *_dsoSig1;
|
||||
view::DsoSignal *_dsoSig2;
|
||||
|
||||
MathType _type;
|
||||
uint64_t _sample_num;
|
||||
|
@ -64,12 +64,12 @@ void Snapshot::free_data()
|
||||
_ch_index.clear();
|
||||
}
|
||||
|
||||
bool Snapshot::memory_failed() const
|
||||
bool Snapshot::memory_failed()
|
||||
{
|
||||
return _memory_failed;
|
||||
}
|
||||
|
||||
bool Snapshot::empty() const
|
||||
bool Snapshot::empty()
|
||||
{
|
||||
if (get_sample_count() == 0)
|
||||
return true;
|
||||
@ -77,7 +77,7 @@ bool Snapshot::empty() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Snapshot::last_ended() const
|
||||
bool Snapshot::last_ended()
|
||||
{
|
||||
return _last_ended;
|
||||
}
|
||||
@ -87,13 +87,13 @@ void Snapshot::set_last_ended(bool ended)
|
||||
_last_ended = ended;
|
||||
}
|
||||
|
||||
uint64_t Snapshot::get_sample_count() const
|
||||
uint64_t Snapshot::get_sample_count()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
return _sample_count;
|
||||
}
|
||||
|
||||
uint64_t Snapshot::get_ring_start() const
|
||||
uint64_t Snapshot::get_ring_start()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (_sample_count < _total_sample_count)
|
||||
@ -102,7 +102,7 @@ uint64_t Snapshot::get_ring_start() const
|
||||
return _ring_sample_count;
|
||||
}
|
||||
|
||||
uint64_t Snapshot::get_ring_end() const
|
||||
uint64_t Snapshot::get_ring_end()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (_sample_count == 0)
|
||||
@ -113,22 +113,22 @@ uint64_t Snapshot::get_ring_end() const
|
||||
return _ring_sample_count - 1;
|
||||
}
|
||||
|
||||
const void* Snapshot::get_data() const
|
||||
const void* Snapshot::get_data()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
int Snapshot::unit_size() const
|
||||
int Snapshot::unit_size()
|
||||
{
|
||||
return _unit_size;
|
||||
}
|
||||
|
||||
uint8_t Snapshot::get_unit_bytes() const
|
||||
uint8_t Snapshot::get_unit_bytes()
|
||||
{
|
||||
return _unit_bytes;
|
||||
}
|
||||
|
||||
unsigned int Snapshot::get_channel_num() const
|
||||
unsigned int Snapshot::get_channel_num()
|
||||
{
|
||||
return _channel_num;
|
||||
}
|
||||
|
@ -39,22 +39,22 @@ public:
|
||||
virtual void clear() = 0;
|
||||
virtual void init() = 0;
|
||||
|
||||
uint64_t get_sample_count() const;
|
||||
uint64_t get_ring_start() const;
|
||||
uint64_t get_ring_end() const;
|
||||
uint64_t get_sample_count();
|
||||
uint64_t get_ring_start();
|
||||
uint64_t get_ring_end();
|
||||
|
||||
const void * get_data() const;
|
||||
const void * get_data();
|
||||
|
||||
int unit_size() const;
|
||||
uint8_t get_unit_bytes() const;
|
||||
int unit_size();
|
||||
uint8_t get_unit_bytes();
|
||||
|
||||
bool memory_failed() const;
|
||||
bool empty() const;
|
||||
bool memory_failed();
|
||||
bool empty();
|
||||
|
||||
bool last_ended() const;
|
||||
bool last_ended();
|
||||
void set_last_ended(bool ended);
|
||||
|
||||
unsigned int get_channel_num() const;
|
||||
unsigned int get_channel_num();
|
||||
|
||||
virtual void capture_ended();
|
||||
virtual bool has_data(int index) = 0;
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
protected:
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
//std::vector<uint8_t> _data;
|
||||
|
||||
void* _data;
|
||||
mutable std::vector<uint16_t> _ch_index;
|
||||
|
||||
|
@ -76,12 +76,12 @@ void SpectrumStack::init()
|
||||
{
|
||||
}
|
||||
|
||||
int SpectrumStack::get_index() const
|
||||
int SpectrumStack::get_index()
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
uint64_t SpectrumStack::get_sample_num() const
|
||||
uint64_t SpectrumStack::get_sample_num()
|
||||
{
|
||||
return _sample_num;
|
||||
}
|
||||
@ -96,7 +96,7 @@ void SpectrumStack::set_sample_num(uint64_t num)
|
||||
FFTW_R2HC, FFTW_ESTIMATE);
|
||||
}
|
||||
|
||||
int SpectrumStack::get_windows_index() const
|
||||
int SpectrumStack::get_windows_index()
|
||||
{
|
||||
return _windows_index;
|
||||
}
|
||||
@ -106,7 +106,7 @@ void SpectrumStack::set_windows_index(int index)
|
||||
_windows_index = index;
|
||||
}
|
||||
|
||||
bool SpectrumStack::dc_ignored() const
|
||||
bool SpectrumStack::dc_ignored()
|
||||
{
|
||||
return _dc_ignore;
|
||||
}
|
||||
@ -116,7 +116,7 @@ void SpectrumStack::set_dc_ignore(bool ignore)
|
||||
_dc_ignore = ignore;
|
||||
}
|
||||
|
||||
int SpectrumStack::get_sample_interval() const
|
||||
int SpectrumStack::get_sample_interval()
|
||||
{
|
||||
return _sample_interval;
|
||||
}
|
||||
@ -126,7 +126,7 @@ void SpectrumStack::set_sample_interval(int interval)
|
||||
_sample_interval = interval;
|
||||
}
|
||||
|
||||
const std::vector<QString> SpectrumStack::get_windows_support() const
|
||||
const std::vector<QString> SpectrumStack::get_windows_support()
|
||||
{
|
||||
std::vector<QString> windows;
|
||||
for (size_t i = 0; i < sizeof(windows_support)/sizeof(windows_support[0]); i++)
|
||||
@ -136,7 +136,7 @@ const std::vector<QString> SpectrumStack::get_windows_support() const
|
||||
return windows;
|
||||
}
|
||||
|
||||
const std::vector<uint64_t> SpectrumStack::get_length_support() const
|
||||
const std::vector<uint64_t> SpectrumStack::get_length_support()
|
||||
{
|
||||
std::vector<uint64_t> length;
|
||||
for (size_t i = 0; i < sizeof(length_support)/sizeof(length_support[0]); i++)
|
||||
@ -146,7 +146,7 @@ const std::vector<uint64_t> SpectrumStack::get_length_support() const
|
||||
return length;
|
||||
}
|
||||
|
||||
const std::vector<double> SpectrumStack::get_fft_spectrum() const
|
||||
const std::vector<double> SpectrumStack::get_fft_spectrum()
|
||||
{
|
||||
std::vector<double> empty;
|
||||
if (_spectrum_state == Stopped)
|
||||
@ -168,11 +168,11 @@ void SpectrumStack::calc_fft()
|
||||
{
|
||||
_spectrum_state = Running;
|
||||
// Get the dso data
|
||||
boost::shared_ptr<pv::data::Dso> data;
|
||||
boost::shared_ptr<pv::view::DsoSignal> dsoSig;
|
||||
pv::data::Dso *data = NULL;
|
||||
pv::view::DsoSignal *dsoSig = NULL;
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_index() == _index && dsoSig->enabled()) {
|
||||
data = dsoSig->dso_data();
|
||||
break;
|
||||
@ -184,10 +184,10 @@ void SpectrumStack::calc_fft()
|
||||
return;
|
||||
|
||||
// Check we have a snapshot of data
|
||||
const deque< boost::shared_ptr<pv::data::DsoSnapshot> > &snapshots =
|
||||
data->get_snapshots();
|
||||
const auto &snapshots = data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return;
|
||||
|
||||
_snapshot = snapshots.front();
|
||||
|
||||
if (_snapshot->get_sample_count() < _sample_num*_sample_interval)
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <fftw3.h>
|
||||
|
||||
@ -67,24 +66,24 @@ public:
|
||||
void clear();
|
||||
void init();
|
||||
|
||||
int get_index() const;
|
||||
int get_index();
|
||||
|
||||
uint64_t get_sample_num() const;
|
||||
uint64_t get_sample_num();
|
||||
void set_sample_num(uint64_t num);
|
||||
|
||||
int get_windows_index() const;
|
||||
int get_windows_index();
|
||||
void set_windows_index(int index);
|
||||
|
||||
const std::vector<QString> get_windows_support() const;
|
||||
const std::vector<uint64_t> get_length_support() const;
|
||||
const std::vector<QString> get_windows_support();
|
||||
const std::vector<uint64_t> get_length_support();
|
||||
|
||||
bool dc_ignored() const;
|
||||
bool dc_ignored();
|
||||
void set_dc_ignore(bool ignore);
|
||||
|
||||
int get_sample_interval() const;
|
||||
int get_sample_interval();
|
||||
void set_sample_interval(int interval);
|
||||
|
||||
const std::vector<double> get_fft_spectrum() const;
|
||||
const std::vector<double> get_fft_spectrum();
|
||||
double get_fft_spectrum(uint64_t index);
|
||||
|
||||
void calc_fft();
|
||||
@ -102,7 +101,7 @@ private:
|
||||
bool _dc_ignore;
|
||||
int _sample_interval;
|
||||
|
||||
boost::shared_ptr<pv::data::DsoSnapshot> _snapshot;
|
||||
pv::data::DsoSnapshot *_snapshot;
|
||||
spectrum_state _spectrum_state;
|
||||
|
||||
fftw_plan _fft_plan;
|
||||
|
@ -42,7 +42,7 @@ Device::~Device()
|
||||
|
||||
}
|
||||
|
||||
sr_dev_inst* Device::dev_inst() const
|
||||
sr_dev_inst* Device::dev_inst()
|
||||
{
|
||||
return _sdi;
|
||||
}
|
||||
@ -70,7 +70,7 @@ void Device::release()
|
||||
sr_dev_close(_sdi);
|
||||
}
|
||||
|
||||
QString Device::format_device_title() const
|
||||
QString Device::format_device_title()
|
||||
{
|
||||
ostringstream s;
|
||||
|
||||
@ -95,7 +95,7 @@ QString Device::format_device_title() const
|
||||
return QString::fromStdString(s.str());
|
||||
}
|
||||
|
||||
bool Device::is_trigger_enabled() const
|
||||
bool Device::is_trigger_enabled()
|
||||
{
|
||||
assert(_sdi);
|
||||
for (const GSList *l = _sdi->channels; l; l = l->next) {
|
||||
|
@ -34,15 +34,15 @@ public:
|
||||
|
||||
~Device();
|
||||
|
||||
sr_dev_inst* dev_inst() const;
|
||||
sr_dev_inst* dev_inst();
|
||||
|
||||
void use(SigSession *owner);
|
||||
|
||||
void release();
|
||||
|
||||
QString format_device_title() const;
|
||||
QString format_device_title();
|
||||
|
||||
bool is_trigger_enabled() const;
|
||||
bool is_trigger_enabled();
|
||||
|
||||
private:
|
||||
sr_dev_inst *const _sdi;
|
||||
|
@ -43,7 +43,7 @@ DevInst::~DevInst()
|
||||
free(_id);
|
||||
}
|
||||
|
||||
void* DevInst::get_id() const
|
||||
void* DevInst::get_id()
|
||||
{
|
||||
assert(_id);
|
||||
|
||||
@ -64,7 +64,7 @@ void DevInst::release()
|
||||
}
|
||||
}
|
||||
|
||||
SigSession* DevInst::owner() const
|
||||
SigSession* DevInst::owner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
@ -188,7 +188,7 @@ QString DevInst::name()
|
||||
return QString::fromLocal8Bit(sdi->driver->name);
|
||||
}
|
||||
|
||||
bool DevInst::is_trigger_enabled() const
|
||||
bool DevInst::is_trigger_enabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -204,7 +204,7 @@ void DevInst::run()
|
||||
sr_session_run();
|
||||
}
|
||||
|
||||
bool DevInst::is_usable() const
|
||||
bool DevInst::is_usable()
|
||||
{
|
||||
return _usable;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ protected:
|
||||
virtual ~DevInst();
|
||||
|
||||
public:
|
||||
SigSession* owner() const;
|
||||
SigSession* owner();
|
||||
|
||||
GVariant* get_config(const sr_channel *ch, const sr_channel_group *group, int key);
|
||||
|
||||
@ -108,7 +108,7 @@ public:
|
||||
QString name();
|
||||
|
||||
|
||||
bool is_usable() const;
|
||||
bool is_usable();
|
||||
|
||||
void destroy();
|
||||
|
||||
@ -117,17 +117,17 @@ public:
|
||||
|
||||
virtual void run();
|
||||
|
||||
virtual void* get_id() const;
|
||||
virtual void* get_id();
|
||||
|
||||
virtual sr_dev_inst* dev_inst() const = 0;
|
||||
virtual sr_dev_inst* dev_inst() = 0;
|
||||
|
||||
virtual void use(SigSession *owner);
|
||||
|
||||
virtual void release();
|
||||
|
||||
virtual bool is_trigger_enabled() const;
|
||||
virtual bool is_trigger_enabled();
|
||||
|
||||
virtual QString format_device_title() const = 0;
|
||||
virtual QString format_device_title() = 0;
|
||||
|
||||
signals:
|
||||
void device_updated();
|
||||
|
@ -43,7 +43,7 @@ File::~File(){
|
||||
|
||||
}
|
||||
|
||||
QString File::format_device_title() const
|
||||
QString File::format_device_title()
|
||||
{
|
||||
QFileInfo fi(_path);
|
||||
return fi.fileName();
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
QJsonDocument get_session();
|
||||
|
||||
public:
|
||||
QString format_device_title() const;
|
||||
QString format_device_title();
|
||||
|
||||
protected:
|
||||
const QString _path;
|
||||
|
@ -37,7 +37,7 @@ InputFile::InputFile(QString path) :
|
||||
{
|
||||
}
|
||||
|
||||
sr_dev_inst* InputFile::dev_inst() const
|
||||
sr_dev_inst* InputFile::dev_inst()
|
||||
{
|
||||
assert(_input);
|
||||
return _input->sdi;
|
||||
|
@ -37,7 +37,7 @@ class InputFile : public File
|
||||
public:
|
||||
InputFile(QString path);
|
||||
|
||||
sr_dev_inst* dev_inst() const;
|
||||
sr_dev_inst* dev_inst();
|
||||
|
||||
virtual void use(SigSession *owner);
|
||||
|
||||
|
@ -30,7 +30,7 @@ SessionFile::SessionFile(QString path) :
|
||||
{
|
||||
}
|
||||
|
||||
sr_dev_inst* SessionFile::dev_inst() const
|
||||
sr_dev_inst* SessionFile::dev_inst()
|
||||
{
|
||||
return _sdi;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class SessionFile : public File
|
||||
public:
|
||||
SessionFile(QString path);
|
||||
|
||||
sr_dev_inst* dev_inst() const;
|
||||
sr_dev_inst* dev_inst();
|
||||
|
||||
virtual void use(SigSession *owner);
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "../dialogs/dsmessagebox.h"
|
||||
#include "../dsvdef.h"
|
||||
|
||||
using namespace boost;
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QSlider>
|
||||
|
||||
#include <list>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <list>
|
||||
|
||||
#include <pv/device/devinst.h>
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -90,8 +90,7 @@ void DeviceOptions::accept()
|
||||
bool hasEnabled = false;
|
||||
|
||||
// Commit the properties
|
||||
const vector< boost::shared_ptr<pv::prop::Property> > &dev_props =
|
||||
_device_options_binding.properties();
|
||||
const auto &dev_props = _device_options_binding.properties();
|
||||
for(auto &p : dev_props) {
|
||||
assert(p);
|
||||
p->commit();
|
||||
@ -116,8 +115,8 @@ void DeviceOptions::accept()
|
||||
if (hasEnabled) {
|
||||
QVector<pv::prop::binding::ProbeOptions *>::iterator i = _probe_options_binding_list.begin();
|
||||
while(i != _probe_options_binding_list.end()) {
|
||||
const vector< boost::shared_ptr<pv::prop::Property> > &probe_props =
|
||||
(*i)->properties();
|
||||
const auto &probe_props = (*i)->properties();
|
||||
|
||||
for(auto &p :probe_props) {
|
||||
assert(p);
|
||||
p->commit();
|
||||
@ -148,8 +147,8 @@ QGridLayout * DeviceOptions::get_property_form(QWidget * parent)
|
||||
QGridLayout *const layout = new QGridLayout(parent);
|
||||
layout->setVerticalSpacing(5);
|
||||
|
||||
const vector< boost::shared_ptr<pv::prop::Property> > &properties =
|
||||
_device_options_binding.properties();
|
||||
const auto &properties =_device_options_binding.properties();
|
||||
|
||||
int i = 0;
|
||||
for(auto &p : properties)
|
||||
{
|
||||
@ -522,8 +521,7 @@ void DeviceOptions::analog_probes(QGridLayout &layout)
|
||||
|
||||
pv::prop::binding::ProbeOptions *probe_options_binding =
|
||||
new pv::prop::binding::ProbeOptions(_dev_inst->dev_inst(), probe);
|
||||
const vector< boost::shared_ptr<pv::prop::Property> > &properties =
|
||||
probe_options_binding->properties();
|
||||
const auto &properties = probe_options_binding->properties();
|
||||
int i = 1;
|
||||
|
||||
for(auto &p : properties)
|
||||
|
@ -36,9 +36,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QRadioButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <QTimer>
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
#include "../device/devinst.h"
|
||||
|
@ -57,8 +57,8 @@ DsoMeasure::DsoMeasure(SigSession *session, View &parent,
|
||||
_measure_tab->setUsesScrollButtons(false);
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) && dsoSig->enabled()) {
|
||||
view::DsoSignal *dsoSig;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)) && dsoSig->enabled()) {
|
||||
QWidget *measure_widget = new QWidget(this);
|
||||
this->add_measure(measure_widget, dsoSig);
|
||||
_measure_tab->addTab(measure_widget, QString::number(dsoSig->get_index()));
|
||||
@ -85,13 +85,15 @@ DsoMeasure::~DsoMeasure(){
|
||||
DESTROY_QT_OBJECT(_measure_tab);
|
||||
}
|
||||
|
||||
void DsoMeasure::add_measure(QWidget *widget, const boost::shared_ptr<view::DsoSignal> dsoSig)
|
||||
void DsoMeasure::add_measure(QWidget *widget, const view::DsoSignal *dsoSig)
|
||||
{
|
||||
const int Column = 5;
|
||||
const int IconSizeForText = 5;
|
||||
QGridLayout *layout = new QGridLayout(widget);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
pv::view::DsoSignal *psig = const_cast<pv::view::DsoSignal*>(dsoSig);
|
||||
|
||||
for (int i=DSO_MS_BEGIN+1; i<DSO_MS_END; i++) {
|
||||
QToolButton *button = new QToolButton(this);
|
||||
@ -99,7 +101,7 @@ void DsoMeasure::add_measure(QWidget *widget, const boost::shared_ptr<view::DsoS
|
||||
button->setIconSize(QSize(48, 48));
|
||||
QPixmap msPix(get_ms_icon(i));
|
||||
QBitmap msMask = msPix.createMaskFromColor(QColor("black"), Qt::MaskOutColor);
|
||||
msPix.fill(dsoSig->get_colour());
|
||||
msPix.fill(psig->get_colour());
|
||||
msPix.setMask(msMask);
|
||||
button->setIcon(QIcon(msPix));
|
||||
layout->addWidget(button,
|
||||
@ -159,8 +161,8 @@ void DsoMeasure::accept()
|
||||
enum DSO_MEASURE_TYPE ms_type = DSO_MEASURE_TYPE(id.toInt());
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (_measure_tab->currentWidget()->property("index").toInt() == dsoSig->get_index()) {
|
||||
_view.get_viewstatus()->set_measure(_position, false, dsoSig->get_index(), ms_type);
|
||||
break;
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../view/dsosignal.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
@ -57,7 +56,7 @@ public:
|
||||
static QString get_ms_text(int ms_type);
|
||||
|
||||
private:
|
||||
void add_measure(QWidget *widget, const boost::shared_ptr<view::DsoSignal> dsoSig);
|
||||
void add_measure(QWidget *widget, const view::DsoSignal *dsoSig);
|
||||
|
||||
private slots:
|
||||
void set_measure(bool en);
|
||||
|
@ -67,8 +67,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
|
||||
// setup _ch_combobox
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
_ch_combobox->addItem(dsoSig->get_name(), QVariant::fromValue(dsoSig->get_index()));
|
||||
}
|
||||
}
|
||||
@ -88,8 +88,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
std::vector<int> dbv_ranges;
|
||||
|
||||
for(auto &t : _session->get_spectrum_traces()) {
|
||||
boost::shared_ptr<view::SpectrumTrace> spectrumTraces;
|
||||
if ((spectrumTraces = dynamic_pointer_cast<view::SpectrumTrace>(t))) {
|
||||
view::SpectrumTrace *spectrumTraces = NULL;
|
||||
if ((spectrumTraces = dynamic_cast<view::SpectrumTrace*>(t))) {
|
||||
windows = spectrumTraces->get_spectrum_stack()->get_windows_support();
|
||||
length = spectrumTraces->get_spectrum_stack()->get_length_support();
|
||||
view_modes = spectrumTraces->get_view_modes_support();
|
||||
@ -138,8 +138,8 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
|
||||
// load current settings
|
||||
for(auto &t : _session->get_spectrum_traces()) {
|
||||
boost::shared_ptr<view::SpectrumTrace> spectrumTraces;
|
||||
if ((spectrumTraces = dynamic_pointer_cast<view::SpectrumTrace>(t))) {
|
||||
view::SpectrumTrace *spectrumTraces = NULL;
|
||||
if ((spectrumTraces = dynamic_cast<view::SpectrumTrace*>(t))) {
|
||||
if (spectrumTraces->enabled()) {
|
||||
_en_checkbox->setChecked(true);
|
||||
for (int i = 0; i < _ch_combobox->count(); i++) {
|
||||
@ -231,8 +231,8 @@ void FftOptions::accept()
|
||||
QDialog::accept();
|
||||
|
||||
for(auto &t : _session->get_spectrum_traces()) {
|
||||
boost::shared_ptr<view::SpectrumTrace> spectrumTraces;
|
||||
if ((spectrumTraces = dynamic_pointer_cast<view::SpectrumTrace>(t))) {
|
||||
view::SpectrumTrace *spectrumTraces = NULL;
|
||||
if ((spectrumTraces = dynamic_cast<view::SpectrumTrace*>(t))) {
|
||||
spectrumTraces->set_enable(false);
|
||||
if (spectrumTraces->get_index() == _ch_combobox->currentData().toInt()) {
|
||||
spectrumTraces->get_spectrum_stack()->set_dc_ignore(_dc_checkbox->isChecked());
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -74,8 +74,8 @@ LissajousOptions::LissajousOptions(SigSession *session, QWidget *parent) :
|
||||
QHBoxLayout *ylayout = new QHBoxLayout();
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
QString index_str = QString::number(dsoSig->get_index());
|
||||
QRadioButton *xradio = new QRadioButton(index_str, _x_group);
|
||||
xradio->setProperty("index", dsoSig->get_index());
|
||||
@ -91,7 +91,7 @@ LissajousOptions::LissajousOptions(SigSession *session, QWidget *parent) :
|
||||
_y_group->setLayout(ylayout);
|
||||
|
||||
|
||||
boost::shared_ptr<LissajousTrace> lissajous = _session->get_lissajous_trace();
|
||||
auto lissajous = _session->get_lissajous_trace();
|
||||
if (lissajous) {
|
||||
_enable->setChecked(lissajous->enabled());
|
||||
_percent->setValue(lissajous->percent());
|
||||
@ -182,12 +182,12 @@ void LissajousOptions::accept()
|
||||
_session->lissajous_rebuild(enable, xindex, yindex, _percent->value());
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->set_show(!enable);
|
||||
}
|
||||
}
|
||||
boost::shared_ptr<view::MathTrace> mathTrace = _session->get_math_trace();
|
||||
auto mathTrace = _session->get_math_trace();
|
||||
if (mathTrace && mathTrace->enabled()) {
|
||||
mathTrace->set_show(!enable);
|
||||
}
|
||||
|
@ -31,8 +31,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../view/dsosignal.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -79,8 +79,8 @@ MathOptions::MathOptions(SigSession *session, QWidget *parent) :
|
||||
QHBoxLayout *src2_layout = new QHBoxLayout();
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
QString index_str = QString::number(dsoSig->get_index());
|
||||
QRadioButton *xradio = new QRadioButton(index_str, _src1_group);
|
||||
xradio->setProperty("index", dsoSig->get_index());
|
||||
@ -96,7 +96,7 @@ MathOptions::MathOptions(SigSession *session, QWidget *parent) :
|
||||
_src2_group->setLayout(src2_layout);
|
||||
|
||||
|
||||
boost::shared_ptr<MathTrace> math = _session->get_math_trace();
|
||||
auto math = _session->get_math_trace();
|
||||
if (math) {
|
||||
_enable->setChecked(math->enabled());
|
||||
for (QVector<QRadioButton *>::const_iterator i = _src1_radio.begin();
|
||||
@ -204,12 +204,12 @@ void MathOptions::accept()
|
||||
}
|
||||
}
|
||||
bool enable = (src1 != -1 && src2 != -1 && _enable->isChecked());
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig1;
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig2;
|
||||
view::DsoSignal *dsoSig1 = NULL;
|
||||
view::DsoSignal *dsoSig2 = NULL;
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_index() == src1)
|
||||
dsoSig1 = dsoSig;
|
||||
if (dsoSig->get_index() == src2)
|
||||
|
@ -31,8 +31,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../view/dsosignal.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -63,12 +63,13 @@ ProtocolExp::ProtocolExp(QWidget *parent, SigSession *session) :
|
||||
_flayout->addRow(new QLabel(tr("Export Format: "), this), _format_combobox);
|
||||
|
||||
pv::data::DecoderModel* decoder_model = _session->get_decoder_model();
|
||||
const boost::shared_ptr<pv::data::DecoderStack>& decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
const auto decoder_stack = decoder_model->getDecoderStack();
|
||||
if (decoder_stack) {
|
||||
int row_index = 0;
|
||||
const std::map<const pv::data::decode::Row, bool> rows = decoder_stack->get_rows_lshow();
|
||||
for (std::map<const pv::data::decode::Row, bool>::const_iterator i = rows.begin();
|
||||
i != rows.end(); i++) {
|
||||
auto rows = decoder_stack->get_rows_lshow();
|
||||
|
||||
for (auto i = rows.begin();i != rows.end(); i++) {
|
||||
if ((*i).second) {
|
||||
QLabel *row_label = new QLabel((*i).first.title(), this);
|
||||
QRadioButton *row_sel = new QRadioButton(this);
|
||||
@ -169,7 +170,7 @@ void ProtocolExp::accept()
|
||||
.arg(title);
|
||||
|
||||
pv::data::DecoderModel* decoder_model = _session->get_decoder_model();
|
||||
const boost::shared_ptr<pv::data::DecoderStack>& decoder_stack = decoder_model->getDecoderStack();
|
||||
const auto decoder_stack = decoder_model->getDecoderStack();
|
||||
int row_index = 0;
|
||||
Row row;
|
||||
const std::map<const Row, bool> rows_lshow = decoder_stack->get_rows_lshow();
|
||||
@ -186,7 +187,7 @@ void ProtocolExp::accept()
|
||||
|
||||
uint64_t exported = 0;
|
||||
double ns_per_sample = SR_SEC(1) * 1.0 / decoder_stack->samplerate();
|
||||
vector<Annotation> annotations;
|
||||
std::vector<Annotation> annotations;
|
||||
decoder_stack->get_annotation_subset(annotations, row,
|
||||
0, decoder_stack->sample_count()-1);
|
||||
if (!annotations.empty()) {
|
||||
|
@ -29,9 +29,7 @@
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../prop/binding/deviceoptions.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -56,8 +56,7 @@ ProtocolList::ProtocolList(QWidget *parent, SigSession *session) :
|
||||
connect(_map_zoom_combobox, SIGNAL(currentIndexChanged(int)), _session, SLOT(set_map_zoom(int)));
|
||||
|
||||
_protocol_combobox = new QComboBox(this);
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
auto &decode_sigs = _session->get_decode_signals();
|
||||
int index = 0;
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
@ -126,9 +125,8 @@ void ProtocolList::set_protocol(int index)
|
||||
}
|
||||
_show_label_list.clear();
|
||||
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack;
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
pv::data::DecoderStack *decoder_stack = NULL;
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
int cur_index = 0;
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
@ -146,9 +144,9 @@ void ProtocolList::set_protocol(int index)
|
||||
|
||||
_session->get_decoder_model()->setDecoderStack(decoder_stack);
|
||||
int row_index = 0;
|
||||
const std::map<const pv::data::decode::Row, bool> rows = decoder_stack->get_rows_lshow();
|
||||
for (std::map<const pv::data::decode::Row, bool>::const_iterator i = rows.begin();
|
||||
i != rows.end(); i++) {
|
||||
const auto rows = decoder_stack->get_rows_lshow();
|
||||
|
||||
for (auto i = rows.begin();i != rows.end(); i++) {
|
||||
QLabel *row_label = new QLabel((*i).first.title(), this);
|
||||
QCheckBox *row_checkbox = new QCheckBox(this);
|
||||
//row_checkbox->setChecked(false);
|
||||
@ -169,9 +167,8 @@ void ProtocolList::on_row_check(bool show)
|
||||
QVariant id = sc->property("index");
|
||||
int index = id.toInt();
|
||||
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack;
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
pv::data::DecoderStack *decoder_stack = NULL;
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
int cur_index = 0;
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../device/devinst.h"
|
||||
#include "../prop/binding/deviceoptions.h"
|
||||
|
@ -28,9 +28,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
|
||||
|
@ -52,8 +52,8 @@ Search::Search(QWidget *parent, SigSession *session, std::map<uint16_t, QString>
|
||||
|
||||
for(auto &sig : _session->get_signals()) {
|
||||
assert(sig);
|
||||
boost::shared_ptr<view::LogicSignal> logic_sig;
|
||||
if ((logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig))) {
|
||||
view::LogicSignal *logic_sig = NULL;
|
||||
if ((logic_sig = dynamic_cast<view::LogicSignal*>(sig))) {
|
||||
QLineEdit *search_lineEdit = new QLineEdit(this);
|
||||
if (pattern.find(logic_sig->get_index()) != pattern.end())
|
||||
search_lineEdit->setText(pattern[logic_sig->get_index()]);
|
||||
@ -112,8 +112,8 @@ std::map<uint16_t, QString> Search::get_pattern()
|
||||
int index = 0;
|
||||
for(auto &sig :_session->get_signals()) {
|
||||
assert(sig);
|
||||
boost::shared_ptr<view::LogicSignal> logic_sig;
|
||||
if ((logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig))) {
|
||||
view::LogicSignal *logic_sig = NULL;
|
||||
if ((logic_sig = dynamic_cast<view::LogicSignal*>(sig))) {
|
||||
pattern[logic_sig->get_index()] = _search_lineEdit_vec[index]->text();
|
||||
index++;
|
||||
}
|
||||
|
@ -33,9 +33,7 @@
|
||||
#include "../toolbars/titlebar.h"
|
||||
#include "dsdialog.h"
|
||||
#include "../device/devinst.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
namespace pv {
|
||||
namespace dialogs {
|
||||
|
||||
|
@ -94,7 +94,7 @@ void Shadow::draw(QPainter* painter)
|
||||
painter->setWorldTransform(restoreTransform);
|
||||
}
|
||||
|
||||
QRectF Shadow::boundingRectFor(const QRectF& rect) const
|
||||
QRectF Shadow::boundingRectFor(const QRectF& rect)
|
||||
{
|
||||
qreal delta = blurRadius() + distance();
|
||||
return rect.united(rect.adjusted(-delta, -delta, delta, delta));
|
||||
|
@ -36,16 +36,16 @@ public:
|
||||
explicit Shadow(QObject *parent = 0);
|
||||
|
||||
void draw(QPainter* painter);
|
||||
QRectF boundingRectFor(const QRectF& rect) const;
|
||||
QRectF boundingRectFor(const QRectF& rect);
|
||||
|
||||
inline void setDistance(qreal distance) { _distance = distance; updateBoundingRect(); }
|
||||
inline qreal distance() const { return _distance; }
|
||||
inline qreal distance() { return _distance; }
|
||||
|
||||
inline void setBlurRadius(qreal blurRadius) { _blurRadius = blurRadius; updateBoundingRect(); }
|
||||
inline qreal blurRadius() const { return _blurRadius; }
|
||||
inline qreal blurRadius() { return _blurRadius; }
|
||||
|
||||
inline void setColor(const QColor& color) { _color = color; }
|
||||
inline QColor color() const { return _color; }
|
||||
inline QColor color() { return _color; }
|
||||
|
||||
private:
|
||||
qreal _distance;
|
||||
|
@ -21,10 +21,7 @@
|
||||
|
||||
#ifndef DSVIEW_PV_DIALOGS_SAVEPROGRESS_H
|
||||
#define DSVIEW_PV_DIALOGS_SAVEPROGRESS_H
|
||||
|
||||
//#include <set>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <QProgressBar>
|
||||
#include "../storesession.h"
|
||||
#include "../dialogs/dsdialog.h"
|
||||
|
@ -184,11 +184,11 @@ void WaitingDialog::changeText()
|
||||
zero_fgain = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (zero_fgain) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
|
||||
for(auto &s : _session->get_signals())
|
||||
{
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
||||
dsoSig->set_enable(dsoSig->get_index() == 0);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
@ -27,9 +27,7 @@
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QMovie>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include "../sigsession.h"
|
||||
#include "../device/devinst.h"
|
||||
#include "../toolbars/titlebar.h"
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "../device/devinst.h"
|
||||
#include "../dialogs/dsmessagebox.h"
|
||||
#include "../view/dsosignal.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include <QObject>
|
||||
@ -389,8 +387,8 @@ void DsoTriggerDock::init()
|
||||
_channel_comboBox->clear();
|
||||
|
||||
for(auto &s : _session->get_signals()) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
_channel_comboBox->addItem(dsoSig->get_name(), QVariant::fromValue(dsoSig->get_index()));
|
||||
}
|
||||
}
|
||||
|
@ -598,12 +598,15 @@ void MeasureDock::update_edge()
|
||||
if (start_ret && end_ret) {
|
||||
uint64_t rising_edges;
|
||||
uint64_t falling_edges;
|
||||
const std::vector< boost::shared_ptr<Signal> > sigs(_session->get_signals());
|
||||
|
||||
const auto &sigs = _session->get_signals();
|
||||
|
||||
for(size_t i = 0; i < sigs.size(); i++) {
|
||||
const boost::shared_ptr<view::Signal> s(sigs[i]);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
view::Signal *s = sigs[i];
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
assert(s);
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s)) &&
|
||||
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(s)) &&
|
||||
(logicSig->enabled()) &&
|
||||
(logicSig->get_index() == _edge_ch_cmb_vec[edge_index]->currentText().toInt())){
|
||||
if (logicSig->edges(_view.get_cursor_samples(end), _view.get_cursor_samples(start), rising_edges, falling_edges)) {
|
||||
@ -650,12 +653,13 @@ QComboBox* MeasureDock::create_probe_selector(QWidget *parent)
|
||||
void MeasureDock::update_probe_selector(QComboBox *selector)
|
||||
{
|
||||
selector->clear();
|
||||
const std::vector< boost::shared_ptr<Signal> > sigs(_session->get_signals());
|
||||
const auto &sigs = _session->get_signals();
|
||||
|
||||
for(size_t i = 0; i < sigs.size(); i++) {
|
||||
const boost::shared_ptr<view::Signal> s(sigs[i]);
|
||||
const auto s = sigs[i];
|
||||
assert(s);
|
||||
|
||||
if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled())
|
||||
if (dynamic_cast<LogicSignal*>(s) && s->enabled())
|
||||
{
|
||||
selector->addItem(QString::number(s->get_index()));
|
||||
}
|
||||
|
@ -46,13 +46,14 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <algorithm>
|
||||
#include "../ui/msgbox.h"
|
||||
#include "../dsvdef.h"
|
||||
#include "../config/appconfig.h"
|
||||
#include "../data/decode/decoderstatus.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
namespace dock {
|
||||
|
||||
@ -205,6 +206,8 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
|
||||
connect(_search_edit, SIGNAL(editingFinished()), this, SLOT(search_changed()));
|
||||
|
||||
retranslateUi();
|
||||
|
||||
ds_debug("protocol panel\n");
|
||||
}
|
||||
|
||||
ProtocolDock::~ProtocolDock()
|
||||
@ -333,9 +336,9 @@ void ProtocolDock::add_protocol(bool silent)
|
||||
}
|
||||
|
||||
//progress connection
|
||||
const std::vector<boost::shared_ptr<pv::view::DecodeTrace>> decode_sigs(_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
connect(decode_sigs.back().get(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int)));
|
||||
connect(decode_sigs.back(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int)));
|
||||
|
||||
protocol_updated();
|
||||
}
|
||||
@ -373,8 +376,7 @@ void ProtocolDock::decoded_progress(int progress)
|
||||
|
||||
int pg = 0;
|
||||
QString err="";
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
int index = 0;
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
@ -414,8 +416,7 @@ void ProtocolDock::set_model()
|
||||
search_done();
|
||||
|
||||
// clear mark_index of all DecoderStacks
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
d->decoder()->set_mark_index(-1);
|
||||
@ -425,8 +426,8 @@ void ProtocolDock::set_model()
|
||||
void ProtocolDock::update_model()
|
||||
{
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
if (decode_sigs.size() == 0)
|
||||
decoder_model->setDecoderStack(NULL);
|
||||
else if (!decoder_model->getDecoderStack())
|
||||
@ -468,12 +469,12 @@ void ProtocolDock::resize_table_view(data::DecoderModel* decoder_model)
|
||||
void ProtocolDock::item_clicked(const QModelIndex &index)
|
||||
{
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
auto decoder_stack = decoder_model->getDecoderStack();
|
||||
if (decoder_stack) {
|
||||
pv::data::decode::Annotation ann;
|
||||
if (decoder_stack->list_annotation(ann, index.column(), index.row())) {
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
d->decoder()->set_mark_index(-1);
|
||||
@ -548,7 +549,8 @@ void ProtocolDock::nav_table_view()
|
||||
{
|
||||
uint64_t row_index = 0;
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
auto decoder_stack = decoder_model->getDecoderStack();
|
||||
if (decoder_stack) {
|
||||
uint64_t offset = _view.offset() * (decoder_stack->samplerate() * _view.scale());
|
||||
std::map<const pv::data::decode::Row, bool> rows = decoder_stack->get_rows_lshow();
|
||||
@ -567,8 +569,7 @@ void ProtocolDock::nav_table_view()
|
||||
|
||||
pv::data::decode::Annotation ann;
|
||||
decoder_stack->list_annotation(ann, index.column(), index.row());
|
||||
const std::vector< boost::shared_ptr<pv::view::DecodeTrace> > decode_sigs(
|
||||
_session->get_decode_signals());
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
for(auto &d : decode_sigs) {
|
||||
d->decoder()->set_mark_index(-1);
|
||||
@ -596,7 +597,8 @@ void ProtocolDock::search_pre()
|
||||
uint64_t rowCount = _model_proxy.rowCount();
|
||||
QModelIndex matchingIndex;
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
auto decoder_stack = decoder_model->getDecoderStack();
|
||||
do {
|
||||
_cur_search_index--;
|
||||
if (_cur_search_index <= -1 || _cur_search_index >= _model_proxy.rowCount())
|
||||
@ -652,7 +654,8 @@ void ProtocolDock::search_nxt()
|
||||
uint64_t rowCount = _model_proxy.rowCount();
|
||||
QModelIndex matchingIndex;
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
auto decoder_stack = decoder_model->getDecoderStack();
|
||||
do {
|
||||
_cur_search_index++;
|
||||
if (_cur_search_index < 0 || _cur_search_index >= _model_proxy.rowCount())
|
||||
@ -716,7 +719,8 @@ void ProtocolDock::search_update()
|
||||
return;
|
||||
|
||||
pv::data::DecoderModel *decoder_model = _session->get_decoder_model();
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack = decoder_model->getDecoderStack();
|
||||
|
||||
auto decoder_stack = decoder_model->getDecoderStack();
|
||||
if (!decoder_stack)
|
||||
return;
|
||||
|
||||
|
@ -40,8 +40,7 @@
|
||||
#include <QProgressDialog>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdint.h>
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
namespace pv {
|
||||
@ -130,9 +129,9 @@ void SearchDock::on_previous()
|
||||
bool ret;
|
||||
int64_t last_pos;
|
||||
bool last_hit;
|
||||
const boost::shared_ptr<data::Snapshot> snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC));
|
||||
const auto snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC);
|
||||
assert(snapshot);
|
||||
const boost::shared_ptr<data::LogicSnapshot> logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot);
|
||||
const auto logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot);
|
||||
|
||||
if (!logic_snapshot || logic_snapshot->empty()) {
|
||||
dialogs::DSMessageBox msg(this);
|
||||
@ -192,9 +191,9 @@ void SearchDock::on_next()
|
||||
{
|
||||
bool ret;
|
||||
int64_t last_pos;
|
||||
const boost::shared_ptr<data::Snapshot> snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC));
|
||||
const auto snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC);
|
||||
assert(snapshot);
|
||||
const boost::shared_ptr<data::LogicSnapshot> logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot);
|
||||
const auto logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot);
|
||||
|
||||
if (!logic_snapshot || logic_snapshot->empty()) {
|
||||
dialogs::DSMessageBox msg(this);
|
||||
|
@ -23,6 +23,13 @@
|
||||
#include "dsvdef.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef DS_DEBUG_TRACE
|
||||
#include <stdio.h>
|
||||
void ds_print(const char *s){
|
||||
printf(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace DecoderDataFormat
|
||||
{
|
||||
int Parse(const char *name){
|
||||
|
@ -22,6 +22,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
|
||||
#ifdef DS_DEBUG_TRACE
|
||||
void ds_print(const char *s);
|
||||
|
||||
#define ds_debug(x) ds_print((x))
|
||||
#else
|
||||
#define ds_debug(x)
|
||||
#endif
|
||||
|
||||
class QWidget;
|
||||
|
||||
#define DESTROY_OBJECT(p) if((p)){delete (p); p = NULL;}
|
||||
@ -48,3 +59,4 @@ namespace app
|
||||
|
||||
bool is_app_top_window(QWidget* w);
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@
|
||||
#include "dock/protocoldock.h"
|
||||
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <QAction>
|
||||
#include <QButtonGroup>
|
||||
@ -92,11 +91,7 @@
|
||||
#include "../ui/msgbox.h"
|
||||
#include "config/appconfig.h"
|
||||
#include "appcontrol.h"
|
||||
|
||||
using boost::shared_ptr;
|
||||
using boost::dynamic_pointer_cast;
|
||||
using std::list;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace pv {
|
||||
|
||||
@ -549,9 +544,9 @@ void MainWindow::device_detach()
|
||||
_view->hide_calibration();
|
||||
if (_session->get_device()->dev_inst()->mode != DSO &&
|
||||
strncmp(_session->get_device()->name().toUtf8(), "virtual", 7)) {
|
||||
const boost::shared_ptr<data::Snapshot> logic_snapshot(_session->get_snapshot(SR_CHANNEL_LOGIC));
|
||||
const auto logic_snapshot = _session->get_snapshot(SR_CHANNEL_LOGIC);
|
||||
assert(logic_snapshot);
|
||||
const boost::shared_ptr<data::Snapshot> analog_snapshot(_session->get_snapshot(SR_CHANNEL_ANALOG));
|
||||
const auto analog_snapshot = _session->get_snapshot(SR_CHANNEL_ANALOG);
|
||||
assert(analog_snapshot);
|
||||
|
||||
if (!logic_snapshot->empty() || !analog_snapshot->empty()) {
|
||||
@ -830,8 +825,8 @@ void MainWindow::commit_trigger(bool instant)
|
||||
for(auto &s : _session->get_signals())
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(s))) {
|
||||
if (logicSig->commit_trig())
|
||||
i++;
|
||||
}
|
||||
@ -848,17 +843,19 @@ void MainWindow::commit_trigger(bool instant)
|
||||
msg.mBox()->addButton(tr("Continue"), QMessageBox::ActionRole);
|
||||
|
||||
msg.exec();
|
||||
|
||||
if (msg.mBox()->clickedButton() == cancelButton) {
|
||||
for(auto &s : _session->get_signals())
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(s))) {
|
||||
logicSig->set_trig(view::LogicSignal::NONTRIG);
|
||||
logicSig->commit_trig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.mBox()->clickedButton() == noMoreButton)
|
||||
{
|
||||
app._appOptions.warnofMultiTrig = false;
|
||||
@ -1068,8 +1065,8 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev)
|
||||
(s->get_type() == obj["type"].toDouble())) {
|
||||
s->set_colour(QColor(obj["colour"].toString()));
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->load_settings();
|
||||
dsoSig->set_zero_ratio(obj["zeroPos"].toDouble());
|
||||
dsoSig->set_trig_ratio(obj["trigValue"].toDouble());
|
||||
@ -1088,21 +1085,21 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev)
|
||||
s->set_colour(QColor(obj["colour"].toString()));
|
||||
s->set_name(g_strdup(obj["name"].toString().toUtf8().data()));
|
||||
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(s))) {
|
||||
logicSig->set_trig(obj["strigger"].toDouble());
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->load_settings();
|
||||
dsoSig->set_zero_ratio(obj["zeroPos"].toDouble());
|
||||
dsoSig->set_trig_ratio(obj["trigValue"].toDouble());
|
||||
dsoSig->commit_settings();
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
view::AnalogSignal *analogSig = NULL;
|
||||
if ((analogSig = dynamic_cast<view::AnalogSignal*>(s))) {
|
||||
analogSig->set_zero_ratio(obj["zeroPos"].toDouble());
|
||||
analogSig->commit_settings();
|
||||
}
|
||||
@ -1200,13 +1197,13 @@ bool MainWindow::on_store_session(QString name)
|
||||
else
|
||||
s_obj["colour"] = QJsonValue::fromVariant("default");
|
||||
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(s))) {
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(s))) {
|
||||
s_obj["strigger"] = logicSig->get_trig();
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_vDialValue()));
|
||||
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(dsoSig->get_factor()));
|
||||
s_obj["coupling"] = dsoSig->get_acCoupling();
|
||||
@ -1214,8 +1211,8 @@ bool MainWindow::on_store_session(QString name)
|
||||
s_obj["zeroPos"] = dsoSig->get_zero_ratio();
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
view::AnalogSignal *analogSig = NULL;
|
||||
if ((analogSig = dynamic_cast<view::AnalogSignal*>(s))) {
|
||||
s_obj["vdiv"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_vdiv()));
|
||||
s_obj["vfactor"] = QJsonValue::fromVariant(static_cast<qulonglong>(analogSig->get_factor()));
|
||||
s_obj["coupling"] = analogSig->get_acCoupling();
|
||||
@ -1289,7 +1286,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
|
||||
if ( event->type() == QEvent::KeyPress ) {
|
||||
SigSession *_session = _control->GetSession();
|
||||
const vector< boost::shared_ptr<view::Signal> > sigs(_session->get_signals());
|
||||
const auto &sigs = _session->get_signals();
|
||||
QKeyEvent *ke = (QKeyEvent *) event;
|
||||
switch(ke->key()) {
|
||||
case Qt::Key_S:
|
||||
@ -1335,8 +1332,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
break;
|
||||
case Qt::Key_0:
|
||||
for(auto & s : sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_index() == 0)
|
||||
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
|
||||
else
|
||||
@ -1348,8 +1345,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
break;
|
||||
case Qt::Key_1:
|
||||
for(auto & s : sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_index() == 1)
|
||||
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
|
||||
else
|
||||
@ -1361,8 +1358,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
for(auto &s : sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_vDialActive()) {
|
||||
dsoSig->go_vDialNext(true);
|
||||
update();
|
||||
@ -1373,8 +1370,8 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
for(auto &s : sigs) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
if (dsoSig->get_vDialActive()) {
|
||||
dsoSig->go_vDialPre(true);
|
||||
update();
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "unzip.h"
|
||||
|
||||
#define READ_8(adr) ((unsigned char)*(adr))
|
||||
#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
|
||||
#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
|
||||
#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8)
|
||||
#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16)
|
||||
|
||||
#define WRITE_8(buff, n) do { \
|
||||
*((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
|
||||
|
@ -26,14 +26,13 @@
|
||||
#include <pv/prop/property.h>
|
||||
|
||||
#include "binding.h"
|
||||
|
||||
using boost::shared_ptr;
|
||||
|
||||
|
||||
namespace pv {
|
||||
namespace prop {
|
||||
namespace binding {
|
||||
|
||||
const std::vector< boost::shared_ptr<Property> >& Binding::properties()
|
||||
const std::vector<Property*>& Binding::properties()
|
||||
{
|
||||
return _properties;
|
||||
}
|
||||
@ -47,7 +46,7 @@ void Binding::commit()
|
||||
}
|
||||
|
||||
void Binding::add_properties_to_form(QFormLayout *layout,
|
||||
bool auto_commit) const
|
||||
bool auto_commit)
|
||||
{
|
||||
assert(layout);
|
||||
|
||||
@ -71,7 +70,7 @@ void Binding::add_properties_to_form(QFormLayout *layout,
|
||||
}
|
||||
|
||||
QWidget* Binding::get_property_form(QWidget *parent,
|
||||
bool auto_commit) const
|
||||
bool auto_commit)
|
||||
{
|
||||
QWidget *const form = new QWidget(parent);
|
||||
QFormLayout *const layout = new QFormLayout(form);
|
||||
@ -84,11 +83,9 @@ QWidget* Binding::get_property_form(QWidget *parent,
|
||||
return form;
|
||||
}
|
||||
|
||||
std::map< boost::shared_ptr<Property>,
|
||||
GVariant* > Binding::get_property_value() const
|
||||
std::map<Property*,GVariant*> Binding::get_property_value()
|
||||
{
|
||||
std::map < boost::shared_ptr<Property>,
|
||||
GVariant* > pvalue;
|
||||
std::map <Property*,GVariant*> pvalue;
|
||||
|
||||
for(auto &p : _properties)
|
||||
{
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <map>
|
||||
|
||||
#include <QString>
|
||||
|
||||
@ -45,23 +44,22 @@ namespace binding {
|
||||
class Binding
|
||||
{
|
||||
public:
|
||||
const std::vector< boost::shared_ptr<Property> >& properties();
|
||||
const std::vector<Property*>& properties();
|
||||
|
||||
void commit();
|
||||
|
||||
void add_properties_to_form(QFormLayout *layout,
|
||||
bool auto_commit = false) const;
|
||||
bool auto_commit = false);
|
||||
|
||||
QWidget* get_property_form(QWidget *parent,
|
||||
bool auto_commit = false) const;
|
||||
bool auto_commit = false);
|
||||
|
||||
std::map< boost::shared_ptr<Property>,
|
||||
GVariant* > get_property_value() const;
|
||||
std::map<Property*,GVariant*> get_property_value();
|
||||
|
||||
static QString print_gvariant(GVariant *const gvar);
|
||||
|
||||
protected:
|
||||
std::vector< boost::shared_ptr<Property> > _properties;
|
||||
std::vector<Property*> _properties;
|
||||
|
||||
QWidget *_form;
|
||||
};
|
||||
|
@ -33,22 +33,16 @@
|
||||
#include <pv/prop/int.h>
|
||||
#include <pv/prop/string.h>
|
||||
|
||||
using boost::bind;
|
||||
using boost::none;
|
||||
using boost::shared_ptr;
|
||||
using std::make_pair;
|
||||
using std::map;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace pv {
|
||||
namespace prop {
|
||||
namespace binding {
|
||||
|
||||
DecoderOptions::DecoderOptions(
|
||||
shared_ptr<pv::data::DecoderStack> decoder_stack,
|
||||
shared_ptr<data::decode::Decoder> decoder) :
|
||||
pv::data::DecoderStack* decoder_stack,
|
||||
data::decode::Decoder *decoder) :
|
||||
_decoder_stack(decoder_stack),
|
||||
_decoder(decoder)
|
||||
{
|
||||
@ -69,19 +63,16 @@ DecoderOptions::DecoderOptions(
|
||||
const Property::Setter setter = bind(
|
||||
&DecoderOptions::setter, this, opt->id, _1);
|
||||
|
||||
shared_ptr<Property> prop;
|
||||
Property *prop = NULL;
|
||||
|
||||
if (opt->values)
|
||||
prop = bind_enum(name, opt, getter, setter);
|
||||
else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("d")))
|
||||
prop = shared_ptr<Property>(new Double(name, name, 2, "",
|
||||
none, none, getter, setter));
|
||||
prop = new Double(name, name, 2, "",none, none, getter, setter);
|
||||
else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("x")))
|
||||
prop = shared_ptr<Property>(
|
||||
new Int(name, name, "", none, getter, setter));
|
||||
prop = new Int(name, name, "", none, getter, setter);
|
||||
else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE("s")))
|
||||
prop = shared_ptr<Property>(
|
||||
new String(name, name, getter, setter));
|
||||
prop = new String(name, name, getter, setter);
|
||||
else
|
||||
continue;
|
||||
|
||||
@ -89,18 +80,18 @@ DecoderOptions::DecoderOptions(
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<Property> DecoderOptions::bind_enum(
|
||||
Property* DecoderOptions::bind_enum(
|
||||
const QString &name, const srd_decoder_option *option,
|
||||
Property::Getter getter, Property::Setter setter)
|
||||
{
|
||||
vector< pair<GVariant*, QString> > values;
|
||||
std::vector<std::pair<GVariant*, QString> > values;
|
||||
for (GSList *l = option->values; l; l = l->next) {
|
||||
GVariant *const var = (GVariant*)l->data;
|
||||
assert(var);
|
||||
values.push_back(make_pair(var, print_gvariant(var)));
|
||||
}
|
||||
|
||||
return shared_ptr<Property>(new Enum(name, name, values, getter, setter));
|
||||
return new Enum(name, name, values, getter, setter);
|
||||
}
|
||||
|
||||
GVariant* DecoderOptions::getter(const char *id)
|
||||
@ -111,7 +102,7 @@ GVariant* DecoderOptions::getter(const char *id)
|
||||
|
||||
// Get the value from the hash table if it is already present
|
||||
const map<string, GVariant*>& options = _decoder->options();
|
||||
map<string, GVariant*>::const_iterator iter = options.find(id);
|
||||
auto iter = options.find(id);
|
||||
|
||||
if (iter != options.end())
|
||||
val = (*iter).second;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "binding.h"
|
||||
|
||||
#include <pv/prop/property.h>
|
||||
#include "../property.h"
|
||||
|
||||
struct srd_decoder_option;
|
||||
|
||||
@ -42,23 +42,23 @@ namespace binding {
|
||||
class DecoderOptions : public Binding
|
||||
{
|
||||
public:
|
||||
DecoderOptions(boost::shared_ptr<pv::data::DecoderStack> decoder_stack,
|
||||
boost::shared_ptr<pv::data::decode::Decoder> decoder);
|
||||
DecoderOptions(pv::data::DecoderStack *decoder_stack,
|
||||
pv::data::decode::Decoder* decoder);
|
||||
|
||||
GVariant* getter(const char *id);
|
||||
|
||||
void setter(const char *id, GVariant *value);
|
||||
|
||||
private:
|
||||
static boost::shared_ptr<Property> bind_enum(const QString &name,
|
||||
static Property* bind_enum(const QString &name,
|
||||
const srd_decoder_option *option,
|
||||
Property::Getter getter, Property::Setter setter);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
boost::shared_ptr<pv::data::DecoderStack> _decoder_stack;
|
||||
boost::shared_ptr<pv::data::decode::Decoder> _decoder;
|
||||
pv::data::DecoderStack *_decoder_stack;
|
||||
pv::data::decode::Decoder *_decoder;
|
||||
};
|
||||
|
||||
} // binding
|
||||
|
@ -166,9 +166,9 @@ void DeviceOptions::config_setter(
|
||||
|
||||
void DeviceOptions::bind_bool(const QString &name, const QString label, int key)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Bool(name, label, bind(config_getter, _sdi, key),
|
||||
bind(config_setter, _sdi, key, _1))));
|
||||
bind(config_setter, _sdi, key, _1)));
|
||||
}
|
||||
|
||||
void DeviceOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
@ -176,7 +176,7 @@ void DeviceOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantIter iter;
|
||||
vector< pair<GVariant*, QString> > values;
|
||||
std::vector< pair<GVariant*, QString> > values;
|
||||
|
||||
assert(gvar_list);
|
||||
|
||||
@ -184,29 +184,29 @@ void DeviceOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
while ((gvar = g_variant_iter_next_value (&iter)))
|
||||
values.push_back(make_pair(gvar, printer(gvar)));
|
||||
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Enum(name, label, values,
|
||||
bind(config_getter, _sdi, key),
|
||||
bind(config_setter, _sdi, key, _1))));
|
||||
bind(config_setter, _sdi, key, _1)));
|
||||
}
|
||||
|
||||
void DeviceOptions::bind_int(const QString &name, const QString label, int key, QString suffix,
|
||||
optional< std::pair<int64_t, int64_t> > range)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Int(name, label, suffix, range,
|
||||
bind(config_getter, _sdi, key),
|
||||
bind(config_setter, _sdi, key, _1))));
|
||||
bind(config_setter, _sdi, key, _1)));
|
||||
}
|
||||
|
||||
void DeviceOptions::bind_double(const QString &name, const QString label, int key, QString suffix,
|
||||
optional< std::pair<double, double> > range,
|
||||
int decimals, boost::optional<double> step)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Double(name, label, decimals, suffix, range, step,
|
||||
bind(config_getter, _sdi, key),
|
||||
bind(config_setter, _sdi, key, _1))));
|
||||
bind(config_setter, _sdi, key, _1)));
|
||||
}
|
||||
|
||||
QString DeviceOptions::print_gvariant(GVariant *const gvar)
|
||||
@ -242,12 +242,12 @@ void DeviceOptions::bind_samplerate(const QString &name, const QString label,
|
||||
|
||||
assert(num_elements == 3);
|
||||
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Double(name, label, 0, QObject::tr("Hz"),
|
||||
make_pair((double)elements[0], (double)elements[1]),
|
||||
(double)elements[2],
|
||||
bind(samplerate_double_getter, _sdi),
|
||||
bind(samplerate_double_setter, _sdi, _1))));
|
||||
bind(samplerate_double_setter, _sdi, _1)));
|
||||
|
||||
g_variant_unref(gvar_list_samplerates);
|
||||
}
|
||||
@ -312,7 +312,7 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantIter iter;
|
||||
vector< pair<GVariant*, QString> > values;
|
||||
std::vector< pair<GVariant*, QString> > values;
|
||||
bool bw_limit = FALSE;
|
||||
|
||||
assert(gvar_list);
|
||||
@ -332,10 +332,10 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in
|
||||
while ((gvar = g_variant_iter_next_value (&iter)))
|
||||
values.push_back(make_pair(gvar, printer(gvar)));
|
||||
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Enum(name, label, values,
|
||||
bind(config_getter, _sdi, key),
|
||||
bind(config_setter, _sdi, key, _1))));
|
||||
bind(config_setter, _sdi, key, _1)));
|
||||
}
|
||||
|
||||
} // binding
|
||||
|
@ -138,9 +138,9 @@ void ProbeOptions::config_setter(
|
||||
|
||||
void ProbeOptions::bind_bool(const QString &name, const QString label, int key)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Bool(name, label, bind(config_getter, _sdi, _probe, key),
|
||||
bind(config_setter, _sdi, _probe, key, _1))));
|
||||
bind(config_setter, _sdi, _probe, key, _1)));
|
||||
}
|
||||
|
||||
void ProbeOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
@ -148,7 +148,7 @@ void ProbeOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
{
|
||||
GVariant *gvar;
|
||||
GVariantIter iter;
|
||||
vector< pair<GVariant*, QString> > values;
|
||||
std::vector< pair<GVariant*, QString> > values;
|
||||
|
||||
assert(gvar_list);
|
||||
|
||||
@ -156,29 +156,29 @@ void ProbeOptions::bind_enum(const QString &name, const QString label, int key,
|
||||
while ((gvar = g_variant_iter_next_value (&iter)))
|
||||
values.push_back(make_pair(gvar, printer(gvar)));
|
||||
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Enum(name, label, values,
|
||||
bind(config_getter, _sdi, _probe, key),
|
||||
bind(config_setter, _sdi, _probe, key, _1))));
|
||||
bind(config_setter, _sdi, _probe, key, _1)));
|
||||
}
|
||||
|
||||
void ProbeOptions::bind_int(const QString &name, const QString label, int key, QString suffix,
|
||||
optional< std::pair<int64_t, int64_t> > range)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Int(name, label, suffix, range,
|
||||
bind(config_getter, _sdi, _probe, key),
|
||||
bind(config_setter, _sdi, _probe, key, _1))));
|
||||
bind(config_setter, _sdi, _probe, key, _1)));
|
||||
}
|
||||
|
||||
void ProbeOptions::bind_double(const QString &name, const QString label, int key, QString suffix,
|
||||
optional< std::pair<double, double> > range,
|
||||
int decimals, boost::optional<double> step)
|
||||
{
|
||||
_properties.push_back(boost::shared_ptr<Property>(
|
||||
_properties.push_back(
|
||||
new Double(name, label, decimals, suffix, range, step,
|
||||
bind(config_getter, _sdi, _probe, key),
|
||||
bind(config_setter, _sdi, _probe, key, _1))));
|
||||
bind(config_setter, _sdi, _probe, key, _1)));
|
||||
}
|
||||
|
||||
void ProbeOptions::bind_vdiv(const QString &name, const QString label,
|
||||
|
@ -65,12 +65,12 @@ QWidget* Bool::get_widget(QWidget *parent, bool auto_commit)
|
||||
return _check_box;
|
||||
}
|
||||
|
||||
bool Bool::labeled_widget() const
|
||||
bool Bool::labeled_widget()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
GVariant* Bool::get_value() const
|
||||
GVariant* Bool::get_value()
|
||||
{
|
||||
GVariant *const value = _getter ? _getter() : NULL;
|
||||
|
||||
|
@ -40,9 +40,9 @@ public:
|
||||
virtual ~Bool();
|
||||
|
||||
QWidget* get_widget(QWidget *parent, bool auto_commit);
|
||||
bool labeled_widget() const;
|
||||
bool labeled_widget();
|
||||
|
||||
GVariant* get_value() const;
|
||||
GVariant* get_value();
|
||||
|
||||
void commit();
|
||||
|
||||
|
@ -34,13 +34,13 @@ namespace pv {
|
||||
namespace prop {
|
||||
|
||||
Enum::Enum(QString name, QString label,
|
||||
vector<pair<GVariant*, QString> > values,
|
||||
std::vector<pair<GVariant*, QString> > values,
|
||||
Getter getter, Setter setter) :
|
||||
Property(name, label, getter, setter),
|
||||
_values(values),
|
||||
_selector(NULL)
|
||||
{
|
||||
for (vector< pair<GVariant*, QString> >::const_iterator i =
|
||||
for (std::vector< pair<GVariant*, QString> >::const_iterator i =
|
||||
_values.begin(); i != _values.end(); i++)
|
||||
g_variant_ref((*i).first);
|
||||
}
|
||||
|
@ -33,22 +33,26 @@ Property::Property(QString name, QString label, Getter getter, Setter setter) :
|
||||
{
|
||||
}
|
||||
|
||||
const QString& Property::name() const
|
||||
Property::~Property(){
|
||||
|
||||
}
|
||||
|
||||
const QString& Property::name()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
const QString& Property::label() const
|
||||
const QString& Property::label()
|
||||
{
|
||||
return _label;
|
||||
}
|
||||
|
||||
bool Property::labeled_widget() const
|
||||
bool Property::labeled_widget()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
GVariant* Property::get_value() const
|
||||
GVariant* Property::get_value()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -47,14 +47,16 @@ protected:
|
||||
Property(QString name, QString label, Getter getter, Setter setter);
|
||||
|
||||
public:
|
||||
const QString& name() const;
|
||||
const QString& label() const;
|
||||
const QString& name();
|
||||
const QString& label();
|
||||
|
||||
virtual ~Property();
|
||||
|
||||
virtual QWidget* get_widget(QWidget *parent,
|
||||
bool auto_commit = false) = 0;
|
||||
virtual bool labeled_widget() const;
|
||||
virtual bool labeled_widget();
|
||||
|
||||
virtual GVariant* get_value() const;
|
||||
virtual GVariant* get_value();
|
||||
|
||||
virtual void commit() = 0;
|
||||
|
||||
|
@ -71,8 +71,7 @@
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace pv {
|
||||
|
||||
// TODO: This should not be necessary
|
||||
@ -115,16 +114,16 @@ SigSession::SigSession(DeviceManager *device_manager) :
|
||||
_stop_scale = 1;
|
||||
|
||||
// Create snapshots & data containers
|
||||
_cur_logic_snapshot.reset(new data::LogicSnapshot());
|
||||
_logic_data.reset(new data::Logic());
|
||||
_cur_logic_snapshot = new data::LogicSnapshot();
|
||||
_logic_data = new data::Logic();
|
||||
_logic_data->push_snapshot(_cur_logic_snapshot);
|
||||
_cur_dso_snapshot.reset(new data::DsoSnapshot());
|
||||
_dso_data.reset(new data::Dso());
|
||||
_cur_dso_snapshot = new data::DsoSnapshot();
|
||||
_dso_data = new data::Dso();
|
||||
_dso_data->push_snapshot(_cur_dso_snapshot);
|
||||
_cur_analog_snapshot.reset(new data::AnalogSnapshot());
|
||||
_analog_data.reset(new data::Analog());
|
||||
_cur_analog_snapshot = new data::AnalogSnapshot();
|
||||
_analog_data = new data::Analog();
|
||||
_analog_data->push_snapshot(_cur_analog_snapshot);
|
||||
_group_data.reset(new data::Group());
|
||||
_group_data = new data::Group();
|
||||
_group_cnt = 0;
|
||||
|
||||
connect(&_feed_timer, SIGNAL(timeout()), this, SLOT(feed_timeout()));
|
||||
@ -136,7 +135,7 @@ SigSession::~SigSession()
|
||||
{
|
||||
}
|
||||
|
||||
DevInst* SigSession::get_device() const
|
||||
DevInst* SigSession::get_device()
|
||||
{
|
||||
return _dev_inst;
|
||||
}
|
||||
@ -230,7 +229,7 @@ void SigSession::set_default_device(boost::function<void (const QString)> error_
|
||||
|
||||
DevInst *default_device = NULL;
|
||||
|
||||
const list<DevInst*> &devices = _device_manager->devices();
|
||||
const std::list<DevInst*> &devices = _device_manager->devices();
|
||||
if (!devices.empty()) {
|
||||
// Fall back to the first device in the list.
|
||||
default_device = devices.front();
|
||||
@ -265,18 +264,18 @@ void SigSession::release_device(DevInst *dev_inst)
|
||||
_dev_inst = NULL;
|
||||
}
|
||||
|
||||
SigSession::capture_state SigSession::get_capture_state() const
|
||||
SigSession::capture_state SigSession::get_capture_state()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_sampling_mutex);
|
||||
return _capture_state;
|
||||
}
|
||||
|
||||
uint64_t SigSession::cur_samplelimits() const
|
||||
uint64_t SigSession::cur_samplelimits()
|
||||
{
|
||||
return _cur_samplelimits;
|
||||
}
|
||||
|
||||
uint64_t SigSession::cur_samplerate() const
|
||||
uint64_t SigSession::cur_samplerate()
|
||||
{
|
||||
// samplerate for current viewport
|
||||
if (_dev_inst->dev_inst()->mode == DSO)
|
||||
@ -285,23 +284,23 @@ uint64_t SigSession::cur_samplerate() const
|
||||
return cur_snap_samplerate();
|
||||
}
|
||||
|
||||
uint64_t SigSession::cur_snap_samplerate() const
|
||||
uint64_t SigSession::cur_snap_samplerate()
|
||||
{
|
||||
// samplerate for current snapshot
|
||||
return _cur_snap_samplerate;
|
||||
}
|
||||
|
||||
double SigSession::cur_sampletime() const
|
||||
double SigSession::cur_sampletime()
|
||||
{
|
||||
return cur_samplelimits() * 1.0 / cur_samplerate();
|
||||
}
|
||||
|
||||
double SigSession::cur_snap_sampletime() const
|
||||
double SigSession::cur_snap_sampletime()
|
||||
{
|
||||
return cur_samplelimits() * 1.0 / cur_snap_samplerate();
|
||||
}
|
||||
|
||||
double SigSession::cur_view_time() const
|
||||
double SigSession::cur_view_time()
|
||||
{
|
||||
return _dev_inst->get_time_base() * DS_CONF_DSO_HDIVS * 1.0 / SR_SEC(1);
|
||||
}
|
||||
@ -374,12 +373,12 @@ void SigSession::capture_init()
|
||||
for(auto &s : _signals)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->set_zero_ratio(dsoSig->get_zero_ratio());
|
||||
}
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
view::AnalogSignal *analogSig = NULL;
|
||||
if ((analogSig = dynamic_cast<view::AnalogSignal*>(s))) {
|
||||
analogSig->set_zero_ratio(analogSig->get_zero_ratio());
|
||||
}
|
||||
}
|
||||
@ -450,8 +449,8 @@ void SigSession::start_capture(bool instant,
|
||||
for(auto &s : _signals)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
||||
dsoSig->set_mValid(false);
|
||||
}
|
||||
|
||||
@ -489,10 +488,7 @@ void SigSession::stop_capture()
|
||||
{
|
||||
data_unlock();
|
||||
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
i != _decode_traces.end();
|
||||
i++)
|
||||
for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++)
|
||||
(*i)->decoder()->stop_decode();
|
||||
|
||||
if (get_capture_state() != Running)
|
||||
@ -530,22 +526,20 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
|
||||
return false;
|
||||
}
|
||||
|
||||
vector< boost::shared_ptr<view::Signal> >& SigSession::get_signals()
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_signals_mutex);
|
||||
std::vector<view::Signal*>& SigSession::get_signals()
|
||||
{
|
||||
return _signals;
|
||||
}
|
||||
|
||||
vector< boost::shared_ptr<view::GroupSignal> > SigSession::get_group_signals()
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_signals_mutex);
|
||||
std::vector<view::GroupSignal*>& SigSession::get_group_signals()
|
||||
{
|
||||
return _group_traces;
|
||||
}
|
||||
|
||||
set< boost::shared_ptr<data::SignalData> > SigSession::get_data() const
|
||||
std::set<data::SignalData*> SigSession::get_data()
|
||||
{
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
set< boost::shared_ptr<data::SignalData> > data;
|
||||
std::set<data::SignalData*> data;
|
||||
|
||||
for(auto &sig : _signals) {
|
||||
assert(sig);
|
||||
@ -617,37 +611,25 @@ void SigSession::add_group()
|
||||
{
|
||||
std::list<int> probe_index_list;
|
||||
|
||||
std::vector< boost::shared_ptr<view::Signal> >::iterator i = _signals.begin();
|
||||
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.reset(new data::Group(_last_sample_rate));
|
||||
// if (_group_data->get_snapshots().empty())
|
||||
// _group_data->set_samplerate(_dev_inst->get_sample_rate());
|
||||
if (probe_index_list.size() > 1) {
|
||||
_group_data->init();
|
||||
_group_data->set_samplerate(_cur_snap_samplerate);
|
||||
const boost::shared_ptr<view::GroupSignal> signal(
|
||||
new view::GroupSignal("New Group",
|
||||
_group_data, probe_index_list, _group_cnt));
|
||||
auto signal = new view::GroupSignal("New Group", _group_data, probe_index_list, _group_cnt);
|
||||
_group_traces.push_back(signal);
|
||||
_group_cnt++;
|
||||
|
||||
const deque< boost::shared_ptr<data::LogicSnapshot> > &snapshots =
|
||||
_logic_data->get_snapshots();
|
||||
if (!snapshots.empty()) {
|
||||
//if (!_cur_group_snapshot)
|
||||
//{
|
||||
// Create a new data snapshot
|
||||
_cur_group_snapshot = boost::shared_ptr<data::GroupSnapshot>(
|
||||
new data::GroupSnapshot(snapshots.front(), signal->get_index_list()));
|
||||
//_cur_group_snapshot->append_payload();
|
||||
_group_data->push_snapshot(_cur_group_snapshot);
|
||||
_cur_group_snapshot.reset();
|
||||
//}
|
||||
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();
|
||||
@ -657,25 +639,32 @@ void SigSession::add_group()
|
||||
|
||||
void SigSession::del_group()
|
||||
{
|
||||
std::vector< boost::shared_ptr<view::GroupSignal> >::iterator i = _group_traces.begin();
|
||||
auto i = _group_traces.begin();
|
||||
|
||||
while (i != _group_traces.end()) {
|
||||
if ((*i)->selected()) {
|
||||
std::vector< boost::shared_ptr<view::GroupSignal> >::iterator j = _group_traces.begin();
|
||||
pv::view::GroupSignal *psig = *(i);
|
||||
|
||||
if (psig->selected()) {
|
||||
auto j = _group_traces.begin();
|
||||
while(j != _group_traces.end()) {
|
||||
if ((*j)->get_sec_index() > (*i)->get_sec_index())
|
||||
if ((*j)->get_sec_index() > psig->get_sec_index())
|
||||
(*j)->set_sec_index((*j)->get_sec_index() - 1);
|
||||
j++;
|
||||
}
|
||||
|
||||
std::deque< boost::shared_ptr<data::GroupSnapshot> > &snapshots = _group_data->get_snapshots();
|
||||
auto &snapshots = _group_data->get_snapshots();
|
||||
if (!snapshots.empty()) {
|
||||
_group_data->get_snapshots().at((*i)->get_sec_index()).reset();
|
||||
std::deque< boost::shared_ptr<data::GroupSnapshot> >::iterator k = snapshots.begin();
|
||||
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).reset();
|
||||
i = _group_traces.erase(i);
|
||||
|
||||
_group_cnt--;
|
||||
@ -693,8 +682,8 @@ void SigSession::init_signals()
|
||||
assert(_dev_inst);
|
||||
stop_capture();
|
||||
|
||||
vector< boost::shared_ptr<view::Signal> > sigs;
|
||||
boost::shared_ptr<view::Signal> signal;
|
||||
std::vector<view::Signal*> sigs;
|
||||
view::Signal *signal = NULL;
|
||||
unsigned int logic_probe_count = 0;
|
||||
unsigned int dso_probe_count = 0;
|
||||
unsigned int analog_probe_count = 0;
|
||||
@ -741,37 +730,35 @@ void SigSession::init_signals()
|
||||
// Make the logic probe list
|
||||
{
|
||||
_group_traces.clear();
|
||||
vector< boost::shared_ptr<view::GroupSignal> >().swap(_group_traces);
|
||||
std::vector<view::GroupSignal*>().swap(_group_traces);
|
||||
|
||||
for (GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) {
|
||||
sr_channel *probe =
|
||||
( sr_channel *)l->data;
|
||||
assert(probe);
|
||||
signal.reset();
|
||||
signal = NULL;
|
||||
|
||||
switch(probe->type) {
|
||||
case SR_CHANNEL_LOGIC:
|
||||
if (probe->enabled)
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(_dev_inst, _logic_data, probe));
|
||||
signal = new view::LogicSignal(_dev_inst, _logic_data, probe);
|
||||
break;
|
||||
|
||||
case SR_CHANNEL_DSO:
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::DsoSignal(_dev_inst, _dso_data, probe));
|
||||
signal = new view::DsoSignal(_dev_inst, _dso_data, probe);
|
||||
break;
|
||||
|
||||
case SR_CHANNEL_ANALOG:
|
||||
if (probe->enabled)
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::AnalogSignal(_dev_inst, _analog_data, probe));
|
||||
signal = new view::AnalogSignal(_dev_inst, _analog_data, probe);
|
||||
break;
|
||||
}
|
||||
if(signal.get())
|
||||
if(signal != NULL)
|
||||
sigs.push_back(signal);
|
||||
}
|
||||
|
||||
_signals.clear();
|
||||
vector< boost::shared_ptr<view::Signal> >().swap(_signals);
|
||||
std::vector<view::Signal*>().swap(_signals);
|
||||
_signals = sigs;
|
||||
}
|
||||
|
||||
@ -789,8 +776,8 @@ void SigSession::reload()
|
||||
stop_capture();
|
||||
|
||||
//refresh(0);
|
||||
vector< boost::shared_ptr<view::Signal> > sigs;
|
||||
boost::shared_ptr<view::Signal> signal;
|
||||
std::vector<view::Signal*> sigs;
|
||||
view::Signal *signal = NULL;
|
||||
|
||||
// Make the logic probe list
|
||||
{
|
||||
@ -798,58 +785,54 @@ void SigSession::reload()
|
||||
sr_channel *probe =
|
||||
(sr_channel *)l->data;
|
||||
assert(probe);
|
||||
signal.reset();
|
||||
signal = NULL;
|
||||
|
||||
switch(probe->type) {
|
||||
case SR_CHANNEL_LOGIC:
|
||||
if (probe->enabled) {
|
||||
std::vector< boost::shared_ptr<view::Signal> >::iterator i = _signals.begin();
|
||||
auto i = _signals.begin();
|
||||
while (i != _signals.end()) {
|
||||
if ((*i)->get_index() == probe->index) {
|
||||
boost::shared_ptr<view::LogicSignal> logicSig;
|
||||
if ((logicSig = dynamic_pointer_cast<view::LogicSignal>(*i)))
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(logicSig, _logic_data, probe));
|
||||
view::LogicSignal *logicSig = NULL;
|
||||
if ((logicSig = dynamic_cast<view::LogicSignal*>(*i)))
|
||||
signal = new view::LogicSignal(logicSig, _logic_data, probe);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!signal.get())
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(_dev_inst, _logic_data, probe));
|
||||
if (signal == NULL){
|
||||
signal = new view::LogicSignal(_dev_inst, _logic_data, probe);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// case SR_CHANNEL_DSO:
|
||||
// signal = boost::shared_ptr<view::Signal>(
|
||||
// new view::DsoSignal(_dev_inst,_dso_data, probe));
|
||||
// break;
|
||||
|
||||
|
||||
case SR_CHANNEL_ANALOG:
|
||||
if (probe->enabled) {
|
||||
std::vector< boost::shared_ptr<view::Signal> >::iterator i = _signals.begin();
|
||||
auto i = _signals.begin();
|
||||
while (i != _signals.end()) {
|
||||
if ((*i)->get_index() == probe->index) {
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(*i)))
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::AnalogSignal(analogSig, _analog_data, probe));
|
||||
view::AnalogSignal *analogSig = NULL;
|
||||
if ((analogSig = dynamic_cast<view::AnalogSignal*>(*i)))
|
||||
signal = new view::AnalogSignal(analogSig, _analog_data, probe);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!signal.get())
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::AnalogSignal(_dev_inst, _analog_data, probe));
|
||||
if (signal == NULL){
|
||||
signal = new view::AnalogSignal(_dev_inst, _analog_data, probe);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (signal.get())
|
||||
if (signal != NULL)
|
||||
sigs.push_back(signal);
|
||||
}
|
||||
|
||||
if (!sigs.empty()) {
|
||||
_signals.clear();
|
||||
vector< boost::shared_ptr<view::Signal> >().swap(_signals);
|
||||
std::vector<view::Signal*>().swap(_signals);
|
||||
_signals = sigs;
|
||||
}
|
||||
}
|
||||
@ -864,8 +847,7 @@ void SigSession::refresh(int holdtime)
|
||||
data_lock();
|
||||
|
||||
if (_logic_data) {
|
||||
_logic_data->init();
|
||||
//_cur_logic_snapshot.reset();
|
||||
_logic_data->init();
|
||||
|
||||
for(auto &d : _decode_traces)
|
||||
{
|
||||
@ -886,8 +868,7 @@ void SigSession::refresh(int holdtime)
|
||||
_math_trace->get_math_stack()->init();
|
||||
}
|
||||
if (_analog_data) {
|
||||
_analog_data->init();
|
||||
//_cur_analog_snapshot.reset();
|
||||
_analog_data->init();
|
||||
}
|
||||
|
||||
QTimer::singleShot(holdtime, this, SLOT(feed_timeout()));
|
||||
@ -978,8 +959,7 @@ void SigSession::feed_in_trigger(const ds_trigger_pos &trigger_pos)
|
||||
}
|
||||
|
||||
void SigSession::feed_in_logic(const sr_datafeed_logic &logic)
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_data_mutex);
|
||||
{
|
||||
if (!_logic_data || _cur_logic_snapshot->memory_failed()) {
|
||||
qDebug() << "Unexpected logic packet";
|
||||
return;
|
||||
@ -1016,9 +996,7 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic)
|
||||
}
|
||||
|
||||
void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_data_mutex);
|
||||
|
||||
{
|
||||
if(!_dso_data || _cur_dso_snapshot->memory_failed())
|
||||
{
|
||||
qDebug() << "Unexpected dso packet";
|
||||
@ -1032,8 +1010,8 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
for(auto &s : _signals)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->set_scale(dsoSig->get_view_rect().height());
|
||||
sig_enable[dsoSig->get_index()] = dsoSig->enabled();
|
||||
}
|
||||
@ -1047,8 +1025,8 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
}
|
||||
|
||||
for(auto &s : _signals) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) && (dsoSig->enabled()))
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)) && (dsoSig->enabled()))
|
||||
dsoSig->paint_prepare();
|
||||
}
|
||||
|
||||
@ -1088,8 +1066,7 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
|
||||
}
|
||||
|
||||
void SigSession::feed_in_analog(const sr_datafeed_analog &analog)
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_data_mutex);
|
||||
{
|
||||
|
||||
if(!_analog_data || _cur_analog_snapshot->memory_failed())
|
||||
{
|
||||
@ -1103,8 +1080,8 @@ void SigSession::feed_in_analog(const sr_datafeed_analog &analog)
|
||||
for(auto &s : _signals)
|
||||
{
|
||||
assert(s);
|
||||
boost::shared_ptr<view::AnalogSignal> analogSig;
|
||||
if ((analogSig = dynamic_pointer_cast<view::AnalogSignal>(s))) {
|
||||
view::AnalogSignal *analogSig = NULL;
|
||||
if ((analogSig = dynamic_cast<view::AnalogSignal*>(s))) {
|
||||
analogSig->set_scale(analogSig->get_totalHeight());
|
||||
}
|
||||
}
|
||||
@ -1187,16 +1164,14 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
|
||||
case SR_DF_END:
|
||||
{
|
||||
{
|
||||
//boost::lock_guard<std::mutex> lock(_data_mutex);
|
||||
|
||||
if (!_cur_logic_snapshot->empty()) {
|
||||
for(auto &g : _group_traces)
|
||||
{
|
||||
assert(g);
|
||||
|
||||
_cur_group_snapshot = boost::shared_ptr<data::GroupSnapshot>(
|
||||
new data::GroupSnapshot(_logic_data->get_snapshots().front(), g->get_index_list()));
|
||||
_group_data->push_snapshot(_cur_group_snapshot);
|
||||
_cur_group_snapshot.reset();
|
||||
auto p = new data::GroupSnapshot(_logic_data->get_snapshots().front(), g->get_index_list());
|
||||
_group_data->push_snapshot(p);
|
||||
}
|
||||
}
|
||||
_cur_logic_snapshot->capture_ended();
|
||||
@ -1331,20 +1306,18 @@ uint16_t SigSession::get_ch_num(int type)
|
||||
uint16_t logic_ch_num = 0;
|
||||
uint16_t dso_ch_num = 0;
|
||||
uint16_t analog_ch_num = 0;
|
||||
|
||||
if (_dev_inst->dev_inst()) {
|
||||
for(auto &s : _signals)
|
||||
{
|
||||
assert(s);
|
||||
if (dynamic_pointer_cast<view::LogicSignal>(s) && s->enabled()) {
|
||||
//if (dynamic_pointer_cast<view::LogicSignal>(s)) {
|
||||
if (dynamic_cast<view::LogicSignal*>(s) && s->enabled()) {
|
||||
logic_ch_num++;
|
||||
}
|
||||
if (dynamic_pointer_cast<view::DsoSignal>(s) && s->enabled()) {
|
||||
//if (dynamic_pointer_cast<view::DsoSignal>(s)) {
|
||||
if (dynamic_cast<view::DsoSignal*>(s) && s->enabled()) {
|
||||
dso_ch_num++;
|
||||
}
|
||||
if (dynamic_pointer_cast<view::AnalogSignal>(s) && s->enabled()) {
|
||||
//if (dynamic_pointer_cast<view::AnalogSignal>(s)) {
|
||||
if (dynamic_cast<view::AnalogSignal*>(s) && s->enabled()) {
|
||||
analog_ch_num++;
|
||||
}
|
||||
}
|
||||
@ -1366,75 +1339,74 @@ uint16_t SigSession::get_ch_num(int type)
|
||||
|
||||
|
||||
bool SigSession::add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus)
|
||||
{
|
||||
bool ret = false;
|
||||
map<const srd_channel*, int> probes;
|
||||
boost::shared_ptr<data::DecoderStack> decoder_stack;
|
||||
{
|
||||
try {
|
||||
|
||||
try {
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
bool ret = false;
|
||||
|
||||
// Create the decoder
|
||||
decoder_stack = boost::shared_ptr<data::DecoderStack>(
|
||||
new data::DecoderStack(this, dec, dstatus));
|
||||
std::map<const srd_channel*, int> probes;
|
||||
data::DecoderStack *decoder_stack = new data::DecoderStack(this, dec, dstatus);
|
||||
assert(decoder_stack);
|
||||
|
||||
// Make a list of all the probes
|
||||
std::vector<const srd_channel*> all_probes;
|
||||
for(const GSList *i = dec->channels; i; i = i->next)
|
||||
all_probes.push_back((const srd_channel*)i->data);
|
||||
|
||||
for(const GSList *i = dec->opt_channels; i; i = i->next)
|
||||
all_probes.push_back((const srd_channel*)i->data);
|
||||
|
||||
assert(decoder_stack);
|
||||
assert(!decoder_stack->stack().empty());
|
||||
assert(decoder_stack->stack().front());
|
||||
|
||||
decoder_stack->stack().front()->set_probes(probes);
|
||||
|
||||
// Create the decode signal
|
||||
boost::shared_ptr<view::DecodeTrace> d(
|
||||
new view::DecodeTrace(this, decoder_stack,
|
||||
_decode_traces.size()));
|
||||
view::DecodeTrace *trace = new view::DecodeTrace(this, decoder_stack, _decode_traces.size());
|
||||
assert(trace);
|
||||
|
||||
// set view early for decode start/end region setting
|
||||
for(auto &s : _signals) {
|
||||
if (s->get_view()) {
|
||||
d->set_view(s->get_view());
|
||||
trace->set_view(s->get_view());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (silent) {
|
||||
_decode_traces.push_back(d);
|
||||
_decode_traces.push_back(trace);
|
||||
ret = true;
|
||||
} else if (d->create_popup()) {
|
||||
_decode_traces.push_back(d);
|
||||
} else if (trace->create_popup()) {
|
||||
_decode_traces.push_back(trace);
|
||||
ret = true;
|
||||
}
|
||||
} catch(const std::runtime_error &e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
signals_changed();
|
||||
// Do an initial decode
|
||||
decoder_stack->begin_decode();
|
||||
data_updated();
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
signals_changed();
|
||||
// Do an initial decode
|
||||
decoder_stack->begin_decode();
|
||||
data_updated();
|
||||
}
|
||||
else{
|
||||
delete trace;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
} catch(...) {
|
||||
ds_debug("Starting a hotplug thread...\n");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
vector< boost::shared_ptr<view::DecodeTrace> > SigSession::get_decode_signals() const
|
||||
{
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
std::vector<view::DecodeTrace*>& SigSession::get_decode_signals()
|
||||
{
|
||||
return _decode_traces;
|
||||
}
|
||||
|
||||
void SigSession::remove_decode_signal(view::DecodeTrace *signal)
|
||||
{
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
i != _decode_traces.end();
|
||||
i++)
|
||||
if ((*i).get() == signal)
|
||||
for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++)
|
||||
if ((*i) == signal)
|
||||
{
|
||||
_decode_traces.erase(i);
|
||||
signals_changed();
|
||||
@ -1445,14 +1417,12 @@ void SigSession::remove_decode_signal(view::DecodeTrace *signal)
|
||||
void SigSession::remove_decode_signal(int index)
|
||||
{
|
||||
int cur_index = 0;
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
i != _decode_traces.end();
|
||||
i++)
|
||||
|
||||
for (auto i = _decode_traces.begin(); i != _decode_traces.end(); i++)
|
||||
{
|
||||
if (cur_index == index)
|
||||
{
|
||||
auto d = (*i)->decoder().get();
|
||||
auto d = (*i)->decoder();
|
||||
d->stop_decode(); //stop decoder thread
|
||||
_decode_traces.erase(i);
|
||||
signals_changed();
|
||||
@ -1464,45 +1434,35 @@ void SigSession::remove_decode_signal(int index)
|
||||
|
||||
void SigSession::rst_decoder(int index)
|
||||
{
|
||||
int cur_index = 0;
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
i != _decode_traces.end();
|
||||
i++)
|
||||
{
|
||||
if (cur_index == index)
|
||||
{
|
||||
if ((*i)->create_popup())
|
||||
if (index >= 0 && index < (int)_decode_traces.size()){
|
||||
auto p = _decode_traces[index];
|
||||
if (p->create_popup())
|
||||
{
|
||||
(*i)->decoder()->stop_decode();
|
||||
(*i)->decoder()->begin_decode();
|
||||
p->decoder()->stop_decode();
|
||||
p->decoder()->begin_decode();
|
||||
data_updated();
|
||||
}
|
||||
return;
|
||||
}
|
||||
cur_index++;
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::rst_decoder(view::DecodeTrace *signal)
|
||||
{
|
||||
for (vector< boost::shared_ptr<view::DecodeTrace> >::iterator i =
|
||||
_decode_traces.begin();
|
||||
i != _decode_traces.end();
|
||||
i++)
|
||||
if ((*i).get() == signal)
|
||||
{
|
||||
if ((*i)->create_popup())
|
||||
{
|
||||
(*i)->decoder()->stop_decode();
|
||||
(*i)->decoder()->begin_decode();
|
||||
data_updated();
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
for (auto p : _decode_traces)
|
||||
{
|
||||
if (p == signal)
|
||||
{
|
||||
if (p->create_popup())
|
||||
{
|
||||
p->decoder()->stop_decode();
|
||||
p->decoder()->begin_decode();
|
||||
data_updated();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pv::data::DecoderModel* SigSession::get_decoder_model() const
|
||||
pv::data::DecoderModel* SigSession::get_decoder_model()
|
||||
{
|
||||
return _decoder_model;
|
||||
}
|
||||
@ -1512,20 +1472,18 @@ void SigSession::spectrum_rebuild()
|
||||
{
|
||||
bool has_dso_signal = false;
|
||||
for(auto &s : _signals) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
has_dso_signal = true;
|
||||
// check already have
|
||||
std::vector< boost::shared_ptr<view::SpectrumTrace> >::iterator iter = _spectrum_traces.begin();
|
||||
auto iter = _spectrum_traces.begin();
|
||||
for(unsigned int i = 0; i < _spectrum_traces.size(); i++, iter++)
|
||||
if ((*iter)->get_index() == dsoSig->get_index())
|
||||
break;
|
||||
// if not, rebuild
|
||||
if (iter == _spectrum_traces.end()) {
|
||||
boost::shared_ptr<data::SpectrumStack> spectrum_stack(
|
||||
new data::SpectrumStack(this, dsoSig->get_index()));
|
||||
boost::shared_ptr<view::SpectrumTrace> spectrum_trace(
|
||||
new view::SpectrumTrace(this, spectrum_stack, dsoSig->get_index()));
|
||||
auto spectrum_stack = new data::SpectrumStack(this, dsoSig->get_index());
|
||||
auto spectrum_trace = new view::SpectrumTrace(this, spectrum_stack, dsoSig->get_index());
|
||||
_spectrum_traces.push_back(spectrum_trace);
|
||||
}
|
||||
}
|
||||
@ -1537,15 +1495,14 @@ void SigSession::spectrum_rebuild()
|
||||
signals_changed();
|
||||
}
|
||||
|
||||
vector< boost::shared_ptr<view::SpectrumTrace> > SigSession::get_spectrum_traces()
|
||||
{
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
std::vector<view::SpectrumTrace*>& SigSession::get_spectrum_traces()
|
||||
{
|
||||
return _spectrum_traces;
|
||||
}
|
||||
|
||||
void SigSession::lissajous_rebuild(bool enable, int xindex, int yindex, double percent)
|
||||
{
|
||||
_lissajous_trace.reset(new view::LissajousTrace(enable, _dso_data, xindex, yindex, percent));
|
||||
_lissajous_trace = new view::LissajousTrace(enable, _dso_data, xindex, yindex, percent);
|
||||
signals_changed();
|
||||
}
|
||||
|
||||
@ -1555,21 +1512,20 @@ void SigSession::lissajous_disable()
|
||||
_lissajous_trace->set_enable(false);
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::LissajousTrace> SigSession::get_lissajous_trace()
|
||||
{
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
view::LissajousTrace* SigSession::get_lissajous_trace()
|
||||
{
|
||||
return _lissajous_trace;
|
||||
}
|
||||
|
||||
void SigSession::math_rebuild(bool enable,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig1,
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig2,
|
||||
void SigSession::math_rebuild(bool enable,view::DsoSignal *dsoSig1,
|
||||
view::DsoSignal *dsoSig2,
|
||||
data::MathStack::MathType type)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_data_mutex);
|
||||
boost::shared_ptr<data::MathStack> math_stack(
|
||||
new data::MathStack(this, dsoSig1, dsoSig2, type));
|
||||
_math_trace.reset(new view::MathTrace(enable, math_stack, dsoSig1, dsoSig2));
|
||||
auto math_stack = new data::MathStack(this, dsoSig1, dsoSig2, type);
|
||||
DESTROY_OBJECT(_math_trace);
|
||||
_math_trace = new view::MathTrace(enable, math_stack, dsoSig1, dsoSig2);
|
||||
|
||||
if (_math_trace && _math_trace->enabled()) {
|
||||
_math_trace->get_math_stack()->set_samplerate(_dev_inst->get_sample_rate());
|
||||
_math_trace->get_math_stack()->realloc(_dev_inst->get_sample_limit());
|
||||
@ -1584,9 +1540,8 @@ void SigSession::math_disable()
|
||||
_math_trace->set_enable(false);
|
||||
}
|
||||
|
||||
boost::shared_ptr<view::MathTrace> SigSession::get_math_trace()
|
||||
view::MathTrace* SigSession::get_math_trace()
|
||||
{
|
||||
//lock_guard<mutex> lock(_signals_mutex);
|
||||
return _math_trace;
|
||||
}
|
||||
|
||||
@ -1595,22 +1550,22 @@ void SigSession::set_session_time(QDateTime time)
|
||||
_session_time = time;
|
||||
}
|
||||
|
||||
QDateTime SigSession::get_session_time() const
|
||||
QDateTime SigSession::get_session_time()
|
||||
{
|
||||
return _session_time;
|
||||
}
|
||||
|
||||
uint64_t SigSession::get_trigger_pos() const
|
||||
uint64_t SigSession::get_trigger_pos()
|
||||
{
|
||||
return _trigger_pos;
|
||||
}
|
||||
|
||||
bool SigSession::trigd() const
|
||||
bool SigSession::trigd()
|
||||
{
|
||||
return _trigger_flag;
|
||||
}
|
||||
|
||||
uint8_t SigSession::trigd_ch() const
|
||||
uint8_t SigSession::trigd_ch()
|
||||
{
|
||||
return _trigger_ch;
|
||||
}
|
||||
@ -1634,7 +1589,7 @@ void SigSession::feed_timeout()
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<data::Snapshot> SigSession::get_snapshot(int type)
|
||||
data::Snapshot* SigSession::get_snapshot(int type)
|
||||
{
|
||||
if (type == SR_CHANNEL_LOGIC)
|
||||
return _cur_logic_snapshot;
|
||||
@ -1646,7 +1601,7 @@ boost::shared_ptr<data::Snapshot> SigSession::get_snapshot(int type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SigSession::error_state SigSession::get_error() const
|
||||
SigSession::error_state SigSession::get_error()
|
||||
{
|
||||
return _error;
|
||||
}
|
||||
@ -1662,12 +1617,12 @@ void SigSession::clear_error()
|
||||
_error = No_err;
|
||||
}
|
||||
|
||||
uint64_t SigSession::get_error_pattern() const
|
||||
uint64_t SigSession::get_error_pattern()
|
||||
{
|
||||
return _error_pattern;
|
||||
}
|
||||
|
||||
SigSession::run_mode SigSession::get_run_mode() const
|
||||
SigSession::run_mode SigSession::get_run_mode()
|
||||
{
|
||||
return _run_mode;
|
||||
}
|
||||
@ -1677,7 +1632,7 @@ void SigSession::set_run_mode(run_mode mode)
|
||||
_run_mode = mode;
|
||||
}
|
||||
|
||||
int SigSession::get_repeat_intvl() const
|
||||
int SigSession::get_repeat_intvl()
|
||||
{
|
||||
return _repeat_intvl;
|
||||
}
|
||||
@ -1694,7 +1649,7 @@ void SigSession::set_repeating(bool repeat)
|
||||
_repeat_hold_prg = 0;
|
||||
}
|
||||
|
||||
bool SigSession::isRepeating() const
|
||||
bool SigSession::isRepeating()
|
||||
{
|
||||
return _repeating;
|
||||
}
|
||||
@ -1729,7 +1684,7 @@ void SigSession::repeat_update()
|
||||
}
|
||||
}
|
||||
|
||||
int SigSession::get_repeat_hold() const
|
||||
int SigSession::get_repeat_hold()
|
||||
{
|
||||
if (isRepeating())
|
||||
return _repeat_hold_prg;
|
||||
@ -1742,7 +1697,7 @@ void SigSession::set_map_zoom(int index)
|
||||
_map_zoom = index;
|
||||
}
|
||||
|
||||
int SigSession::get_map_zoom() const
|
||||
int SigSession::get_map_zoom()
|
||||
{
|
||||
return _map_zoom;
|
||||
}
|
||||
@ -1750,8 +1705,8 @@ int SigSession::get_map_zoom() const
|
||||
void SigSession::auto_end()
|
||||
{
|
||||
for(auto &s : _signals) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))) {
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s))) {
|
||||
dsoSig->auto_end();
|
||||
}
|
||||
}
|
||||
@ -1767,17 +1722,17 @@ void SigSession::set_save_end(uint64_t end)
|
||||
_save_end = end;
|
||||
}
|
||||
|
||||
uint64_t SigSession::get_save_start() const
|
||||
uint64_t SigSession::get_save_start()
|
||||
{
|
||||
return _save_start;
|
||||
}
|
||||
|
||||
uint64_t SigSession::get_save_end() const
|
||||
uint64_t SigSession::get_save_end()
|
||||
{
|
||||
return _save_end;
|
||||
}
|
||||
|
||||
bool SigSession::get_saving() const
|
||||
bool SigSession::get_saving()
|
||||
{
|
||||
return _saving;
|
||||
}
|
||||
@ -1804,7 +1759,7 @@ void SigSession::exit_capture()
|
||||
}
|
||||
}
|
||||
|
||||
float SigSession::stop_scale() const
|
||||
float SigSession::stop_scale()
|
||||
{
|
||||
return _stop_scale;
|
||||
}
|
||||
|
@ -24,9 +24,7 @@
|
||||
#define DSVIEW_PV_SIGSESSION_H
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -139,7 +137,7 @@ public:
|
||||
|
||||
~SigSession();
|
||||
|
||||
DevInst* get_device() const;
|
||||
DevInst* get_device();
|
||||
|
||||
/**
|
||||
* Sets device instance that will be used in the next capture session.
|
||||
@ -156,20 +154,20 @@ public:
|
||||
|
||||
void release_device(DevInst *dev_inst);
|
||||
|
||||
capture_state get_capture_state() const;
|
||||
capture_state get_capture_state();
|
||||
|
||||
uint64_t cur_samplerate() const;
|
||||
uint64_t cur_snap_samplerate() const;
|
||||
uint64_t cur_samplelimits() const;
|
||||
double cur_sampletime() const;
|
||||
double cur_snap_sampletime() const;
|
||||
double cur_view_time() const;
|
||||
uint64_t cur_samplerate();
|
||||
uint64_t cur_snap_samplerate();
|
||||
uint64_t cur_samplelimits();
|
||||
double cur_sampletime();
|
||||
double cur_snap_sampletime();
|
||||
double cur_view_time();
|
||||
|
||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
void set_session_time(QDateTime time);
|
||||
QDateTime get_session_time() const;
|
||||
uint64_t get_trigger_pos() const;
|
||||
QDateTime get_session_time();
|
||||
uint64_t get_trigger_pos();
|
||||
|
||||
void start_capture(bool instant,
|
||||
boost::function<void (const QString)> error_handler);
|
||||
@ -177,19 +175,15 @@ public:
|
||||
bool get_capture_status(bool &triggered, int &progress);
|
||||
void container_init();
|
||||
|
||||
std::set< boost::shared_ptr<data::SignalData> > get_data() const;
|
||||
std::set<data::SignalData*> get_data();
|
||||
|
||||
std::vector< boost::shared_ptr<view::Signal> >&
|
||||
get_signals();
|
||||
|
||||
std::vector< boost::shared_ptr<view::GroupSignal> >
|
||||
get_group_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);
|
||||
|
||||
std::vector< boost::shared_ptr<view::DecodeTrace> >
|
||||
get_decode_signals() const;
|
||||
std::vector<view::DecodeTrace*>& get_decode_signals();
|
||||
|
||||
void remove_decode_signal(view::DecodeTrace *signal);
|
||||
|
||||
@ -199,17 +193,13 @@ public:
|
||||
|
||||
void rst_decoder(view::DecodeTrace *signal);
|
||||
|
||||
pv::data::DecoderModel* get_decoder_model() const;
|
||||
pv::data::DecoderModel* get_decoder_model();
|
||||
|
||||
std::vector<view::SpectrumTrace*>& get_spectrum_traces();
|
||||
|
||||
std::vector< boost::shared_ptr<view::SpectrumTrace> >
|
||||
get_spectrum_traces();
|
||||
view::LissajousTrace* get_lissajous_trace();
|
||||
|
||||
boost::shared_ptr<view::LissajousTrace>
|
||||
get_lissajous_trace();
|
||||
|
||||
boost::shared_ptr<view::MathTrace>
|
||||
get_math_trace();
|
||||
view::MathTrace* get_math_trace();
|
||||
|
||||
void init_signals();
|
||||
|
||||
@ -232,40 +222,39 @@ public:
|
||||
void spectrum_rebuild();
|
||||
void lissajous_rebuild(bool enable, int xindex, int yindex, double percent);
|
||||
void lissajous_disable();
|
||||
void math_rebuild(bool enable,
|
||||
boost::shared_ptr<pv::view::DsoSignal> dsoSig1,
|
||||
boost::shared_ptr<pv::view::DsoSignal> dsoSig2,
|
||||
void math_rebuild(bool enable,pv::view::DsoSignal *dsoSig1,
|
||||
pv::view::DsoSignal *dsoSig2,
|
||||
data::MathStack::MathType type);
|
||||
void math_disable();
|
||||
|
||||
bool trigd() const;
|
||||
uint8_t trigd_ch() const;
|
||||
bool trigd();
|
||||
uint8_t trigd_ch();
|
||||
|
||||
boost::shared_ptr<data::Snapshot> get_snapshot(int type);
|
||||
data::Snapshot* get_snapshot(int type);
|
||||
|
||||
error_state get_error() const;
|
||||
error_state get_error();
|
||||
void set_error(error_state state);
|
||||
void clear_error();
|
||||
uint64_t get_error_pattern() const;
|
||||
uint64_t get_error_pattern();
|
||||
|
||||
run_mode get_run_mode() const;
|
||||
run_mode get_run_mode();
|
||||
void set_run_mode(run_mode mode);
|
||||
int get_repeat_intvl() const;
|
||||
int get_repeat_intvl();
|
||||
void set_repeat_intvl(int interval);
|
||||
bool isRepeating() const;
|
||||
bool isRepeating();
|
||||
bool repeat_check();
|
||||
int get_repeat_hold() const;
|
||||
int get_repeat_hold();
|
||||
|
||||
int get_map_zoom() const;
|
||||
int get_map_zoom();
|
||||
|
||||
void set_save_start(uint64_t start);
|
||||
void set_save_end(uint64_t end);
|
||||
uint64_t get_save_start() const;
|
||||
uint64_t get_save_end() const;
|
||||
bool get_saving() const;
|
||||
uint64_t get_save_start();
|
||||
uint64_t get_save_end();
|
||||
bool get_saving();
|
||||
void set_saving(bool saving);
|
||||
void set_stop_scale(float scale);
|
||||
float stop_scale() const;
|
||||
float stop_scale();
|
||||
|
||||
void exit_capture();
|
||||
|
||||
@ -402,25 +391,24 @@ private:
|
||||
uint64_t _cur_samplelimits;
|
||||
|
||||
//mutable std::mutex _signals_mutex;
|
||||
std::vector< boost::shared_ptr<view::Signal> > _signals;
|
||||
std::vector< boost::shared_ptr<view::GroupSignal> > _group_traces;
|
||||
std::vector<view::Signal*> _signals;
|
||||
std::vector<view::GroupSignal*> _group_traces;
|
||||
|
||||
std::vector< boost::shared_ptr<view::DecodeTrace> > _decode_traces;
|
||||
pv::data::DecoderModel *_decoder_model;
|
||||
std::vector<view::DecodeTrace*> _decode_traces;
|
||||
pv::data::DecoderModel *_decoder_model;
|
||||
|
||||
std::vector< boost::shared_ptr<view::SpectrumTrace> > _spectrum_traces;
|
||||
boost::shared_ptr<view::LissajousTrace> _lissajous_trace;
|
||||
boost::shared_ptr<view::MathTrace> _math_trace;
|
||||
std::vector<view::SpectrumTrace*> _spectrum_traces;
|
||||
view::LissajousTrace *_lissajous_trace;
|
||||
view::MathTrace *_math_trace;
|
||||
|
||||
mutable std::mutex _data_mutex;
|
||||
boost::shared_ptr<data::Logic> _logic_data;
|
||||
boost::shared_ptr<data::LogicSnapshot> _cur_logic_snapshot;
|
||||
boost::shared_ptr<data::Dso> _dso_data;
|
||||
boost::shared_ptr<data::DsoSnapshot> _cur_dso_snapshot;
|
||||
boost::shared_ptr<data::Analog> _analog_data;
|
||||
boost::shared_ptr<data::AnalogSnapshot> _cur_analog_snapshot;
|
||||
boost::shared_ptr<data::Group> _group_data;
|
||||
boost::shared_ptr<data::GroupSnapshot> _cur_group_snapshot;
|
||||
data::Logic *_logic_data;
|
||||
data::LogicSnapshot *_cur_logic_snapshot;
|
||||
data::Dso *_dso_data;
|
||||
data::DsoSnapshot *_cur_dso_snapshot;
|
||||
data::Analog *_analog_data;
|
||||
data::AnalogSnapshot *_cur_analog_snapshot;
|
||||
data::Group *_group_data;
|
||||
int _group_cnt;
|
||||
|
||||
std::thread *_sampling_thread;
|
||||
|
@ -82,13 +82,13 @@ SigSession* StoreSession::session()
|
||||
return _session;
|
||||
}
|
||||
|
||||
pair<uint64_t, uint64_t> StoreSession::progress() const
|
||||
std::pair<uint64_t, uint64_t> StoreSession::progress()
|
||||
{
|
||||
//lock_guard<mutex> lock(_mutex);
|
||||
return make_pair(_units_stored, _unit_count);
|
||||
return std::make_pair(_units_stored, _unit_count);
|
||||
}
|
||||
|
||||
const QString& StoreSession::error() const
|
||||
const QString& StoreSession::error()
|
||||
{
|
||||
//lock_guard<mutex> lock(_mutex);
|
||||
return _error;
|
||||
@ -153,7 +153,7 @@ bool StoreSession::save_start()
|
||||
return false;
|
||||
}
|
||||
|
||||
const boost::shared_ptr<data::Snapshot> snapshot(_session->get_snapshot(*type_set.begin()));
|
||||
const auto snapshot = _session->get_snapshot(*type_set.begin());
|
||||
assert(snapshot);
|
||||
// Check we have data
|
||||
if (snapshot->empty()) {
|
||||
@ -205,17 +205,17 @@ bool StoreSession::save_start()
|
||||
return false;
|
||||
}
|
||||
|
||||
void StoreSession::save_proc(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
void StoreSession::save_proc(data::Snapshot *snapshot)
|
||||
{
|
||||
assert(snapshot);
|
||||
|
||||
int ret = SR_ERR;
|
||||
int num = 0;
|
||||
boost::shared_ptr<data::LogicSnapshot> logic_snapshot;
|
||||
boost::shared_ptr<data::AnalogSnapshot> analog_snapshot;
|
||||
boost::shared_ptr<data::DsoSnapshot> dso_snapshot;
|
||||
data::LogicSnapshot *logic_snapshot = NULL;
|
||||
//data::AnalogSnapshot *analog_snapshot = NULL;
|
||||
//data::DsoSnapshot *dso_snapshot = NULL;
|
||||
|
||||
if ((logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
if ((logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot))) {
|
||||
uint16_t to_save_probes = 0;
|
||||
for(auto &s : _session->get_signals()) {
|
||||
if (s->enabled() && logic_snapshot->has_data(s->get_index()))
|
||||
@ -345,7 +345,7 @@ void StoreSession::save_proc(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
QString StoreSession::meta_gen(data::Snapshot *snapshot)
|
||||
{
|
||||
GSList *l;
|
||||
GVariant *gvar;
|
||||
@ -396,8 +396,8 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
fprintf(meta, "total blocks = %d\n", snapshot->get_block_num());
|
||||
}
|
||||
|
||||
boost::shared_ptr<data::LogicSnapshot> logic_snapshot;
|
||||
if ((logic_snapshot = dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
data::LogicSnapshot *logic_snapshot = NULL;
|
||||
if ((logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot))) {
|
||||
uint16_t to_save_probes = 0;
|
||||
for (l = sdi->channels; l; l = l->next) {
|
||||
probe = (struct sr_channel *)l->data;
|
||||
@ -451,8 +451,8 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
} else if (sdi->mode == LOGIC) {
|
||||
fprintf(meta, "trigger time = %lld\n", _session->get_session_time().toMSecsSinceEpoch());
|
||||
} else if (sdi->mode == ANALOG) {
|
||||
boost::shared_ptr<data::AnalogSnapshot> analog_snapshot;
|
||||
if ((analog_snapshot = dynamic_pointer_cast<data::AnalogSnapshot>(snapshot))) {
|
||||
data::AnalogSnapshot *analog_snapshot = NULL;
|
||||
if ((analog_snapshot = dynamic_cast<data::AnalogSnapshot*>(snapshot))) {
|
||||
uint8_t tmp_u8 = analog_snapshot->get_unit_bytes();
|
||||
fprintf(meta, "bits = %d\n", tmp_u8*8);
|
||||
}
|
||||
@ -559,7 +559,7 @@ bool StoreSession::export_start()
|
||||
return false;
|
||||
}
|
||||
|
||||
const boost::shared_ptr<data::Snapshot> snapshot(_session->get_snapshot(*type_set.begin()));
|
||||
const auto snapshot = _session->get_snapshot(*type_set.begin());
|
||||
assert(snapshot);
|
||||
// Check we have data
|
||||
if (snapshot->empty()) {
|
||||
@ -605,20 +605,20 @@ bool StoreSession::export_start()
|
||||
return false;
|
||||
}
|
||||
|
||||
void StoreSession::export_proc(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
void StoreSession::export_proc(data::Snapshot *snapshot)
|
||||
{
|
||||
assert(snapshot);
|
||||
|
||||
boost::shared_ptr<data::LogicSnapshot> logic_snapshot;
|
||||
boost::shared_ptr<data::AnalogSnapshot> analog_snapshot;
|
||||
boost::shared_ptr<data::DsoSnapshot> dso_snapshot;
|
||||
data::LogicSnapshot *logic_snapshot = NULL;
|
||||
data::AnalogSnapshot *analog_snapshot = NULL;
|
||||
data::DsoSnapshot *dso_snapshot = NULL;
|
||||
int channel_type;
|
||||
|
||||
if ((logic_snapshot = boost::dynamic_pointer_cast<data::LogicSnapshot>(snapshot))) {
|
||||
if ((logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_LOGIC;
|
||||
} else if ((dso_snapshot = boost::dynamic_pointer_cast<data::DsoSnapshot>(snapshot))) {
|
||||
} else if ((dso_snapshot = dynamic_cast<data::DsoSnapshot*>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_DSO;
|
||||
} else if ((analog_snapshot = boost::dynamic_pointer_cast<data::AnalogSnapshot>(snapshot))) {
|
||||
} else if ((analog_snapshot = dynamic_cast<data::AnalogSnapshot*>(snapshot))) {
|
||||
channel_type = SR_CHANNEL_ANALOG;
|
||||
} else {
|
||||
_has_error = true;
|
||||
@ -871,15 +871,15 @@ QJsonArray StoreSession::json_decoders()
|
||||
QJsonObject dec_obj;
|
||||
QJsonArray stack_array;
|
||||
QJsonObject show_obj;
|
||||
const boost::shared_ptr<data::DecoderStack>& stack = t->decoder();
|
||||
const std::list< boost::shared_ptr<data::decode::Decoder> >& decoder = stack->stack();
|
||||
const auto &stack = t->decoder();
|
||||
const auto &decoder = stack->stack();
|
||||
|
||||
for(auto &dec : decoder) {
|
||||
QJsonArray ch_array;
|
||||
const srd_decoder *const d = dec->decoder();;
|
||||
const bool have_probes = (d->channels || d->opt_channels) != 0;
|
||||
if (have_probes) {
|
||||
for(std::map<const srd_channel*, int>::const_iterator i = dec->channels().begin();
|
||||
for(auto i = dec->channels().begin();
|
||||
i != dec->channels().end(); i++) {
|
||||
QJsonObject ch_obj;
|
||||
ch_obj[(*i).first->id] = QJsonValue::fromVariant((*i).second);
|
||||
@ -888,8 +888,8 @@ QJsonArray StoreSession::json_decoders()
|
||||
}
|
||||
|
||||
QJsonObject options_obj;
|
||||
boost::shared_ptr<prop::binding::DecoderOptions> dec_binding(
|
||||
new prop::binding::DecoderOptions(stack, dec));
|
||||
auto dec_binding = new prop::binding::DecoderOptions(stack, dec);
|
||||
|
||||
for (GSList *l = d->options; l; l = l->next)
|
||||
{
|
||||
const srd_decoder_option *const opt =
|
||||
@ -934,10 +934,10 @@ QJsonArray StoreSession::json_decoders()
|
||||
dec_obj["stacked decoders"] = stack_array;
|
||||
|
||||
|
||||
std::map<const pv::data::decode::Row, bool> rows = stack->get_rows_gshow();
|
||||
for (std::map<const pv::data::decode::Row, bool>::const_iterator i = rows.begin();
|
||||
i != rows.end(); i++) {
|
||||
show_obj[(*i).first.title()] = QJsonValue::fromVariant((*i).second);
|
||||
auto rows = stack->get_rows_gshow();
|
||||
for (auto i = rows.begin(); i != rows.end(); i++) {
|
||||
pv::data::decode::Row _row = (*i).first;
|
||||
show_obj[_row.title()] = QJsonValue::fromVariant((*i).second);
|
||||
}
|
||||
dec_obj["show"] = show_obj;
|
||||
|
||||
@ -954,17 +954,18 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra
|
||||
|
||||
foreach (const QJsonValue &dec_value, dec_array) {
|
||||
QJsonObject dec_obj = dec_value.toObject();
|
||||
const vector< boost::shared_ptr<view::DecodeTrace> > pre_dsigs(
|
||||
_session->get_decode_signals());
|
||||
|
||||
auto &pre_dsigs = _session->get_decode_signals();
|
||||
if (widget->sel_protocol(dec_obj["id"].toString()))
|
||||
widget->add_protocol(true);
|
||||
const vector< boost::shared_ptr<view::DecodeTrace> > aft_dsigs(
|
||||
_session->get_decode_signals());
|
||||
|
||||
auto &aft_dsigs = _session->get_decode_signals();
|
||||
|
||||
if (aft_dsigs.size() > pre_dsigs.size()) {
|
||||
const GSList *l;
|
||||
boost::shared_ptr<view::DecodeTrace> new_dsig = aft_dsigs.back();
|
||||
const boost::shared_ptr<data::DecoderStack>& stack = new_dsig->decoder();
|
||||
|
||||
auto new_dsig = aft_dsigs.back();
|
||||
auto stack = new_dsig->decoder();
|
||||
|
||||
if (dec_obj.contains("stacked decoders")) {
|
||||
foreach(const QJsonValue &value, dec_obj["stacked decoders"].toArray()) {
|
||||
@ -976,8 +977,7 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra
|
||||
assert(d);
|
||||
|
||||
if (QString::fromUtf8(d->id) == stacked_obj["id"].toString()) {
|
||||
stack->push(boost::shared_ptr<data::decode::Decoder>(
|
||||
new data::decode::Decoder(d)));
|
||||
stack->push(new data::decode::Decoder(d));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -985,7 +985,7 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra
|
||||
}
|
||||
}
|
||||
|
||||
const std::list< boost::shared_ptr<data::decode::Decoder> >& decoder = stack->stack();
|
||||
auto &decoder = stack->stack();
|
||||
|
||||
for(auto &dec : decoder) {
|
||||
const srd_decoder *const d = dec->decoder();
|
||||
@ -1074,10 +1074,13 @@ void StoreSession::load_decoders(dock::ProtocolDock *widget, QJsonArray dec_arra
|
||||
if (dec_obj.contains("show")) {
|
||||
QJsonObject show_obj = dec_obj["show"].toObject();
|
||||
std::map<const pv::data::decode::Row, bool> rows = stack->get_rows_gshow();
|
||||
for (std::map<const pv::data::decode::Row, bool>::const_iterator i = rows.begin();
|
||||
i != rows.end(); i++) {
|
||||
if (show_obj.contains((*i).first.title())) {
|
||||
stack->set_rows_gshow((*i).first, show_obj[(*i).first.title()].toBool());
|
||||
|
||||
for (auto i = rows.begin();i != rows.end(); i++) {
|
||||
QString key = (*i).first.title();
|
||||
if (show_obj.contains(key)) {
|
||||
bool bShow = show_obj[key].toBool();
|
||||
const pv::data::decode::Row r = (*i).first;
|
||||
stack->set_rows_gshow(r, bShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
@ -59,9 +58,9 @@ public:
|
||||
|
||||
SigSession* session();
|
||||
|
||||
std::pair<uint64_t, uint64_t> progress() const;
|
||||
std::pair<uint64_t, uint64_t> progress();
|
||||
|
||||
const QString& error() const;
|
||||
const QString& error();
|
||||
|
||||
bool save_start();
|
||||
|
||||
@ -72,9 +71,9 @@ public:
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
void save_proc(boost::shared_ptr<pv::data::Snapshot> snapshot);
|
||||
QString meta_gen(boost::shared_ptr<data::Snapshot> snapshot);
|
||||
void export_proc(boost::shared_ptr<pv::data::Snapshot> snapshot);
|
||||
void save_proc(pv::data::Snapshot *snapshot);
|
||||
QString meta_gen(data::Snapshot *snapshot);
|
||||
void export_proc(pv::data::Snapshot *snapshot);
|
||||
|
||||
QString decoders_gen();
|
||||
|
||||
|
@ -20,9 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include <QMetaObject>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
@ -259,7 +259,7 @@ void SamplingBar::set_device_list(const std::list<DevInst*> &devices, DevInst *s
|
||||
_updating_device_selector = false;
|
||||
}
|
||||
|
||||
DevInst* SamplingBar::get_selected_device() const
|
||||
DevInst* SamplingBar::get_selected_device()
|
||||
{
|
||||
const int index = _device_selector.currentIndex();
|
||||
if (index < 0)
|
||||
@ -331,11 +331,11 @@ void SamplingBar::on_configure()
|
||||
|
||||
void SamplingBar::zero_adj()
|
||||
{
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
view::DsoSignal *dsoSig = NULL;
|
||||
|
||||
for(auto &s : _session->get_signals())
|
||||
{
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
||||
dsoSig->set_enable(true);
|
||||
}
|
||||
const int index_back = _sample_count.currentIndex();
|
||||
@ -352,7 +352,7 @@ void SamplingBar::zero_adj()
|
||||
if (wait.start() == QDialog::Rejected) {
|
||||
for(auto &s : _session->get_signals())
|
||||
{
|
||||
if ((dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)))
|
||||
if ((dsoSig = dynamic_cast<view::DsoSignal*>(s)))
|
||||
dsoSig->commit_settings();
|
||||
}
|
||||
}
|
||||
@ -364,19 +364,19 @@ void SamplingBar::zero_adj()
|
||||
commit_hori_res();
|
||||
}
|
||||
|
||||
bool SamplingBar::get_sampling() const
|
||||
bool SamplingBar::get_sampling()
|
||||
{
|
||||
return _sampling;
|
||||
}
|
||||
|
||||
bool SamplingBar::get_instant() const
|
||||
bool SamplingBar::get_instant()
|
||||
{
|
||||
return _instant;
|
||||
}
|
||||
|
||||
void SamplingBar::set_sampling(bool sampling)
|
||||
{
|
||||
lock_guard<std::mutex> lock(_sampling_mutex);
|
||||
std::lock_guard<std::mutex> lock(_sampling_mutex);
|
||||
_sampling = sampling;
|
||||
|
||||
if (!sampling) {
|
||||
@ -505,7 +505,7 @@ void SamplingBar::update_sample_rate_selector_value()
|
||||
void SamplingBar::on_samplerate_sel(int index)
|
||||
{
|
||||
(void)index;
|
||||
const DevInst *dev_inst = get_selected_device();
|
||||
DevInst *dev_inst = get_selected_device();
|
||||
if (dev_inst->dev_inst()->mode != DSO)
|
||||
update_sample_count_selector();
|
||||
}
|
||||
@ -707,7 +707,7 @@ void SamplingBar::on_samplecount_sel(int index)
|
||||
{
|
||||
(void)index;
|
||||
|
||||
const DevInst *dev_inst = get_selected_device();
|
||||
DevInst *dev_inst = get_selected_device();
|
||||
if (dev_inst->dev_inst()->mode == DSO)
|
||||
commit_hori_res();
|
||||
sig_duration_changed();
|
||||
|
@ -27,9 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
@ -76,13 +74,13 @@ namespace pv
|
||||
|
||||
void set_device_list(const std::list<DevInst*> &devices, DevInst* selected);
|
||||
|
||||
DevInst *get_selected_device() const;
|
||||
DevInst *get_selected_device();
|
||||
|
||||
void update_sample_rate_selector();
|
||||
|
||||
void set_sampling(bool sampling);
|
||||
bool get_sampling() const;
|
||||
bool get_instant() const;
|
||||
bool get_sampling();
|
||||
bool get_instant();
|
||||
|
||||
void enable_toggle(bool enable);
|
||||
|
||||
|
@ -69,17 +69,17 @@ TitleBar::TitleBar(bool top, QWidget *parent, bool hasClose) :
|
||||
_lay->addWidget(_minimizeButton);
|
||||
_lay->addWidget(_maximizeButton);
|
||||
|
||||
connect(this, SIGNAL(normalShow() ), parent, SLOT(showNormal() ) );
|
||||
connect(this, SIGNAL( maximizedShow() ), parent, SLOT(showMaximized() ) );
|
||||
connect(_minimizeButton, SIGNAL( clicked() ), parent, SLOT(showMinimized() ) );
|
||||
connect(_maximizeButton, SIGNAL( clicked() ), this, SLOT(showMaxRestore() ) );
|
||||
connect(this, SIGNAL(normalShow()), parent, SLOT(showNormal()));
|
||||
connect(this, SIGNAL( maximizedShow()), parent, SLOT(showMaximized()));
|
||||
connect(_minimizeButton, SIGNAL( clicked()), parent, SLOT(showMinimized()));
|
||||
connect(_maximizeButton, SIGNAL( clicked()), this, SLOT(showMaxRestore()));
|
||||
}
|
||||
|
||||
if (_isTop || _hasClose) {
|
||||
_closeButton= new QToolButton(this);
|
||||
_closeButton->setObjectName("CloseButton");
|
||||
_lay->addWidget(_closeButton);
|
||||
connect(_closeButton, SIGNAL( clicked() ), parent, SLOT(close() ) );
|
||||
connect(_closeButton, SIGNAL( clicked()), parent, SLOT(close()));
|
||||
}
|
||||
|
||||
_lay->insertStretch(0, 500);
|
||||
@ -160,7 +160,7 @@ void TitleBar::setTitle(QString title)
|
||||
_title->setText(title);
|
||||
}
|
||||
|
||||
QString TitleBar::title() const
|
||||
QString TitleBar::title()
|
||||
{
|
||||
return _title->text();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
~TitleBar();
|
||||
|
||||
void setTitle(QString title);
|
||||
QString title() const;
|
||||
QString title();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
|
@ -47,8 +47,7 @@ const QColor AnalogSignal::SignalColours[4] = {
|
||||
|
||||
const float AnalogSignal::EnvelopeThreshold = 16.0f;
|
||||
|
||||
AnalogSignal::AnalogSignal(DevInst *dev_inst,
|
||||
boost::shared_ptr<data::Analog> data,
|
||||
AnalogSignal::AnalogSignal(DevInst *dev_inst,data::Analog *data,
|
||||
sr_channel *probe) :
|
||||
Signal(dev_inst, probe),
|
||||
_data(data),
|
||||
@ -96,10 +95,8 @@ AnalogSignal::AnalogSignal(DevInst *dev_inst,
|
||||
}
|
||||
}
|
||||
|
||||
AnalogSignal::AnalogSignal(boost::shared_ptr<view::AnalogSignal> s,
|
||||
boost::shared_ptr<pv::data::Analog> data,
|
||||
sr_channel *probe) :
|
||||
Signal(*s.get(), probe),
|
||||
AnalogSignal::AnalogSignal(view::AnalogSignal *s, pv::data::Analog *data, sr_channel *probe) :
|
||||
Signal(*s, probe),
|
||||
_data(data),
|
||||
_rects(NULL),
|
||||
_hover_en(false),
|
||||
@ -124,7 +121,7 @@ AnalogSignal::~AnalogSignal()
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<pv::data::SignalData> AnalogSignal::data() const
|
||||
pv::data::SignalData* AnalogSignal::data()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
@ -134,27 +131,27 @@ void AnalogSignal::set_scale(int height)
|
||||
_scale = height / (_ref_max - _ref_min);
|
||||
}
|
||||
|
||||
float AnalogSignal::get_scale() const
|
||||
float AnalogSignal::get_scale()
|
||||
{
|
||||
return _scale;
|
||||
}
|
||||
|
||||
int AnalogSignal::get_bits() const
|
||||
int AnalogSignal::get_bits()
|
||||
{
|
||||
return _bits;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_ref_min() const
|
||||
double AnalogSignal::get_ref_min()
|
||||
{
|
||||
return _ref_min;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_ref_max() const
|
||||
double AnalogSignal::get_ref_max()
|
||||
{
|
||||
return _ref_max;
|
||||
}
|
||||
|
||||
int AnalogSignal::get_hw_offset() const
|
||||
int AnalogSignal::get_hw_offset()
|
||||
{
|
||||
int hw_offset = 0;
|
||||
GVariant *gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_HW_OFFSET);
|
||||
@ -205,13 +202,11 @@ bool AnalogSignal::measure(const QPointF &p)
|
||||
if (!window.contains(p))
|
||||
return false;
|
||||
|
||||
const deque< boost::shared_ptr<pv::data::AnalogSnapshot> > &snapshots =
|
||||
_data->get_snapshots();
|
||||
const auto &snapshots = _data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return false;
|
||||
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot =
|
||||
snapshots.front();
|
||||
const auto snapshot = snapshots.front();
|
||||
if (snapshot->empty())
|
||||
return false;
|
||||
|
||||
@ -248,13 +243,11 @@ QPointF AnalogSignal::get_point(uint64_t index, float &value)
|
||||
if (!enabled())
|
||||
return pt;
|
||||
|
||||
const deque< boost::shared_ptr<pv::data::AnalogSnapshot> > &snapshots =
|
||||
_data->get_snapshots();
|
||||
const auto &snapshots = _data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return pt;
|
||||
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot =
|
||||
snapshots.front();
|
||||
const auto snapshot = snapshots.front();
|
||||
if (snapshot->empty())
|
||||
return pt;
|
||||
|
||||
@ -288,7 +281,7 @@ QPointF AnalogSignal::get_point(uint64_t index, float &value)
|
||||
/**
|
||||
* Probe options
|
||||
**/
|
||||
uint64_t AnalogSignal::get_vdiv() const
|
||||
uint64_t AnalogSignal::get_vdiv()
|
||||
{
|
||||
uint64_t vdiv = 0;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_VDIV);
|
||||
@ -299,7 +292,7 @@ uint64_t AnalogSignal::get_vdiv() const
|
||||
return vdiv;
|
||||
}
|
||||
|
||||
uint8_t AnalogSignal::get_acCoupling() const
|
||||
uint8_t AnalogSignal::get_acCoupling()
|
||||
{
|
||||
uint64_t coupling = 0;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_COUPLING);
|
||||
@ -310,7 +303,7 @@ uint8_t AnalogSignal::get_acCoupling() const
|
||||
return coupling;
|
||||
}
|
||||
|
||||
bool AnalogSignal::get_mapDefault() const
|
||||
bool AnalogSignal::get_mapDefault()
|
||||
{
|
||||
bool isDefault = true;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_DEFAULT);
|
||||
@ -321,7 +314,7 @@ bool AnalogSignal::get_mapDefault() const
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
QString AnalogSignal::get_mapUnit() const
|
||||
QString AnalogSignal::get_mapUnit()
|
||||
{
|
||||
QString unit;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_UNIT);
|
||||
@ -332,7 +325,7 @@ QString AnalogSignal::get_mapUnit() const
|
||||
return unit;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_mapMin() const
|
||||
double AnalogSignal::get_mapMin()
|
||||
{
|
||||
double min = -1;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MIN);
|
||||
@ -343,7 +336,7 @@ double AnalogSignal::get_mapMin() const
|
||||
return min;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_mapMax() const
|
||||
double AnalogSignal::get_mapMax()
|
||||
{
|
||||
double max = 1;
|
||||
GVariant* gvar = _dev_inst->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MAX);
|
||||
@ -354,7 +347,7 @@ double AnalogSignal::get_mapMax() const
|
||||
return max;
|
||||
}
|
||||
|
||||
uint64_t AnalogSignal::get_factor() const
|
||||
uint64_t AnalogSignal::get_factor()
|
||||
{
|
||||
GVariant* gvar;
|
||||
uint64_t factor;
|
||||
@ -369,24 +362,24 @@ uint64_t AnalogSignal::get_factor() const
|
||||
}
|
||||
}
|
||||
|
||||
int AnalogSignal::ratio2value(double ratio) const
|
||||
int AnalogSignal::ratio2value(double ratio)
|
||||
{
|
||||
return ratio * (_ref_max - _ref_min) + _ref_min;
|
||||
}
|
||||
|
||||
int AnalogSignal::ratio2pos(double ratio) const
|
||||
int AnalogSignal::ratio2pos(double ratio)
|
||||
{
|
||||
const int height = get_totalHeight();
|
||||
const int top = get_y() - height * 0.5;
|
||||
return ratio * height + top;
|
||||
}
|
||||
|
||||
double AnalogSignal::value2ratio(int value) const
|
||||
double AnalogSignal::value2ratio(int value)
|
||||
{
|
||||
return max(0.0, (value - _ref_min) / (_ref_max - _ref_min));
|
||||
}
|
||||
|
||||
double AnalogSignal::pos2ratio(int pos) const
|
||||
double AnalogSignal::pos2ratio(int pos)
|
||||
{
|
||||
const int height = get_totalHeight();
|
||||
const int top = get_y() - height / 2;
|
||||
@ -403,7 +396,7 @@ void AnalogSignal::set_zero_vpos(int pos)
|
||||
}
|
||||
}
|
||||
|
||||
int AnalogSignal::get_zero_vpos() const
|
||||
int AnalogSignal::get_zero_vpos()
|
||||
{
|
||||
return ratio2pos(get_zero_ratio());
|
||||
}
|
||||
@ -418,12 +411,12 @@ void AnalogSignal::set_zero_ratio(double ratio)
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
}
|
||||
|
||||
double AnalogSignal::get_zero_ratio() const
|
||||
double AnalogSignal::get_zero_ratio()
|
||||
{
|
||||
return value2ratio(_zero_offset);
|
||||
}
|
||||
|
||||
int AnalogSignal::get_zero_offset() const
|
||||
int AnalogSignal::get_zero_offset()
|
||||
{
|
||||
return _zero_offset;
|
||||
}
|
||||
@ -510,13 +503,11 @@ void AnalogSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QCol
|
||||
assert(scale > 0);
|
||||
const int64_t offset = _view->offset();
|
||||
|
||||
const deque< boost::shared_ptr<pv::data::AnalogSnapshot> > &snapshots =
|
||||
_data->get_snapshots();
|
||||
const auto &snapshots = _data->get_snapshots();
|
||||
if (snapshots.empty())
|
||||
return;
|
||||
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot =
|
||||
snapshots.front();
|
||||
const auto snapshot = snapshots.front();
|
||||
if (snapshot->empty())
|
||||
return;
|
||||
|
||||
@ -571,7 +562,7 @@ void AnalogSignal::paint_fore(QPainter &p, int left, int right, QColor fore, QCo
|
||||
}
|
||||
|
||||
void AnalogSignal::paint_trace(QPainter &p,
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot,
|
||||
const pv::data::AnalogSnapshot *snapshot,
|
||||
int zeroY, const int start_pixel,
|
||||
const uint64_t start_index, const int64_t sample_count,
|
||||
const double samples_per_pixel, const int order,
|
||||
@ -579,10 +570,12 @@ void AnalogSignal::paint_trace(QPainter &p,
|
||||
{
|
||||
(void)width;
|
||||
|
||||
const int64_t channel_num = snapshot->get_channel_num();
|
||||
pv::data::AnalogSnapshot *pshot = const_cast<pv::data::AnalogSnapshot*>(snapshot);
|
||||
|
||||
int64_t channel_num = (int64_t)pshot->get_channel_num();
|
||||
if (sample_count > 0) {
|
||||
const uint8_t unit_bytes = snapshot->get_unit_bytes();
|
||||
const uint8_t *const samples = snapshot->get_samples(0);
|
||||
const uint8_t unit_bytes = pshot->get_unit_bytes();
|
||||
const uint8_t *const samples = pshot->get_samples(0);
|
||||
assert(samples);
|
||||
|
||||
p.setPen(_colour);
|
||||
@ -603,10 +596,10 @@ void AnalogSignal::paint_trace(QPainter &p,
|
||||
yvalue = zeroY + (yvalue - hw_offset) * _scale;
|
||||
yvalue = min(max(yvalue, top), bottom);
|
||||
*point++ = QPointF(x, yvalue);
|
||||
if (yindex == snapshot->get_ring_end())
|
||||
if (yindex == pshot->get_ring_end())
|
||||
break;
|
||||
yindex++;
|
||||
yindex %= snapshot->get_sample_count();
|
||||
yindex %= pshot->get_sample_count();
|
||||
x += pixels_per_sample;
|
||||
}
|
||||
p.drawPolyline(points, point - points);
|
||||
@ -615,7 +608,7 @@ void AnalogSignal::paint_trace(QPainter &p,
|
||||
}
|
||||
|
||||
void AnalogSignal::paint_envelope(QPainter &p,
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot,
|
||||
const pv::data::AnalogSnapshot *snapshot,
|
||||
int zeroY, const int start_pixel,
|
||||
const uint64_t start_index, const int64_t sample_count,
|
||||
const double samples_per_pixel, const int order,
|
||||
@ -623,9 +616,10 @@ void AnalogSignal::paint_envelope(QPainter &p,
|
||||
{
|
||||
using namespace Qt;
|
||||
using pv::data::AnalogSnapshot;
|
||||
pv::data::AnalogSnapshot *pshot = const_cast<pv::data::AnalogSnapshot*>(snapshot);
|
||||
|
||||
AnalogSnapshot::EnvelopeSection e;
|
||||
snapshot->get_envelope_section(e, start_index, sample_count,
|
||||
pshot->get_envelope_section(e, start_index, sample_count,
|
||||
samples_per_pixel, order);
|
||||
if (e.samples_num == 0)
|
||||
return;
|
||||
@ -640,7 +634,8 @@ void AnalogSignal::paint_envelope(QPainter &p,
|
||||
float y_min = zeroY, y_max = zeroY, pre_y_min = zeroY, pre_y_max = zeroY;
|
||||
int pcnt = 0;
|
||||
const double scale_pixels_per_samples = e.scale / samples_per_pixel;
|
||||
const uint64_t ring_end = max((int64_t)0, (int64_t)snapshot->get_ring_end() / e.scale - 1);
|
||||
int64_t end_v = pshot->get_ring_end();
|
||||
const uint64_t ring_end = max((int64_t)0, end_v / e.scale - 1);
|
||||
const int hw_offset = get_hw_offset();
|
||||
|
||||
float x = start_pixel;
|
||||
@ -717,7 +712,7 @@ void AnalogSignal::paint_hover_measure(QPainter &p, QColor fore, QColor back)
|
||||
p.drawText(hover_rect, Qt::AlignCenter | Qt::AlignTop | Qt::TextDontClip, hover_str);
|
||||
}
|
||||
|
||||
list<Cursor*>::iterator i = _view->get_cursorList().begin();
|
||||
auto i = _view->get_cursorList().begin();
|
||||
while (i != _view->get_cursorList().end()) {
|
||||
float pt_value;
|
||||
const QPointF pt = get_point((*i)->index(), pt_value);
|
||||
|
@ -24,8 +24,7 @@
|
||||
#define DSVIEW_PV_ANALOGSIGNAL_H
|
||||
|
||||
#include "signal.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
namespace pv {
|
||||
|
||||
@ -53,23 +52,21 @@ private:
|
||||
static const uint8_t DefaultBits = 8;
|
||||
|
||||
public:
|
||||
AnalogSignal(DevInst* dev_inst,
|
||||
boost::shared_ptr<pv::data::Analog> data,
|
||||
sr_channel *probe);
|
||||
AnalogSignal(boost::shared_ptr<view::AnalogSignal> s,
|
||||
boost::shared_ptr<pv::data::Analog> data,
|
||||
AnalogSignal(DevInst* dev_inst, pv::data::Analog *data,
|
||||
sr_channel *probe);
|
||||
|
||||
AnalogSignal(view::AnalogSignal* s, pv::data::Analog *data, sr_channel *probe);
|
||||
|
||||
virtual ~AnalogSignal();
|
||||
|
||||
boost::shared_ptr<pv::data::SignalData> data() const;
|
||||
pv::data::SignalData* data();
|
||||
|
||||
void set_scale(int height);
|
||||
float get_scale() const;
|
||||
int get_bits() const;
|
||||
double get_ref_min() const;
|
||||
double get_ref_max() const;
|
||||
int get_hw_offset() const;
|
||||
float get_scale();
|
||||
int get_bits();
|
||||
double get_ref_min();
|
||||
double get_ref_max();
|
||||
int get_hw_offset();
|
||||
int commit_settings();
|
||||
|
||||
/**
|
||||
@ -83,30 +80,30 @@ public:
|
||||
/**
|
||||
* Probe options
|
||||
**/
|
||||
uint64_t get_vdiv() const;
|
||||
uint8_t get_acCoupling() const;
|
||||
bool get_mapDefault() const;
|
||||
QString get_mapUnit() const;
|
||||
double get_mapMin() const;
|
||||
double get_mapMax() const;
|
||||
uint64_t get_factor() const;
|
||||
uint64_t get_vdiv();
|
||||
uint8_t get_acCoupling();
|
||||
bool get_mapDefault();
|
||||
QString get_mapUnit();
|
||||
double get_mapMin();
|
||||
double get_mapMax();
|
||||
uint64_t get_factor();
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
void set_zero_vpos(int pos);
|
||||
int get_zero_vpos() const;
|
||||
int get_zero_vpos();
|
||||
void set_zero_ratio(double ratio);
|
||||
double get_zero_ratio() const;
|
||||
int get_zero_offset() const;
|
||||
double get_zero_ratio();
|
||||
int get_zero_offset();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
int ratio2value(double ratio) const;
|
||||
int ratio2pos(double ratio) const;
|
||||
double value2ratio(int value) const;
|
||||
double pos2ratio(int pos) const;
|
||||
int ratio2value(double ratio);
|
||||
int ratio2pos(double ratio);
|
||||
double value2ratio(int value);
|
||||
double pos2ratio(int pos);
|
||||
|
||||
/**
|
||||
* Event
|
||||
@ -139,14 +136,14 @@ public:
|
||||
|
||||
private:
|
||||
void paint_trace(QPainter &p,
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot,
|
||||
const pv::data::AnalogSnapshot *snapshot,
|
||||
int zeroY, const int start_pixel,
|
||||
const uint64_t start_index, const int64_t sample_count,
|
||||
const double samples_per_pixel, const int order,
|
||||
const float top, const float bottom, const int width);
|
||||
|
||||
void paint_envelope(QPainter &p,
|
||||
const boost::shared_ptr<pv::data::AnalogSnapshot> &snapshot,
|
||||
const pv::data::AnalogSnapshot *snapshot,
|
||||
int zeroY, const int start_pixel,
|
||||
const uint64_t start_index, const int64_t sample_count,
|
||||
const double samples_per_pixel, const int order,
|
||||
@ -155,7 +152,7 @@ private:
|
||||
void paint_hover_measure(QPainter &p, QColor fore, QColor back);
|
||||
|
||||
private:
|
||||
boost::shared_ptr<pv::data::Analog> _data;
|
||||
pv::data::Analog *_data;
|
||||
|
||||
QRectF *_rects;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user