diff options
Diffstat (limited to 'Application')
-rw-r--r-- | Application/cluster-service.cpp | 120 | ||||
-rw-r--r-- | Application/main.cpp | 23 |
2 files changed, 95 insertions, 48 deletions
diff --git a/Application/cluster-service.cpp b/Application/cluster-service.cpp index 1bc86ad..37bd8cb 100644 --- a/Application/cluster-service.cpp +++ b/Application/cluster-service.cpp @@ -1,9 +1,12 @@ #include "cluster-service.hxx" -#include <cluster_api.h> -#include <cluster-api-sdevent.h> +#if ENABLE_CLUSTER_BACKEND +#include <climits> +#include <cluster-api-sdevent.h> +#include <cluster_api.h> #include <systemd/sd-daemon.h> #include <systemd/sd-event.h> +#endif //----------------------------------------------------------------------------------- QClusterService::QClusterService() @@ -21,8 +24,9 @@ Q_INVOKABLE int QClusterService::getSpAnalogVal() { uint32_t speed_u32 = 0; int retval = 0; - +#if ENABLE_CLUSTER_BACKEND speed_u32 = ::getSpAnalogVal(); +#endif if (speed_u32 > (uint32_t)INT_MAX) retval = INT_MAX; else @@ -35,8 +39,9 @@ Q_INVOKABLE int QClusterService::getTaAnalogVal() { uint32_t ta_u32 = 0; int retval = 0; - +#if ENABLE_CLUSTER_BACKEND ta_u32 = ::getTaAnalogVal(); +#endif if (ta_u32 > (uint32_t)INT_MAX) retval = INT_MAX; else @@ -49,8 +54,9 @@ Q_INVOKABLE int QClusterService::getTrcomTripAVal() { uint32_t tripa_u32 = 0; int retval = 0; - +#if ENABLE_CLUSTER_BACKEND tripa_u32 = ::getTrcomTripAVal(); +#endif if (tripa_u32 > (uint32_t)INT_MAX) retval = INT_MAX; else @@ -63,8 +69,9 @@ Q_INVOKABLE int QClusterService::getOTempVal() { int16_t tmp_val = -40; int retval = -40; - +#if ENABLE_CLUSTER_BACKEND tmp_val = ::getOTempVal(); +#endif retval = (int)tmp_val; return retval; @@ -72,272 +79,292 @@ Q_INVOKABLE int QClusterService::getOTempVal() //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getTurnR() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getTurnR(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getTurnL() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getTurnL(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getFrontRightSeatbelt() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getFrontRightSeatbelt(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getFrontLeftSeatbelt() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getFrontLeftSeatbelt(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getGeneralWarn() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getGeneralWarn(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getEngine() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getEngine(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getLowBattery() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getLowBattery(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getLdwOff() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getLdwOff(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getSrsAirbag() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getSrsAirbag(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getEspOff() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getEspOff(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getBrake() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getBrake(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getAbs() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getAbs(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getEspAct() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getEspAct(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getHillDescent() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getHillDescent(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getImmobi() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getImmobi(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getDoor() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getDoor(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getEps() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getEps(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getAutoHiBeamGreen() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getAutoHiBeamGreen(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE bool QClusterService::getHighbeam() { - IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; bool retval = false; +#if ENABLE_CLUSTER_BACKEND + IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF; on_off_flag = ::getHighbeam(); if (on_off_flag == IC_HMI_OFF) retval = false; else retval = true; - +#endif return retval; } //----------------------------------------------------------------------------------- Q_INVOKABLE QString QClusterService::getGearAtVal() { +#if ENABLE_CLUSTER_BACKEND IC_HMI_GEAR_AT_VAL gear_val = IC_HMI_AT_UNUSED; QString gear_string = QString(""); @@ -385,6 +412,9 @@ Q_INVOKABLE QString QClusterService::getGearAtVal() } return gear_string; +#else + return QStringLiteral("Test"); +#endif } //----------------------------------------------------------------------------------- /* @@ -395,6 +425,7 @@ static void ic_notify(uint64_t signal, IC_HMI_ON_OFF val)ui */ void QClusterService::run() { +#if ENABLE_CLUSTER_BACKEND sd_event *event = NULL; data_pool_client_handle_sdevent handle = NULL; int ret = -1; @@ -421,6 +452,7 @@ finish: (void) data_pool_client_cleanup_sdevent(handle); event = sd_event_unref(event); +#endif return; } diff --git a/Application/main.cpp b/Application/main.cpp index 51b0c39..1593d25 100644 --- a/Application/main.cpp +++ b/Application/main.cpp @@ -14,17 +14,21 @@ * limitations under the License. */ +#include <QDebug> +#include <QDir> +#include <QDirIterator> #include <QGuiApplication> #include <QQmlApplicationEngine> -#include <QSurfaceFormat> -#include <QDir> #include <QQmlContext> -#include <QDebug> - +#include <QSurfaceFormat> +#if QT_VERSION >= 0x060000 +#include <QQuickWindow> +#endif #include "cluster-service.hxx" int main(int argc, char *argv[]) { +#ifdef CROSSCOMPILING QSurfaceFormat defaultFormat; defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer); defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES); @@ -34,6 +38,17 @@ int main(int argc, char *argv[]) defaultFormat.setDepthBufferSize(8); defaultFormat.setAlphaBufferSize(8); QSurfaceFormat::setDefaultFormat(defaultFormat); +#endif + +#if QT_VERSION >= 0x060000 + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); + qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); +#endif + + QDirIterator it(":", QDirIterator::Subdirectories); + while (it.hasNext()) { + qDebug() << it.next(); + } QGuiApplication app(argc, argv); |