2
0
forked from Ivasoft/DSView

rename project for upgrade

This commit is contained in:
DreamSourceLab
2015-04-17 00:21:14 +08:00
parent eea8d95eb1
commit 153d1f9ebd
174 changed files with 5986 additions and 1530 deletions

View File

@@ -1,5 +1,5 @@
##
## This file is part of the PulseView project.
## This file is part of the DSView project.
##
## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
@@ -26,7 +26,7 @@ include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
project(DSLogic)
project(DSView)
#===============================================================================
#= User Options
@@ -60,7 +60,7 @@ endif()
#-------------------------------------------------------------------------------
list(APPEND PKGDEPS
"libsigrok4DSLogic >= 0.2.0"
"libsigrok4DSL >= 0.2.0"
"libusb-1.0 >= 1.0.16"
)
if(ENABLE_DECODE)
@@ -98,12 +98,12 @@ find_package(libusb-1.0 REQUIRED)
#= Config Header
#-------------------------------------------------------------------------------
set(DS_TITLE DSLogic)
set(DS_DESCRIPTION "A GUI for DSLogic")
set(DS_TITLE DSView)
set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
set(DS_VERSION_MAJOR 0)
set(DS_VERSION_MINOR 4)
set(DS_VERSION_MICRO 0)
set(DS_VERSION_MINOR 9)
set(DS_VERSION_MICRO 2)
set(DS_VERSION_STRING
${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}
)
@@ -117,7 +117,7 @@ configure_file (
#= Sources
#-------------------------------------------------------------------------------
set(DSLogic_SOURCES
set(DSView_SOURCES
main.cpp
pv/devicemanager.cpp
pv/mainwindow.cpp
@@ -142,6 +142,8 @@ set(DSLogic_SOURCES
pv/dialogs/deviceoptions.cpp
pv/dialogs/search.cpp
pv/dialogs/storeprogress.cpp
pv/dialogs/streamoptions.cpp
pv/dialogs/waitingdialog.cpp
pv/dock/dsotriggerdock.cpp
pv/dock/measuredock.cpp
pv/dock/searchdock.cpp
@@ -153,7 +155,7 @@ set(DSLogic_SOURCES
pv/prop/property.cpp
pv/prop/string.cpp
pv/prop/binding/binding.cpp
pv/prop/binding/deviceoptions.cpp
pv/prop/binding/binding_deviceoptions.cpp
pv/toolbars/filebar.cpp
pv/toolbars/logobar.cpp
pv/toolbars/samplingbar.cpp
@@ -176,7 +178,7 @@ set(DSLogic_SOURCES
pv/widgets/fakelineedit.cpp
)
set(DSLogic_HEADERS
set(DSView_HEADERS
pv/mainwindow.h
pv/sigsession.h
pv/storesession.h
@@ -185,6 +187,8 @@ set(DSLogic_HEADERS
pv/dialogs/deviceoptions.h
pv/dialogs/search.h
pv/dialogs/storeprogress.h
pv/dialogs/streamoptions.h
pv/dialogs/waitingdialog.h
pv/dock/dsotriggerdock.h
pv/dock/measuredock.h
pv/dock/searchdock.h
@@ -211,17 +215,17 @@ set(DSLogic_HEADERS
pv/widgets/fakelineedit.h
)
set(DSLogic_FORMS
set(DSView_FORMS
pv/dialogs/about.ui
)
set(DSLogic_RESOURCES
DSLogic.qrc
set(DSView_RESOURCES
DSView.qrc
)
if(ENABLE_DECODE)
list(APPEND DSLogic_SOURCES
list(APPEND DSView_SOURCES
pv/dock/protocoldock.cpp
pv/data/decoderstack.cpp
pv/data/decode/annotation.cpp
@@ -234,7 +238,7 @@ if(ENABLE_DECODE)
pv/widgets/decodermenu.cpp
)
list(APPEND DSLogic_HEADERS
list(APPEND DSView_HEADERS
pv/dock/protocoldock.h
pv/data/decoderstack.h
pv/view/decodetrace.h
@@ -244,20 +248,20 @@ if(ENABLE_DECODE)
endif()
if(WIN32)
# Use the DSLogic icon for the DSLogic.exe executable.
# Use the DSView icon for the DSView.exe executable.
set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
enable_language(RC)
list(APPEND DSLogic_SOURCES DSLogic.rc)
list(APPEND DSView_SOURCES DSView.rc)
endif()
if(Qt5Core_FOUND)
qt5_wrap_cpp(DSLogic_HEADERS_MOC ${DSLogic_HEADERS})
qt5_wrap_ui(DSLogic_FORMS_HEADERS ${DSLogic_FORMS})
qt5_add_resources(DSLogic_RESOURCES_RCC ${DSLogic_RESOURCES})
qt5_wrap_cpp(DSView_HEADERS_MOC ${DSView_HEADERS})
qt5_wrap_ui(DSView_FORMS_HEADERS ${DSView_FORMS})
qt5_add_resources(DSView_RESOURCES_RCC ${DSView_RESOURCES})
else()
qt4_wrap_cpp(DSLogic_HEADERS_MOC ${DSLogic_HEADERS})
qt4_wrap_ui(DSLogic_FORMS_HEADERS ${DSLogic_FORMS})
qt4_add_resources(DSLogic_RESOURCES_RCC ${DSLogic_RESOURCES})
qt4_wrap_cpp(DSView_HEADERS_MOC ${DSView_HEADERS})
qt4_wrap_ui(DSView_FORMS_HEADERS ${DSView_FORMS})
qt4_add_resources(DSView_RESOURCES_RCC ${DSView_RESOURCES})
include(${QT_USE_FILE})
endif()
@@ -299,7 +303,7 @@ endif()
link_directories(${Boost_LIBRARY_DIRS})
set(DSLOGIC_LINK_LIBS
set(DSVIEW_LINK_LIBS
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${QT_LIBRARIES}
@@ -308,25 +312,25 @@ set(DSLOGIC_LINK_LIBS
if(STATIC_PKGDEPS_LIBS)
link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
list(APPEND DSLOGIC_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES})
if(WIN32)
# Workaround for a MinGW linking issue.
list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2")
endif()
else()
link_directories(${PKGDEPS_LIBRARY_DIRS})
list(APPEND DSLOGIC_LINK_LIBS ${PKGDEPS_LIBRARIES})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
endif()
add_executable(${PROJECT_NAME}
${DSLogic_SOURCES}
${DSLogic_HEADERS_MOC}
${DSLogic_FORMS_HEADERS}
${DSLogic_RESOURCES_RCC}
${DSView_SOURCES}
${DSView_HEADERS_MOC}
${DSView_FORMS_HEADERS}
${DSView_RESOURCES_RCC}
)
target_link_libraries(${PROJECT_NAME} ${DSLOGIC_LINK_LIBS})
target_link_libraries(${PROJECT_NAME} ${DSVIEW_LINK_LIBS})
if(WIN32)
# Pass -mwindows so that no "DOS box" will open when PulseView is started.
@@ -349,6 +353,10 @@ install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
install(FILES res/DSLogic.fw DESTINATION bin/res/)
install(FILES res/DSLogic33.bin DESTINATION bin/res/)
install(FILES res/DSLogic50.bin DESTINATION bin/res/)
install(FILES res/DSLogicPro.fw DESTINATION bin/res/)
install(FILES res/DSLogicPro.bin DESTINATION bin/res/)
install(FILES res/DSCope.fw DESTINATION bin/res/)
install(FILES res/DSCope.bin DESTINATION bin/res/)
#===============================================================================
#= Packaging (handled by CPack)
@@ -373,5 +381,5 @@ include(CPack)
if(ENABLE_TESTS)
add_subdirectory(test)
enable_testing()
add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/DSLogic-test)
add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/DSView-test)
endif(ENABLE_TESTS)

View File

@@ -35,5 +35,6 @@
<file>icons/params_dis.png</file>
<file>icons/gear.png</file>
<file>icons/wiki.png</file>
<file>icons/wait.gif</file>
</qresource>
</RCC>

View File

@@ -16,15 +16,15 @@ Requirements
- libboost >= 1.42 (including the following libs):
- libboost-system
- libboost-thread
- libsigrok4DSLogic >= 0.2.0
- libsigrok4DSL >= 0.2.0
Building and installing
-----------------------
Get the DSLogic-gui source code from: www.dreamsourcelab.com/download.html
Get the DSView source code from: www.dreamsourcelab.com/download.html
In order to build it, run:
$ cd DSLogic-gui
$ cd DSView
$ cmake .
$ make

View File

@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
README
-------------------------------------------------------------------------------
DSLogic-gui is GUI for DSLogic software, it's based on PulseView
DSView is a GUI for instruments of DreamSourceLab, it's based on PulseView
from the sigrok project.
The sigrok project aims at creating a portable, cross-platform,
@@ -14,7 +14,7 @@ PulseView is a Qt-based LA/scope/MSO GUI for sigrok.
Status
------
DSLogic-gui is in a usable state and has had official tarball releases.
DSView is in a usable state and has had official tarball releases.
However, it is still work in progress. Some basic functionality
is available and working, but other things are still on the TODO list.
@@ -23,7 +23,7 @@ is available and working, but other things are still on the TODO list.
Copyright and license
---------------------
DSLogic-gui is licensed under the terms of the GNU General Public License
DSView is licensed under the terms of the GNU General Public License
(GPL), version 3 or later.
While some individual source code files are licensed under the GPLv2+, and

6
DSView/cmake_clear Executable file
View File

@@ -0,0 +1,6 @@
echo "rm cmake cache begin..."
rm ./cmake_install.cmake
rm -r ./CMakeFiles
rm ./Makefile
rm ./CMakeCache.txt
echo "rm cmake cache end..."

View File

@@ -17,15 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DSLOGIC_CONFIG_H
#define _DSLOGIC_CONFIG_H
#ifndef _DSVIEW_CONFIG_H
#define _DSVIEW_CONFIG_H
/* Application details */
#define DS_TITLE "@DS_TITLE@"
#define DS_DESCRIPTION "@DS_DESCRIPTION@"
#define DS_BIN_NAME "@PROJECT_NAME@"
/* DSLogic version information */
/* DSView version information */
#define DS_VERSION_MAJOR @DS_VERSION_MAJOR@
#define DS_VERSION_MINOR @DS_VERSION_MINOR@
#define DS_VERSION_MICRO @DS_VERSION_MICRO@

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,12 +21,12 @@
*/
#ifndef DSLOGIC_EXTDEF_H
#define DSLOGIC_EXTDEF_H
#ifndef DSVIEW_EXTDEF_H
#define DSVIEW_EXTDEF_H
#define countof(x) (sizeof(x)/sizeof(x[0]))
#define begin_element(x) (&x[0])
#define end_element(x) (&x[countof(x)])
#endif // DSLOGIC_EXTDEF_H
#endif // DSVIEW_EXTDEF_H

BIN
DSView/icons/load.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
DSView/icons/wait.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -26,7 +26,7 @@
#endif
#include <stdint.h>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include <getopt.h>
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
// Set some application metadata
QApplication::setApplicationVersion(DS_VERSION_STRING);
QApplication::setApplicationName("DSLogic(Beta)");
QApplication::setApplicationName("DSView(Beta)");
QApplication::setOrganizationDomain("http://www.DreamSourceLab.com");
// Parse arguments

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -30,17 +30,11 @@ using namespace std;
namespace pv {
namespace data {
Analog::Analog(unsigned int num_probes) :
SignalData(),
_num_probes(num_probes)
Analog::Analog() :
SignalData()
{
}
int Analog::get_num_probes() const
{
return _num_probes;
}
void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot)
{
_snapshots.push_front(snapshot);

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_ANALOG_H
#define DSLOGIC_PV_DATA_ANALOG_H
#ifndef DSVIEW_PV_DATA_ANALOG_H
#define DSVIEW_PV_DATA_ANALOG_H
#include "signaldata.h"
@@ -37,9 +37,7 @@ class AnalogSnapshot;
class Analog : public SignalData
{
public:
Analog(unsigned int num_probes);
int get_num_probes() const;
Analog();
void push_snapshot(
boost::shared_ptr<AnalogSnapshot> &snapshot);
@@ -50,11 +48,10 @@ public:
void clear();
private:
const unsigned int _num_probes;
std::deque< boost::shared_ptr<AnalogSnapshot> > _snapshots;
};
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_ANALOG_H
#endif // DSVIEW_PV_DATA_ANALOG_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H
#define DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H
#ifndef DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#define DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#include "snapshot.h"
@@ -95,4 +95,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H
#endif // DSVIEW_PV_DATA_ANALOGSNAPSHOT_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
#define DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
#ifndef DSVIEW_PV_VIEW_DECODE_ANNOTATION_H
#define DSVIEW_PV_VIEW_DECODE_ANNOTATION_H
#include <stdint.h>
@@ -52,4 +52,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_VIEW_DECODE_ANNOTATION_H
#endif // DSVIEW_PV_VIEW_DECODE_ANNOTATION_H

View File

@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include <libsigrokdecode/libsigrokdecode.h>
#include "decoder.h"
@@ -37,8 +37,6 @@ namespace decode {
Decoder::Decoder(const srd_decoder *const dec) :
_decoder(dec),
_shown(true),
_shown_back(true),
_shown_setted(false),
_setted(true)
{
}
@@ -62,16 +60,7 @@ bool Decoder::shown() const
void Decoder::show(bool show)
{
_shown_back = show;
_shown_setted = true;
}
void Decoder::commit_show()
{
if (_shown_setted) {
_shown = _shown_back;
_shown_setted = false;
}
_shown = show;
}
const map<const srd_channel*, shared_ptr<view::LogicSignal> >&

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DATA_DECODE_DECODER_H
#define DSLOGIC_PV_DATA_DECODE_DECODER_H
#ifndef DSVIEW_PV_DATA_DECODE_DECODER_H
#define DSVIEW_PV_DATA_DECODE_DECODER_H
#include <map>
#include <set>
@@ -56,7 +56,6 @@ public:
bool shown() const;
void show(bool show = true);
void commit_show();
const std::map<const srd_channel*,
boost::shared_ptr<view::LogicSignal> >& channels() const;
@@ -80,10 +79,8 @@ private:
const srd_decoder *const _decoder;
bool _shown;
bool _shown_back;
bool _shown_setted;
std::map<const srd_channel*, boost::shared_ptr<pv::view::LogicSignal> >
std::map<const srd_channel*, boost::shared_ptr<pv::view::LogicSignal> >
_probes;
std::map<std::string, GVariant*> _options;
@@ -98,4 +95,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_DECODE_DECODER_H
#endif // DSVIEW_PV_DATA_DECODE_DECODER_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DATA_DECODE_ROW_H
#define DSLOGIC_PV_DATA_DECODE_ROW_H
#ifndef DSVIEW_PV_DATA_DECODE_ROW_H
#define DSVIEW_PV_DATA_DECODE_ROW_H
#include <vector>
@@ -56,4 +56,4 @@ private:
} // data
} // pv
#endif // DSLOGIC_PV_DATA_DECODE_ROW_H
#endif // DSVIEW_PV_DATA_DECODE_ROW_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DATA_DECODE_ROWDATA_H
#define DSLOGIC_PV_DATA_DECODE_ROWDATA_H
#ifndef DSVIEW_PV_DATA_DECODE_ROWDATA_H
#define DSVIEW_PV_DATA_DECODE_ROWDATA_H
#include <vector>
@@ -56,4 +56,4 @@ private:
} // data
} // pv
#endif // DSLOGIC_PV_DATA_DECODE_ROWDATA_H
#endif // DSVIEW_PV_DATA_DECODE_ROWDATA_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DATA_DECODERSTACK_H
#define DSLOGIC_PV_DATA_DECODERSTACK_H
#ifndef DSVIEW_PV_DATA_DECODERSTACK_H
#define DSVIEW_PV_DATA_DECODERSTACK_H
#include "signaldata.h"
@@ -182,4 +182,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_DECODERSTACK_H
#endif // DSVIEW_PV_DATA_DECODERSTACK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
@@ -29,8 +29,8 @@ using namespace std;
namespace pv {
namespace data {
Dso::Dso(int num_probes) :
SignalData(num_probes)
Dso::Dso() :
SignalData()
{
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
@@ -20,8 +20,8 @@
*/
#ifndef DSLOGIC_PV_DATA_DSO_H
#define DSLOGIC_PV_DATA_DSO_H
#ifndef DSVIEW_PV_DATA_DSO_H
#define DSVIEW_PV_DATA_DSO_H
#include "signaldata.h"
@@ -36,7 +36,7 @@ class DsoSnapshot;
class Dso : public SignalData
{
public:
Dso(int num_probes);
Dso();
void push_snapshot(
boost::shared_ptr<DsoSnapshot> &snapshot);
@@ -53,4 +53,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_DSO_H
#endif // DSVIEW_PV_DATA_DSO_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
@@ -39,18 +39,21 @@ using namespace std;
namespace pv {
namespace data {
const int DsoSnapshot::EnvelopeScalePower = 4;
const int DsoSnapshot::EnvelopeScalePower = 8;
const int DsoSnapshot::EnvelopeScaleFactor = 1 << EnvelopeScalePower;
const float DsoSnapshot::LogEnvelopeScaleFactor =
logf(EnvelopeScaleFactor);
const uint64_t DsoSnapshot::EnvelopeDataUnit = 64*1024; // bytes
const uint64_t DsoSnapshot::EnvelopeDataUnit = 4*1024; // bytes
DsoSnapshot::DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num) :
Snapshot(sizeof(uint16_t), _total_sample_len, channel_num)
DsoSnapshot::DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num, bool instant) :
Snapshot(sizeof(uint16_t), _total_sample_len, channel_num),
_envelope_en(false),
_envelope_done(false),
_instant(instant)
{
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
memset(_envelope_levels, 0, sizeof(_envelope_levels));
init(_total_sample_len * channel_num);
init(_total_sample_len);
append_payload(dso);
}
@@ -64,10 +67,21 @@ DsoSnapshot::~DsoSnapshot()
void DsoSnapshot::append_payload(const sr_datafeed_dso &dso)
{
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
append_data(dso.data, dso.num_samples);
// Generate the first mip-map from the data
append_payload_to_envelope_levels();
if (_channel_num > 0) {
refill_data(dso.data, dso.num_samples, _instant);
// Generate the first mip-map from the data
if (_envelope_en)
append_payload_to_envelope_levels();
}
}
void DsoSnapshot::enable_envelope(bool enable)
{
if (!_envelope_done & enable)
append_payload_to_envelope_levels();
_envelope_en = enable;
}
const uint8_t *DsoSnapshot::get_samples(
@@ -87,7 +101,7 @@ const uint8_t *DsoSnapshot::get_samples(
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
// (end_sample - start_sample));
// return data;
return (uint8_t*)_data + start_sample * _channel_num + index;
return (uint8_t*)_data + start_sample * _channel_num + index * (_channel_num != 1);
}
void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
@@ -108,7 +122,10 @@ void DsoSnapshot::get_envelope_section(EnvelopeSection &s,
s.start = start << scale_power;
s.scale = 1 << scale_power;
s.length = end - start;
//if (_envelope_levels[probe_index][min_level].length < get_sample_count() / EnvelopeScaleFactor)
// s.length = 0;
//else
s.length = end - start;
// s.samples = new EnvelopeSample[s.length];
// memcpy(s.samples, _envelope_levels[min_level].samples + start,
// s.length * sizeof(EnvelopeSample));
@@ -228,6 +245,7 @@ void DsoSnapshot::append_payload_to_envelope_levels()
}
}
}
_envelope_done = true;
}
} // namespace data

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
@@ -20,8 +20,8 @@
*/
#ifndef DSLOGIC_PV_DATA_DSOSNAPSHOT_H
#define DSLOGIC_PV_DATA_DSOSNAPSHOT_H
#ifndef DSVIEW_PV_DATA_DSOSNAPSHOT_H
#define DSVIEW_PV_DATA_DSOSNAPSHOT_H
#include "snapshot.h"
@@ -68,7 +68,7 @@ private:
static const uint64_t EnvelopeDataUnit;
public:
DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num);
DsoSnapshot(const sr_datafeed_dso &dso, uint64_t _total_sample_len, unsigned int channel_num, bool instant);
virtual ~DsoSnapshot();
@@ -80,6 +80,8 @@ public:
void get_envelope_section(EnvelopeSection &s,
uint64_t start, uint64_t end, float min_length, int probe_index) const;
void enable_envelope(bool enable);
private:
void reallocate_envelope(Envelope &l);
@@ -87,6 +89,9 @@ private:
private:
struct Envelope _envelope_levels[2*DS_MAX_DSO_PROBES_NUM][ScaleStepCount];
bool _envelope_en;
bool _envelope_done;
bool _instant;
friend class DsoSnapshotTest::Basic;
};
@@ -94,4 +99,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_DSOSNAPSHOT_H
#endif // DSVIEW_PV_DATA_DSOSNAPSHOT_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_GROUP_H
#define DSLOGIC_PV_DATA_GROUP_H
#ifndef DSVIEW_PV_DATA_GROUP_H
#define DSVIEW_PV_DATA_GROUP_H
#include "signaldata.h"
@@ -54,4 +54,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_GROUP_H
#endif // DSVIEW_PV_DATA_GROUP_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_GROUPSNAPSHOT_H
#define DSLOGIC_PV_DATA_GROUPSNAPSHOT_H
#ifndef DSVIEW_PV_DATA_GROUPSNAPSHOT_H
#define DSVIEW_PV_DATA_GROUPSNAPSHOT_H
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
@@ -110,4 +110,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_GROUPSNAPSHOT_H
#endif // DSVIEW_PV_DATA_GROUPSNAPSHOT_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -30,8 +30,8 @@ using namespace std;
namespace pv {
namespace data {
Logic::Logic(int num_probes) :
SignalData(num_probes)
Logic::Logic() :
SignalData()
{
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_LOGIC_H
#define DSLOGIC_PV_DATA_LOGIC_H
#ifndef DSVIEW_PV_DATA_LOGIC_H
#define DSVIEW_PV_DATA_LOGIC_H
#include "signaldata.h"
@@ -37,9 +37,7 @@ class LogicSnapshot;
class Logic : public SignalData
{
public:
Logic(int num_probes);
int get_num_probes() const;
Logic();
void push_snapshot(
boost::shared_ptr<LogicSnapshot> &snapshot);
@@ -56,4 +54,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_LOGIC_H
#endif // DSVIEW_PV_DATA_LOGIC_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_LOGICSNAPSHOT_H
#define DSLOGIC_PV_DATA_LOGICSNAPSHOT_H
#ifndef DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#define DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#include "snapshot.h"
@@ -119,4 +119,4 @@ private:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_LOGICSNAPSHOT_H
#endif // DSVIEW_PV_DATA_LOGICSNAPSHOT_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -27,12 +27,10 @@
namespace pv {
namespace data {
SignalData::SignalData(int num_probes) :
SignalData::SignalData() :
_samplerate(0),
_start_time(0),
_num_probes(num_probes)
_start_time(0)
{
assert(num_probes >= 0);
}
double SignalData::samplerate() const
@@ -52,16 +50,5 @@ double SignalData::get_start_time() const
return _start_time;
}
int SignalData::get_num_probes() const
{
return _num_probes;
}
void SignalData::set_num_probes(int num)
{
assert(num >= 0);
_num_probes = num;
}
} // namespace data
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DATA_SIGNALDATA_H
#define DSLOGIC_PV_DATA_SIGNALDATA_H
#ifndef DSVIEW_PV_DATA_SIGNALDATA_H
#define DSVIEW_PV_DATA_SIGNALDATA_H
#include <stdint.h>
@@ -32,7 +32,7 @@ namespace data {
class SignalData
{
public:
SignalData(int num_probes = 1);
SignalData();
public:
double samplerate() const;
@@ -42,17 +42,12 @@ public:
double get_start_time() const;
int get_num_probes() const;
void set_num_probes(int num);
protected:
double _samplerate;
double _start_time;
int _num_probes;
};
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_SIGNALDATA_H
#endif // DSVIEW_PV_DATA_SIGNALDATA_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -36,7 +36,7 @@ Snapshot::Snapshot(int unit_size, uint64_t total_sample_count, unsigned int chan
_data(NULL),
_channel_num(channel_num),
_sample_count(0),
_total_sample_count(total_sample_count * channel_num),
_total_sample_count(total_sample_count),
_ring_sample_count(0),
_unit_size(unit_size)
{
@@ -75,7 +75,7 @@ bool Snapshot::buf_null() const
uint64_t Snapshot::get_sample_count() const
{
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
return _sample_count / _channel_num;
return _sample_count;
}
void* Snapshot::get_data() const
@@ -108,7 +108,7 @@ uint64_t Snapshot::get_sample(uint64_t index) const
void Snapshot::append_data(void *data, uint64_t samples)
{
// boost::lock_guard<boost::recursive_mutex> lock(_mutex);
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
// _data = realloc(_data, (_sample_count + samples) * _unit_size +
// sizeof(uint64_t));
if (_sample_count + samples < _total_sample_count)
@@ -129,5 +129,19 @@ void Snapshot::append_data(void *data, uint64_t samples)
}
}
void Snapshot::refill_data(void *data, uint64_t samples, bool instant)
{
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
if (instant) {
memcpy((uint8_t*)_data + _sample_count * _channel_num, data, samples*_channel_num);
_sample_count = (_sample_count + samples) % (_total_sample_count + 1);
} else {
memcpy((uint8_t*)_data, data, samples*_channel_num);
_sample_count = samples;
}
}
} // namespace data
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,10 +21,10 @@
*/
#ifndef DSLOGIC_PV_DATA_SNAPSHOT_H
#define DSLOGIC_PV_DATA_SNAPSHOT_H
#ifndef DSVIEW_PV_DATA_SNAPSHOT_H
#define DSVIEW_PV_DATA_SNAPSHOT_H
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include <boost/thread.hpp>
@@ -54,6 +54,7 @@ public:
protected:
void append_data(void *data, uint64_t samples);
void refill_data(void *data, uint64_t samples, bool instant);
protected:
mutable boost::recursive_mutex _mutex;
@@ -68,4 +69,4 @@ protected:
} // namespace data
} // namespace pv
#endif // DSLOGIC_PV_DATA_SNAPSHOT_H
#endif // DSVIEW_PV_DATA_SNAPSHOT_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -21,7 +21,7 @@
#include <sstream>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include "device.h"

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DEVICE_DEVICE_H
#define DSLOGIC_PV_DEVICE_DEVICE_H
#ifndef DSVIEW_PV_DEVICE_DEVICE_H
#define DSVIEW_PV_DEVICE_DEVICE_H
#include "devinst.h"
@@ -49,4 +49,4 @@ private:
} // device
} // pv
#endif // DSLOGIC_PV_DEVICE_DEVICE_H
#endif // DSVIEW_PV_DEVICE_DEVICE_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -23,7 +23,7 @@
#include <QDebug>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include "devinst.h"

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DEVICE_DEVINST_H
#define DSLOGIC_PV_DEVICE_DEVINST_H
#ifndef DSVIEW_PV_DEVICE_DEVINST_H
#define DSVIEW_PV_DEVICE_DEVINST_H
#include <string>
@@ -129,4 +129,4 @@ protected:
} // device
} // pv
#endif // DSLOGIC_PV_DEVICE_DEVINST_H
#endif // DSVIEW_PV_DEVICE_DEVINST_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -25,7 +25,7 @@
#include <boost/filesystem.hpp>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
using std::string;

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DEVICE_FILE_H
#define DSLOGIC_PV_DEVICE_FILE_H
#ifndef DSVIEW_PV_DEVICE_FILE_H
#define DSVIEW_PV_DEVICE_FILE_H
#include <string>
@@ -47,4 +47,4 @@ protected:
} // device
} // pv
#endif // DSLOGIC_PV_DEVICE_FILE_H
#endif // DSVIEW_PV_DEVICE_FILE_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -27,7 +27,7 @@
#include "inputfile.h"
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
using std::string;

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DEVICE_INPUTFILE_H
#define DSLOGIC_PV_DEVICE_INPUTFILE_H
#ifndef DSVIEW_PV_DEVICE_INPUTFILE_H
#define DSVIEW_PV_DEVICE_INPUTFILE_H
#include "file.h"
@@ -66,4 +66,4 @@ private:
} // device
} // pv
#endif // DSLOGIC_PV_DEVICE_INPUTFILE_H
#endif // DSVIEW_PV_DEVICE_INPUTFILE_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -21,7 +21,7 @@
#include "sessionfile.h"
#include <libsigrok4DSLogic//libsigrok.h>
#include <libsigrok4DSL//libsigrok.h>
namespace pv {
namespace device {

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DEVICE_SESSIONFILE_H
#define DSLOGIC_PV_DEVICE_SESSIONFILE_H
#ifndef DSVIEW_PV_DEVICE_SESSIONFILE_H
#define DSVIEW_PV_DEVICE_SESSIONFILE_H
#include "file.h"
@@ -45,4 +45,4 @@ private:
} // device
} // pv
#endif // DSLOGIC_PV_DEVICE_SESSIONFILE_H
#endif // DSVIEW_PV_DEVICE_SESSIONFILE_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -38,7 +38,7 @@
#include <boost/foreach.hpp>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
using boost::shared_ptr;
using std::list;
@@ -101,8 +101,8 @@ std::list<boost::shared_ptr<device::DevInst> > DeviceManager::driver_scan(
sr_dev_clear(driver);
//release_driver(driver);
// Check If DSLogic driver
if (strcmp(driver->name, "DSLogic") == 0) {
// Check If DSL hardware driver
if (strcmp(driver->name, "demo") != 0) {
QDir dir(QCoreApplication::applicationDirPath());
if (!dir.cd("res"))
return driver_devices;

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DEVICEMANAGER_H
#define DSLOGIC_PV_DEVICEMANAGER_H
#ifndef DSVIEW_PV_DEVICEMANAGER_H
#define DSVIEW_PV_DEVICEMANAGER_H
#include <glib.h>
@@ -85,4 +85,4 @@ private:
} // namespace pv
#endif // DSLOGIC_PV_DEVICEMANAGER_H
#endif // DSVIEW_PV_DEVICEMANAGER_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -29,7 +29,7 @@
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#define __STDC_FORMAT_MACROS
#include <glib.h>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
@@ -47,6 +47,8 @@ About::About(QWidget *parent) :
.arg(QApplication::applicationVersion())
.arg(QApplication::organizationDomain()));
ui->versionInfo->setOpenExternalLinks(true);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
}
About::~About()
@@ -54,5 +56,11 @@ About::~About()
delete ui;
}
void About::accept()
{
using namespace Qt;
QDialog::accept();
}
} // namespace dialogs
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_ABOUT_H
#define DSLOGIC_PV_ABOUT_H
#ifndef DSVIEW_PV_ABOUT_H
#define DSVIEW_PV_ABOUT_H
#include <QDialog>
@@ -43,6 +43,9 @@ public:
explicit About(QWidget *parent = 0);
~About();
protected:
void accept();
private:
Ui::About *ui;
};
@@ -50,4 +53,4 @@ private:
} // namespace dialogs
} // namespace pv
#endif // DSLOGIC_PV_ABOUT_H
#endif // DSVIEW_PV_ABOUT_H

