PulseView
unreleased development snapshot
A Qt-based sigrok GUI
|
#include <signalbase.hpp>
Public Types | |
enum | ChannelType { AnalogChannel = 1, LogicChannel, DecodeChannel, MathChannel } |
enum | ConversionType { NoConversion = 0, A2LConversionByThreshold = 1, A2LConversionBySchmittTrigger = 2 } |
enum | ConversionPreset { NoPreset = -1, DynamicPreset = 0 } |
Signals | |
void | enabled_changed (const bool &value) |
void | name_changed (const QString &name) |
void | color_changed (const QColor &color) |
void | error_message_changed (QString msg) |
void | conversion_type_changed (const ConversionType t) |
void | samples_cleared () |
void | samples_added (uint64_t segment_id, uint64_t start_sample, uint64_t end_sample) |
void | min_max_changed (float min, float max) |
Public Member Functions | |
SignalBase (shared_ptr< sigrok::Channel > channel, ChannelType channel_type) | |
virtual | ~SignalBase () |
shared_ptr< sigrok::Channel > | channel () const |
bool | is_generated () const |
bool | enabled () const |
void | set_enabled (bool value) |
ChannelType | type () const |
unsigned int | index () const |
void | set_index (unsigned int index) |
unsigned int | logic_bit_index () const |
void | set_group (SignalGroup *group) |
SignalGroup * | group () const |
QString | name () const |
QString | internal_name () const |
void | set_internal_name (QString internal_name) |
QString | display_name () const |
virtual void | set_name (QString name) |
QColor | color () const |
virtual void | set_color (QColor color) |
QColor | bgcolor () const |
virtual QString | get_error_message () const |
void | set_data (shared_ptr< pv::data::SignalData > data) |
void | clear_sample_data () |
shared_ptr< pv::data::Analog > | analog_data () const |
shared_ptr< pv::data::Logic > | logic_data () const |
shared_ptr< pv::data::SignalData > | data () const |
bool | segment_is_complete (uint32_t segment_id) const |
bool | has_samples () const |
virtual double | get_samplerate () const |
ConversionType | get_conversion_type () const |
void | set_conversion_type (ConversionType t) |
map< QString, QVariant > | get_conversion_options () const |
bool | set_conversion_option (QString key, QVariant value) |
vector< double > | get_conversion_thresholds (const ConversionType t=NoConversion, const bool always_custom=false) const |
vector< pair< QString, int > > | get_conversion_presets () const |
ConversionPreset | get_current_conversion_preset () const |
void | set_conversion_preset (ConversionPreset id) |
virtual void | save_settings (QSettings &settings) const |
virtual void | restore_settings (QSettings &settings) |
void | start_conversion (bool delayed_start=false) |
Static Public Attributes | |
static const QColor | AnalogSignalColors [8] |
static const QColor | LogicSignalColors [10] |
Protected Member Functions | |
virtual void | set_error_message (QString msg) |
Protected Attributes | |
shared_ptr< sigrok::Channel > | channel_ |
ChannelType | channel_type_ |
SignalGroup * | group_ |
shared_ptr< pv::data::SignalData > | data_ |
shared_ptr< pv::data::SignalData > | converted_data_ |
ConversionType | conversion_type_ |
map< QString, QVariant > | conversion_options_ |
float | min_value_ |
float | max_value_ |
std::thread | conversion_thread_ |
atomic< bool > | conversion_interrupt_ |
mutex | conversion_input_mutex_ |
condition_variable | conversion_input_cond_ |
QTimer | delayed_conversion_starter_ |
QString | internal_name_ |
QString | name_ |
QColor | color_ |
QColor | bgcolor_ |
unsigned int | index_ |
QString | error_message_ |
Properties | |
QString | error_message |
Private Slots | |
void | on_samples_cleared () |
void | on_samples_added (SharedPtrToSegment segment, uint64_t start_sample, uint64_t end_sample) |
void | on_input_segment_completed () |
void | on_min_max_changed (float min, float max) |
void | on_capture_state_changed (int state) |
void | on_delayed_conversion_start () |
Private Member Functions | |
void | stop_conversion () |
bool | conversion_is_a2l () const |
uint8_t | convert_a2l_threshold (float threshold, float value) |
uint8_t | convert_a2l_schmitt_trigger (float lo_thr, float hi_thr, float value, uint8_t &state) |
void | convert_single_segment_range (shared_ptr< AnalogSegment > asegment, shared_ptr< LogicSegment > lsegment, uint64_t start_sample, uint64_t end_sample) |
void | convert_single_segment (shared_ptr< AnalogSegment > asegment, shared_ptr< LogicSegment > lsegment) |
void | conversion_thread_proc () |
Static Private Attributes | |
static const int | ColorBGAlpha = 8 * 256 / 100 |
static const uint64_t | ConversionBlockSize = 4096 |
static const uint32_t | ConversionDelay = 1000 |
Definition at line 87 of file signalbase.hpp.
Enumerator | |
---|---|
AnalogChannel |
Analog data. |
LogicChannel |
Logic data. |
DecodeChannel |
Protocol Decoder channel using libsigrokdecode. |
MathChannel |
Virtual channel generated by math operations. |
Definition at line 93 of file signalbase.hpp.
Conversion presets range from -1 to n, where 1..n are dependent on the conversion these presets apply to. -1 and 0 have fixed meanings, however.
Enumerator | |
---|---|
NoPreset |
Conversion uses custom values. |
DynamicPreset |
Conversion uses calculated values. |
Definition at line 111 of file signalbase.hpp.
Enumerator | |
---|---|
NoConversion | |
A2LConversionByThreshold | |
A2LConversionBySchmittTrigger |
Definition at line 100 of file signalbase.hpp.
pv::data::SignalBase::SignalBase | ( | shared_ptr< sigrok::Channel > | channel, |
ChannelType | channel_type | ||
) |
|
virtual |
shared_ptr< data::Analog > pv::data::SignalBase::analog_data | ( | ) | const |
Get the internal data as analog data object in case of analog type.
Definition at line 309 of file signalbase.cpp.
QColor pv::data::SignalBase::bgcolor | ( | ) | const |
Get the background color of the signal.
Definition at line 261 of file signalbase.cpp.
shared_ptr< sigrok::Channel > pv::data::SignalBase::channel | ( | ) | const |
Returns the underlying SR channel. Generated channels don't have a SR channel.
Definition at line 153 of file signalbase.cpp.
void pv::data::SignalBase::clear_sample_data | ( | ) |
Clears all sample data and removes all associated segments.
Definition at line 300 of file signalbase.cpp.
QColor pv::data::SignalBase::color | ( | ) | const |
Get the color of the signal.
Definition at line 246 of file signalbase.cpp.
|
signal |
|
private |
|
private |
Definition at line 771 of file signalbase.cpp.
|
signal |
|
private |
|
private |
|
private |
Definition at line 735 of file signalbase.cpp.
|
private |
Definition at line 632 of file signalbase.cpp.
shared_ptr< pv::data::SignalData > pv::data::SignalBase::data | ( | ) | const |
Get the primary internal data object, i.e. the data that was acquired from the device.
Definition at line 333 of file signalbase.cpp.
QString pv::data::SignalBase::display_name | ( | ) | const |
Produces a string for this signal that can be used for display, i.e. it contains one or both of the signal/internal names.
Definition at line 228 of file signalbase.cpp.
bool pv::data::SignalBase::enabled | ( | ) | const |
Returns enabled status of this channel.
Definition at line 164 of file signalbase.cpp.
|
signal |
|
signal |
map< QString, QVariant > pv::data::SignalBase::get_conversion_options | ( | ) | const |
Returns all currently known conversion options
Definition at line 433 of file signalbase.cpp.
vector< pair< QString, int > > pv::data::SignalBase::get_conversion_presets | ( | ) | const |
Provides all conversion presets available for the currently active conversion.
Definition at line 519 of file signalbase.cpp.
vector< double > pv::data::SignalBase::get_conversion_thresholds | ( | const ConversionType | t = NoConversion , |
const bool | always_custom = false |
||
) | const |
Returns the threshold(s) used for conversions, if applicable. The resulting thresholds are given for the chosen conversion, so you can query thresholds also for conversions which aren't currently active.
If you want the thresholds for the currently active conversion, call it either with NoConversion or no parameter.
t | the type of conversion to obtain the thresholds for, leave empty or use NoConversion if you want to query the currently used conversion |
always_custom | ignore the currently selected preset and always return the custom values for this conversion, using 0 if those aren't set |
Definition at line 451 of file signalbase.cpp.
SignalBase::ConversionType pv::data::SignalBase::get_conversion_type | ( | ) | const |
Queries the kind of conversion performed on this channel.
Definition at line 404 of file signalbase.cpp.
SignalBase::ConversionPreset pv::data::SignalBase::get_current_conversion_preset | ( | ) | const |
Determines the ID of the currently used conversion preset, which is only valid for the currently available conversion presets. It is therefore suggested to call get_conversion_presets right before calling this.
Definition at line 544 of file signalbase.cpp.
|
virtual |
Returns the current error message text.
Definition at line 266 of file signalbase.cpp.
|
virtual |
Returns the sample rate for this signal.
Reimplemented in pv::data::DecodeSignal.
Definition at line 389 of file signalbase.cpp.
SignalGroup * pv::data::SignalBase::group | ( | ) | const |
Returns the signal group this signal belongs to or nullptr if none
Definition at line 205 of file signalbase.cpp.
bool pv::data::SignalBase::has_samples | ( | ) | const |
Determines whether this signal has any sample data at all.
Definition at line 367 of file signalbase.cpp.
unsigned int pv::data::SignalBase::index | ( | ) | const |
Gets the index number of this channel, i.e. a unique ID assigned by the device driver.
Definition at line 182 of file signalbase.cpp.
QString pv::data::SignalBase::internal_name | ( | ) | const |
Gets the internal name of this signal, i.e. how the device/generator calls it.
Definition at line 215 of file signalbase.cpp.
bool pv::data::SignalBase::is_generated | ( | ) | const |
Returns whether this channel is generated or a channel associated with the device.
Definition at line 158 of file signalbase.cpp.
unsigned int pv::data::SignalBase::logic_bit_index | ( | ) | const |
Returns which bit of a given sample for this signal represents the signal itself. This is relevant for compound signals like logic, rather meaningless for everything else but provided in case there is a conversion active that provides a digital signal using bit #0.
Definition at line 192 of file signalbase.cpp.
shared_ptr< data::Logic > pv::data::SignalBase::logic_data | ( | ) | const |
Get the internal data as logic data object in case of logic type.
Definition at line 317 of file signalbase.cpp.
|
signal |
QString pv::data::SignalBase::name | ( | ) | const |
Gets the name of this signal.
Definition at line 210 of file signalbase.cpp.
|
signal |
|
privateslot |
|
privateslot |
Definition at line 938 of file signalbase.cpp.
|
privateslot |
|
privateslot |
Definition at line 919 of file signalbase.cpp.
|
privateslot |
Definition at line 893 of file signalbase.cpp.
|
privateslot |
|
virtual |
Reimplemented in pv::data::DecodeSignal, and pv::data::MathSignal.
Definition at line 581 of file signalbase.cpp.
|
signal |
|
signal |
|
virtual |
Reimplemented in pv::data::DecodeSignal, and pv::data::MathSignal.
Definition at line 565 of file signalbase.cpp.
bool pv::data::SignalBase::segment_is_complete | ( | uint32_t | segment_id | ) | const |
Determines whether a given segment is complete (i.e. end-of-frame has been seen). It only considers the original data, not the converted data.
Definition at line 338 of file signalbase.cpp.
|
virtual |
Set the color of the signal.
Reimplemented in pv::data::DecodeSignal.
Definition at line 251 of file signalbase.cpp.
bool pv::data::SignalBase::set_conversion_option | ( | QString | key, |
QVariant | value | ||
) |
Sets the value of a particular conversion option Note: it is not checked whether the option is valid for the currently conversion. If it's not, it will be silently ignored.
Does not restart the conversion.
Definition at line 438 of file signalbase.cpp.
void pv::data::SignalBase::set_conversion_preset | ( | ConversionPreset | id | ) |
Sets the conversion preset to be used.
Does not restart the conversion.
id | the id of the preset to use |
Definition at line 553 of file signalbase.cpp.
void pv::data::SignalBase::set_conversion_type | ( | ConversionType | t | ) |
Changes the kind of conversion performed on this channel.
Restarts the conversion.
Definition at line 409 of file signalbase.cpp.
void pv::data::SignalBase::set_data | ( | shared_ptr< pv::data::SignalData > | data | ) |
Sets the internal data object.
Definition at line 271 of file signalbase.cpp.
void pv::data::SignalBase::set_enabled | ( | bool | value | ) |
Sets the enabled status of this channel.
value | Boolean value to set. |
Definition at line 169 of file signalbase.cpp.
|
protectedvirtual |
Definition at line 867 of file signalbase.cpp.
void pv::data::SignalBase::set_group | ( | SignalGroup * | group | ) |
Sets the signal group this signal belongs to
Definition at line 200 of file signalbase.cpp.
void pv::data::SignalBase::set_index | ( | unsigned int | index | ) |
Sets the index number of this channel, i.e. a unique ID assigned by the device driver or the logic bit index (see below). Only use immediately after creating the signal and leave it untouched after.
Definition at line 187 of file signalbase.cpp.
void pv::data::SignalBase::set_internal_name | ( | QString | internal_name | ) |
Sets the internal name of this signal, i.e. how the device/generator calls it. Only use immediately after creating the signal and leave it untouched after.
Definition at line 220 of file signalbase.cpp.
|
virtual |
Sets the name of the signal.
Reimplemented in pv::data::DecodeSignal.
Definition at line 236 of file signalbase.cpp.
void pv::data::SignalBase::start_conversion | ( | bool | delayed_start = false | ) |
Definition at line 849 of file signalbase.cpp.
|
private |
SignalBase::ChannelType pv::data::SignalBase::type | ( | ) | const |
Gets the type of this channel.
Definition at line 177 of file signalbase.cpp.
|
static |
Definition at line 116 of file signalbase.hpp.
|
protected |
Definition at line 423 of file signalbase.hpp.
|
protected |
Definition at line 406 of file signalbase.hpp.
|
protected |
Definition at line 407 of file signalbase.hpp.
|
protected |
Definition at line 423 of file signalbase.hpp.
|
staticprivate |
Definition at line 120 of file signalbase.hpp.
|
protected |
Definition at line 419 of file signalbase.hpp.
|
protected |
Definition at line 418 of file signalbase.hpp.
|
protected |
Definition at line 417 of file signalbase.hpp.
|
protected |
Definition at line 412 of file signalbase.hpp.
|
protected |
Definition at line 416 of file signalbase.hpp.
|
protected |
Definition at line 411 of file signalbase.hpp.
|
staticprivate |
Definition at line 121 of file signalbase.hpp.
|
staticprivate |
Definition at line 122 of file signalbase.hpp.
|
protected |
Definition at line 410 of file signalbase.hpp.
|
protected |
Definition at line 409 of file signalbase.hpp.
|
protected |
Definition at line 420 of file signalbase.hpp.
|
protected |
Definition at line 426 of file signalbase.hpp.
|
protected |
Definition at line 408 of file signalbase.hpp.
|
protected |
Definition at line 424 of file signalbase.hpp.
|
protected |
Definition at line 422 of file signalbase.hpp.
|
static |
Definition at line 117 of file signalbase.hpp.
|
protected |
Definition at line 414 of file signalbase.hpp.
|
protected |
Definition at line 414 of file signalbase.hpp.
|
protected |
Definition at line 422 of file signalbase.hpp.
|
read |
Definition at line 90 of file signalbase.hpp.