Commit 9eb36b33 authored by DreamSourceLab's avatar DreamSourceLab

v0.4 release

parent 5d7e3237
......@@ -19,10 +19,13 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.6)
include(FindPkgConfig)
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
project(DSLogic)
#===============================================================================
......@@ -31,22 +34,27 @@ project(DSLogic)
option(DISABLE_WERROR "Build without -Werror" TRUE)
option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
option(ENABLE_DECODE "Build with libsigrokdecode" TRUE)
option(ENABLE_COTIRE "Enable cotire" FALSE)
option(ENABLE_TESTS "Enable unit tests" FALSE)
option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE)
option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE)
option(FORCE_QT4 "Force use of Qt4 even if Qt5 is available" FALSE)
if(WIN32)
# On Windows/MinGW we need to statically link to libraries.
# This option is user configurable, but enable it by default on win32.
set(STATIC_PKGDEPS_LIBS TRUE)
# For boost-thread we need two additional settings on win32:
set(Boost_USE_STATIC_LIBS on)
add_definitions(-DBOOST_THREAD_USE_LIB)
# Windsws does not support UNIX signals
# Windows does not support UNIX signals.
set(ENABLE_SIGNALS FALSE)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
#===============================================================================
#= Dependencies
#-------------------------------------------------------------------------------
......@@ -55,26 +63,35 @@ list(APPEND PKGDEPS
"libsigrok4DSLogic >= 0.2.0"
"libusb-1.0 >= 1.0.16"
)
if(ENABLE_DECODE)
list(APPEND PKGDEPS "libsigrokdecode>=0.3.0")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
find_package(PkgConfig)
pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
find_package(Qt4 REQUIRED)
# Find the platform's thread library (needed for boost-thread).
# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
find_package(Threads)
if(FORCE_QT4)
set(Qt5Core_FOUND FALSE)
else()
find_package(Qt5Core QUIET)
endif()
if(WIN32)
# On Windows/MinGW the we need to use 'thread_win32' instead of 'thread'.
# The library is named libboost_thread_win32* (not libboost_thread*).
find_package(Boost 1.42 COMPONENTS system thread_win32 REQUIRED)
if(Qt5Core_FOUND)
message("-- Using Qt5")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(QT_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Gui Qt5::Widgets)
add_definitions(${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
else()
find_package(Boost 1.42 COMPONENTS system thread REQUIRED)
find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
find_package(Qt4 REQUIRED)
endif()
find_package(Threads)
find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
find_package(libusb-1.0 REQUIRED)
#===============================================================================
......@@ -85,7 +102,7 @@ set(DS_TITLE DSLogic)
set(DS_DESCRIPTION "A GUI for DSLogic")
set(DS_VERSION_MAJOR 0)
set(DS_VERSION_MINOR 3)
set(DS_VERSION_MINOR 4)
set(DS_VERSION_MICRO 0)
set(DS_VERSION_STRING
${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}
......@@ -105,31 +122,28 @@ set(DSLogic_SOURCES
pv/devicemanager.cpp
pv/mainwindow.cpp
pv/sigsession.cpp
pv/storesession.cpp
pv/data/analog.cpp
pv/data/analogsnapshot.cpp
pv/data/dso.cpp
pv/data/dsosnapshot.cpp
pv/data/group.cpp
pv/data/groupsnapshot.cpp
pv/data/logic.cpp
pv/data/logicsnapshot.cpp
pv/data/signaldata.cpp
pv/data/snapshot.cpp
pv/data/dso.cpp
pv/data/dsosnapshot.cpp
pv/decoder/decoder.cpp
pv/decoder/decoderfactory.cpp
pv/decoder/democonfig.cpp
pv/decoder/ds1wire.cpp
pv/decoder/dsdmx512.cpp
pv/decoder/dsi2c.cpp
pv/decoder/dsserial.cpp
pv/decoder/dsspi.cpp
pv/device/devinst.cpp
pv/device/device.cpp
pv/device/file.cpp
pv/device/inputfile.cpp
pv/device/sessionfile.cpp
pv/dialogs/about.cpp
pv/dialogs/connect.cpp
pv/dialogs/deviceoptions.cpp
pv/dialogs/search.cpp
pv/dock/fakelineedit.cpp
pv/dialogs/storeprogress.cpp
pv/dock/dsotriggerdock.cpp
pv/dock/measuredock.cpp
pv/dock/protocoldock.cpp
pv/dock/searchdock.cpp
pv/dock/triggerdock.cpp
pv/prop/bool.cpp
......@@ -137,80 +151,116 @@ set(DSLogic_SOURCES
pv/prop/enum.cpp
pv/prop/int.cpp
pv/prop/property.cpp
pv/prop/string.cpp
pv/prop/binding/binding.cpp
pv/prop/binding/binding_deviceoptions.cpp
pv/toolbars/devicebar.cpp
pv/prop/binding/deviceoptions.cpp
pv/prop/binding/decoderoptions.cpp
pv/toolbars/filebar.cpp
pv/toolbars/logobar.cpp
pv/toolbars/samplingbar.cpp
pv/toolbars/trigbar.cpp
pv/view/analogsignal.cpp
pv/view/cursor.cpp
pv/view/devmode.cpp
pv/view/dsldial.cpp
pv/view/dsosignal.cpp
pv/view/groupsignal.cpp
pv/view/header.cpp
pv/view/logicsignal.cpp
pv/view/protocolsignal.cpp
pv/view/ruler.cpp
pv/view/selectableitem.cpp
pv/view/signal.cpp
pv/view/timemarker.cpp
pv/view/trace.cpp
pv/view/view.cpp
pv/view/viewport.cpp
pv/view/dsosignal.cpp
pv/view/dsldial.cpp
pv/dock/dsotriggerdock.cpp
pv/widgets/fakelineedit.cpp
)
set(DSLogic_HEADERS
pv/sigsession.h
pv/mainwindow.h
pv/decoder/democonfig.h
pv/dock/fakelineedit.h
pv/dock/measuredock.h
pv/dock/protocoldock.h
pv/dock/searchdock.h
pv/dock/triggerdock.h
pv/sigsession.h
pv/storesession.h
pv/device/devinst.h
pv/dialogs/about.h
pv/dialogs/connect.h
pv/dialogs/deviceoptions.h
pv/dialogs/search.h
pv/toolbars/samplingbar.h
pv/toolbars/devicebar.h
pv/dialogs/storeprogress.h
pv/dock/dsotriggerdock.h
pv/dock/measuredock.h
pv/dock/searchdock.h
pv/dock/triggerdock.h
pv/prop/bool.h
pv/prop/double.h
pv/prop/enum.h
pv/prop/int.h
pv/prop/property.h
pv/prop/string.h
pv/toolbars/filebar.h
pv/toolbars/logobar.h
pv/toolbars/samplingbar.h
pv/toolbars/trigbar.h
pv/data/dso.h
pv/data/dsosnapshot.h
pv/view/cursor.h
pv/view/devmode.h
pv/view/header.h
pv/view/ruler.h
pv/view/selectableitem.h
pv/view/timemarker.h
pv/view/groupsignal.h
pv/view/protocolsignal.h
pv/view/trace.h
pv/view/view.h
pv/view/dsosignal.h
pv/view/viewport.h
pv/view/dsldial.h
pv/dock/dsotriggerdock.h
pv/widgets/fakelineedit.h
)
set(DSLogic_FORMS
pv/dialogs/about.ui
pv/decoder/dmx512config.ui
pv/decoder/i2cconfig.ui
pv/decoder/serialconfig.ui
pv/decoder/spiconfig.ui
pv/decoder/wire1config.ui
)
set(DSLogic_RESOURCES
DSLogic.qrc
)
qt4_wrap_cpp(DSLogic_HEADERS_MOC ${DSLogic_HEADERS})
qt4_wrap_ui(DSLogic_FORMS_HEADERS ${DSLogic_FORMS})
qt4_add_resources(DSLogic_RESOURCES_RCC ${DSLogic_RESOURCES})
include(${QT_USE_FILE})
if(ENABLE_DECODE)
list(APPEND DSLogic_SOURCES
pv/dock/protocoldock.cpp
pv/data/decoderstack.cpp
pv/data/decode/annotation.cpp
pv/data/decode/decoder.cpp
pv/data/decode/row.cpp
pv/data/decode/rowdata.cpp
pv/prop/binding/decoderoptions.cpp
pv/view/decodetrace.cpp
pv/widgets/decodergroupbox.cpp
pv/widgets/decodermenu.cpp
)
list(APPEND DSLogic_HEADERS
pv/dock/protocoldock.h
pv/data/decoderstack.h
pv/view/decodetrace.h
pv/widgets/decodergroupbox.h
pv/widgets/decodermenu.h
)
endif()
if(WIN32)
# Use the DSLogic icon for the DSLogic.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)
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})
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})
include(${QT_USE_FILE})
endif()
#===============================================================================
#= Global Definitions
......@@ -219,8 +269,12 @@ include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
add_definitions(-Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers)
if(ENABLE_DECODE)
add_definitions(-DENABLE_DECODE)
endif()
if(NOT DISABLE_WERROR)
add_definitions(-Werror)
add_definitions(-Werror)
endif()
#===============================================================================
......@@ -231,6 +285,7 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
)
if(STATIC_PKGDEPS_LIBS)
......@@ -255,11 +310,16 @@ set(DSLOGIC_LINK_LIBS
if(STATIC_PKGDEPS_LIBS)
link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
list(APPEND DSLOGIC_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})
endif()
add_executable(${PROJECT_NAME}
${DSLogic_SOURCES}
${DSLogic_HEADERS_MOC}
......@@ -273,6 +333,12 @@ if(WIN32)
# Pass -mwindows so that no "DOS box" will open when PulseView is started.
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
endif()
if(ENABLE_COTIRE)
include(cotire)
cotire(${PROJECT_NAME})
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "/usr/local/lib")
#===============================================================================
......@@ -282,7 +348,8 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "/usr/local/lib")
# Install the executable.
install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
install(FILES res/DSLogic.fw DESTINATION bin/res/)
install(FILES res/DSLogic.bin DESTINATION bin/res/)
install(FILES res/DSLogic33.bin DESTINATION bin/res/)
install(FILES res/DSLogic50.bin DESTINATION bin/res/)
#===============================================================================
#= Packaging (handled by CPack)
......
......@@ -4,14 +4,12 @@
<file>icons/next.png</file>
<file>icons/pre.png</file>
<file>icons/file.png</file>
<file>icons/photo.png</file>
<file>icons/save.png</file>
<file>icons/open.png</file>
<file>icons/params.png</file>
<file>stylesheet.qss</file>
<file>icons/down-arrow.png</file>
<file>icons/slider-handle.png</file>
<file>icons/set.png</file>
<file>icons/add.png</file>
<file>icons/del.png</file>
<file>icons/trigger.png</file>
......@@ -20,14 +18,22 @@
<file>icons/protocol.png</file>
<file>icons/logo_noColor.png</file>
<file>icons/logo_color.png</file>
<file>icons/logo_muColor.png</file>
<file>icons/about.png</file>
<file>icons/capture.png</file>
<file>icons/stop.png</file>
<file>icons/start.png</file>
<file>icons/dsl_logo.png</file>
<file>icons/logo.png</file>
<file>icons/checkbox.png</file>
<file>icons/radiobutton.png</file>
<file>icons/decoder-hidden.png</file>
<file>icons/decoder-shown.png</file>
<file>icons/instant.png</file>
<file>icons/trigger_dis.png</file>
<file>icons/file_dis.png</file>
<file>icons/measure_dis.png</file>
<file>icons/protocol_dis.png</file>
<file>icons/search-bar_dis.png</file>
<file>icons/params_dis.png</file>
<file>icons/gear.png</file>
<file>icons/wiki.png</file>
</qresource>
</RCC>
DSLogic-gui/icons/about.png