View File

@@ -34,7 +34,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../DSLogic.qrc">:/icons/dsl_logo.png</pixmap>
<pixmap resource="../../DSView.qrc">:/icons/dsl_logo.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -51,12 +51,19 @@
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../DSLogic.qrc"/>
<include location="../../DSView.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -27,6 +27,7 @@
#include <QFormLayout>
#include <QListWidget>
#include <QMessageBox>
#include <pv/prop/property.h>
@@ -36,27 +37,33 @@ using namespace std;
namespace pv {
namespace dialogs {
DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) :
DeviceOptions::DeviceOptions(QWidget *parent, shared_ptr<pv::device::DevInst> dev_inst) :
QDialog(parent),
_sdi(sdi),
_dev_inst(dev_inst),
_layout(this),
_probes_box(tr("Channels"), this),
_props_box(tr("Mode"), this),
_button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this),
_device_options_binding(sdi)
_device_options_binding(_dev_inst->dev_inst())
{
setWindowTitle(tr("Configure Device"));
setLayout(&_layout);
_props_box.setLayout(&_props_box_layout);
_props_box = new QGroupBox(tr("Mode"), this);
_props_box->setLayout(&_props_box_layout);
_props_box_layout.addWidget(get_property_form());
_layout.addWidget(&_props_box);
_layout.addWidget(_props_box);
setup_probes();
_probes_box.setLayout(&_probes_box_layout);
if (_dev_inst->dev_inst()->mode != DSO) {
_probes_box = new QGroupBox(tr("Channels"), this);
setup_probes();
_probes_box->setLayout(&_probes_box_layout);
_layout.addWidget(_probes_box);
} else {
_config_button = new QPushButton(tr("Zero Adjustment"), this);
_layout.addWidget(_config_button);
connect(_config_button, SIGNAL(clicked()), this, SLOT(zero_adj()));
}
_layout.addWidget(&_probes_box);
_layout.addStretch(1);
_layout.addWidget(&_button_box);
@@ -79,13 +86,15 @@ void DeviceOptions::accept()
}
// Commit the probes
int index = 0;
for (const GSList *l = _sdi->channels; l; l = l->next) {
sr_channel *const probe = (sr_channel*)l->data;
assert(probe);
if (_dev_inst->dev_inst()->mode != DSO) {
int index = 0;
for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) {
sr_channel *const probe = (sr_channel*)l->data;
assert(probe);
probe->enabled = (_probes_checkBox_list.at(index)->checkState() == Qt::Checked);
index++;
probe->enabled = (_probes_checkBox_list.at(index)->checkState() == Qt::Checked);
index++;
}
}
}
@@ -131,7 +140,7 @@ void DeviceOptions::setup_probes()
_probes_label_list.clear();
_probes_checkBox_list.clear();
for (const GSList *l = _sdi->channels; l; l = l->next) {
for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) {
sr_channel *const probe = (sr_channel*)l->data;
assert(probe);
@@ -179,5 +188,23 @@ void DeviceOptions::disable_all_probes()
set_all_probes(false);
}
void DeviceOptions::zero_adj()
{
using namespace Qt;
QDialog::reject();
QMessageBox msg(this);
msg.setText("Information");
msg.setInformativeText("Zero adjustment program will be started. This may take a few minutes!");
//msg.setStandardButtons(QMessageBox::);
msg.addButton(tr("Ok"), QMessageBox::AcceptRole);
msg.addButton(tr("Cancel"), QMessageBox::RejectRole);
msg.setIcon(QMessageBox::Information);
int ret = msg.exec();
if ( ret == QMessageBox::AcceptRole) {
_dev_inst->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(true));
}
}
} // namespace dialogs
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DEVICEOPTIONS_H
#define DSLOGIC_PV_DEVICEOPTIONS_H
#ifndef DSVIEW_PV_DEVICEOPTIONS_H
#define DSVIEW_PV_DEVICEOPTIONS_H
#include <QDialog>
#include <QDialogButtonBox>
@@ -37,6 +37,9 @@
#include <QComboBox>
#include <QRadioButton>
#include <boost/shared_ptr.hpp>
#include <pv/device/devinst.h>
#include <pv/prop/binding/deviceoptions.h>
namespace pv {
@@ -47,7 +50,7 @@ class DeviceOptions : public QDialog
Q_OBJECT
public:
DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi);
DeviceOptions(QWidget *parent, boost::shared_ptr<pv::device::DevInst> dev_inst);
protected:
void accept();
@@ -64,19 +67,21 @@ private:
private slots:
void enable_all_probes();
void disable_all_probes();
void zero_adj();
private:
struct sr_dev_inst *const _sdi;
boost::shared_ptr<pv::device::DevInst> _dev_inst;
QVBoxLayout _layout;
QGroupBox _probes_box;
QGroupBox *_probes_box;
QGridLayout _probes_box_layout;
QVector <QLabel *> _probes_label_list;
QVector <QCheckBox *> _probes_checkBox_list;
QGroupBox _props_box;
QGroupBox *_props_box;
QVBoxLayout _props_box_layout;
QPushButton *_config_button;
QDialogButtonBox _button_box;
pv::prop::binding::DeviceOptions _device_options_binding;
@@ -85,4 +90,4 @@ private:
} // namespace dialogs
} // namespace pv
#endif // DSLOGIC_PV_DEVICEOPTIONS_H
#endif // DSVIEW_PV_DEVICEOPTIONS_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_SEARCH_H
#define DSLOGIC_PV_SEARCH_H
#ifndef DSVIEW_PV_SEARCH_H
#define DSVIEW_PV_SEARCH_H
#include <QDialog>
#include <QLabel>
@@ -31,7 +31,7 @@
#include <QGridLayout>
#include <QDialogButtonBox>
#include "../sigsession.h"
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
namespace dialogs {
@@ -63,4 +63,4 @@ private:
} // namespace decoder
} // namespace pv
#endif // DSLOGIC_PV_SEARCH_H
#endif // DSVIEW_PV_SEARCH_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_DIALOGS_SAVEPROGRESS_H
#define DSLOGIC_PV_DIALOGS_SAVEPROGRESS_H
#ifndef DSVIEW_PV_DIALOGS_SAVEPROGRESS_H
#define DSVIEW_PV_DIALOGS_SAVEPROGRESS_H
#include <set>

