diff --git a/cellulo-unity.pri b/cellulo-unity.pri new file mode 100644 index 0000000..ad57eb5 --- /dev/null +++ b/cellulo-unity.pri @@ -0,0 +1,171 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-07-30T12:15:05 +# +#------------------------------------------------- + +QT -= gui +QT += qml quick bluetooth + +linux:!android { + CONFIG += link_pkgconfig + + packagesExist(bluez){ + PKGCONFIG += bluez + DEFINES += BT_MULTIADAPTER_SUPPORT + message("BlueZ found, enabling Bluetooth multiadapter support.") + } + else{ + message("BlueZ not found, disabling Bluetooth multiadapter support.") + } +} + + +android{ + QT += androidextras + CONFIG += c++11 +} + +DEFINES += CELLULOUNITY_LIBRARY + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + $$PWD/cellulounity.cpp \ + $$PWD/cellulothread.cpp \ + $$PWD/cellulorobotwrapper.cpp + +HEADERS += \ + $$PWD/cellulounity.h \ + $$PWD/cellulo-unity_global.h \ + $$PWD/cellulothread.h \ + $$PWD/cellulorobotwrapper.h + +HEADERS += \ + $$PWD/cellulo-qml-plugin/src/CelluloPlugin.h \ + $$PWD/cellulo-qml-plugin/src/robot/CelluloRobot.h \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTracker.h \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerConstVel.h \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerConstAccel.h \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerAdaptiveVel.h \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerProfiledVel.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetooth.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloCommUtil.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothEMP.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothScanner.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothEnums.h \ + $$PWD/cellulo-qml-plugin/src/comm/CameraFrameImageProvider.h \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothPacket.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRelayServer.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRelayClient.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayServer.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayClient.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRobotPoolClient.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayServer.h \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayClient.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneClient.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePoint.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneLine.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneCircle.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePolygon.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePolyBezier.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZone.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneRectangle.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneAngle.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneAngleInterval.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneEngine.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneJsonHandler.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneTypes.h \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePaintedItem.h \ + $$PWD/cellulo-qml-plugin/src/util/math/CelluloMathUtil.h \ + $$PWD/cellulo-qml-plugin/src/util/math/CubicBezier.h \ + $$PWD/cellulo-qml-plugin/src/util/math/PolyBezier.h \ + $$PWD/cellulo-qml-plugin/src/util/svg/CelluloSVGUtil.h \ + $$PWD/cellulo-qml-plugin/src/util/lang/TranslationTool.h \ + $$PWD/cellulo-qml-plugin/src/util/system/CelluloSystemUtil.h \ + $$PWD/cellulo-qml-plugin/src/util/ui/CelluloUIUtil.h \ + $$PWD/cellulo-qml-plugin/src/util/ui/ProgressCircle.h \ + $$PWD/cellulo-qml-plugin/src/tile/PoseRemapper.h \ + $$PWD/cellulo-qml-plugin/src/tile/OffsetRemapper.h \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileMap.h \ + $$PWD/cellulo-qml-plugin/src/tile/HexTile.h \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileStdSourceCoords.h \ + $$PWD/cellulo-qml-plugin/src/tile/CoordSpaceConverter.h \ + $$PWD/cellulo-qml-plugin/src/tile/AxialHexCoords.h \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileMapAutoBuilder.h + +SOURCES += \ + $$PWD/cellulo-qml-plugin/src/CelluloPlugin.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/CelluloRobot.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTracker.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerConstVel.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerConstAccel.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerAdaptiveVel.cpp \ + $$PWD/cellulo-qml-plugin/src/robot/PolyBezierTrackerProfiledVel.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetooth.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloCommUtil.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothEMP.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothScanner.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothEnums.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CameraFrameImageProvider.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/CelluloBluetoothPacket.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRelayServer.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRelayClient.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayServer.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayClient.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloRobotPoolClient.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayServer.cpp \ + $$PWD/cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayClient.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneClient.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePoint.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneLine.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneCircle.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePolygon.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePolyBezier.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZone.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneRectangle.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneAngle.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneAngleInterval.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneEngine.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneJsonHandler.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZoneTypes.cpp \ + $$PWD/cellulo-qml-plugin/src/zones/CelluloZonePaintedItem.cpp \ + $$PWD/cellulo-qml-plugin/src/util/math/CelluloMathUtil.cpp \ + $$PWD/cellulo-qml-plugin/src/util/math/CubicBezier.cpp \ + $$PWD/cellulo-qml-plugin/src/util/math/PolyBezier.cpp \ + $$PWD/cellulo-qml-plugin/src/util/svg/CelluloSVGUtil.cpp \ + $$PWD/cellulo-qml-plugin/src/util/lang/TranslationTool.cpp \ + $$PWD/cellulo-qml-plugin/src/util/system/CelluloSystemUtil.cpp \ + $$PWD/cellulo-qml-plugin/src/util/ui/CelluloUIUtil.cpp \ + $$PWD/cellulo-qml-plugin/src/util/ui/ProgressCircle.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/PoseRemapper.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/OffsetRemapper.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileMap.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/HexTile.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileStdSourceCoords.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/CoordSpaceConverter.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/AxialHexCoords.cpp \ + $$PWD/cellulo-qml-plugin/src/tile/HexTileMapAutoBuilder.cpp + +INCLUDEPATH += \ + $$PWD/cellulo-qml-plugin/include/ + +QML_SOURCES = \ + $$PWD/cellulo-qml-plugin/src/util/ui/MacAddrSelector.qml \ + $$PWD/cellulo-qml-plugin/src/util/ui/Toast.qml \ + $$PWD/cellulo-qml-plugin/src/util/ui/ToastManager.qml + + +unix { + target.path = /usr/lib + INSTALLS += target +} diff --git a/cellulo-unity.pro b/cellulo-unity.pro index 485db3e..b105352 100644 --- a/cellulo-unity.pro +++ b/cellulo-unity.pro @@ -1,168 +1,12 @@ #------------------------------------------------- # # Project created by QtCreator 2018-07-30T12:15:05 # #------------------------------------------------- -QT -= gui -QT += qml quick bluetooth -linux:!android { - CONFIG += link_pkgconfig - - packagesExist(bluez){ - PKGCONFIG += bluez - DEFINES += BT_MULTIADAPTER_SUPPORT - message("BlueZ found, enabling Bluetooth multiadapter support.") - } - else{ - message("BlueZ not found, disabling Bluetooth multiadapter support.") - } -} +# including base file +include(cellulo-unity.pri) TARGET = cellulo-unity TEMPLATE = lib - -DEFINES += CELLULOUNITY_LIBRARY - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - cellulounity.cpp \ - cellulothread.cpp \ - cellulorobotwrapper.cpp - -HEADERS += \ - cellulounity.h \ - cellulo-unity_global.h \ - cellulothread.h \ - cellulorobotwrapper.h - -HEADERS += \ - cellulo-qml-plugin/src/CelluloPlugin.h \ - cellulo-qml-plugin/src/robot/CelluloRobot.h \ - cellulo-qml-plugin/src/robot/PolyBezierTracker.h \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerConstVel.h \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerConstAccel.h \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerAdaptiveVel.h \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerProfiledVel.h \ - cellulo-qml-plugin/src/comm/CelluloBluetooth.h \ - cellulo-qml-plugin/src/comm/CelluloCommUtil.h \ - cellulo-qml-plugin/src/comm/CelluloBluetoothEMP.h \ - cellulo-qml-plugin/src/comm/CelluloBluetoothScanner.h \ - cellulo-qml-plugin/src/comm/CelluloBluetoothEnums.h \ - cellulo-qml-plugin/src/comm/CameraFrameImageProvider.h \ - cellulo-qml-plugin/src/comm/CelluloBluetoothPacket.h \ - cellulo-qml-plugin/src/comm/relay/CelluloRelayServer.h \ - cellulo-qml-plugin/src/comm/relay/CelluloRelayClient.h \ - cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayServer.h \ - cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayClient.h \ - cellulo-qml-plugin/src/comm/relay/CelluloRobotPoolClient.h \ - cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayServer.h \ - cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayClient.h \ - cellulo-qml-plugin/src/zones/CelluloZoneClient.h \ - cellulo-qml-plugin/src/zones/CelluloZonePoint.h \ - cellulo-qml-plugin/src/zones/CelluloZoneLine.h \ - cellulo-qml-plugin/src/zones/CelluloZoneCircle.h \ - cellulo-qml-plugin/src/zones/CelluloZonePolygon.h \ - cellulo-qml-plugin/src/zones/CelluloZonePolyBezier.h \ - cellulo-qml-plugin/src/zones/CelluloZone.h \ - cellulo-qml-plugin/src/zones/CelluloZoneRectangle.h \ - cellulo-qml-plugin/src/zones/CelluloZoneAngle.h \ - cellulo-qml-plugin/src/zones/CelluloZoneAngleInterval.h \ - cellulo-qml-plugin/src/zones/CelluloZoneEngine.h \ - cellulo-qml-plugin/src/zones/CelluloZoneJsonHandler.h \ - cellulo-qml-plugin/src/zones/CelluloZoneTypes.h \ - cellulo-qml-plugin/src/zones/CelluloZonePaintedItem.h \ - cellulo-qml-plugin/src/util/math/CelluloMathUtil.h \ - cellulo-qml-plugin/src/util/math/CubicBezier.h \ - cellulo-qml-plugin/src/util/math/PolyBezier.h \ - cellulo-qml-plugin/src/util/svg/CelluloSVGUtil.h \ - cellulo-qml-plugin/src/util/lang/TranslationTool.h \ - cellulo-qml-plugin/src/util/system/CelluloSystemUtil.h \ - cellulo-qml-plugin/src/util/ui/CelluloUIUtil.h \ - cellulo-qml-plugin/src/util/ui/ProgressCircle.h \ - cellulo-qml-plugin/src/tile/PoseRemapper.h \ - cellulo-qml-plugin/src/tile/OffsetRemapper.h \ - cellulo-qml-plugin/src/tile/HexTileMap.h \ - cellulo-qml-plugin/src/tile/HexTile.h \ - cellulo-qml-plugin/src/tile/HexTileStdSourceCoords.h \ - cellulo-qml-plugin/src/tile/CoordSpaceConverter.h \ - cellulo-qml-plugin/src/tile/AxialHexCoords.h \ - cellulo-qml-plugin/src/tile/HexTileMapAutoBuilder.h - -SOURCES += \ - cellulo-qml-plugin/src/CelluloPlugin.cpp \ - cellulo-qml-plugin/src/robot/CelluloRobot.cpp \ - cellulo-qml-plugin/src/robot/PolyBezierTracker.cpp \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerConstVel.cpp \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerConstAccel.cpp \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerAdaptiveVel.cpp \ - cellulo-qml-plugin/src/robot/PolyBezierTrackerProfiledVel.cpp \ - cellulo-qml-plugin/src/comm/CelluloBluetooth.cpp \ - cellulo-qml-plugin/src/comm/CelluloCommUtil.cpp \ - cellulo-qml-plugin/src/comm/CelluloBluetoothEMP.cpp \ - cellulo-qml-plugin/src/comm/CelluloBluetoothScanner.cpp \ - cellulo-qml-plugin/src/comm/CelluloBluetoothEnums.cpp \ - cellulo-qml-plugin/src/comm/CameraFrameImageProvider.cpp \ - cellulo-qml-plugin/src/comm/CelluloBluetoothPacket.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloRelayServer.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloRelayClient.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayServer.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloLocalRelayClient.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloRobotPoolClient.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayServer.cpp \ - cellulo-qml-plugin/src/comm/relay/CelluloTcpRelayClient.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneClient.cpp \ - cellulo-qml-plugin/src/zones/CelluloZonePoint.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneLine.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneCircle.cpp \ - cellulo-qml-plugin/src/zones/CelluloZonePolygon.cpp \ - cellulo-qml-plugin/src/zones/CelluloZonePolyBezier.cpp \ - cellulo-qml-plugin/src/zones/CelluloZone.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneRectangle.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneAngle.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneAngleInterval.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneEngine.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneJsonHandler.cpp \ - cellulo-qml-plugin/src/zones/CelluloZoneTypes.cpp \ - cellulo-qml-plugin/src/zones/CelluloZonePaintedItem.cpp \ - cellulo-qml-plugin/src/util/math/CelluloMathUtil.cpp \ - cellulo-qml-plugin/src/util/math/CubicBezier.cpp \ - cellulo-qml-plugin/src/util/math/PolyBezier.cpp \ - cellulo-qml-plugin/src/util/svg/CelluloSVGUtil.cpp \ - cellulo-qml-plugin/src/util/lang/TranslationTool.cpp \ - cellulo-qml-plugin/src/util/system/CelluloSystemUtil.cpp \ - cellulo-qml-plugin/src/util/ui/CelluloUIUtil.cpp \ - cellulo-qml-plugin/src/util/ui/ProgressCircle.cpp \ - cellulo-qml-plugin/src/tile/PoseRemapper.cpp \ - cellulo-qml-plugin/src/tile/OffsetRemapper.cpp \ - cellulo-qml-plugin/src/tile/HexTileMap.cpp \ - cellulo-qml-plugin/src/tile/HexTile.cpp \ - cellulo-qml-plugin/src/tile/HexTileStdSourceCoords.cpp \ - cellulo-qml-plugin/src/tile/CoordSpaceConverter.cpp \ - cellulo-qml-plugin/src/tile/AxialHexCoords.cpp \ - cellulo-qml-plugin/src/tile/HexTileMapAutoBuilder.cpp - -INCLUDEPATH += \ - cellulo-qml-plugin/include/ - -QML_SOURCES = \ - cellulo-qml-plugin/src/util/ui/MacAddrSelector.qml \ - cellulo-qml-plugin/src/util/ui/Toast.qml \ - cellulo-qml-plugin/src/util/ui/ToastManager.qml - - -unix { - target.path = /usr/lib - INSTALLS += target -} diff --git a/cellulothread.cpp b/cellulothread.cpp index f65b412..caca247 100644 --- a/cellulothread.cpp +++ b/cellulothread.cpp @@ -1,19 +1,18 @@ #include "cellulothread.h" -#include "democlass.h" CelluloThread::CelluloThread() { } void CelluloThread::run() { argc = 1; argv[0] = strdup("CelluloThread"); argv[1] = nullptr; // todo: free argv on thread finish application = new QCoreApplication(argc, argv); (*application).exec(); } diff --git a/cpp-test/.gitignore b/cpp-test/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/cpp-test/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/cpp-test/cpp-test.pro b/cpp-test/cpp-test.pro new file mode 100644 index 0000000..8f73d6a --- /dev/null +++ b/cpp-test/cpp-test.pro @@ -0,0 +1,14 @@ +QT -= gui + +include(../cellulo-unity.pri) + +CONFIG += c++11 console +CONFIG -= app_bundle + +SOURCES += \ + main.cpp + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/cpp-test/main.cpp b/cpp-test/main.cpp new file mode 100644 index 0000000..b53e6e1 --- /dev/null +++ b/cpp-test/main.cpp @@ -0,0 +1,31 @@ +#include +#include "../cellulounity.h" +#include + +void onKidnappedChanged() { + fprintf(stderr, "callback: kidnapped changed\n"); +} + +int main() { + long robot = newRobot(); + fprintf(stderr, "Got robot %d\n", robot); + setLocalAdapterMacAddr(robot, ""); + setMacAddr(robot, "00:06:66:E7:8A:E0"); + connectToServer(robot); + setKidnappedCallback(robot, &onKidnappedChanged); + + sleep(1); + + int r, g, b; + g = 0; + b = 0; + r = 0; + while(true) + { + fprintf(stderr, "x=%f y=%f theta=%f kidnapped=%s\n", getX(robot), getY(robot), getTheta(robot), getKidnapped(robot) ? "true" : "false"); + setVisualEffect(robot, 0, r, g, b, 255); + r += 50; + r %= 255; + usleep(1000000); + } +}