1.03 KB | W: | H:

DSLogic-gui/icons/about.png

5.95 KB | W: | H:

DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
DSLogic-gui/icons/about.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/capture.png

2.01 KB | W: | H:

DSLogic-gui/icons/capture.png

5.87 KB | W: | H:

DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
DSLogic-gui/icons/capture.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/file.png

450 Bytes | W: | H:

DSLogic-gui/icons/file.png

1.16 KB | W: | H:

DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
DSLogic-gui/icons/file.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/logo_color.png

364 Bytes | W: | H:

DSLogic-gui/icons/logo_color.png

2.34 KB | W: | H:

DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
DSLogic-gui/icons/logo_color.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/logo_noColor.png

364 Bytes | W: | H:

DSLogic-gui/icons/logo_noColor.png

1.86 KB | W: | H:

DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
DSLogic-gui/icons/logo_noColor.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/measure.png

1.84 KB | W: | H:

DSLogic-gui/icons/measure.png

1.26 KB | W: | H:

DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
DSLogic-gui/icons/measure.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/next.png

632 Bytes | W: | H:

DSLogic-gui/icons/next.png

5.73 KB | W: | H:

DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
DSLogic-gui/icons/next.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/open.png

1.15 KB | W: | H:

DSLogic-gui/icons/open.png