View File

@@ -0,0 +1,107 @@
/*
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "streamoptions.h"
#include <boost/foreach.hpp>
#include <QFormLayout>
#include <QListWidget>
#include <QMessageBox>
#include <pv/prop/property.h>
using namespace boost;
using namespace std;
namespace pv {
namespace dialogs {
StreamOptions::StreamOptions(QWidget *parent, shared_ptr<pv::device::DevInst> dev_inst,
uint64_t sample_count, bool stream) :
QDialog(parent),
_dev_inst(dev_inst),
_sample_count(sample_count),
_layout(this),
_stream(stream),
_button_box(QDialogButtonBox::Ok,
Qt::Horizontal, this)
{
setWindowTitle(tr("Stream Mode Options"));
setLayout(&_layout);
QLabel *_info = new QLabel(this);
if (_stream)
_info->setText("Stream Mode Active!");
else
_info->setText("Buffer Mode Active!");
_layout.addWidget(_info);
if (_stream) {
_op0 = new QRadioButton(this);
_op1 = new QRadioButton(this);
_op0->setText("16 Channels, Max 10MHz sample rate");
_op1->setText(" 8 Channels, Max 25MHz sample rate");
_layout.addWidget(_op0);
_layout.addWidget(_op1);
if (_sample_count >= SR_GB(1)) {
_op0->setDisabled(true);
_op1->setChecked(true);
}else{
_op0->setChecked(true);
}
}
_layout.addWidget(&_button_box);
connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
connect(&_button_box, SIGNAL(rejected()), this, SLOT(accept()));
}
void StreamOptions::accept()
{
using namespace Qt;
uint64_t sample_rate = _dev_inst->get_sample_rate();
if (_stream) {
if (_op0->isChecked())
sample_rate = (sample_rate <= SR_MHZ(10)) ? sample_rate : SR_MHZ(10);
else if (_op1->isChecked())
sample_rate = (sample_rate > SR_MHZ(10) && sample_rate <= SR_MHZ(25)) ? sample_rate : SR_MHZ(25);
}
_dev_inst->set_config(NULL, NULL,
SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate));
QDialog::accept();
}
void StreamOptions::reject()
{
accept();
}
} // namespace dialogs
} // namespace pv

View File

@@ -0,0 +1,76 @@
/*
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSVIEW_PV_STREAMOPTIONS_H
#define DSVIEW_PV_STREAMOPTIONS_H
#include <QDialog>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QPushButton>
#include <QVector>
#include <QLabel>
#include <QCheckBox>
#include <QComboBox>
#include <QRadioButton>
#include <boost/shared_ptr.hpp>
#include <pv/device/devinst.h>
#include <pv/prop/binding/deviceoptions.h>
namespace pv {
namespace dialogs {
class StreamOptions : public QDialog
{
Q_OBJECT
public:
StreamOptions(QWidget *parent, boost::shared_ptr<pv::device::DevInst> dev_inst,
uint64_t sample_count, bool stream);
protected:
void accept();
void reject();
private:
boost::shared_ptr<pv::device::DevInst> _dev_inst;
uint64_t _sample_count;
QVBoxLayout _layout;
QRadioButton * _op0;
QRadioButton * _op1;
bool _stream;
QDialogButtonBox _button_box;
};
} // namespace dialogs
} // namespace pv
#endif // DSVIEW_PV_STREAMOPTIONS_H

View File

@@ -0,0 +1,132 @@
/*
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "waitingdialog.h"
#include <boost/foreach.hpp>
#include <QMovie>
#include <QAbstractButton>
#include "libsigrok4DSL/libsigrok.h"
#include "../view/trace.h"
using namespace boost;
using namespace std;
namespace pv {
namespace dialogs {
const QString WaitingDialog::TIPS_INFO = "Waiting";
WaitingDialog::WaitingDialog(QWidget *parent, shared_ptr<pv::device::DevInst> dev_inst) :
QDialog(parent),
_dev_inst(dev_inst),
_button_box(QDialogButtonBox::Save | QDialogButtonBox::Abort,
Qt::Horizontal, this)
{
this->setFixedSize((GIF_SIZE+TIP_WIDTH)*2, (GIF_SIZE+TIP_HEIGHT)*2);
int midx = this->width() / 2;
int midy = this->height() / 2;
this->setWindowOpacity(0.6);
this->setStyleSheet("background-color: rgb(255, 255, 255);");
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
label = new QLabel(this);
label->setStyleSheet("background-color: transparent;");
label->setGeometry(midx-GIF_SIZE/2, midy-GIF_SIZE/2, GIF_SIZE, GIF_SIZE);
movie = new QMovie(":/icons/wait.gif");
label->setMovie(movie);
tips = new QLabel(this);
tips->setText(TIPS_INFO);
tips->setStyleSheet("color: rgb(17, 133, 209); background-color: transparent;");
QFont font;
font.setPointSize(10);
font.setBold(true);
tips->setFont(font);
tips->setGeometry(midx-TIP_WIDTH/2, midy+GIF_SIZE/2, TIP_WIDTH, TIP_HEIGHT);
index = 0;
timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(changeText()));
QString styleSheet = "* {color: rgb(255, 255, 255); background-color: rgb(17, 133, 209);} *:hover {background-color: rgb(238, 178, 17);}";
_button_box.setStyleSheet(styleSheet);
_button_box.setGeometry(width()-_button_box.width()-30, height()-_button_box.height()-15,
_button_box.width(), _button_box.height());
connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept()));
connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject()));
_button_box.buttons().front()->setVisible(false);
}
void WaitingDialog::accept()
{
using namespace Qt;
movie->stop();
timer->stop();
_dev_inst->set_config(NULL, NULL, SR_CONF_ZERO_SET, g_variant_new_boolean(true));
QDialog::accept();
}
void WaitingDialog::reject()
{
using namespace Qt;
movie->stop();
timer->stop();
QDialog::reject();
}
void WaitingDialog::start()
{
movie->start();
timer->start(300);
this->exec();
}
void WaitingDialog::changeText()
{
sr_status status;
index++;
if(index == WPOINTS_NUM + 1)
{
tips->setText(TIPS_INFO);
index = 0;
sr_status_get(_dev_inst->dev_inst(), &status, 0, 0);
if (!status.zeroing) {
movie->stop();
movie->jumpToFrame(0);
timer->stop();
tips->setText("");
_button_box.buttons().front()->setVisible(true);
}
} else {
tips->setText(tips->text()+".");
}
}
} // namespace dialogs
} // namespace pv

View File

@@ -0,0 +1,77 @@
/*
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSVIEW_PV_WAITINGDIALOG_H
#define DSVIEW_PV_WAITINGDIALOG_H
#include <QDialog>
#include <QDialogButtonBox>
#include <QTimer>
#include <QLabel>
#include <QMovie>
#include <boost/shared_ptr.hpp>
#include <pv/device/devinst.h>
namespace pv {
namespace dialogs {
class WaitingDialog : public QDialog
{
Q_OBJECT
private:
static const int GIF_SIZE = 80;
static const int TIP_WIDTH = 100;
static const int TIP_HEIGHT = 40;
static const int WPOINTS_NUM = 6;
static const QString TIPS_INFO;
public:
WaitingDialog(QWidget *parent, boost::shared_ptr<pv::device::DevInst> dev_inst);
void start();
protected:
void accept();
void reject();
private slots:
void changeText();
private:
boost::shared_ptr<pv::device::DevInst> _dev_inst;
QDialogButtonBox _button_box;
int index;
QLabel *label;
QMovie *movie;
QTimer *timer;
QLabel *tips;
};
} // namespace dialogs
} // namespace pv
#endif // DSVIEW_PV_WAITINGDIALOG_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -36,7 +36,7 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "libsigrok4DSLogic/libsigrok.h"
#include "libsigrok4DSL/libsigrok.h"
namespace pv {
namespace dock {
@@ -200,5 +200,33 @@ void DsoTriggerDock::device_change()
}
}
void DsoTriggerDock::init()
{
// TRIGGERPOS
GVariant* gvar = _session.get_device()->get_config(NULL, NULL,
SR_CONF_HORIZ_TRIGGERPOS);
if (gvar != NULL) {
uint16_t pos = g_variant_get_uint16(gvar);
g_variant_unref(gvar);
position_slider->setValue(pos);
}
gvar = _session.get_device()->get_config(NULL, NULL,
SR_CONF_TRIGGER_SOURCE);
if (gvar != NULL) {
uint8_t src = g_variant_get_byte(gvar);
g_variant_unref(gvar);
source_group->button(src)->setChecked(true);
}
gvar = _session.get_device()->get_config(NULL, NULL,
SR_CONF_TRIGGER_SLOPE);
if (gvar != NULL) {
uint8_t slope = g_variant_get_uint16(gvar);
g_variant_unref(gvar);
type_group->button(slope)->setChecked(true);
}
}
} // namespace dock
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_DSOTRIGGERDOCK_H
#define DSLOGIC_PV_DSOTRIGGERDOCK_H
#ifndef DSVIEW_PV_DSOTRIGGERDOCK_H
#define DSVIEW_PV_DSOTRIGGERDOCK_H
#include <QDockWidget>
#include <QSlider>
@@ -31,7 +31,7 @@
#include <vector>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
@@ -51,6 +51,8 @@ public:
void device_change();
void init();
signals:
void set_trig_pos(quint64 trig_pos);
@@ -74,4 +76,4 @@ private:
} // namespace dock
} // namespace pv
#endif // DSLOGIC_PV_DSOTRIGGERDOCK_H
#endif // DSVIEW_PV_DSOTRIGGERDOCK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -36,7 +36,7 @@
#include <QPainter>
#include <QRegExpValidator>
#include "libsigrok4DSLogic/libsigrok.h"
#include "libsigrok4DSL/libsigrok.h"
using boost::shared_ptr;
@@ -64,7 +64,7 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_mouse_layout->addWidget(_width_label, 1, 1);
_mouse_layout->addWidget(new QLabel("Period: ", this), 2, 0);
_mouse_layout->addWidget(_period_label, 2, 1);
_mouse_layout->addWidget(new QLabel("Freqency: ", this), 3, 0);
_mouse_layout->addWidget(new QLabel("Frequency: ", this), 3, 0);
_mouse_layout->addWidget(_freq_label, 3, 1);
_mouse_layout->addWidget(new QLabel(this), 0, 2);
_mouse_layout->addWidget(new QLabel(this), 1, 2);

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_MEASUREDOCK_H
#define DSLOGIC_PV_MEASUREDOCK_H
#ifndef DSVIEW_PV_MEASUREDOCK_H
#define DSVIEW_PV_MEASUREDOCK_H
#include <QDockWidget>
#include <QPushButton>
@@ -43,7 +43,7 @@
#include <vector>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
@@ -110,4 +110,4 @@ private:
} // namespace dock
} // namespace pv
#endif // DSLOGIC_PV_MEASUREDOCK_H
#endif // DSVIEW_PV_MEASUREDOCK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROTOCOLDOCK_H
#define DSLOGIC_PV_PROTOCOLDOCK_H
#ifndef DSVIEW_PV_PROTOCOLDOCK_H
#define DSVIEW_PV_PROTOCOLDOCK_H
#include <libsigrokdecode/libsigrokdecode.h>
@@ -36,7 +36,7 @@
#include <vector>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
@@ -83,4 +83,4 @@ private:
} // namespace dock
} // namespace pv
#endif // DSLOGIC_PV_PROTOCOLDOCK_H
#endif // DSVIEW_PV_PROTOCOLDOCK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_SEARCHDOCK_H
#define DSLOGIC_PV_SEARCHDOCK_H
#ifndef DSVIEW_PV_SEARCHDOCK_H
#define DSVIEW_PV_SEARCHDOCK_H
#include <QDockWidget>
#include <QPushButton>
@@ -43,7 +43,7 @@
#include <vector>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include "../widgets/fakelineedit.h"
@@ -96,4 +96,4 @@ private:
} // namespace dock
} // namespace pv
#endif // DSLOGIC_PV_SEARCHDOCK_H
#endif // DSVIEW_PV_SEARCHDOCK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -32,7 +32,7 @@
#include <QRegExpValidator>
#include <QMessageBox>
#include "libsigrok4DSLogic/libsigrok.h"
#include "libsigrok4DSL/libsigrok.h"
namespace pv {
namespace dock {
@@ -53,10 +53,10 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
position_label = new QLabel("Trigger Position: ", this);
position_spinBox = new QSpinBox(this);
position_spinBox->setRange(0, 100);
position_spinBox->setRange(0, 99);
position_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
position_slider = new QSlider(Qt::Horizontal, this);
position_slider->setRange(0, 100);
position_slider->setRange(0, 99);
connect(position_slider, SIGNAL(valueChanged(int)), position_spinBox, SLOT(setValue(int)));
connect(position_spinBox, SIGNAL(valueChanged(int)), position_slider, SLOT(setValue(int)));
@@ -86,6 +86,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
_value0_lineEdit->setValidator(value_validator);
_value0_lineEdit->setMaxLength(TriggerProbes * 2 - 1);
_value0_lineEdit->setInputMask("X X X X X X X X X X X X X X X X");
_value0_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
_value0_lineEdit_list.push_back(_value0_lineEdit);
QSpinBox *_count0_spinBox = new QSpinBox(this);
_count0_spinBox->setRange(1, 1 << TriggerCountBits);
@@ -101,6 +102,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
_value1_lineEdit->setValidator(value_validator);
_value1_lineEdit->setMaxLength(TriggerProbes * 2 - 1);
_value1_lineEdit->setInputMask("X X X X X X X X X X X X X X X X");
_value1_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
_value1_lineEdit_list.push_back(_value1_lineEdit);
QSpinBox *_count1_spinBox = new QSpinBox(this);
_count1_spinBox->setRange(1, 1 << TriggerCountBits);
@@ -129,7 +131,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
stage_glayout->addWidget(_inv1_comboBox, 3, 1);
stage_glayout->addWidget(_count1_spinBox, 3, 2);
stage_layout->addLayout(stage_glayout);
stage_layout->addSpacing(160);
stage_layout->addSpacing(100);
stage_layout->addWidget(new QLabel("X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge"));
stage_layout->addStretch(1);
@@ -211,9 +213,25 @@ void TriggerDock::simple_trigger()
void TriggerDock::adv_trigger()
{
if (strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") == 0) {
widget_enable();
ds_trigger_set_mode(ADV_TRIGGER);
_session.set_adv_trigger(true);
bool stream = false;
GVariant *gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
if (gvar != NULL) {
stream = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
}
if (stream) {
QMessageBox msg(this);
msg.setText("Trigger");
msg.setInformativeText("Stram Mode Don't Support Advanced Trigger!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
simple_radioButton->setChecked(true);
} else {
widget_enable();
ds_trigger_set_mode(ADV_TRIGGER);
_session.set_adv_trigger(true);
}
} else {
QMessageBox msg(this);
msg.setText("Trigger");
@@ -342,7 +360,15 @@ void TriggerDock::pos_changed(int pos)
void TriggerDock::device_change()
{
if (strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") != 0) {
bool stream = false;
GVariant *gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
if (gvar != NULL) {
stream = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
}
if (stream ||
strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") != 0) {
position_spinBox->setDisabled(true);
position_slider->setDisabled(true);
} else {
@@ -351,5 +377,12 @@ void TriggerDock::device_change()
}
}
void TriggerDock::init()
{
// TRIGGERPOS
//uint16_t pos = ds_trigger_get_pos();
//position_slider->setValue(pos);
}
} // namespace dock
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_TRIGGERDOCK_H
#define DSLOGIC_PV_TRIGGERDOCK_H
#ifndef DSVIEW_PV_TRIGGERDOCK_H
#define DSVIEW_PV_TRIGGERDOCK_H
#include <QDockWidget>
#include <QPushButton>
@@ -41,7 +41,7 @@
#include <vector>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
namespace pv {
@@ -61,6 +61,8 @@ public:
void device_change();
void init();
signals:
private slots:
@@ -107,4 +109,4 @@ private:
} // namespace dock
} // namespace pv
#endif // DSLOGIC_PV_TRIGGERDOCK_H
#endif // DSVIEW_PV_TRIGGERDOCK_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -53,7 +53,9 @@
#include "device/file.h"
#include "dialogs/about.h"
#include "dialogs/deviceoptions.h"
#include "dialogs/storeprogress.h"
#include "dialogs/waitingdialog.h"
#include "toolbars/samplingbar.h"
#include "toolbars/trigbar.h"
@@ -77,7 +79,7 @@
#include <stdarg.h>
#include <glib.h>
#include <list>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
@@ -100,6 +102,9 @@ MainWindow::MainWindow(DeviceManager &device_manager,
Qt::QueuedConnection,
Q_ARG(QString, s));
}
test_timer_linked = false;
test_timer.stop();
test_timer.setSingleShot(true);
}
void MainWindow::setup_ui()
@@ -170,7 +175,7 @@ void MainWindow::setup_ui()
// Setup _view widget
_view = new pv::view::View(_session, this);
_view = new pv::view::View(_session, _sampling_bar, this);
_vertical_layout->addWidget(_view);
connect(_sampling_bar, SIGNAL(device_selected()), this,
@@ -182,7 +187,7 @@ void MainWindow::setup_ui()
connect(_sampling_bar, SIGNAL(instant_stop()), this,
SLOT(instant_stop()));
connect(_sampling_bar, SIGNAL(update_scale()), _view,
SLOT(update_scale()));
SLOT(update_scale()), Qt::DirectConnection);
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(quint64)), _view,
SLOT(set_trig_pos(quint64)));
@@ -218,7 +223,9 @@ void MainWindow::setup_ui()
addDockWidget(Qt::BottomDockWidgetArea, _search_dock);
// Set the title
setWindowTitle(QApplication::translate("MainWindow", "DSLogic(Beta)", 0,
QString title = QApplication::applicationName()+" v"+QApplication::applicationVersion();
std::string std_title = title.toStdString();
setWindowTitle(QApplication::translate("MainWindow", std_title.c_str(), 0,
QApplication::UnicodeUTF8));
// Setup _session events
@@ -230,8 +237,8 @@ void MainWindow::setup_ui()
SLOT(device_detach()));
connect(&_session, SIGNAL(test_data_error()), this,
SLOT(test_data_error()));
connect(&_session, SIGNAL(sample_rate_changed(uint64_t)), _sampling_bar,
SLOT(set_sample_rate(uint64_t)));
connect(&_session, SIGNAL(malloc_error()), this,
SLOT(malloc_error()));
connect(_view, SIGNAL(cursor_update()), _measure_widget,
SLOT(cursor_update()));
@@ -257,7 +264,8 @@ void MainWindow::setup_ui()
_search_dock->installEventFilter(this);
// Populate the device list and select the initially selected device
_session.set_default_device();
_session.set_default_device(boost::bind(&MainWindow::session_error, this,
QString("Set Default Device failed"), _1));
update_device_list();
_session.start_hotplug_proc(boost::bind(&MainWindow::session_error, this,
QString("Hotplug failed"), _1));
@@ -282,7 +290,11 @@ void MainWindow::update_device_list()
#endif
_trig_bar->close_all();
if (_session.get_device()->dev_inst()->mode == LOGIC) {
_trig_bar->enable_protocol(true);
} else {
_trig_bar->enable_protocol(false);
}
if (_session.get_device()->dev_inst()->mode == DSO) {
_sampling_bar->enable_toggle(false);
} else {
@@ -302,10 +314,10 @@ void MainWindow::update_device_list()
errorMessage, infoMessage));
}
if (strcmp(selected_device->dev_inst()->driver->name, "DSLogic") == 0)
_logo_bar->dslogic_connected(true);
if (strcmp(selected_device->dev_inst()->driver->name, "demo") != 0)
_logo_bar->dsl_connected(true);
else
_logo_bar->dslogic_connected(false);
_logo_bar->dsl_connected(false);
}
void MainWindow::load_file(QString file_name)
@@ -314,7 +326,8 @@ void MainWindow::load_file(QString file_name)
_session.set_file(file_name.toStdString());
} catch(QString e) {
show_session_error(tr("Failed to load ") + file_name, e);
_session.set_default_device();
_session.set_default_device(boost::bind(&MainWindow::session_error, this,
QString("Set Default Device failed"), _1));
update_device_list();
return;
}
@@ -342,12 +355,12 @@ void MainWindow::device_attach()
struct sr_dev_driver **const drivers = sr_driver_list();
struct sr_dev_driver **driver;
for (driver = drivers; strcmp(((struct sr_dev_driver *)*driver)->name, "DSLogic") != 0 && *driver; driver++);
for (driver = drivers; *driver; driver++)
if (*driver)
_device_manager.driver_scan(*driver);
if (*driver)
_device_manager.driver_scan(*driver);
_session.set_default_device();
_session.set_default_device(boost::bind(&MainWindow::session_error, this,
QString("Set Default Device failed"), _1));
update_device_list();
}
@@ -360,44 +373,52 @@ void MainWindow::device_detach()
struct sr_dev_driver **const drivers = sr_driver_list();
struct sr_dev_driver **driver;
for (driver = drivers; strcmp(((struct sr_dev_driver *)*driver)->name, "DSLogic") != 0 && *driver; driver++);
for (driver = drivers; *driver; driver++)
if (*driver)
_device_manager.driver_scan(*driver);
if (*driver)
_device_manager.driver_scan(*driver);
_session.set_default_device();
_session.set_default_device(boost::bind(&MainWindow::session_error, this,
QString("Set Default Device failed"), _1));
update_device_list();
}
void MainWindow::run_stop()
{
_sampling_bar->enable_run_stop(false);
_sampling_bar->enable_instant(false);
#ifdef TEST_MODE
if (!test_timer_linked) {
connect(&test_timer, SIGNAL(timeout()),
this, SLOT(run_stop()));
test_timer_linked = true;
}
#endif
switch(_session.get_capture_state()) {
case SigSession::Init:
case SigSession::Stopped:
_view->show_trig_cursor(false);
_view->update_sample(false);
_session.start_capture(false,
boost::bind(&MainWindow::session_error, this,
QString("Capture failed"), _1));
break;
break;
case SigSession::Running:
_session.stop_capture();
break;
}
g_usleep(1000);
_sampling_bar->enable_run_stop(true);
}
void MainWindow::instant_stop()
{
_sampling_bar->enable_instant(false);
_sampling_bar->enable_run_stop(false);
#ifdef TEST_MODE
disconnect(&test_timer, SIGNAL(timeout()),
this, SLOT(run_stop()));
test_timer_linked = false;
#else
switch(_session.get_capture_state()) {
case SigSession::Init:
case SigSession::Stopped:
_view->show_trig_cursor(false);
_view->update_sample(true);
_session.start_capture(true,
boost::bind(&MainWindow::session_error, this,
QString("Capture failed"), _1));
@@ -407,12 +428,16 @@ void MainWindow::instant_stop()
_session.stop_capture();
break;
}
g_usleep(1000);
_sampling_bar->enable_instant(true);
#endif
}
void MainWindow::test_data_error()
{
#ifdef TEST_MODE
disconnect(&test_timer, SIGNAL(timeout()),
this, SLOT(run_stop()));
test_timer_linked = false;
#endif
_session.stop_capture();
QMessageBox msg(this);
msg.setText("Data Error");
@@ -422,31 +447,51 @@ void MainWindow::test_data_error()
msg.exec();
}
void MainWindow::malloc_error()
{
_session.stop_capture();
QMessageBox msg(this);
msg.setText("Malloc Error");
msg.setInformativeText("Memory is not enough for this sample!\nPlease reduce the sample depth!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
}
void MainWindow::capture_state_changed(int state)
{
_file_bar->enable_toggle(state != SigSession::Running);
_sampling_bar->set_sampling(state == SigSession::Running);
_view->on_state_changed(state != SigSession::Running);
if (_session.get_device()->dev_inst()->mode != DSO) {
_sampling_bar->enable_toggle(state != SigSession::Running);
_trig_bar->enable_toggle(state != SigSession::Running);
_measure_dock->widget()->setEnabled(state != SigSession::Running);
#ifdef TEST_MODE
if (state == SigSession::Stopped) {
test_timer.start(100);
}
#endif
}
_file_bar->enable_toggle(state != SigSession::Running);
_sampling_bar->set_sampling(state == SigSession::Running);
_view->on_state_changed(state != SigSession::Running);
}
void MainWindow::on_protocol(bool visible)
{
#ifdef ENABLE_DECODE
_protocol_dock->setVisible(visible);
if (_session.get_device()->dev_inst()->mode == LOGIC)
_protocol_dock->setVisible(visible);
#endif
}
void MainWindow::on_trigger(bool visible)
{
if (_session.get_device()->dev_inst()->mode != DSO) {
_trigger_widget->init();
_trigger_dock->setVisible(visible);
_dso_trigger_dock->setVisible(false);
} else {
_dso_trigger_widget->init();
_trigger_dock->setVisible(false);
_dso_trigger_dock->setVisible(visible);
}
@@ -489,7 +534,7 @@ void MainWindow::on_save()
// Show the dialog
const QString file_name = QFileDialog::getSaveFileName(
this, tr("Save File"), "", tr("DSLogic Sessions (*.dsl)"));
this, tr("Save File"), "", tr("DSView Sessions (*.dsl)"));
if (file_name.isEmpty())
return;
@@ -537,11 +582,11 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
break;
case Qt::Key_PageUp:
_view->set_scale_offset(_view->scale(),
_view->offset() - _view->scale()*_view->viewport()->width());
_view->offset() - _view->scale()*_view->get_view_width());
break;
case Qt::Key_PageDown:
_view->set_scale_offset(_view->scale(),
_view->offset() + _view->scale()*_view->viewport()->width());
_view->offset() + _view->scale()*_view->get_view_width());
break;
case Qt::Key_Left:
@@ -550,6 +595,32 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
case Qt::Key_Right:
_view->zoom(-1);
break;
case Qt::Key_0:
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
shared_ptr<view::DsoSignal> dsoSig;
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
if (dsoSig->get_index() == 0)
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
else
dsoSig->set_vDialActive(false);
}
}
_view->setFocus();
update();
break;
case Qt::Key_1:
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
shared_ptr<view::DsoSignal> dsoSig;
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
if (dsoSig->get_index() == 1)
dsoSig->set_vDialActive(!dsoSig->get_vDialActive());
else
dsoSig->set_vDialActive(false);
}
}
_view->setFocus();
update();
break;
case Qt::Key_Up:
BOOST_FOREACH(const shared_ptr<view::Signal> s, sigs) {
shared_ptr<view::DsoSignal> dsoSig;

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,12 +21,13 @@
*/
#ifndef DSLOGIC_PV_MAINWINDOW_H
#define DSLOGIC_PV_MAINWINDOW_H
#ifndef DSVIEW_PV_MAINWINDOW_H
#define DSVIEW_PV_MAINWINDOW_H
#include <list>
#include <QMainWindow>
#include <QTimer>
#include "sigsession.h"
@@ -98,6 +99,8 @@ private slots:
void test_data_error();
void malloc_error();
void capture_state_changed(int state);
void on_protocol(bool visible);
@@ -159,8 +162,11 @@ private:
QDockWidget *_measure_dock;
QDockWidget *_search_dock;
dock::SearchDock * _search_widget;
QTimer test_timer;
bool test_timer_linked;
};
} // namespace pv
#endif // DSLOGIC_PV_MAINWINDOW_H
#endif // DSVIEW_PV_MAINWINDOW_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_BINDING_BINDING_H
#define DSLOGIC_PV_PROP_BINDING_BINDING_H
#ifndef DSVIEW_PV_PROP_BINDING_BINDING_H
#define DSVIEW_PV_PROP_BINDING_BINDING_H
#include <glib.h>
@@ -66,4 +66,4 @@ protected:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_BINDING_BINDING_H
#endif // DSVIEW_PV_PROP_BINDING_BINDING_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -87,15 +87,23 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
case SR_CONF_OPERATION_MODE:
case SR_CONF_THRESHOLD:
case SR_CONF_ZERO:
case SR_CONF_STREAM:
case SR_CONF_TEST:
case SR_CONF_STATUS:
bind_enum(name, key, gvar_list);
break;
case SR_CONF_VTH:
bind_double(name, key, "V", pair<double, double>(0.0, 5.0), 1, 0.1);
break;
case SR_CONF_RLE:
bind_bool(name, key);
break;
case SR_CONF_CLOCK_TYPE:
case SR_CONF_CLOCK_EDGE:
case SR_CONF_INSTANT:
bind_bool(name, key);
break;
@@ -170,6 +178,16 @@ void DeviceOptions::bind_int(const QString &name, int key, QString suffix,
bind(config_setter, _sdi, key, _1))));
}
void DeviceOptions::bind_double(const QString &name, int key, QString suffix,
optional< std::pair<double, double> > range,
int decimals, boost::optional<double> step)
{
_properties.push_back(boost::shared_ptr<Property>(
new Double(name, decimals, suffix, range, step,
bind(config_getter, _sdi, key),
bind(config_setter, _sdi, key, _1))));
}
QString DeviceOptions::print_gvariant(GVariant *const gvar)
{
QString s;

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_PROP_BINDING_DECODEROPTIONS_H
#define DSLOGIC_PV_PROP_BINDING_DECODEROPTIONS_H
#ifndef DSVIEW_PV_PROP_BINDING_DECODEROPTIONS_H
#define DSVIEW_PV_PROP_BINDING_DECODEROPTIONS_H
#include "binding.h"
@@ -63,4 +63,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_BINDING_DECODEROPTIONS_H
#endif // DSVIEW_PV_PROP_BINDING_DECODEROPTIONS_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,15 +21,15 @@
*/
#ifndef DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H
#define DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H
#ifndef DSVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
#define DSVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
#include <boost/function.hpp>
#include <boost/optional.hpp>
#include <QString>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include "binding.h"
@@ -56,6 +56,10 @@ private:
void bind_int(const QString &name, int key, QString suffix,
boost::optional< std::pair<int64_t, int64_t> > range);
void bind_double(const QString &name, int key, QString suffix,
boost::optional<std::pair<double, double> > range,
int decimals, boost::optional<double> step);
static QString print_gvariant(GVariant *const gvar);
void bind_samplerate(const QString &name,
@@ -77,4 +81,4 @@ protected:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H
#endif // DSVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_BOOL_H
#define DSLOGIC_PV_PROP_BOOL_H
#ifndef DSVIEW_PV_PROP_BOOL_H
#define DSVIEW_PV_PROP_BOOL_H
#include "property.h"
@@ -55,4 +55,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_BOOL_H
#endif // DSVIEW_PV_PROP_BOOL_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_DOUBLE_H
#define DSLOGIC_PV_PROP_DOUBLE_H
#ifndef DSVIEW_PV_PROP_DOUBLE_H
#define DSVIEW_PV_PROP_DOUBLE_H
#include <utility>
@@ -67,4 +67,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_DOUBLE_H
#endif // DSVIEW_PV_PROP_DOUBLE_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_ENUM_H
#define DSLOGIC_PV_PROP_ENUM_H
#ifndef DSVIEW_PV_PROP_ENUM_H
#define DSVIEW_PV_PROP_ENUM_H
#include <utility>
#include <vector>
@@ -60,4 +60,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_ENUM_H
#endif // DSVIEW_PV_PROP_ENUM_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_INT_H
#define DSLOGIC_PV_PROP_INT_H
#ifndef DSVIEW_PV_PROP_INT_H
#define DSVIEW_PV_PROP_INT_H
#include <utility>
@@ -64,4 +64,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_INT_H
#endif // DSVIEW_PV_PROP_INT_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_PROP_PROPERTY_H
#define DSLOGIC_PV_PROP_PROPERTY_H
#ifndef DSVIEW_PV_PROP_PROPERTY_H
#define DSVIEW_PV_PROP_PROPERTY_H
#include <glib.h>
@@ -67,4 +67,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_PROPERTY_H
#endif // DSVIEW_PV_PROP_PROPERTY_H

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_PROP_STRING_H
#define DSLOGIC_PV_PROP_STRING_H
#ifndef DSVIEW_PV_PROP_STRING_H
#define DSVIEW_PV_PROP_STRING_H
#include "property.h"
@@ -49,4 +49,4 @@ private:
} // prop
} // pv
#endif // DSLOGIC_PV_PROP_STRING_H
#endif // DSVIEW_PV_PROP_STRING_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -72,15 +72,13 @@ using std::min;
namespace pv {
const float SigSession::Oversampling = 2.0f;
// TODO: This should not be necessary
SigSession* SigSession::_session = NULL;
SigSession::SigSession(DeviceManager &device_manager) :
_device_manager(device_manager),
_capture_state(Init),
_instant(false)
_instant(false)
{
// TODO: This should not be necessary
_session = this;
@@ -89,16 +87,21 @@ SigSession::SigSession(DeviceManager &device_manager) :
_adv_trigger = false;
_group_cnt = 0;
ds_trigger_init();
register_hotplug_callback();
register_hotplug_callback();
_view_timer.stop();
_view_timer.setSingleShot(true);
connect(this, SIGNAL(start_timer(int)), &_view_timer, SLOT(start(int)));
connect(&_view_timer, SIGNAL(timeout()), this, SLOT(refresh()));
}
SigSession::~SigSession()
{
stop_capture();
stop_capture();
if (_hotplug_handle) {
stop_hotplug_proc();
deregister_hotplug_callback();
}
ds_trigger_destroy();
_dev_inst->release();
@@ -131,7 +134,12 @@ void SigSession::set_device(shared_ptr<device::DevInst> dev_inst) throw(QString)
_group_traces.clear();
if (_dev_inst) {
_dev_inst->use(this);
try {
_dev_inst->use(this);
} catch(const QString e) {
throw(e);
return;
}
sr_session_datafeed_callback_add(data_feed_in_proc, NULL);
device_setted();
}
@@ -142,8 +150,18 @@ void SigSession::set_file(const string &name) throw(QString)
{
// Deslect the old device, because file type detection in File::create
// destorys the old session inside libsigrok.
set_device(shared_ptr<device::DevInst>());
set_device(shared_ptr<device::DevInst>(device::File::create(name)));
try {
set_device(shared_ptr<device::DevInst>());
} catch(const QString e) {
throw(e);
return;
}
try {
set_device(shared_ptr<device::DevInst>(device::File::create(name)));
} catch(const QString e) {
throw(e);
return;
}
}
void SigSession::save_file(const std::string &name){
@@ -161,7 +179,7 @@ void SigSession::save_file(const std::string &name){
snapshot->get_sample_count());
}
void SigSession::set_default_device()
void SigSession::set_default_device(boost::function<void (const QString)> error_handler)
{
shared_ptr<pv::device::DevInst> default_device;
const list< shared_ptr<device::DevInst> > &devices =
@@ -171,15 +189,20 @@ void SigSession::set_default_device()
// Fall back to the first device in the list.
default_device = devices.front();
// Try and find the DSLogic device and select that by default
// Try and find the DreamSourceLab device and select that by default
BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev, devices)
if (dev->dev_inst() &&
strcmp(dev->dev_inst()->driver->name,
"DSLogic") == 0) {
"demo") != 0) {
default_device = dev;
break;
}
set_device(default_device);
try {
set_device(default_device);
} catch(const QString e) {
error_handler(e);
return;
}
}
}
@@ -222,11 +245,17 @@ void SigSession::start_capture(bool instant,
}
if (!l) {
error_handler(tr("No probes enabled."));
capture_state_changed(_capture_state);
return;
}
// Begin the session
// update setting
_instant = instant;
if (~_instant)
_view_timer.blockSignals(false);
// Begin the session
_sampling_thread.reset(new boost::thread(
&SigSession::sample_thread_proc, this, _dev_inst,
error_handler));
@@ -237,6 +266,7 @@ void SigSession::stop_capture()
if (get_capture_state() != Running)
return;
sr_session_stop();
_view_timer.blockSignals(true);
// Check that sampling stopped
if (_sampling_thread.get())
@@ -268,6 +298,11 @@ set< shared_ptr<data::SignalData> > SigSession::get_data() const
return data;
}
bool SigSession::get_instant()
{
return _instant;
}
void* SigSession::get_buf(int& unit_size, uint64_t &length)
{
if (_dev_inst->dev_inst()->mode == LOGIC) {
@@ -309,12 +344,6 @@ void* SigSession::get_buf(int& unit_size, uint64_t &length)
}
}
void SigSession::set_sample_rate(uint64_t sample_rate)
{
if (_capture_state != Stopped)
sample_rate_changed(sample_rate);
}
void SigSession::set_capture_state(capture_state state)
{
boost::lock_guard<boost::mutex> lock(_sampling_mutex);
@@ -511,7 +540,7 @@ void SigSession::init_signals()
// Create data containers for the coming data snapshots
{
if (logic_probe_count != 0) {
_logic_data.reset(new data::Logic(logic_probe_count));
_logic_data.reset(new data::Logic());
assert(_logic_data);
_group_data.reset(new data::Group());
@@ -520,12 +549,12 @@ void SigSession::init_signals()
}
if (dso_probe_count != 0) {
_dso_data.reset(new data::Dso(dso_probe_count));
_dso_data.reset(new data::Dso());
assert(_dso_data);
}
if (analog_probe_count != 0) {
_analog_data.reset(new data::Analog(analog_probe_count));
_analog_data.reset(new data::Analog());
assert(_analog_data);
}
}
@@ -609,6 +638,23 @@ void SigSession::reload()
signals_changed();
}
void SigSession::refresh()
{
if (_logic_data) {
_logic_data->clear();
_cur_logic_snapshot.reset();
}
if (_dso_data) {
_dso_data->clear();
_cur_dso_snapshot.reset();
}
if (_analog_data) {
_analog_data->clear();
_cur_analog_snapshot.reset();
}
data_updated();
}
void SigSession::feed_in_meta(const sr_dev_inst *sdi,
const sr_datafeed_meta &meta)
{
@@ -654,7 +700,8 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic)
new data::LogicSnapshot(logic, _dev_inst->get_sample_limit(), 1));
if (_cur_logic_snapshot->buf_null())
{
stop_capture();
malloc_error();
return;
} else {
_logic_data->push_snapshot(_cur_logic_snapshot);
}
@@ -664,12 +711,12 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic)
// frame_began is DecoderStack, but in future we need to signal
// this after both analog and logic sweeps have begun.
frame_began();
}
else
{
} else if(!_cur_logic_snapshot->buf_null()) {
// Append to the existing data snapshot
_cur_logic_snapshot->append_payload(logic);
}
} else {
return;
}
receive_data(logic.length/logic.unitsize);
data_received();
@@ -690,20 +737,25 @@ void SigSession::feed_in_dso(const sr_datafeed_dso &dso)
{
// Create a new data snapshot
_cur_dso_snapshot = boost::shared_ptr<data::DsoSnapshot>(
new data::DsoSnapshot(dso, _dev_inst->get_sample_limit(), _dso_data->get_num_probes()));
new data::DsoSnapshot(dso, _dev_inst->get_sample_limit(), get_ch_num(SR_CHANNEL_DSO), _instant));
if (_cur_dso_snapshot->buf_null())
stop_capture();
else
{
malloc_error();
return;
} else {
_dso_data->push_snapshot(_cur_dso_snapshot);
}
else
{
}
} else if(!_cur_dso_snapshot->buf_null()) {
// Append to the existing data snapshot
_cur_dso_snapshot->append_payload(dso);
} else {
return;
}
receive_data(dso.num_samples);
data_updated();
if (!_instant)
start_timer(ViewTime);
}
void SigSession::feed_in_analog(const sr_datafeed_analog &analog)
@@ -720,17 +772,19 @@ void SigSession::feed_in_analog(const sr_datafeed_analog &analog)
{
// Create a new data snapshot
_cur_analog_snapshot = boost::shared_ptr<data::AnalogSnapshot>(
new data::AnalogSnapshot(analog, _dev_inst->get_sample_limit(), _analog_data->get_num_probes()));
new data::AnalogSnapshot(analog, _dev_inst->get_sample_limit(), get_ch_num(SR_CHANNEL_ANALOG)));
if (_cur_analog_snapshot->buf_null())
stop_capture();
else
{
return;
} else if(!_cur_analog_snapshot->buf_null()) {
_analog_data->push_snapshot(_cur_analog_snapshot);
}
else
{
}
} else if(!_cur_analog_snapshot->buf_null()) {
// Append to the existing data snapshot
_cur_analog_snapshot->append_payload(analog);
}
} else {
return;
}
receive_data(analog.num_samples);
data_updated();
@@ -822,10 +876,10 @@ int SigSession::hotplug_callback(struct libusb_context *ctx, struct libusb_devic
if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
_session->_hot_attach = true;
qDebug("DSLogic attaced!\n");
qDebug("DreamSourceLab Hardware Attaced!\n");
}else if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
_session->_hot_detach = true;
qDebug("DSLogic dettaced!\n");
qDebug("DreamSourceLab Hardware Dettaced!\n");
}else{
qDebug("Unhandled event %d\n", event);
}
@@ -847,12 +901,12 @@ void SigSession::hotplug_proc(boost::function<void (const QString)> error_handle
while(_session) {
libusb_handle_events_timeout(NULL, &tv);
if (_hot_attach) {
qDebug("DSLogic hardware attached!");
qDebug("DreamSourceLab hardware attached!");
device_attach();
_hot_attach = false;
}
if (_hot_detach) {
qDebug("DSLogic hardware detached!");
qDebug("DreamSourceLab hardware detached!");
device_detach();
_logic_data.reset();
_dso_data.reset();
@@ -873,7 +927,7 @@ void SigSession::register_hotplug_callback()
ret = libusb_hotplug_register_callback(NULL, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
(libusb_hotplug_flag)LIBUSB_HOTPLUG_ENUMERATE, 0x2A0E, 0x0001,
(libusb_hotplug_flag)LIBUSB_HOTPLUG_ENUMERATE, 0x2A0E, LIBUSB_HOTPLUG_MATCH_ANY,
LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, NULL,
&_hotplug_handle);
if (LIBUSB_SUCCESS != ret){
@@ -907,7 +961,6 @@ void SigSession::stop_hotplug_proc()
_hotplug.reset();
}
/*
* Tigger
*/
@@ -917,17 +970,42 @@ void SigSession::set_adv_trigger(bool adv_trigger)
}
uint16_t SigSession::get_dso_ch_num()
uint16_t SigSession::get_ch_num(int type)
{
uint16_t num_channels = 0;
BOOST_FOREACH(const shared_ptr<view::Signal> s, _signals)
{
assert(s);
//if (dynamic_pointer_cast<view::DsoSignal>(s) && s->enabled()) {
if (dynamic_pointer_cast<view::DsoSignal>(s)) {
num_channels++;
uint16_t logic_ch_num = 0;
uint16_t dso_ch_num = 0;
uint16_t analog_ch_num = 0;
if (_dev_inst->dev_inst()) {
BOOST_FOREACH(const shared_ptr<view::Signal> s, _signals)
{
assert(s);
if (dynamic_pointer_cast<view::LogicSignal>(s) && s->enabled()) {
//if (dynamic_pointer_cast<view::LogicSignal>(s)) {
logic_ch_num++;
}
if (dynamic_pointer_cast<view::DsoSignal>(s) && s->enabled()) {
//if (dynamic_pointer_cast<view::DsoSignal>(s)) {
dso_ch_num++;
}
if (dynamic_pointer_cast<view::AnalogSignal>(s) && s->enabled()) {
//if (dynamic_pointer_cast<view::AnalogSignal>(s)) {
analog_ch_num++;
}
}
}
switch(type) {
case SR_CHANNEL_LOGIC:
num_channels = logic_ch_num; break;
case SR_CHANNEL_DSO:
num_channels = dso_ch_num; break;
case SR_CHANNEL_ANALOG:
num_channels = analog_ch_num; break;
default:
num_channels = logic_ch_num+dso_ch_num+analog_ch_num; break;
}
return num_channels;
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_SIGSESSION_H
#define DSLOGIC_PV_SIGSESSION_H
#ifndef DSVIEW_PV_SIGSESSION_H
#define DSVIEW_PV_SIGSESSION_H
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
@@ -42,8 +42,9 @@
#include <QVector>
#include <QMap>
#include <QVariant>
#include <QTimer>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include <libusb.h>
struct srd_decoder;
@@ -85,7 +86,8 @@ class SigSession : public QObject
Q_OBJECT
private:
static const float Oversampling;
static const float Oversampling = 2.0f;
static const int ViewTime = 800;
public:
enum capture_state {
@@ -112,7 +114,7 @@ public:
void save_file(const std::string &name);
void set_default_device();
void set_default_device(boost::function<void (const QString)> error_handler);
void release_device(device::DevInst *dev_inst);
@@ -157,14 +159,14 @@ public:
void start_hotplug_proc(boost::function<void (const QString)> error_handler);
void stop_hotplug_proc();
void register_hotplug_callback();
void register_hotplug_callback();
void deregister_hotplug_callback();
void set_adv_trigger(bool adv_trigger);
uint16_t get_dso_ch_num();
uint16_t get_ch_num(int type);
void set_sample_rate(uint64_t sample_rate);
bool get_instant();
private:
void set_capture_state(capture_state state);
@@ -203,6 +205,7 @@ private:
static void data_feed_in_proc(const struct sr_dev_inst *sdi,
const struct sr_datafeed_packet *packet, void *cb_data);
// thread for hotplug
void hotplug_proc(boost::function<void (const QString)> error_handler);
static int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
libusb_hotplug_event event, void *user_data);
@@ -239,13 +242,15 @@ private:
std::auto_ptr<boost::thread> _sampling_thread;
libusb_hotplug_callback_handle _hotplug_handle;
libusb_hotplug_callback_handle _hotplug_handle;
std::auto_ptr<boost::thread> _hotplug;
bool _hot_attach;
bool _hot_detach;
bool _adv_trigger;
QTimer _view_timer;
signals:
void capture_state_changed(int state);
@@ -253,7 +258,7 @@ signals:
void data_updated();
void sample_rate_changed(uint64_t sample_rate);
void start_timer(int);
void receive_data(quint64 length);
@@ -274,8 +279,13 @@ signals:
void device_setted();
void malloc_error();
void zero_adj();
public slots:
void reload();
void refresh();
private:
// TODO: This should not be necessary. Multiple concurrent
@@ -286,4 +296,4 @@ private:
} // namespace pv
#endif // DSLOGIC_PV_SIGSESSION_H
#endif // DSVIEW_PV_SIGSESSION_H

View File

@@ -81,7 +81,7 @@ bool StoreSession::start()
}
if (data_set.size() > 1) {
_error = tr("DSLogic currently only has support for "
_error = tr("DSView currently only has support for "
"storing a single data stream.");
return false;
}
@@ -90,7 +90,7 @@ bool StoreSession::start()
//shared_ptr<data::SignalData
shared_ptr<data::Logic> data;
if (!(data = dynamic_pointer_cast<data::Logic>(*data_set.begin()))) {
_error = tr("DSLogic currently only has support for "
_error = tr("DSView currently only has support for "
"storing a logic data.");
return false;
}

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DSLOGIC_PV_STORESESSION_H
#define DSLOGIC_PV_STORESESSION_H
#ifndef DSVIEW_PV_STORESESSION_H
#define DSVIEW_PV_STORESESSION_H
#include <stdint.h>
@@ -80,4 +80,4 @@ private:
} // pv
#endif // DSLOGIC_PV_STORESESSION_H
#endif // DSVIEW_PV_STORESESSION_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -84,7 +84,7 @@ void FileBar::on_actionOpen_triggered()
// Show the dialog
const QString file_name = QFileDialog::getOpenFileName(
this, tr("Open File"), "", tr(
"DSLogic Sessions (*.dsl)"));
"DSView Sessions (*.dsl)"));
if (!file_name.isEmpty())
load_file(file_name);
}
@@ -124,14 +124,14 @@ void FileBar::on_actionSave_triggered()
} else if (_session.get_device()->dev_inst()->mode != LOGIC) {
QMessageBox msg(this);
msg.setText("File Save");
msg.setInformativeText("DSLogic currently only support saving logic data to file!");
msg.setInformativeText("DSView currently only support saving logic data to file!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
}else {
const QString file_name = QFileDialog::getSaveFileName(
this, tr("Save File"), "",
tr("DSLogic Session (*.dsl)"));
tr("DSView Session (*.dsl)"));
if (!file_name.isEmpty()) {
_session.save_file(file_name.toStdString());
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_TOOLBARS_FILEBAR_H
#define DSLOGIC_PV_TOOLBARS_FILEBAR_H
#ifndef DSVIEW_PV_TOOLBARS_FILEBAR_H
#define DSVIEW_PV_TOOLBARS_FILEBAR_H
#include <QToolBar>
#include <QToolButton>
@@ -74,4 +74,4 @@ private:
} // namespace toolbars
} // namespace pv
#endif // DSLOGIC_PV_TOOLBARS_FILEBAR_H
#endif // DSVIEW_PV_TOOLBARS_FILEBAR_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -75,7 +75,7 @@ LogoBar::LogoBar(SigSession &session, QWidget *parent) :
addWidget(margin);
}
void LogoBar::dslogic_connected(bool conn)
void LogoBar::dsl_connected(bool conn)
{
if (conn)
_logo_button.setIcon(QIcon(":/icons/logo_color.png"));

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_TOOLBARS_LOGOBAR_H
#define DSLOGIC_PV_TOOLBARS_LOGOBAR_H
#ifndef DSVIEW_PV_TOOLBARS_LOGOBAR_H
#define DSVIEW_PV_TOOLBARS_LOGOBAR_H
#include <QToolBar>
#include <QToolButton>
@@ -42,7 +42,7 @@ public:
void enable_toggle(bool enable);
void dslogic_connected(bool conn);
void dsl_connected(bool conn);
private:
void session_error(
@@ -70,4 +70,4 @@ private:
} // namespace toolbars
} // namespace pv
#endif // DSLOGIC_PV_TOOLBARS_LOGOBAR_H
#endif // DSVIEW_PV_TOOLBARS_LOGOBAR_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -27,18 +27,23 @@
#include <boost/foreach.hpp>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include <QAction>
#include <QDebug>
#include <QLabel>
#include <QMessageBox>
#include "samplingbar.h"
#include "../devicemanager.h"
#include "../device/devinst.h"
#include "../dialogs/deviceoptions.h"
#include "../dialogs/waitingdialog.h"
#include "../dialogs/streamoptions.h"
#include "../view/dsosignal.h"
using namespace boost;
using boost::shared_ptr;
using std::map;
using std::max;
@@ -72,26 +77,6 @@ const uint64_t SamplingBar::RecordLengths[19] = {
const uint64_t SamplingBar::DefaultRecordLength = 1000000;
const uint64_t SamplingBar::DSLogic_RecordLengths[15] = {
1024,
2048,
4096,
8192,
16384,
32768,
65536,
131072,
262144,
524288,
1048576,
2097152,
4194304,
8388608,
16777216,
};
const uint64_t SamplingBar::DSLogic_DefaultRecordLength = 16777216;
SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
QToolBar("Sampling Bar", parent),
_session(session),
@@ -139,6 +124,8 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
// }
_sample_count.setSizeAdjustPolicy(QComboBox::AdjustToContents);
set_sampling(false);
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int)));
//_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_run_stop_button.setObjectName(tr("run_stop_button"));
@@ -218,10 +205,51 @@ void SamplingBar::on_configure()
shared_ptr<pv::device::DevInst> dev_inst = get_selected_device();
assert(dev_inst);
pv::dialogs::DeviceOptions dlg(this, dev_inst->dev_inst());
pv::dialogs::DeviceOptions dlg(this, dev_inst);
ret = dlg.exec();
if (ret == QDialog::Accepted)
device_updated();
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero)
zero_adj();
}
gvar = dev_inst->get_config(NULL, NULL, SR_CONF_TEST);
if (gvar != NULL) {
bool test = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (test) {
update_sample_count_selector_value();
update_sample_rate_selector_value();
#ifndef TEST_MODE
_sample_count.setDisabled(true);
_sample_rate.setDisabled(true);
#endif
} else if (dev_inst->dev_inst()->mode != DSO) {
_sample_count.setDisabled(false);
_sample_rate.setDisabled(false);
}
}
}
void SamplingBar::zero_adj()
{
boost::shared_ptr<view::DsoSignal> dsoSig;
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals())
{
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s))
dsoSig->set_enable(true);
}
run_stop();
pv::dialogs::WaitingDialog wait(this, get_selected_device());
wait.start();
run_stop();
}
uint64_t SamplingBar::get_record_length() const
@@ -244,6 +272,16 @@ void SamplingBar::set_record_length(uint64_t length)
}
}
void SamplingBar::update_record_length()
{
update_sample_count_selector_value();
}
void SamplingBar::update_sample_rate()
{
update_sample_rate_selector_value();
}
void SamplingBar::set_sampling(bool sampling)
{
if (_instant)
@@ -252,9 +290,31 @@ void SamplingBar::set_sampling(bool sampling)
_run_stop_button.setIcon(sampling ? _icon_stop : _icon_start);
if (!sampling) {
g_usleep(100000);
_run_stop_button.setEnabled(true);
_instant_button.setEnabled(true);
} else {
// bool running = false;
// boost::shared_ptr<pv::device::DevInst> dev_inst = get_selected_device();
// assert(dev_inst);
// while (!running) {
// GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_STATUS);
// if (gvar != NULL) {
// running = g_variant_get_boolean(gvar);
// g_variant_unref(gvar);
// }
// g_usleep(10000);
// }
g_usleep(100000);
if (_instant)
_instant_button.setEnabled(true);
else
_run_stop_button.setEnabled(true);
}
_configure_button.setEnabled(!sampling);
_configure_button.setIcon(sampling ? QIcon(":/icons/params_dis.png") :
QIcon(":/icons/params.png"));
}
void SamplingBar::set_sample_rate(uint64_t sample_rate)
@@ -294,6 +354,8 @@ void SamplingBar::update_sample_rate_selector()
if (_updating_sample_rate)
return;
disconnect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplerate_sel(int)));
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
@@ -328,8 +390,10 @@ void SamplingBar::update_sample_rate_selector()
g_variant_unref(gvar_list);
}
_updating_sample_rate = false;
g_variant_unref(gvar_dict);
connect(&_sample_rate, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplerate_sel(int)));
update_sample_rate_selector_value();
}
@@ -343,10 +407,14 @@ void SamplingBar::update_sample_rate_selector_value()
assert(!_updating_sample_rate);
_updating_sample_rate = true;
for (int i = 0; i < _sample_rate.count(); i++)
if (samplerate == _sample_rate.itemData(
i).value<uint64_t>())
//for (int i = 0; i < _sample_rate.count(); i++)
for (int i = _sample_rate.count() - 1; i >= 0; i--) {
if (samplerate >= _sample_rate.itemData(
i).value<uint64_t>()) {
_sample_rate.setCurrentIndex(i);
break;
}
}
_updating_sample_rate = false;
}
@@ -373,21 +441,94 @@ void SamplingBar::commit_sample_rate()
// Get last samplerate
last_sample_rate = get_selected_device()->get_sample_rate();
// Set the samplerate
get_selected_device()->set_config(NULL, NULL,
SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate));
if (last_sample_rate != sample_rate)
if (last_sample_rate != sample_rate) {
// Set the samplerate
get_selected_device()->set_config(NULL, NULL,
SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate));
update_scale();
}
_updating_sample_rate = false;
}
void SamplingBar::on_samplecount_sel(int index)
{
uint64_t sample_count = 0;
uint64_t max_sample_count = 0;
uint64_t last_sample_count = 0;
bool stream_mode = false;
bool buffer2stream = false;
bool stream2buffer = false;
if (index >= 0)
sample_count = _sample_count.itemData(
index).value<uint64_t>();
boost::shared_ptr<pv::device::DevInst> _devInst = get_selected_device();
assert(_devInst);
if (strcmp(_devInst->dev_inst()->driver->name, "DSLogic") == 0 && _devInst->dev_inst()->mode != DSO) {
GVariant* gvar = _devInst->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
if (gvar != NULL) {
last_sample_count = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
}
gvar = _devInst->get_config(NULL, NULL, SR_CONF_MAX_LOGIC_SAMPLELIMITS);
if (gvar != NULL) {
max_sample_count = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
}
gvar = _devInst->get_config(NULL, NULL, SR_CONF_STREAM);
if (gvar != NULL) {
stream_mode = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
}
if (((!stream_mode || (last_sample_count >= SR_GB(1))) && sample_count > max_sample_count) ||
(sample_count >= SR_GB(1) && _devInst->get_sample_rate() <= SR_MHZ(10))) {
stream_mode = sample_count > max_sample_count;
buffer2stream = true;
} else if (stream_mode && sample_count <= max_sample_count) {
stream_mode = sample_count > max_sample_count;
stream2buffer = true;
}
// Set the sample count
_devInst->set_config(NULL, NULL,
SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count));
if (buffer2stream) {
pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode);
stream.setFixedSize(300, 150);
stream.exec();
update_sample_rate_selector_value();
update_sample_count_selector_value();
_devInst->set_config(NULL, NULL,
SR_CONF_STREAM,
g_variant_new_boolean(true));
} else if (stream2buffer) {
QMessageBox msg(this);
pv::dialogs::StreamOptions stream(this, _devInst, sample_count, stream_mode);
stream.setFixedSize(300, 100);
stream.exec();
_devInst->set_config(NULL, NULL,
SR_CONF_STREAM,
g_variant_new_boolean(false));
}
device_updated();
update_scale();
}
}
void SamplingBar::on_samplerate_sel(int index)
{
uint64_t sample_rate = 0;
uint64_t last_sample_rate = 0;
//uint64_t last_sample_rate = 0;
if (index >= 0)
sample_rate = _sample_rate.itemData(
@@ -397,21 +538,16 @@ void SamplingBar::on_samplerate_sel(int index)
assert(_sdi);
// Get last samplerate
last_sample_rate = get_selected_device()->get_sample_rate();
//last_sample_rate = get_selected_device()->get_sample_rate();
if (strcmp(_sdi->driver->name, "DSLogic") == 0 && _sdi->mode != DSO) {
if ((last_sample_rate == SR_MHZ(200)&& sample_rate != SR_MHZ(200)) ||
(last_sample_rate != SR_MHZ(200) && sample_rate == SR_MHZ(200)) ||
(last_sample_rate == SR_MHZ(400)&& sample_rate != SR_MHZ(400)) ||
(last_sample_rate != SR_MHZ(400) && sample_rate == SR_MHZ(400))) {
// Set the samplerate
get_selected_device()->set_config(NULL, NULL,
SR_CONF_SAMPLERATE,
g_variant_new_uint64(sample_rate));
update_sample_count_selector_value();
device_updated();
update_scale();
}
}
}
@@ -424,6 +560,9 @@ void SamplingBar::update_sample_count_selector()
if (_updating_sample_count)
return;
disconnect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int)));
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
@@ -459,8 +598,10 @@ void SamplingBar::update_sample_count_selector()
}
_updating_sample_count = false;
g_variant_unref(gvar_dict);
connect(&_sample_count, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_samplecount_sel(int)));
update_sample_count_selector_value();
}
@@ -505,30 +646,73 @@ void SamplingBar::commit_sample_count()
// Get last samplecount
last_sample_count = get_selected_device()->get_sample_limit();
// Set the samplecount
get_selected_device()->set_config(NULL, NULL,
SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count));
if (last_sample_count != sample_count) {
// Set the samplecount
get_selected_device()->set_config(NULL, NULL,
SR_CONF_LIMIT_SAMPLES,
g_variant_new_uint64(sample_count));
update_scale();
}
_updating_sample_count = false;
if (sample_count != last_sample_count)
update_scale();
}
void SamplingBar::on_run_stop()
{
enable_run_stop(false);
enable_instant(false);
commit_sample_rate();
commit_sample_count();
_instant = false;
run_stop();
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
}
}
run_stop();
}
void SamplingBar::on_instant_stop()
{
enable_run_stop(false);
enable_instant(false);
commit_sample_rate();
commit_sample_count();
_instant = true;
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO);
if (gvar != NULL) {
bool zero = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
msg.setText("Zero Adjustment");
if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0)
msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!");
else
msg.setInformativeText("Please adjust zero skew and save the result!");
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
zero_adj();
return;
}
}
instant_stop();
}
@@ -541,15 +725,29 @@ void SamplingBar::on_device_selected()
if (!dev_inst)
return;
_session.set_device(dev_inst);
try {
_session.set_device(dev_inst);
} catch(QString e) {
show_session_error(tr("Failed to Select ") + dev_inst->dev_inst()->model, e);
}
device_selected();
}
void SamplingBar::enable_toggle(bool enable)
{
_sample_count.setDisabled(!enable);
_sample_rate.setDisabled(!enable);
bool test = false;
const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (dev_inst && dev_inst->owner()) {
GVariant *gvar = dev_inst->get_config(NULL, NULL, SR_CONF_TEST);
if (gvar != NULL) {
test = g_variant_get_boolean(gvar);
g_variant_unref(gvar);
}
}
if (!test) {
_sample_count.setDisabled(!enable);
_sample_rate.setDisabled(!enable);
}
}
void SamplingBar::enable_run_stop(bool enable)
@@ -562,5 +760,16 @@ void SamplingBar::enable_instant(bool enable)
_instant_button.setDisabled(!enable);
}
void SamplingBar::show_session_error(
const QString text, const QString info_text)
{
QMessageBox msg(this);
msg.setText(text);
msg.setInformativeText(info_text);
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
}
} // namespace toolbars
} // namespace pv

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H
#define DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H
#ifndef DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H
#define DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H
#include <stdint.h>
@@ -35,7 +35,7 @@
#include <QToolBar>
#include <QToolButton>
#include <libsigrok4DSLogic/libsigrok.h>
#include <libsigrok4DSL/libsigrok.h>
#include "../sigsession.h"
@@ -63,8 +63,6 @@ class SamplingBar : public QToolBar
private:
static const uint64_t RecordLengths[19];
static const uint64_t DefaultRecordLength;
static const uint64_t DSLogic_RecordLengths[15];
static const uint64_t DSLogic_DefaultRecordLength;
public:
SamplingBar(SigSession &session, QWidget *parent);
@@ -76,6 +74,9 @@ public:
uint64_t get_record_length() const;
void set_record_length(uint64_t length);
void update_record_length();
void update_sample_rate();
void set_sampling(bool sampling);
@@ -103,15 +104,21 @@ private:
void update_sample_count_selector_value();
void commit_sample_rate();
void commit_sample_count();
void setting_adj();
private slots:
void on_run_stop();
void on_instant_stop();
void on_device_selected();
void on_samplerate_sel(int index);
void on_samplecount_sel(int index);
void show_session_error(
const QString text, const QString info_text);
public slots:
void on_configure();
void zero_adj();
private:
SigSession &_session;
@@ -142,4 +149,4 @@ private:
} // namespace toolbars
} // namespace pv
#endif // DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H
#endif // DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -103,6 +103,13 @@ void TrigBar::enable_toggle(bool enable)
QIcon::fromTheme("trig", QIcon(":/icons/search-bar_dis.png")));
}
void TrigBar::enable_protocol(bool enable)
{
_protocol_button.setDisabled(!enable);
_protocol_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/protocol.png")) :
QIcon::fromTheme("trig", QIcon(":/icons/protocol_dis.png")));
}
void TrigBar::close_all()
{
if (_trig_button.isChecked()) {

View File

@@ -1,6 +1,6 @@
/*
* This file is part of the DSLogic-gui project.
* DSLogic-gui is based on PulseView.
* This file is part of the DSView project.
* DSView is based on PulseView.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
* Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
@@ -21,8 +21,8 @@
*/
#ifndef DSLOGIC_PV_TOOLBARS_TRIGBAR_H
#define DSLOGIC_PV_TOOLBARS_TRIGBAR_H
#ifndef DSVIEW_PV_TOOLBARS_TRIGBAR_H
#define DSVIEW_PV_TOOLBARS_TRIGBAR_H
#include <QToolBar>
#include <QToolButton>
@@ -37,7 +37,7 @@ public:
explicit TrigBar(QWidget *parent = 0);
void enable_toggle(bool enable);
void enable_protocol(bool enable);
void close_all();
signals:
@@ -64,4 +64,4 @@ private:
} // namespace toolbars
} // namespace pv
#endif // DSLOGIC_PV_TOOLBARS_TRIGBAR_H
#endif // DSVIEW_PV_TOOLBARS_TRIGBAR_H

Some files were not shown because too many files have changed in this diff Show More