Add tool basic structure and rename to nymea-gpio
This commit is contained in:
parent
8d1369c7ef
commit
6af34bd531
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
libnymea-gpio (0.1.0) bionic; urgency=medium
|
||||
nymea-gpio (1.0.0) bionic; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
|
||||
13
debian/control
vendored
13
debian/control
vendored
@ -1,4 +1,4 @@
|
||||
Source: libnymea-gpio
|
||||
Source: nymea-gpio
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Simon Stürz <simon.stuerz@nymea.io>
|
||||
@ -18,13 +18,22 @@ Depends: ${shlibs:Depends},
|
||||
Description: Qt 5 based library for GPIO interaction.
|
||||
Qt 5 based library for GPIO interaction.
|
||||
|
||||
Package: nymea-gpio-tool
|
||||
Section: tools
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libnymea-gpio (= ${binary:Version})
|
||||
Description: Qt 5 based tool for GPIO interaction.
|
||||
Qt 5 based tool for GPIO interaction.
|
||||
|
||||
Package: libnymea-gpio-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
pkg-config,
|
||||
libnymea-gpio (= ${binary:Version}),
|
||||
libnymea-gpio (= ${binary:Version})
|
||||
Description: Qt 5 based library for GPIO interaction - development files
|
||||
Development files for Qt 5 based GPIO library.
|
||||
|
||||
|
||||
12
debian/copyright
vendored
12
debian/copyright
vendored
@ -1,11 +1,19 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Author: Simon Stürz <simon.stuerz@nymea.io>
|
||||
Download: https://github.com/guh/libnymea-gpio
|
||||
Download: https://github.com/guh/nymea-gpio
|
||||
|
||||
License: LGPL-3
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/LGPL-3'.
|
||||
|
||||
Files: *
|
||||
License: GPL-3+
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL-3'.
|
||||
|
||||
Files: libnymea-gpio/*
|
||||
Copyright: (C) 2019 Simon Stürz <simon.stuerz@nymea.io>
|
||||
License: LGPL-3
|
||||
|
||||
Files: nymea-gpio-tool/*
|
||||
Copyright: (C) 2019 Simon Stürz <simon.stuerz@nymea.io>
|
||||
License: GPL-3+
|
||||
|
||||
1
debian/nymea-gpio.tool.install.in
vendored
Normal file
1
debian/nymea-gpio.tool.install.in
vendored
Normal file
@ -0,0 +1 @@
|
||||
nymea-gpio-tool usr/bin
|
||||
@ -48,6 +48,9 @@ void GpioMonitor::setEnabled(bool enabled)
|
||||
|
||||
void GpioMonitor::run()
|
||||
{
|
||||
// Initialize the current value
|
||||
setValue(m_gpio->value());
|
||||
|
||||
// Poll the GPIO value until the stop is true
|
||||
while (true) {
|
||||
|
||||
@ -78,8 +81,11 @@ bool GpioMonitor::enable()
|
||||
return true;
|
||||
}
|
||||
|
||||
QMutexLocker locker(&m_stopMutex);
|
||||
m_stop = false;
|
||||
// Init the GPIO
|
||||
if (!m_gpio->isAvailable()) {
|
||||
qCWarning(dcGpio()) << "Could not enable GPIO monitor.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_gpio->exportGpio()) {
|
||||
qCWarning(dcGpio()) << "Could not enable GPIO monitor.";
|
||||
@ -96,6 +102,9 @@ bool GpioMonitor::enable()
|
||||
return false;
|
||||
}
|
||||
|
||||
QMutexLocker locker(&m_stopMutex);
|
||||
m_stop = false;
|
||||
|
||||
// Everything went fine, lets start the poll thread and inform about the result
|
||||
start();
|
||||
return true;
|
||||
@ -1,15 +1,8 @@
|
||||
include(../nymea-gpio.pri)
|
||||
|
||||
TARGET = nymea-gpio
|
||||
TEMPLATE = lib
|
||||
|
||||
QT -= gui
|
||||
|
||||
QMAKE_CXXFLAGS *= -Werror -std=c++11 -g
|
||||
QMAKE_LFLAGS *= -std=c++11
|
||||
|
||||
VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"')
|
||||
|
||||
DEFINES += LIBNYMEAGPIO_LIBRARY
|
||||
|
||||
SOURCES += \
|
||||
gpio.cpp \
|
||||
gpiomonitor.cpp
|
||||
21
nymea-gpio-tool/main.cpp
Normal file
21
nymea-gpio-tool/main.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication application(argc, argv);
|
||||
application.setOrganizationName("guh");
|
||||
application.setApplicationName("nymea-gpio-tool");
|
||||
application.setApplicationVersion(VERSION_STRING);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
QString applicationDescription = QString("\nnymea-gpio-tool is a command line tool which allowes to interact with GPIOs.\n"
|
||||
"Version: %1\n"
|
||||
"Copyright %2 2019 Simon Stürz <simon.stuerz@nymea.io>\n"
|
||||
"Released under the GNU GENERAL PUBLIC LICENSE Version 3.").arg(application.applicationVersion()).arg(QChar(0xA9));
|
||||
parser.setApplicationDescription(applicationDescription);
|
||||
parser.process(application);
|
||||
|
||||
return application.exec();
|
||||
}
|
||||
15
nymea-gpio-tool/nymea-gpio-tool.pro
Normal file
15
nymea-gpio-tool/nymea-gpio-tool.pro
Normal file
@ -0,0 +1,15 @@
|
||||
include(../nymea-gpio.pri)
|
||||
|
||||
TARGET = nymea-gpio-tool
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
|
||||
INCLUDEPATH += $$top_srcdir/libnymea-gpio/
|
||||
LIBS += -L$$top_builddir/libnymea-gpio/ -lnymea-gpio
|
||||
|
||||
SOURCES += main.cpp \
|
||||
|
||||
target.path = /usr/bin
|
||||
INSTALLS += target
|
||||
10
nymea-gpio.pri
Normal file
10
nymea-gpio.pri
Normal file
@ -0,0 +1,10 @@
|
||||
QT -= gui
|
||||
|
||||
QMAKE_CXXFLAGS *= -Werror -std=c++11 -g
|
||||
QMAKE_LFLAGS *= -std=c++11
|
||||
|
||||
top_srcdir=$$PWD
|
||||
top_builddir=$$shadowed($$PWD)
|
||||
|
||||
VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"')
|
||||
DEFINES += VERSION_STRING=\\\"$${VERSION_STRING}\\\"
|
||||
4
nymea-gpio.pro
Normal file
4
nymea-gpio.pro
Normal file
@ -0,0 +1,4 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = libnymea-gpio nymea-gpio-tool
|
||||
nymea-gpio-tool.depends = libnymea-gpio
|
||||
|
||||
Reference in New Issue
Block a user