diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 5f78471..e026827 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -15,15 +15,20 @@ cmake_policy(SET CMP0071 NEW) find_package(Qt5 COMPONENTS Core REQUIRED) find_package(Qt5 COMPONENTS RemoteObjects REQUIRED) +find_package(Qt5 COMPONENTS Qml REQUIRED) +find_package(Qt5 COMPONENTS Quick REQUIRED) +find_package(Qt5 COMPONENTS QuickControls2 REQUIRED) find_package(PkgConfig REQUIRED) #configure_file(include/config.h.in include/config.h) set(HEADERS + include/client.hpp ) set(SOURCES source/main.cpp + source/client.cpp ) qt5_generate_repc(REPSOURCES ${CMAKE_SOURCE_DIR}/plugins/dcdc-usb-200/source/dcdc_usb_200.rep @@ -39,6 +44,7 @@ add_executable(sbcbmc-client ${SOURCES} ${HEADERS} ${REPSOURCES} + sbcbmc-client.qrc ) target_include_directories(sbcbmc-client PRIVATE @@ -49,4 +55,4 @@ target_include_directories(sbcbmc-client PRIVATE ${LibUSB_INCLUDE_DIRS} ) -target_link_libraries(sbcbmc-client Qt5::Core Qt5::RemoteObjects) \ No newline at end of file +target_link_libraries(sbcbmc-client Qt5::Core Qt5::RemoteObjects Qt5::Qml Qt5::Quick) \ No newline at end of file diff --git a/client/include/client.hpp b/client/include/client.hpp new file mode 100644 index 0000000..19cd4b2 --- /dev/null +++ b/client/include/client.hpp @@ -0,0 +1,12 @@ +#include +#include + +class SBCBMCClient : public QObject { + Q_OBJECT + public: + SBCBMCClient(QObject *parent = nullptr); + ~SBCBMCClient(); + + private: + QQmlApplicationEngine *engine; +}; \ No newline at end of file diff --git a/client/qml/main.qml b/client/qml/main.qml new file mode 100644 index 0000000..0997d81 --- /dev/null +++ b/client/qml/main.qml @@ -0,0 +1,21 @@ +import QtQuick.Controls 2.12 + +ApplicationWindow { + visible: true + + menuBar: MenuBar { + // ... + } + + header: ToolBar { + // ... + } + + footer: TabBar { + // ... + } + + StackView { + anchors.fill: parent + } +} \ No newline at end of file diff --git a/client/sbcbmc-client.qrc b/client/sbcbmc-client.qrc new file mode 100644 index 0000000..8903331 --- /dev/null +++ b/client/sbcbmc-client.qrc @@ -0,0 +1,5 @@ + + +qml/main.qml + + diff --git a/client/source/client.cpp b/client/source/client.cpp new file mode 100644 index 0000000..f5e08e9 --- /dev/null +++ b/client/source/client.cpp @@ -0,0 +1,38 @@ +#include "client.hpp" + +SBCBMCClient::SBCBMCClient(QObject *parent) : + QObject(parent) +{ + this->engine = new QQmlApplicationEngine("qrc:///qml/main.qml"); +} + +SBCBMCClient::~SBCBMCClient() +{ + +} + +#if 0 + QRemoteObjectNode node(QUrl("tcp://127.0.0.1:1999")); + + QObject::connect(&node, &QRemoteObjectNode::remoteObjectAdded, + [](const QRemoteObjectSourceLocation& info){ + qDebug() << "New source added : " << info; + }); + + qDebug() << "Waiting for registry "; + node.waitForRegistry(10000); + + qDebug() << "Already here sources : " << node.registry()->sourceLocations(); + + QTimer timer; + timer.start(5000); + + QObject::connect(&timer, &QTimer::timeout, + [&](){ + qDebug() << "New sources list : " << node.registry()->sourceLocations(); + }); + + QRemoteObjectDynamicReplica *plugin = node.acquireDynamic("plugins/thermal/thermal_zone1/x86_pkg_temp"); + QRemoteObjectDynamicReplica *plugin2 = node.acquireDynamic("plugins/thermal/thermal_zone0/x86_pkg_temp"); + +#endif \ No newline at end of file diff --git a/client/source/main.cpp b/client/source/main.cpp index 95cc694..7ba5a7c 100644 --- a/client/source/main.cpp +++ b/client/source/main.cpp @@ -3,9 +3,10 @@ #include #include #include +#include "client.hpp" -Q_LOGGING_CATEGORY(ozwdaemon, "ozw.daemon"); +Q_LOGGING_CATEGORY(sbcclient, "sbcbmc.client"); #if 0 #define APP_VERSION #carputer_VERSION_MAJOR.#carputer_VERSION_MINOR.#carputer_VERSION_PATCH @@ -17,40 +18,21 @@ Q_LOGGING_CATEGORY(ozwdaemon, "ozw.daemon"); int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); - QCoreApplication::setApplicationName("carclient"); + QCoreApplication::setApplicationName("sbcbmc-client"); //QCoreApplication::setApplicationVersion(DEF2STR(APP_VERSION)); QCoreApplication::setOrganizationName("DynamX"); QCoreApplication::setOrganizationDomain("dynam.com"); QCommandLineParser parser; - parser.setApplicationDescription("CarClient"); + parser.setApplicationDescription("SBCBMC Client"); parser.addHelpOption(); parser.addVersionOption(); parser.process(a); - QRemoteObjectNode node(QUrl("tcp://127.0.0.1:1999")); + SBCBMCClient client; - QObject::connect(&node, &QRemoteObjectNode::remoteObjectAdded, - [](const QRemoteObjectSourceLocation& info){ - qDebug() << "New source added : " << info; - }); - qDebug() << "Waiting for registry "; - node.waitForRegistry(10000); - - qDebug() << "Already here sources : " << node.registry()->sourceLocations(); - - QTimer timer; - timer.start(5000); - - QObject::connect(&timer, &QTimer::timeout, - [&](){ - qDebug() << "New sources list : " << node.registry()->sourceLocations(); - }); - - QRemoteObjectDynamicReplica *plugin = node.acquireDynamic("plugins/thermal/thermal_zone1/x86_pkg_temp"); - QRemoteObjectDynamicReplica *plugin2 = node.acquireDynamic("plugins/thermal/thermal_zone0/x86_pkg_temp"); a.exec(); diff --git a/plugins/dcdc-usb-200/CMakeLists.txt b/plugins/dcdc-usb-200/CMakeLists.txt index 1c4cf98..af69b07 100644 --- a/plugins/dcdc-usb-200/CMakeLists.txt +++ b/plugins/dcdc-usb-200/CMakeLists.txt @@ -48,7 +48,7 @@ add_library(dcdc-usb-200 target_include_directories(dcdc-usb-200 PRIVATE "${PROJECT_BINARY_DIR}" - "${CMAKE_SOURCE_DIR}/car/include/" + "${CMAKE_SOURCE_DIR}/agent/include/" ${LibUSB_INCLUDE_DIRS} ) diff --git a/plugins/thermal/CMakeLists.txt b/plugins/thermal/CMakeLists.txt index 08bb3dd..9914518 100644 --- a/plugins/thermal/CMakeLists.txt +++ b/plugins/thermal/CMakeLists.txt @@ -38,7 +38,7 @@ add_library(thermal target_include_directories(thermal PRIVATE "${PROJECT_BINARY_DIR}" - "${CMAKE_SOURCE_DIR}/car/include/" + "${CMAKE_SOURCE_DIR}/agent/include/" ) target_include_directories(thermal PUBLIC