5.67 KB | W: | H:

DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
DSLogic-gui/icons/open.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/params.png

1.92 KB | W: | H:

DSLogic-gui/icons/params.png

1.35 KB | W: | H:

DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
DSLogic-gui/icons/params.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/pre.png

648 Bytes | W: | H:

DSLogic-gui/icons/pre.png

5.71 KB | W: | H:

DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
DSLogic-gui/icons/pre.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/protocol.png

2.45 KB | W: | H:

DSLogic-gui/icons/protocol.png

1.11 KB | W: | H:

DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
DSLogic-gui/icons/protocol.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/save.png

1.15 KB | W: | H:

DSLogic-gui/icons/save.png

5.53 KB | W: | H:

DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
DSLogic-gui/icons/save.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/search-bar.png

1.93 KB | W: | H:

DSLogic-gui/icons/search-bar.png

1.65 KB | W: | H:

DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
DSLogic-gui/icons/search-bar.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/start.png

1.22 KB | W: | H:

DSLogic-gui/icons/start.png

1.21 KB | W: | H:

DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
DSLogic-gui/icons/start.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/stop.png

1.08 KB | W: | H:

DSLogic-gui/icons/stop.png

789 Bytes | W: | H:

DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
DSLogic-gui/icons/stop.png
  • 2-up
  • Swipe
  • Onion skin
