Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
dsview
Commits
c86154b4
Commit
c86154b4
authored
Apr 19, 2015
by
Diego F. Asanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding support for export data into multiple formats
parent
d83c08a0
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1547 additions
and
1141 deletions
+1547
-1141
DSView/CMakeLists.txt
DSView/CMakeLists.txt
+1
-1
DSView/pv/dialogs/deviceoptions.cpp
DSView/pv/dialogs/deviceoptions.cpp
+1
-1
DSView/pv/dialogs/streamoptions.cpp
DSView/pv/dialogs/streamoptions.cpp
+1
-1
DSView/pv/dialogs/waitingdialog.cpp
DSView/pv/dialogs/waitingdialog.cpp
+1
-1
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+8
-9
DSView/pv/sigsession.h
DSView/pv/sigsession.h
+1
-1
DSView/pv/view/analogsignal.cpp
DSView/pv/view/analogsignal.cpp
+2
-2
DSView/pv/view/devmode.cpp
DSView/pv/view/devmode.cpp
+3
-3
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+7
-7
DSView/pv/view/groupsignal.cpp
DSView/pv/view/groupsignal.cpp
+1
-1
DSView/pv/view/header.cpp
DSView/pv/view/header.cpp
+13
-13
DSView/pv/view/logicsignal.cpp
DSView/pv/view/logicsignal.cpp
+2
-2
DSView/pv/view/view.cpp
DSView/pv/view/view.cpp
+22
-22
DSView/pv/view/view.h
DSView/pv/view/view.h
+1
-1
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+11
-11
DSView/pv/view/viewport.h
DSView/pv/view/viewport.h
+1
-1
libsigrok4DSL/backend.c
libsigrok4DSL/backend.c
+5
-5
libsigrok4DSL/configure.ac
libsigrok4DSL/configure.ac
+0
-1
libsigrok4DSL/libsigrok.h
libsigrok4DSL/libsigrok.h
+50
-82
libsigrok4DSL/output/Makefile.am
libsigrok4DSL/output/Makefile.am
+7
-9
libsigrok4DSL/output/csv.c
libsigrok4DSL/output/csv.c
+225
-0
libsigrok4DSL/output/gnuplot.c
libsigrok4DSL/output/gnuplot.c
+229
-0
libsigrok4DSL/output/out_analog.c
libsigrok4DSL/output/out_analog.c
+0
-251
libsigrok4DSL/output/out_binary.c
libsigrok4DSL/output/out_binary.c
+0
-77
libsigrok4DSL/output/output.c
libsigrok4DSL/output/output.c
+293
-30
libsigrok4DSL/output/srzip.c
libsigrok4DSL/output/srzip.c
+321
-0
libsigrok4DSL/output/text/Makefile.am
libsigrok4DSL/output/text/Makefile.am
+0
-33
libsigrok4DSL/output/text/ascii.c
libsigrok4DSL/output/text/ascii.c
+0
-136
libsigrok4DSL/output/text/bits.c
libsigrok4DSL/output/text/bits.c
+0
-119
libsigrok4DSL/output/text/hex.c
libsigrok4DSL/output/text/hex.c
+0
-112
libsigrok4DSL/output/text/text.c
libsigrok4DSL/output/text/text.c
+0
-208
libsigrok4DSL/output/vcd.c
libsigrok4DSL/output/vcd.c
+271
-0
libsigrok4DSL/proto.h
libsigrok4DSL/proto.h
+1
-1
libsigrok4DSL/version.h
libsigrok4DSL/version.h
+69
-0
No files found.
DSView/CMakeLists.txt
View file @
c86154b4
...
...
@@ -270,7 +270,7 @@ endif()
#-------------------------------------------------------------------------------
add_definitions
(
${
QT_DEFINITIONS
}
)
add_definitions
(
-Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers
)
add_definitions
(
-
std=c++11 -
Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers
)
if
(
ENABLE_DECODE
)
add_definitions
(
-DENABLE_DECODE
)
...
...
DSView/pv/dialogs/deviceoptions.cpp
View file @
c86154b4
...
...
@@ -37,7 +37,7 @@ using namespace std;
namespace
pv
{
namespace
dialogs
{
DeviceOptions
::
DeviceOptions
(
QWidget
*
parent
,
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
)
:
DeviceOptions
::
DeviceOptions
(
QWidget
*
parent
,
boost
::
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
)
:
QDialog
(
parent
),
_dev_inst
(
dev_inst
),
_layout
(
this
),
...
...
DSView/pv/dialogs/streamoptions.cpp
View file @
c86154b4
...
...
@@ -37,7 +37,7 @@ using namespace std;
namespace
pv
{
namespace
dialogs
{
StreamOptions
::
StreamOptions
(
QWidget
*
parent
,
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
,
StreamOptions
::
StreamOptions
(
QWidget
*
parent
,
boost
::
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
,
uint64_t
sample_count
,
bool
stream
)
:
QDialog
(
parent
),
_dev_inst
(
dev_inst
),
...
...
DSView/pv/dialogs/waitingdialog.cpp
View file @
c86154b4
...
...
@@ -39,7 +39,7 @@ namespace dialogs {
const
QString
WaitingDialog
::
TIPS_INFO
=
"Waiting"
;
WaitingDialog
::
WaitingDialog
(
QWidget
*
parent
,
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
)
:
WaitingDialog
::
WaitingDialog
(
QWidget
*
parent
,
boost
::
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
)
:
QDialog
(
parent
),
_dev_inst
(
dev_inst
),
_button_box
(
QDialogButtonBox
::
Save
|
QDialogButtonBox
::
Abort
,
...
...
DSView/pv/sigsession.cpp
View file @
c86154b4
...
...
@@ -183,10 +183,9 @@ void SigSession::save_file(const std::string &name){
}
QList
<
QString
>
SigSession
::
getSuportedExportFormats
(){
// TODO: uncomment this
//const struct sr_output_module** supportedModules = sr_output_list();
const
struct
sr_output_module
**
supportedModules
=
sr_output_list
();
QList
<
QString
>
list
;
/*
while(*supportedModules){
while
(
*
supportedModules
){
if
(
*
supportedModules
==
NULL
)
break
;
QString
format
((
*
supportedModules
)
->
desc
);
...
...
@@ -195,7 +194,7 @@ QList<QString> SigSession::getSuportedExportFormats(){
format
.
append
(
")"
);
list
.
append
(
format
);
*
supportedModules
++
;
}
*/
}
return
list
;
}
...
...
@@ -204,7 +203,7 @@ void SigSession::cancelSaveFile(){
}
void
SigSession
::
export_file
(
const
std
::
string
&
name
,
QWidget
*
parent
,
const
std
::
string
&
ext
){
/*
const deque< boost::shared_ptr<pv::data::LogicSnapshot> > &snapshots =
const
deque
<
boost
::
shared_ptr
<
pv
::
data
::
LogicSnapshot
>
>
&
snapshots
=
_logic_data
->
get_snapshots
();
if
(
snapshots
.
empty
())
return
;
...
...
@@ -240,7 +239,7 @@ void SigSession::export_file(const std::string &name, QWidget* parent, const std
unsigned
char
*
datat
=
(
unsigned
char
*
)
snapshot
->
get_data
();
int
numsamples
=
snapshot
->
get_sample_count
()
*
snapshot
->
unit_size
();
GString
*
data_out
;
int usize =
1024
;
int
usize
=
8192
;
int
size
=
usize
;
struct
sr_datafeed_logic
lp
;
struct
sr_datafeed_packet
p
;
...
...
@@ -257,7 +256,7 @@ void SigSession::export_file(const std::string &name, QWidget* parent, const std
out
<<
(
char
*
)
data_out
->
str
;
g_string_free
(
data_out
,
TRUE
);
}
emit progressValueChanged(i*100/numsamples);
emit
progress
SaveFile
ValueChanged
(
i
*
100
/
numsamples
);
if
(
!
saveFileThreadRunning
)
break
;
}
...
...
@@ -269,7 +268,7 @@ void SigSession::export_file(const std::string &name, QWidget* parent, const std
dlg
.
setWindowModality
(
Qt
::
WindowModal
);
watcher
.
setFuture
(
future
);
connect
(
&
watcher
,
SIGNAL
(
finished
()),
&
dlg
,
SLOT
(
cancel
()));
connect(this,SIGNAL(progressValueChanged(int)),&dlg,SLOT(setValue(int)));
connect
(
this
,
SIGNAL
(
progress
SaveFile
ValueChanged
(
int
)),
&
dlg
,
SLOT
(
setValue
(
int
)));
connect
(
&
dlg
,
SIGNAL
(
canceled
()),
this
,
SLOT
(
cancelSaveFile
()));
dlg
.
exec
();
future
.
waitForFinished
();
...
...
@@ -277,7 +276,7 @@ void SigSession::export_file(const std::string &name, QWidget* parent, const std
file
.
close
();
outModule
->
cleanup
(
&
output
);
g_hash_table_destroy
(
params
);
g_variant_unref(filenameGVariant);
*/
g_variant_unref
(
filenameGVariant
);
}
void
SigSession
::
set_default_device
(
boost
::
function
<
void
(
const
QString
)
>
error_handler
)
...
...
DSView/pv/sigsession.h
View file @
c86154b4
...
...
@@ -87,7 +87,7 @@ class SigSession : public QObject
Q_OBJECT
private:
static
const
float
Oversampling
=
2.0
f
;
static
const
expr
float
Oversampling
=
2.0
f
;
static
const
int
ViewTime
=
800
;
bool
saveFileThreadRunning
=
false
;
...
...
DSView/pv/view/analogsignal.cpp
View file @
c86154b4
...
...
@@ -65,7 +65,7 @@ AnalogSignal::~AnalogSignal()
{
}
shared_ptr
<
pv
::
data
::
SignalData
>
AnalogSignal
::
data
()
const
boost
::
shared_ptr
<
pv
::
data
::
SignalData
>
AnalogSignal
::
data
()
const
{
return
_data
;
}
...
...
@@ -86,7 +86,7 @@ void AnalogSignal::paint_mid(QPainter &p, int left, int right)
assert
(
scale
>
0
);
const
double
offset
=
_view
->
offset
();
const
deque
<
shared_ptr
<
pv
::
data
::
AnalogSnapshot
>
>
&
snapshots
=
const
deque
<
boost
::
shared_ptr
<
pv
::
data
::
AnalogSnapshot
>
>
&
snapshots
=
_data
->
get_snapshots
();
if
(
snapshots
.
empty
())
return
;
...
...
DSView/pv/view/devmode.cpp
View file @
c86154b4
...
...
@@ -68,7 +68,7 @@ void DevMode::set_device()
l
;
l
=
l
->
next
)
{
sr_dev_mode
*
mode
=
(
sr_dev_mode
*
)
l
->
data
;
shared_ptr
<
QPushButton
>
mode_button
=
shared_ptr
<
QPushButton
>
(
new
QPushButton
(
NULL
));
boost
::
shared_ptr
<
QPushButton
>
mode_button
=
boost
::
shared_ptr
<
QPushButton
>
(
new
QPushButton
(
NULL
));
mode_button
->
setFlat
(
true
);
mode_button
->
setText
(
mode
->
name
);
...
...
@@ -97,7 +97,7 @@ void DevMode::paintEvent(QPaintEvent*)
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
painter
.
setPen
(
Qt
::
NoPen
);
for
(
std
::
map
<
shared_ptr
<
QPushButton
>
,
sr_dev_mode
*>::
const_iterator
i
=
_mode_button_list
.
begin
();
for
(
std
::
map
<
boost
::
shared_ptr
<
QPushButton
>
,
sr_dev_mode
*>::
const_iterator
i
=
_mode_button_list
.
begin
();
i
!=
_mode_button_list
.
end
();
i
++
)
{
const
boost
::
shared_ptr
<
device
::
DevInst
>
dev_inst
=
_view
.
session
().
get_device
();
assert
(
dev_inst
);
...
...
@@ -118,7 +118,7 @@ void DevMode::on_mode_change()
assert
(
dev_inst
);
QPushButton
*
button
=
qobject_cast
<
QPushButton
*>
(
sender
());
for
(
std
::
map
<
shared_ptr
<
QPushButton
>
,
sr_dev_mode
*>::
const_iterator
i
=
_mode_button_list
.
begin
();
for
(
std
::
map
<
boost
::
shared_ptr
<
QPushButton
>
,
sr_dev_mode
*>::
const_iterator
i
=
_mode_button_list
.
begin
();
i
!=
_mode_button_list
.
end
();
i
++
)
{
if
((
*
i
).
first
.
get
()
==
button
)
{
if
(
dev_inst
->
dev_inst
()
->
mode
!=
(
*
i
).
second
->
mode
)
{
...
...
DSView/pv/view/dsosignal.cpp
View file @
c86154b4
...
...
@@ -109,7 +109,7 @@ const int DsoSignal::DownMargin = 30;
const
int
DsoSignal
::
RightMargin
=
30
;
DsoSignal
::
DsoSignal
(
boost
::
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
,
shared_ptr
<
data
::
Dso
>
data
,
boost
::
shared_ptr
<
data
::
Dso
>
data
,
const
sr_channel
*
const
probe
)
:
Signal
(
dev_inst
,
probe
,
DS_DSO
),
_data
(
data
),
...
...
@@ -173,7 +173,7 @@ DsoSignal::~DsoSignal()
{
}
shared_ptr
<
pv
::
data
::
SignalData
>
DsoSignal
::
data
()
const
boost
::
shared_ptr
<
pv
::
data
::
SignalData
>
DsoSignal
::
data
()
const
{
return
_data
;
}
...
...
@@ -582,7 +582,7 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right)
return
;
_scale
=
height
*
1.0
f
/
256
;
const
shared_ptr
<
pv
::
data
::
DsoSnapshot
>
&
snapshot
=
const
boost
::
shared_ptr
<
pv
::
data
::
DsoSnapshot
>
&
snapshot
=
snapshots
.
front
();
const
uint16_t
number_channels
=
snapshot
->
get_channel_num
();
...
...
@@ -846,8 +846,8 @@ void DsoSignal::paint_measure(QPainter &p)
const
double
upPeriod
=
get_hDialValue
()
*
DS_CONF_DSO_HDIVS
*
0.8
;
const
double
dnPeriod
=
get_hDialValue
()
*
DS_CONF_DSO_HDIVS
*
0.2
;
if
(
_period
>
upPeriod
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
go_hDialNext
(
setted
);
setted
=
true
;
...
...
@@ -856,8 +856,8 @@ void DsoSignal::paint_measure(QPainter &p)
}
else
if
(
_period
>
dnPeriod
)
{
_autoH
=
false
;
}
else
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
go_hDialPre
(
setted
);
setted
=
true
;
...
...
DSView/pv/view/groupsignal.cpp
View file @
c86154b4
...
...
@@ -63,7 +63,7 @@ bool GroupSignal::enabled() const
return
true
;
}
shared_ptr
<
pv
::
data
::
SignalData
>
GroupSignal
::
data
()
const
boost
::
shared_ptr
<
pv
::
data
::
SignalData
>
GroupSignal
::
data
()
const
{
return
_data
;
}
...
...
DSView/pv/view/header.cpp
View file @
c86154b4
...
...
@@ -160,7 +160,7 @@ void Header::mouseDoubleClickEvent(QMouseEvent *event)
const
boost
::
shared_ptr
<
Trace
>
mTrace
=
get_mTrace
(
action
,
event
->
pos
());
if
(
action
==
Trace
::
LABEL
&&
mTrace
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
auto_set
();
}
...
...
@@ -239,8 +239,8 @@ void Header::mousePressEvent(QMouseEvent *event)
else
mTrace
->
set_trig
(
Trace
::
EDGETRIG
);
}
else
if
(
action
==
Trace
::
VDIAL
&&
mTrace
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_hDialActive
(
false
);
if
(
t
!=
mTrace
)
{
...
...
@@ -251,17 +251,17 @@ void Header::mousePressEvent(QMouseEvent *event)
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
dsoSig
->
set_vDialActive
(
!
dsoSig
->
get_vDialActive
());
}
else
if
(
action
==
Trace
::
HDIAL
&&
mTrace
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
if
(
dsoSig
->
get_hDialActive
())
{
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_vDialActive
(
false
);
dsoSig
->
set_hDialActive
(
false
);
}
}
}
else
{
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_vDialActive
(
false
);
dsoSig
->
set_hDialActive
(
true
);
...
...
@@ -270,12 +270,12 @@ void Header::mousePressEvent(QMouseEvent *event)
}
}
}
else
if
(
action
==
Trace
::
CHEN
&&
mTrace
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
set_enable
(
!
dsoSig
->
enabled
());
}
}
else
if
(
action
==
Trace
::
ACDC
&&
mTrace
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
if
(
strcmp
(
_view
.
session
().
get_device
()
->
dev_inst
()
->
driver
->
name
,
"DSLogic"
)
==
0
)
dsoSig
->
set_acCoupling
((
dsoSig
->
get_acCoupling
()
+
1
)
%
2
);
...
...
@@ -287,7 +287,7 @@ void Header::mousePressEvent(QMouseEvent *event)
if
(
~
QApplication
::
keyboardModifiers
()
&
Qt
::
ControlModifier
)
{
// Unselect all other Traces because the Ctrl is not
// pressed
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
if
(
t
!=
mTrace
)
t
->
select
(
false
);
}
...
...
@@ -330,13 +330,13 @@ void Header::wheelEvent(QWheelEvent *event)
assert
(
event
);
if
(
event
->
orientation
()
==
Qt
::
Vertical
)
{
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
// Vertical scrolling
double
shift
=
event
->
delta
()
/
20.0
;
bool
setted
=
false
;
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
if
(
dsoSig
->
get_vDialActive
())
{
if
(
shift
>
1.0
)
...
...
@@ -407,7 +407,7 @@ void Header::mouseMoveEvent(QMouseEvent *event)
// Ensure the Trace is selected
sig
->
select
(
true
);
}
else
{
shared_ptr
<
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
DsoSignal
>
(
sig
))
{
dsoSig
->
set_zeroPos
(
y
);
dsoSig
->
select
(
false
);
...
...
DSView/pv/view/logicsignal.cpp
View file @
c86154b4
...
...
@@ -85,12 +85,12 @@ const sr_channel* LogicSignal::probe() const
return
_probe
;
}
shared_ptr
<
pv
::
data
::
SignalData
>
LogicSignal
::
data
()
const
boost
::
shared_ptr
<
pv
::
data
::
SignalData
>
LogicSignal
::
data
()
const
{
return
_data
;
}
shared_ptr
<
pv
::
data
::
Logic
>
LogicSignal
::
logic_data
()
const
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
LogicSignal
::
logic_data
()
const
{
return
_data
;
}
...
...
DSView/pv/view/view.cpp
View file @
c86154b4
...
...
@@ -211,10 +211,10 @@ void View::zoom(double steps, int offset)
_scale
*=
std
::
pow
(
3.0
/
2.0
,
-
steps
);
_scale
=
max
(
min
(
_scale
,
_maxscale
),
_minscale
);
}
else
{
const
vector
<
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
bool
setted
=
false
;
BOOST_FOREACH
(
const
shared_ptr
<
Signal
>
s
,
sigs
)
{
shared_ptr
<
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Signal
>
s
,
sigs
)
{
boost
::
shared_ptr
<
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
DsoSignal
>
(
s
))
{
if
(
steps
>
0.5
)
dsoSig
->
go_hDialPre
(
setted
);
...
...
@@ -273,19 +273,19 @@ void View::set_preScale_preOffset()
set_scale_offset
(
_preScale
,
_preOffset
);
}
vector
<
shared_ptr
<
Trace
>
>
View
::
get_traces
()
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
View
::
get_traces
()
const
{
const
vector
<
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
#ifdef ENABLE_DECODE
const
vector
<
shared_ptr
<
DecodeTrace
>
>
decode_sigs
(
const
vector
<
boost
::
shared_ptr
<
DecodeTrace
>
>
decode_sigs
(
_session
.
get_decode_signals
());
vector
<
shared_ptr
<
Trace
>
>
traces
(
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
sigs
.
size
()
+
decode_sigs
.
size
());
#else
vector
<
shared_ptr
<
Trace
>
>
traces
(
sigs
.
size
());
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
sigs
.
size
());
#endif
vector
<
shared_ptr
<
Trace
>
>::
iterator
i
=
traces
.
begin
();
vector
<
boost
::
shared_ptr
<
Trace
>
>::
iterator
i
=
traces
.
begin
();
i
=
copy
(
sigs
.
begin
(),
sigs
.
end
(),
i
);
#ifdef ENABLE_DECODE
i
=
copy
(
decode_sigs
.
begin
(),
decode_sigs
.
end
(),
i
);
...
...
@@ -295,8 +295,8 @@ vector< shared_ptr<Trace> > View::get_traces() const
return
traces
;
}
bool
View
::
compare_trace_v_offsets
(
const
shared_ptr
<
Trace
>
&
a
,
const
shared_ptr
<
Trace
>
&
b
)
bool
View
::
compare_trace_v_offsets
(
const
boost
::
shared_ptr
<
Trace
>
&
a
,
const
boost
::
shared_ptr
<
Trace
>
&
b
)
{
assert
(
a
);
assert
(
b
);
...
...
@@ -379,14 +379,14 @@ const QPointF& View::hover_point() const
void
View
::
normalize_layout
()
{
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
int
v_min
=
INT_MAX
;
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
v_min
=
min
(
t
->
get_v_offset
(),
v_min
);
const
int
delta
=
-
min
(
v_min
,
0
);
BOOST_FOREACH
(
shared_ptr
<
Trace
>
t
,
traces
)
BOOST_FOREACH
(
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
t
->
set_v_offset
(
t
->
get_v_offset
()
+
delta
);
verticalScrollBar
()
->
setSliderPosition
(
_v_offset
+
delta
);
...
...
@@ -406,7 +406,7 @@ int View::get_signalHeight()
void
View
::
get_scroll_layout
(
double
&
length
,
double
&
offset
)
const
{
const
set
<
shared_ptr
<
data
::
SignalData
>
>
data_set
=
_session
.
get_data
();
const
set
<
boost
::
shared_ptr
<
data
::
SignalData
>
>
data_set
=
_session
.
get_data
();
if
(
data_set
.
empty
())
return
;
...
...
@@ -474,8 +474,8 @@ void View::update_scale()
void
View
::
signals_changed
()
{
int
total_rows
=
0
;
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
if
(
dynamic_pointer_cast
<
DsoSignal
>
(
t
)
||
...
...
@@ -490,7 +490,7 @@ void View::signals_changed()
_signalHeight
=
(
int
)((
height
<=
0
)
?
1
:
height
);
_spanY
=
_signalHeight
+
2
*
SignalMargin
;
int
next_v_offset
=
SignalMargin
;
BOOST_FOREACH
(
shared_ptr
<
Trace
>
t
,
traces
)
{
BOOST_FOREACH
(
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
t
->
set_view
(
this
);
const
double
traceHeight
=
_signalHeight
*
t
->
rows_size
();
t
->
set_signalHeight
((
int
)
traceHeight
);
...
...
@@ -558,9 +558,9 @@ int View::headerWidth()
QFont
font
=
QApplication
::
font
();
QFontMetrics
fm
(
font
);
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
get_traces
());
if
(
!
traces
.
empty
()){
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
maxNameWidth
=
max
(
fm
.
boundingRect
(
t
->
get_name
()).
width
(),
maxNameWidth
);
maxLeftWidth
=
max
(
t
->
get_leftWidth
(),
maxLeftWidth
);
maxRightWidth
=
max
(
t
->
get_rightWidth
(),
maxRightWidth
);
...
...
@@ -804,8 +804,8 @@ int View::get_view_width()
{
int
view_width
=
0
;
if
(
_session
.
get_device
()
->
dev_inst
()
->
mode
==
DSO
)
{
const
vector
<
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
BOOST_FOREACH
(
const
shared_ptr
<
Signal
>
s
,
sigs
)
{
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_session
.
get_signals
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Signal
>
s
,
sigs
)
{
view_width
=
max
((
double
)
view_width
,
s
->
get_view_rect
().
width
());
}
}
else
{
...
...
DSView/pv/view/view.h
View file @
c86154b4
...
...
@@ -75,7 +75,7 @@ public:
static
const
QSizeF
LabelPadding
;
static
const
int
WellPixelsPerSample
=
10.0
f
;
static
const
double
MaxViewRate
=
1.0
f
;
static
const
expr
double
MaxViewRate
=
1.0
f
;
static
const
int
MaxPixelsPerSample
=
100.0
f
;
public:
...
...
DSView/pv/view/viewport.cpp
View file @
c86154b4
...
...
@@ -77,8 +77,8 @@ int Viewport::get_total_height() const
{
int
h
=
0
;
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
{
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
h
+=
(
int
)(
t
->
get_signalHeight
());
}
...
...
@@ -103,8 +103,8 @@ void Viewport::paintEvent(QPaintEvent *event)
QPainter
p
(
this
);
style
()
->
drawPrimitive
(
QStyle
::
PE_Widget
,
&
o
,
&
p
,
this
);
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
t
->
paint_back
(
p
,
0
,
_view
.
get_view_width
());
...
...
@@ -130,7 +130,7 @@ void Viewport::paintEvent(QPaintEvent *event)
paintSignals
(
p
);
}
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
if
(
t
->
enabled
())
...
...
@@ -146,7 +146,7 @@ void Viewport::paintEvent(QPaintEvent *event)
void
Viewport
::
paintSignals
(
QPainter
&
p
)
{
const
vector
<
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
if
(
_view
.
scale
()
!=
_curScale
||
_view
.
offset
()
!=
_curOffset
||
_view
.
get_signalHeight
()
!=
_curSignalHeight
||
...
...
@@ -160,7 +160,7 @@ void Viewport::paintSignals(QPainter &p)
QPainter
dbp
(
&
pixmap
);
dbp
.
initFrom
(
this
);
p
.
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
BOOST_FOREACH
(
const
shared_ptr
<
Trace
>
t
,
traces
)
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
if
(
t
->
enabled
())
...
...
@@ -359,10 +359,10 @@ void Viewport::mousePressEvent(QMouseEvent *event)
// _zoom_rect_visible = true;
// }
const
vector
<
shared_ptr
<
Signal
>
>
sigs
(
_view
.
session
().
get_signals
());
BOOST_FOREACH
(
const
shared_ptr
<
Signal
>
s
,
sigs
)
{
const
vector
<
boost
::
shared_ptr
<
Signal
>
>
sigs
(
_view
.
session
().
get_signals
());
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Signal
>
s
,
sigs
)
{
assert
(
s
);
shared_ptr
<
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
DsoSignal
>
dsoSig
;
if
((
dsoSig
=
dynamic_pointer_cast
<
DsoSignal
>
(
s
))
&&
dsoSig
->
get_trig_rect
(
0
,
_view
.
get_view_width
()).
contains
(
_mouse_point
))
{
_drag_sig
=
s
;
...
...
@@ -385,7 +385,7 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
if
(
event
->
buttons
()
&
Qt
::
LeftButton
)
{
if
(
_drag_sig
)
{
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
_drag_sig
))
dsoSig
->
set_trig_vpos
(
_mouse_point
.
y
());
}
else
{
...
...
DSView/pv/view/viewport.h
View file @
c86154b4
...
...
@@ -47,7 +47,7 @@ class Viewport : public QWidget
public:
static
const
int
HitCursorMargin
=
10
;
static
const
double
HitCursorTimeMargin
=
0.3
;
static
const
expr
double
HitCursorTimeMargin
=
0.3
;
public:
explicit
Viewport
(
View
&
parent
);
...
...
libsigrok4DSL/backend.c
View file @
c86154b4
...
...
@@ -261,7 +261,7 @@ static int sanity_check_all_input_modules(void)
static
int
sanity_check_all_output_modules
(
void
)
{
int
i
,
errors
,
ret
=
SR_OK
;
struct
sr_output_
format
**
outputs
;
struct
sr_output_
module
**
outputs
;
const
char
*
d
;
sr_spew
(
"Sanity-checking all output modules."
);
...
...
@@ -276,18 +276,18 @@ static int sanity_check_all_output_modules(void)
sr_err
(
"No ID in module %d ('%s')."
,
i
,
d
);
errors
++
;
}
if
(
!
outputs
[
i
]
->
desc
ription
)
{
if
(
!
outputs
[
i
]
->
desc
)
{
sr_err
(
"No description in module %d ('%s')."
,
i
,
d
);
errors
++
;
}
if
(
outputs
[
i
]
->
df_type
<
10000
||
outputs
[
i
]
->
df_type
>
10007
)
{
/*
if (outputs[i]->df_type < 10000 || outputs[i]->df_type > 10007) {
sr_err("Invalid df_type %d in module %d ('%s').",
outputs[i]->df_type, i, d);
errors++;
}
}
*/
/* All modules must provide a data or recv API callback. */
if
(
!
outputs
[
i
]
->
data
&&
!
outputs
[
i
]
->
receive
)
{
if
(
!
outputs
[
i
]
->
receive
)
{
sr_err
(
"No data/receive in module %d ('%s')."
,
i
,
d
);
errors
++
;
}
...
...
libsigrok4DSL/configure.ac
View file @
c86154b4
...
...
@@ -227,7 +227,6 @@ AC_CONFIG_FILES([Makefile version.h hardware/Makefile
hardware/DSL/Makefile
input/Makefile
output/Makefile
output/text/Makefile
libsigrok4DSL.pc
tests/Makefile
])
...
...
libsigrok4DSL/libsigrok.h
View file @
c86154b4
...
...
@@ -415,7 +415,7 @@ struct sr_output {
* A pointer to this output format's 'struct sr_output_format'.
* The frontend can use this to call the module's callbacks.
*/
struct
sr_output_
format
*
format
;
struct
sr_output_
module
*
module
;
/**
* The device for which this output module is creating output. This
...
...
@@ -437,29 +437,57 @@ struct sr_output {
* For example, the module might store a pointer to a chunk of output
* there, and only flush it when it reaches a certain size.
*/
void
*
internal
;
void
*
priv
;
};
/** Generic option struct used by various subsystems. */
struct
sr_option
{
/* Short name suitable for commandline usage, [a-z0-9-]. */
char
*
id
;
/* Short name suitable for GUI usage, can contain UTF-8. */
char
*
name
;
/* Description of the option, in a sentence. */
char
*
desc
;
/* Default value for this option. */
GVariant
*
def
;
/* List of possible values, if this is an option with few values. */
GSList
*
values
;
};
struct
sr_output_format
{
/** Output module driver. */
struct
sr_output_module
{
/**
* A unique ID for this output format. Must not be NULL.
*
* It can be used by frontends to select this output format for use.
*
* For example, calling sigrok-cli with <code>-O hex</code> will
* select the hexadecimal text output format.
* A unique ID for this output module, suitable for use in command-line
* clients, [a-z0-9-]. Must not be NULL.
*/
char
*
id
;
/**
* A short description of the output format. Must not be NULL.
* A unique name for this output module, suitable for use in GUI
* clients, can contain UTF-8. Must not be NULL.
*/
const
char
*
name
;
/**
* A short description of the output module. Must not be NULL.
*
* This can be displayed by frontends, e.g. when selecting the output
*
format
for saving a file.
*
module
for saving a file.
*/
char
*
desc
ription
;
char
*
desc
;
int
df_type
;
/**
* A NULL terminated array of strings containing a list of file name
* extensions typical for the input file format, or NULL if there is
* no typical extension for this file format.
*/
const
char
*
const
*
exts
;
/**
* Returns a NULL-terminated list of options this module can take.
* Can be NULL, if the module has no options.
*/
const
struct
sr_option
*
(
*
options
)
(
void
);
/**
* This function is called once, at the beginning of an output stream.
...
...
@@ -473,73 +501,10 @@ struct sr_output_format {
*
* @param o Pointer to the respective 'struct sr_output'.
*
* @return SR_OK upon success, a negative error code otherwise.
*/
int
(
*
init
)
(
struct
sr_output
*
o
);
/**
* Whenever a chunk of data comes in, it will be passed to the
* output module via this function. The <code>data_in</code> and
* <code>length_in</code> values refers to this data; the module
* must not alter or g_free() this buffer.
*
* The function must allocate a buffer for storing its output, and
* pass along a pointer to this buffer in the <code>data_out</code>
* parameter, as well as storing the length of the buffer in
* <code>length_out</code>. The calling frontend will g_free()
* this buffer when it's done with it.
*
* IMPORTANT: The memory allocation much happen using a glib memory
* allocation call (not a "normal" malloc) since g_free() will be
* used to free the memory!
*
* If there is no output, this function MUST store NULL in the
* <code>data_out</code> parameter, so the caller knows not to try
* and g_free() it.
*
* Note: This API call is obsolete, use receive() instead.
*
* @param o Pointer to the respective 'struct sr_output'.
* @param data_in Pointer to the input data buffer.
* @param length_in Length of the input.
* @param data_out Pointer to the allocated output buffer.
* @param length_out Length (in bytes) of the output.
*
* @return SR_OK upon success, a negative error code otherwise.
* @retval SR_OK Success
* @retval other Negative error code.
*/
int
(
*
data
)
(
struct
sr_output
*
o
,
const
uint8_t
*
data_in
,
uint64_t
length_in
,
uint8_t
**
data_out
,
uint64_t
*
length_out
);
/**
* This function is called when an event occurs in the datafeed
* which the output module may need to be aware of. No data is