diff --git a/documentation/docs/build/configure.md b/documentation/docs/build/configure.md
index 2eb442588..dce863cbf 100644
--- a/documentation/docs/build/configure.md
+++ b/documentation/docs/build/configure.md
@@ -9,8 +9,14 @@ Do not build code related to the thermal measurement setup.
* --noassembly
Do not build code related to the automated module assembly setup.
-* --notwitter
-Do not build with twitter support (only used by thermal measurement software).
+* --noplasma
+Do not build code related to the plasma cleaner.
+
+* --nopumpstation
+Do not build code related to the CMS DAF pump station.
+
+* --noueye
+Build without support for uEye cameras.
* --fake
-Build with fake device support
+Build with fake device support.
diff --git a/documentation/docs/pumpstation/index.md b/documentation/docs/pumpstation/index.md
index e69de29bb..ed5f64537 100644
--- a/documentation/docs/pumpstation/index.md
+++ b/documentation/docs/pumpstation/index.md
@@ -0,0 +1,3 @@
+# Usage
+
+![Screenshot](screenshot.png)
\ No newline at end of file
diff --git a/documentation/docs/pumpstation/screenshot.png b/documentation/docs/pumpstation/screenshot.png
new file mode 100644
index 000000000..118c19cbb
Binary files /dev/null and b/documentation/docs/pumpstation/screenshot.png differ
diff --git a/documentation/docs/pumpstation/setup.md b/documentation/docs/pumpstation/setup.md
new file mode 100644
index 000000000..24158b291
--- /dev/null
+++ b/documentation/docs/pumpstation/setup.md
@@ -0,0 +1,22 @@
+# Setup Instructions for Pump Station Software
+
+The software is supposed to be running on a raspberry pi with Raspbian (Jessie) as operating system.
+
+## Requirements
+
+You should have a running Raspbian Linux installation based on the
+[build instructions](../build/RaspbianLinux.md) to start with.
+In addition, please install the following packages via
+
+ `sudo apt-get install apache2`
+ `sudo apt-get install libapache2-mod-webauth`
+ `sudo apt-get install libapache2-mod-php5`
+
+## Installation
+
+Once building the software has successfully finished, install all required libraries and applications via
+
+ `sudo make install`
+
+This will also install scripts to automatically start the pump station daemon on system startup.
+After a reboot of the system, the daemon will be running as the default raspberry pi user.
\ No newline at end of file
diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml
index 481cb68a2..1d69359eb 100644
--- a/documentation/mkdocs.yml
+++ b/documentation/mkdocs.yml
@@ -19,6 +19,8 @@ pages:
- defoDAQ Scripting: defo/defoDAQScripting.md
- Assembly: assembly/index.md
- Plasma Cleaner: plasma/index.md
-- Pump Station: pumpstation/index.md
+- Pump Station:
+ - setup: pumpstation/setup.md
+ - usage: pumpstation/index.md
theme: readthedocs
diff --git a/pumpstation/controller/Controller.cc b/pumpstation/controller/Controller.cc
index e3668035e..3d4721b97 100644
--- a/pumpstation/controller/Controller.cc
+++ b/pumpstation/controller/Controller.cc
@@ -29,10 +29,6 @@ Controller::Controller(QStringList& arguments)
connect(socket_, SIGNAL(connected()), this, SLOT(sendCommand()));
connect(socket_, SIGNAL(readyRead()), this, SLOT(readResponse()));
- connect(socket_, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(reportError(QAbstractSocket::SocketError)));
-
- connectToServer();
}
void Controller::connectToServer()
@@ -43,6 +39,16 @@ void Controller::connectToServer()
socket_->abort();
socket_->connectToHost(ipAddress, port);
+
+ if (!socket_->waitForConnected(500)) {
+ NQLog("controller") << "The following error occurred: " << socket_->errorString().toStdString();
+
+ std::cout << "ERR" << std::endl;
+
+ socket_->close();
+ socket_->deleteLater();
+ QCoreApplication::quit();
+ }
}
void Controller::sendCommand()
@@ -90,19 +96,3 @@ void Controller::readResponse()
QCoreApplication::quit();
}
-
-void Controller::reportError(QAbstractSocket::SocketError socketError)
-{
- switch (socketError) {
- case QAbstractSocket::RemoteHostClosedError:
- break;
- case QAbstractSocket::HostNotFoundError:
- NQLogFatal("controller") << "The host was not found. Please check the host name and port settings.";
- break;
- case QAbstractSocket::ConnectionRefusedError:
- NQLogFatal("controller") << "The connection was refused by the peer. Make sure the fortune server is running, and check that the host name and port settings are correct.";
- break;
- default:
- NQLogFatal("controller") << "The following error occurred: " << socket_->errorString().toStdString();
- }
-}
diff --git a/pumpstation/controller/Controller.h b/pumpstation/controller/Controller.h
index 38c740aec..1179cb737 100644
--- a/pumpstation/controller/Controller.h
+++ b/pumpstation/controller/Controller.h
@@ -13,12 +13,11 @@ class Controller : public QObject
Controller(QStringList& arguments);
-private slots:
+public slots:
void connectToServer();
void sendCommand();
void readResponse();
- void reportError(QAbstractSocket::SocketError socketError);
private:
diff --git a/pumpstation/controller/PumpStationControl.cc b/pumpstation/controller/PumpStationControl.cc
index 5609af963..cd8af0520 100644
--- a/pumpstation/controller/PumpStationControl.cc
+++ b/pumpstation/controller/PumpStationControl.cc
@@ -31,6 +31,7 @@ int main(int argc, char *argv[])
}
Controller controller(arguments);
+ QTimer::singleShot(0, &controller, SLOT(connectToServer()));
return app.exec();
}
diff --git a/pumpstation/controller/PumpStationControl.pro.in b/pumpstation/controller/PumpStationControl.pro.in
index c91742055..552ad8097 100644
--- a/pumpstation/controller/PumpStationControl.pro.in
+++ b/pumpstation/controller/PumpStationControl.pro.in
@@ -52,6 +52,13 @@ greaterThan(QT_MAJOR_VERSION, 4) {
cache()
}
+unix {
+ target.path = /usr/bin
+ target.from = PumpStationController
+
+ INSTALLS += target
+}
+
# Input
HEADERS += Controller.h \
@basepath@/common/ApplicationConfig.h \
diff --git a/pumpstation/daemon/.gitignore b/pumpstation/daemon/.gitignore
index dee0b8e34..9f1f95752 100644
--- a/pumpstation/daemon/.gitignore
+++ b/pumpstation/daemon/.gitignore
@@ -8,6 +8,4 @@ Makefile
*~
moc_*
PumpStationDaemon
-pumpstation
-pumpstation.pid
-
+pumpstation.service
diff --git a/pumpstation/daemon/PumpStationDaemon.pro.in b/pumpstation/daemon/PumpStationDaemon.pro.in
index 41e6b5f6c..51955280e 100644
--- a/pumpstation/daemon/PumpStationDaemon.pro.in
+++ b/pumpstation/daemon/PumpStationDaemon.pro.in
@@ -54,8 +54,8 @@ unix {
target.path = /usr/bin
target.from = PumpStationDaemon
- systemd.path = /etc/init.d
- systemd.extra = chmod a+x pumpstation; cp pumpstation /etc/init.d; systemctl enable pumpstation
+ systemd.path = /etc/systemd/system
+ systemd.extra = systemctl stop pumpstation; chmod 664 pumpstation.service; cp pumpstation.service /etc/systemd/system; systemctl daemon-reload; systemctl enable pumpstation; systemctl start pumpstation
INSTALLS += target systemd
}
diff --git a/pumpstation/daemon/pumpstation.in b/pumpstation/daemon/pumpstation.in
deleted file mode 100755
index 42adb30b1..000000000
--- a/pumpstation/daemon/pumpstation.in
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
-if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
- set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
-fi
-### BEGIN INIT INFO
-# Provides: pumpstation
-# Required-Start: $local_fs $remote_fs $network $syslog $named
-# Required-Stop: $local_fs $remote_fs $network $syslog $named
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: initscript for CMS pump station daemon
-# Description: control daemon for CMS pump station
-### END INIT INFO
-
-#
-# Author: Andreas Mussgiller
-#
-
-DESC="CMS pump station control"
-NAME=pumpstation
-SCRIPTNAME=/etc/init.d/$NAME
-DAEMON=/usr/bin/PumpStationDaemon
-PIDFILE=/var/run/pumpstation.pid
-
-[ -x "$DAEMON" ] || exit 0
-
-do_start () {
- log_daemon_msg "Starting pump station daemon" "pumpstation"
- start-stop-daemon --start --quiet --oknodo --background --chuid pi --group pi --make-pidfile --pidfile $PIDFILE --startas $DAEMON
- log_end_msg $?
-}
-
-do_stop () {
- log_daemon_msg "Stopping pump station daemon" "pumpstation"
- start-stop-daemon --stop --quiet --oknodo --chuid pi --group pi --pidfile $PIDFILE
- log_end_msg $?
- rm -f $PIDFILE
-}
diff --git a/pumpstation/daemon/pumpstation.service.in b/pumpstation/daemon/pumpstation.service.in
new file mode 100644
index 000000000..9441f7fcd
--- /dev/null
+++ b/pumpstation/daemon/pumpstation.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Service for pump station daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/PumpStationDaemon
+Type=simple
+User=pi
+Group=pi
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pumpstation/website/Makefile.in b/pumpstation/website/Makefile.in
index bfaa407be..25edecded 100644
--- a/pumpstation/website/Makefile.in
+++ b/pumpstation/website/Makefile.in
@@ -11,7 +11,6 @@ all:
clean:
install:
- cp -f pumpstation.ini $(DEPLOYMENTPATH)
cp -f pumpstation.ini $(DEPLOYMENTPATH)
cp -f index.php $(DEPLOYMENTPATH)
cp -f ConradSwitch.php $(DEPLOYMENTPATH)