DSLogic-gui/icons/trigger.png

4.36 KB | W: | H:

DSLogic-gui/icons/trigger.png

1007 Bytes | W: | H:

DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
DSLogic-gui/icons/trigger.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -21,7 +21,7 @@
*/
#ifdef ENABLE_SIGROKDECODE
#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#endif
......@@ -33,12 +33,15 @@
#include <QtGui/QApplication>
#include <QDebug>
#include <QFile>
#include <QDir>
#include "pv/devicemanager.h"
#include "pv/mainwindow.h"
#include "config.h"
char decoders_path[256];
void usage()
{
fprintf(stdout,
......@@ -85,7 +88,7 @@ int main(int argc, char *argv[])
const int loglevel = atoi(optarg);
sr_log_loglevel_set(loglevel);
#ifdef ENABLE_SIGROKDECODE
#ifdef ENABLE_DECODE
srd_log_loglevel_set(loglevel);
#endif
......@@ -118,7 +121,12 @@ int main(int argc, char *argv[])
do {
#ifdef ENABLE_SIGROKDECODE
#ifdef ENABLE_DECODE
QDir dir(QCoreApplication::applicationDirPath());
assert(dir.cd("decoders"));
std::string str = dir.absolutePath().toStdString() + "/";
strcpy(decoders_path, str.c_str());
// Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) {
qDebug() << "ERROR: libsigrokdecode init failed.";
......@@ -148,7 +156,7 @@ int main(int argc, char *argv[])
qDebug() << e.what();
}
#ifdef ENABLE_SIGROKDECODE
#ifdef ENABLE_DECODE
// Destroy libsigrokdecode
srd_exit();
#endif
......
......@@ -30,11 +30,17 @@ using namespace std;
namespace pv {
namespace data {
Analog::Analog(unsigned int num_probes, uint64_t samplerate) :
SignalData(num_probes, samplerate)
Analog::Analog(unsigned int num_probes) :
SignalData(),
_num_probes(num_probes)
{
}
int Analog::get_num_probes() const
{
return _num_probes;
}
void Analog::push_snapshot(boost::shared_ptr<AnalogSnapshot> &snapshot)
{
_snapshots.push_front(snapshot);
......@@ -45,5 +51,10 @@ deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
return _snapshots;
}
void Analog::clear()
{
_snapshots.clear();
}
} // namespace data
} // namespace pv
......@@ -37,7 +37,9 @@ class AnalogSnapshot;
class Analog : public SignalData
{
public:
Analog(unsigned int num_probes, uint64_t samplerate);
Analog(unsigned int num_probes);
int get_num_probes() const;
void push_snapshot(
boost::shared_ptr<AnalogSnapshot> &snapshot);
......@@ -45,7 +47,10 @@ public:
std::deque< boost::shared_ptr<AnalogSnapshot> >&
get_snapshots();
void clear();
private:
const unsigned int _num_probes;
std::deque< boost::shared_ptr<AnalogSnapshot> > _snapshots;
};
......
......@@ -75,6 +75,8 @@ void AnalogSnapshot::append_payload(
const uint16_t* AnalogSnapshot::get_samples(
int64_t start_sample, int64_t end_sample) const
{
(void)end_sample;
assert(start_sample >= 0);
assert(start_sample < (int64_t)get_sample_count());
assert(end_sample >= 0);
......
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* 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
*/
extern "C" {
#include <libsigrokdecode/libsigrokdecode.h>
}
#include <vector>
#include <assert.h>
#include "annotation.h"
namespace pv {
namespace data {
namespace decode {
Annotation::Annotation(const srd_proto_data *const pdata) :
_start_sample(pdata->start_sample),
_end_sample(pdata->end_sample)
{
assert(pdata);
const srd_proto_data_annotation *const pda =
(const srd_proto_data_annotation*)pdata->data;
assert(pda);
_format = pda->ann_format;
const char *const *annotations = (char**)pda->ann_text;
while(*annotations) {
_annotations.push_back(QString::fromUtf8(*annotations));
annotations++;
}
}
uint64_t Annotation::start_sample() const
{
return _start_sample;
}
uint64_t Annotation::end_sample() const
{
return _end_sample;
}
int Annotation::format() const
{
return _format;