diff --git a/CMakeLists.txt b/CMakeLists.txt index b52b1fc..7f2079d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,17 @@ +cmake_minimum_required(VERSION 3.20) +set(DEFAULT_BUILD_TYPE "Release") +project(OpenLCP VERSION 0.2.0 LANGUAGES CXX) -add_subdirectory(protocols) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") +endif() + +add_subdirectory(platform) +add_subdirectory(protocol) add_subdirectory(test) -add_subdirectory(platform/qt) +add_subdirectory(example) #if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease") option(BUILD_DOC "Build documentation" ON) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index edf3a97..a4282c4 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -127,7 +127,8 @@ FILE_PATTERNS = *.cpp \ *.md \ *.py RECURSIVE = YES -EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/platform \ +EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/example \ + @CMAKE_CURRENT_SOURCE_DIR@/platform \ @CMAKE_CURRENT_SOURCE_DIR@/test EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt new file mode 100644 index 0000000..49ae724 --- /dev/null +++ b/example/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory("sACN Explorer") diff --git a/example/sACN Explorer/CMakeLists.txt b/example/sACN Explorer/CMakeLists.txt new file mode 100644 index 0000000..3235379 --- /dev/null +++ b/example/sACN Explorer/CMakeLists.txt @@ -0,0 +1,60 @@ +project(sacnExplorer VERSION 1.1.1 LANGUAGES CXX) + +find_package(QT NAMES Qt5 Qt6 COMPONENTS Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION) +else() + if(ANDROID) + add_library(${PROJECT_NAME} SHARED) + else() + add_executable(${PROJECT_NAME}) + endif() +endif() + +target_sources(${PROJECT_NAME} + PRIVATE + adduniversedialog.cpp + adduniversedialog.h + adduniversedialog.ui + multiverseitem.h + multiverseitem.cpp + multiversemodel.h + multiversemodel.cpp + main.cpp + multiverseview.cpp + multiverseview.h + multiverseview.ui + sacnexplorer.h + sacnexplorer.cpp + universemodel.cpp + universemodel.h + universeview.h + universeview.cpp + universeview.ui + universeviewdelegate.h + universeviewdelegate.cpp + ) + +target_link_libraries(${PROJECT_NAME} + PRIVATE + Qt${QT_VERSION_MAJOR}::Widgets + QsACN + ) + +set_target_properties(${PROJECT_NAME} PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER ${PROJECT_NAME}.company235.com + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} +) + +if(QT_VERSION_MAJOR EQUAL 6) + qt_finalize_executable(${PROJECT_NAME}) +endif() + + diff --git a/example/sACN Explorer/adduniversedialog.cpp b/example/sACN Explorer/adduniversedialog.cpp new file mode 100644 index 0000000..7144d0f --- /dev/null +++ b/example/sACN Explorer/adduniversedialog.cpp @@ -0,0 +1,25 @@ +#include "adduniversedialog.h" +#include "ui_adduniversedialog.h" + +AddUniverseDialog::AddUniverseDialog(QWidget *parent, uint16_t universe, + QString title) + : QDialog(parent) + , ui(new Ui::AddUniverseDialog) +{ + ui->setupUi(this); + ui->spinBox->setValue(universe); + + setWindowTitle(title.isEmpty() ? tr("Add Universe") : title); + + connect(this, &QDialog::accepted, + this, &AddUniverseDialog::requestAddition); +} + +AddUniverseDialog::~AddUniverseDialog() +{ + delete ui; +} + +void AddUniverseDialog::requestAddition() { + emit additionRequested(ui->spinBox->value()); +} diff --git a/example/sACN Explorer/adduniversedialog.h b/example/sACN Explorer/adduniversedialog.h new file mode 100644 index 0000000..31a0ea6 --- /dev/null +++ b/example/sACN Explorer/adduniversedialog.h @@ -0,0 +1,28 @@ +#pragma once + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { + class AddUniverseDialog; +} +QT_END_NAMESPACE + +class AddUniverseDialog : public QDialog +{ + Q_OBJECT + +public: + explicit AddUniverseDialog(QWidget *parent = nullptr, uint16_t universe = 1, + QString title = ""); + virtual ~AddUniverseDialog(); + +public slots: + void requestAddition(); + +signals: + void additionRequested(int universe); + +private: + Ui::AddUniverseDialog *ui; +}; diff --git a/example/sACN Explorer/adduniversedialog.ui b/example/sACN Explorer/adduniversedialog.ui new file mode 100644 index 0000000..edf191a --- /dev/null +++ b/example/sACN Explorer/adduniversedialog.ui @@ -0,0 +1,74 @@ + + + AddUniverseDialog + + + + + + + + Universe + + + spinBox + + + + + + + 1 + + + 63999 + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + dialogButtonBox + accepted() + AddUniverseDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + dialogButtonBox + rejected() + AddUniverseDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/example/sACN Explorer/main.cpp b/example/sACN Explorer/main.cpp new file mode 100644 index 0000000..21579a4 --- /dev/null +++ b/example/sACN Explorer/main.cpp @@ -0,0 +1,7 @@ +#include "sacnexplorer.h" + +int main(int argc, char *argv[]) +{ + SacnExplorer a(argc, argv); + return a.exec(); +} diff --git a/example/sACN Explorer/multiverseitem.cpp b/example/sACN Explorer/multiverseitem.cpp new file mode 100644 index 0000000..3404797 --- /dev/null +++ b/example/sACN Explorer/multiverseitem.cpp @@ -0,0 +1,205 @@ +#include "multiverseitem.h" +#include "multiversemodel.h" + +#include +#include +#include + + +/** + * @brief MultiverseItem::MultiverseItem + * @param universe + * @param parent + */ +MultiverseItem::MultiverseItem(MultiverseItem* parent, + QSacnUniverse *universe, + discoveredUniverse *discovery) + : universe_(universe) + , discovery_(discovery) + , parentItem_(parent) + , override_data_(QVariant()) +{ + if(parent) + parent->appendChild(this); +} + + +/** + * @brief MultiverseItem::~MultiverseItem + */ +MultiverseItem::~MultiverseItem() +{ + for (const auto & child : childItems_) + delete child; +} + + +/** + * @brief MultiverseItem::appendChild + * @param item + */ +void MultiverseItem::appendChild(MultiverseItem* item) +{ + childItems_.append(item); +} + +/** + * @brief MultiverseItem::removeChild + * @param child + */ +void MultiverseItem::removeChild(MultiverseItem* child) +{ + for (int i = 0; i < childItems_.size(); ++i) + if (childItems_.at(i) == child) + childItems_.remove(i); +} + + +/** + * @brief MultiverseItem::setOverrideData + * @param data + */ +void MultiverseItem::setOverrideData(QVariant data) +{ + override_data_ = data; +} + + +/** + * @brief MultiverseItem::child + * @param row + * @return + */ +MultiverseItem* MultiverseItem::child(int row) +{ + if (row < 0 || row >= childItems_.size()) + return nullptr; + return childItems_.at(row); +} + + +/** + * @brief MultiverseItem::childCount + * @return + */ +int MultiverseItem::childCount() const +{ + return childItems_.count(); +} + + +/** + * @brief MultiverseItem::row + * @return + */ +int MultiverseItem::row() const +{ + if (parentItem_) + return parentItem_->childItems_.indexOf(const_cast(this)); + return 0; +} + + +/** + * @brief MultiverseItem::data + * @param column + * @return + */ +QVariant MultiverseItem::data(int column, int role) const +{ + switch (role) { + case Qt::DisplayRole: + { + if (!universe_ && !discovery_) + return column ? QVariant() : override_data_; + if (universe_) + { + switch (static_cast(column)) + { + case MultiverseModel::Universe: + return universe_->number(); + case MultiverseModel::Priority: + { + auto v = universe_->priority(); + if (v > 200) + return QVariant(); + return v; + } + case MultiverseModel::Description: + return universe_->description(); + default: + return QVariant(); + } + } + if (discovery_) + { + switch (static_cast(column)) + { + case MultiverseModel::Universe: + return discovery_->universe; + case MultiverseModel::Description: + return QString::fromUtf8(discovery_->description); + default: + return QVariant(); + } + } + } + case Qt::FontRole: + if (!universe_ && !discovery_) + { + QFont bold; + bold.setBold(true); + return QVariant(bold); + } + return QVariant(); + case Qt::EditRole: + if (universe_) + return QVariant(QVariant::fromValue(universe_)); + if (discovery_) + return QVariant(QVariant::fromValue(static_cast(discovery_))); + return data(column, Qt::DisplayRole); + default: + return QVariant(); + } +} + + +/** + * @brief MultiverseItem::flags + * @param column + * @return + */ +Qt::ItemFlags MultiverseItem::flags(int column, Qt::ItemFlags base) const +{ + if (!universe_ && !universe_) + { + if (column) + return Qt::NoItemFlags; + return base & ~Qt::ItemIsSelectable; + } + + base |= Qt::ItemIsEditable; + + switch (static_cast(column)) + { + case MultiverseModel::Universe: + return base; + case MultiverseModel::Priority: + return base; + case MultiverseModel::Description: + return base; + default: + return Qt::NoItemFlags; + } +} + + +/** + * @brief MultiverseItem::parentItem + * @return + */ +MultiverseItem * MultiverseItem::parentItem() +{ + return parentItem_; +} + diff --git a/example/sACN Explorer/multiverseitem.h b/example/sACN Explorer/multiverseitem.h new file mode 100644 index 0000000..3b7804d --- /dev/null +++ b/example/sACN Explorer/multiverseitem.h @@ -0,0 +1,44 @@ +#pragma once + +#include "sacn/extended.h" + +#include +#include + +class QSacnUniverse; // forward declare + +using discoveredUniverse = sACN::EXTENDED::DISCOVERY::discoveredUniverse; + +/** + * @brief The MultiverseItem class + */ +class MultiverseItem +{ +public: + explicit MultiverseItem(MultiverseItem* parentItem = nullptr, + QSacnUniverse * universe = nullptr, + discoveredUniverse * discovery = nullptr); + virtual ~MultiverseItem(); + + void appendChild(MultiverseItem* child); + void removeChild(MultiverseItem* child); + void setOverrideData(QVariant data); + + MultiverseItem * child(int row); + int childCount() const; + QVariant data(int column, int role = Qt::DisplayRole) const; + Qt::ItemFlags flags(int column, Qt::ItemFlags base) const; + int row() const; + MultiverseItem * parentItem(); + +private: + QVector childItems_; + QSacnUniverse* universe_; + discoveredUniverse* discovery_; + MultiverseItem* parentItem_; + QVariant override_data_; +}; + +Q_DECLARE_METATYPE(discoveredUniverse*) + + diff --git a/example/sACN Explorer/multiversemodel.cpp b/example/sACN Explorer/multiversemodel.cpp new file mode 100644 index 0000000..c426aba --- /dev/null +++ b/example/sACN Explorer/multiversemodel.cpp @@ -0,0 +1,234 @@ +#include "multiverseitem.h" +#include "multiversemodel.h" +#include "uuid/uuid.h" +#include "qsacnnode.h" + +#include + +/** + * @brief MultiverseModel::MultiverseModel + * @param parent + * @param node + */ +MultiverseModel::MultiverseModel(QObject *parent, QSacnNode *node) + : QAbstractItemModel(parent) + , node_(node) + , rootItem_(new MultiverseItem()) +{ + QMetaEnum e = QMetaEnum::fromType(); + for (int k = 0; k < e.keyCount(); k++) + { + auto item = new MultiverseItem(rootItem_); + item->setOverrideData(QString(e.key(k))); + auto idx = MultiverseModel::index(k, 0, QModelIndex()); + categoryIndexes.insert(static_cast + (e.value(k)), idx); + } + + connect(node, &QSacnNode::subscribing, + this, &MultiverseModel::doSubscription); + connect(node, &QSacnNode::creating, + this, &MultiverseModel::doCreation); +} + + +/** + * @brief MultiverseModel::~MultiverseModel + */ +MultiverseModel::~MultiverseModel() +{ + delete rootItem_; +} + + +/** + * @brief MultiverseModel::root + * @return + */ +MultiverseItem * MultiverseModel::root() +{ + return rootItem_; +} + + +/** + * @brief MultiverseModel::getItem + * @param index + * @return + */ +MultiverseItem * MultiverseModel::getItem(const QModelIndex &index) const +{ + if (index.isValid()) + { + auto item = static_cast(index.internalPointer()); + if (item) + return item; + } + return rootItem_; +} + + +/** + * @brief MultiverseModel::headerData + * @param section + * @param orientation + * @param role + * @return + */ +QVariant MultiverseModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { + switch (static_cast(section)) { + case Universe: + return QString(tr("Universe")); + case Priority: + return QString(tr("Priority")); + case Description: + return QString(tr("Description")); + } + } + return QVariant(); +} + + +/** + * @brief MultiverseModel::index + * @param row + * @param column + * @param parent + * @return + */ +QModelIndex MultiverseModel::index(int row, int column, + const QModelIndex &parent) const +{ + if (parent.isValid() && parent.column() != 0) + return QModelIndex(); + + MultiverseItem *parentItem = getItem(parent); + if (!parentItem) + return QModelIndex(); + + auto childItem = parentItem->child(row); + if (childItem) + return createIndex(row, column, childItem); + + return QModelIndex(); +} + + +/** + * @brief MultiverseModel::parent + * @param index + * @return + */ +QModelIndex MultiverseModel::parent(const QModelIndex &index) const +{ + if (!checkIndex(index, CheckIndexOption::IndexIsValid | + CheckIndexOption::DoNotUseParent)) + return QModelIndex(); + + auto childItem = getItem(index); + auto parentItem = childItem ? childItem->parentItem() : nullptr; + + if (parentItem == rootItem_ || !parentItem) + return QModelIndex(); + + return createIndex(parentItem->row(), 0, parentItem); +} + + +/** + * @brief MultiverseModel::rowCount + * @param parent + * @return + */ +int MultiverseModel::rowCount(const QModelIndex &parent) const +{ + auto parentItem = getItem(parent); + return parentItem ? parentItem->childCount() : 0; +} + + +/** + * @brief MultiverseModel::columnCount + * @param parent + * @return + */ +int MultiverseModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return QMetaEnum::fromType().keyCount(); +} + + +/** + * @brief MultiverseModel::data + * @param index + * @param role + * @return + */ +QVariant MultiverseModel::data(const QModelIndex &index, int role) const +{ + if (!checkIndex(index, CheckIndexOption::IndexIsValid)) + return QVariant(); + + return getItem(index)->data(index.column(), role); +} + + +/** + * @brief MultiverseModel::flags + * @param index + * @return + */ +Qt::ItemFlags MultiverseModel::flags(const QModelIndex &index) const +{ + if (!checkIndex(index, CheckIndexOption::IndexIsValid)) + return Qt::NoItemFlags; + + auto item = getItem(index); + + if (!item) + return Qt::NoItemFlags; + + return item->flags(index.column(), QAbstractItemModel::flags(index)); +} + + +/** + * @brief MultiverseModel::insert + * @param universe + * @param parent + * @return + */ +void MultiverseModel::insert(const QModelIndex &parent, + QSacnUniverse *universe, + discoveredUniverse *discovery) +{ + auto item = getItem(parent); + beginInsertRows(parent, item->childCount(), item->childCount() + 1); + new MultiverseItem(item, universe, discovery); + endInsertRows(); +} + + +/** + * @brief MultiverseModel::doSubscription + * @param universe + */ +void MultiverseModel::doSubscription(QSacnUniverse* universe) +{ + auto parentIndex = categoryIndexes.value(MultiverseModel::Receiver); + insert(parentIndex, universe); +} + +/** + * @brief MultiverseModel::doCreation + * @param universe + */ +void MultiverseModel::doCreation(QSacnUniverse* universe) +{ + auto parentIndex = categoryIndexes.value(MultiverseModel::Source); + insert(parentIndex, universe); +} diff --git a/example/sACN Explorer/multiversemodel.h b/example/sACN Explorer/multiversemodel.h new file mode 100644 index 0000000..12b3de5 --- /dev/null +++ b/example/sACN Explorer/multiversemodel.h @@ -0,0 +1,70 @@ +#pragma once + +#include +#include "qsacnuniverse.h" +#include "multiverseitem.h" + +class QSacnNode; // forward declare node class + +/** + * @brief The MultiverseModel class + */ +class MultiverseModel + : public QAbstractItemModel +{ + Q_OBJECT + +public: + /// @brief The Catagory enum + enum Catagory { + Discovery, + Receiver, + Source + }; + Q_ENUM(Catagory) + + /// @brief The Column enum + enum Column { + Universe, + Priority, + Description + }; + Q_ENUM(Column) + + explicit MultiverseModel(QObject *parent = nullptr, + QSacnNode *node = nullptr); + virtual ~MultiverseModel(); + + // Model overrides: + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, + int role = Qt::DisplayRole) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + + // non-standard model operations + MultiverseItem * root(); + void insert(const QModelIndex &parent, + QSacnUniverse *universe = nullptr, + discoveredUniverse *discovery = nullptr); + + QMap categoryIndexes; + +public slots: + void doSubscription(QSacnUniverse*); + void doCreation(QSacnUniverse*); + +private: + MultiverseItem * getItem(const QModelIndex &index) const; + + QSacnNode * node_; + MultiverseItem * rootItem_; +}; + + + diff --git a/example/sACN Explorer/multiverseview.cpp b/example/sACN Explorer/multiverseview.cpp new file mode 100644 index 0000000..c9f605d --- /dev/null +++ b/example/sACN Explorer/multiverseview.cpp @@ -0,0 +1,30 @@ +#include "multiverseview.h" +#include "multiversemodel.h" +#include "ui_multiverseview.h" +#include "universeviewdelegate.h" + +#include + +/** + * @brief MultiverseView::MultiverseView + * @param parent + */ +MultiverseView::MultiverseView(QWidget *parent, QSacnNode *node) + : QMainWindow(parent) + , ui(new Ui::MultiverseView) +{ + ui->setupUi(this); + + ui->multiverseView->setModel(new MultiverseModel(this, node)); + ui->multiverseView->setItemDelegate(new UniverseViewDelegate()); + ui->multiverseView->expandAll(); +} + + +/** + * @brief MultiverseView::~MultiverseView + */ +MultiverseView::~MultiverseView() +{ + delete ui; +} diff --git a/example/sACN Explorer/multiverseview.h b/example/sACN Explorer/multiverseview.h new file mode 100644 index 0000000..8739ade --- /dev/null +++ b/example/sACN Explorer/multiverseview.h @@ -0,0 +1,47 @@ +/* + multiverseview.h + + Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +#pragma once + +#include +#include "qsacnnode.h" + +QT_BEGIN_NAMESPACE +namespace Ui { + class MultiverseView; +} +QT_END_NAMESPACE + +class MultiverseView + : public QMainWindow +{ + Q_OBJECT + +public: + explicit MultiverseView(QWidget *parent = nullptr, + QSacnNode* node = nullptr); + virtual ~MultiverseView(); + +private: + Ui::MultiverseView *ui; +}; diff --git a/example/sACN Explorer/multiverseview.ui b/example/sACN Explorer/multiverseview.ui new file mode 100644 index 0000000..24fcbe6 --- /dev/null +++ b/example/sACN Explorer/multiverseview.ui @@ -0,0 +1,134 @@ + + + MultiverseView + + + + 0 + 0 + 800 + 391 + + + + sACN Multiverse + + + + + + + true + + + 0 + + + true + + + true + + + true + + + 120 + + + + + + + + + 0 + 0 + 800 + 25 + + + + + EPI 19 + + + + + + + + + true + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + + + Subscribe + + + Subscribe to an sACN Universe + + + + + + + + + false + + + Unsubscribe + + + - + + + + + Create + + + N + + + + + false + + + Terminate + + + Terminate + + + X + + + + + User Assigned Component Name + + + Set this Component's UACN + + + + + + diff --git a/example/sACN Explorer/sacnexplorer.cpp b/example/sACN Explorer/sacnexplorer.cpp new file mode 100644 index 0000000..3965509 --- /dev/null +++ b/example/sACN Explorer/sacnexplorer.cpp @@ -0,0 +1,74 @@ +#include "sacnexplorer.h" + +#include +#include + +SacnExplorer::SacnExplorer(int argc, char *argv[]) + : QApplication(argc, argv) +{ + setOrganizationName("Company235"); + setOrganizationDomain("company235.com"); + setApplicationName(tr("sACN Explorer")); + + loadSettings(); + + node_ = new QSacnNode(this, cid_); + qDebug() << "sACN node started with CID" << node_->cid().string().c_str(); + node_->assignUserName(applicationName().toStdString()); + qDebug() << "Starting sACN discovery."; + node_->discoveryStart(); + + window = new MultiverseView(nullptr, node_); + window->show(); + + node_->subscribe(1); + node_->subscribe(2); + node_->subscribe(3); + node_->subscribe(4); + + node_->create(1); + node_->sACN::Source::universe(1)->setValue(100, 1); + node_->create(2); + node_->sACN::Source::universe(2)->setValue(100, 2); + node_->create(3); + node_->sACN::Source::universe(3)->setValue(100, 3); +} + + +SacnExplorer::~SacnExplorer() +{ + saveSettings(); + + delete window; + delete node_; +} + +/** + * @brief MultiverseView::loadSettings + */ +void SacnExplorer::loadSettings() +{ + QSettings settings; + qDebug() << "Loading application settings from" << settings.fileName(); + + settings.beginGroup("acn"); + cid_ = QUuid(settings.value("cid", + QUuid::createUuid().toString()).toString()); + qDebug() << "Persistent CID is" << cid_.toString().toStdString().c_str(); + settings.endGroup(); +} + + +/** + * @brief MultiverseView::saveSettings + */ +void SacnExplorer::saveSettings() +{ + QSettings settings; + qDebug() << "Saving application settings to" << settings.fileName(); + + settings.beginGroup("acn"); + settings.setValue("cid", cid_.toString()); + settings.endGroup(); +} + diff --git a/example/sACN Explorer/sacnexplorer.h b/example/sACN Explorer/sacnexplorer.h new file mode 100644 index 0000000..30afa91 --- /dev/null +++ b/example/sACN Explorer/sacnexplorer.h @@ -0,0 +1,25 @@ +#pragma once + +#include "multiverseview.h" +#include "qsacnnode.h" + +#include +#include + +class SacnExplorer + : public QApplication +{ + Q_OBJECT +public: + explicit SacnExplorer(int argc, char *argv[]); + virtual ~SacnExplorer(); + +private: + void loadSettings(); + void saveSettings(); + + MultiverseView* window; + QSacnNode *node_; + QUuid cid_; +}; + diff --git a/example/sACN Explorer/universemodel.cpp b/example/sACN Explorer/universemodel.cpp new file mode 100644 index 0000000..e866f2c --- /dev/null +++ b/example/sACN Explorer/universemodel.cpp @@ -0,0 +1,259 @@ +#include "universemodel.h" + +#include +#include +#include +#include + +/** + * @brief UniverseModel::UniverseModel + * @param parent + */ +UniverseModel::UniverseModel(QObject *parent) + : QAbstractTableModel(parent) + , universe_(nullptr) + , data_mode_(Decimal) +{ +} + + +/** + * @brief UniverseModel::headerData + * @param section + * @param orientation + * @param role + * @return + */ +QVariant UniverseModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + switch (role) + { + case Qt::DisplayRole: + switch (orientation) + { + case Qt::Horizontal: + return section + 1; + case Qt::Vertical: + return section * 10; + } + default: + return QVariant(); + } +} + + +/** + * @brief UniverseModel::rowCount + * @param parent + * @return + */ +int UniverseModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + + return 52; +} + + +/** + * @brief UniverseModel::columnCount + * @param parent + * @return + */ +int UniverseModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + + return 10; +} + + +/** + * @brief UniverseModel::data + * @param index + * @param role + * @return + */ +QVariant UniverseModel::data(const QModelIndex &index, int role) const +{ + if (!checkIndex(index, CheckIndexOption::IndexIsValid)) + return QVariant(); + + if (!universe_) + return QVariant(); + + uint16_t slot = (index.row() * 10) + (index.column() + 1); + + switch (role) { + case Qt::DisplayRole: + { + if (slot == 0 || slot > 512) + return QVariant(); + switch (data_mode_) + { + case Decimal: + return universe_->slot(slot); + case Hex: + return QString("%1") + .arg(universe_->slot(slot), 2, 16, QChar('0')) + .toUpper(); + case Percent: + return QString("%1%").arg((universe_->slot(slot) / 255.0F) * 100, + 0, 'f', 0, '0'); + } + return QVariant(); + } + case Qt::FontRole: + return QFont("monospace"); + case Qt::TextAlignmentRole: + return int(Qt::AlignCenter | Qt::AlignVCenter); + case Qt::ForegroundRole: + { + if (slot > universe_->activeSlots() - 1) + return QBrush(Qt::gray); + return QVariant(); + } + default: + return QVariant(); + } +} + + +/** + * @brief UniverseModel::setData + * @param index + * @param value + * @param role + * @return + */ +bool UniverseModel::setData(const QModelIndex &index, const QVariant &value, + int role) +{ + if (!universe_->isEditable()) + return false; + + if (data(index, role) == value) + return false; + + uint16_t slot = (index.row() * 10) + (index.column() + 1); + uint8_t data; + + switch (data_mode_) + { + case Decimal: + { + if (!value.canConvert()) + return false; + uint d = value.toUInt(); + if (d > 255) + return false; + data = d; + } + break; + case Hex: + { + if (!value.canConvert()) + return false; + bool ok; + uint d = value.toString().toInt(&ok, 16); + if (!ok || d > 255) + return false; + data = d; + } + break; + case Percent: + { + if (!value.canConvert()) + return false; + int d = 255 * (value.toDouble() / 100); + if (d < 0 || d > 255) + return false; + data = d; + } + break; + } + + universe_->setValue(slot, data); + emit dataChanged(index, index, QVector() << role); + return true; +} + + +/** + * @brief UniverseModel::flags + * @param index + * @return + */ +Qt::ItemFlags UniverseModel::flags(const QModelIndex &index) const +{ + if (!checkIndex(index, CheckIndexOption::IndexIsValid)) + return Qt::NoItemFlags; + + if (!universe_) + return Qt::NoItemFlags; + + uint16_t slot = (index.row() * 10) + (index.column() + 1); + + if (slot == 0 || slot > 512) + return Qt::NoItemFlags; + + auto f = QAbstractItemModel::flags(index); + return universe_->isEditable() ? f | Qt::ItemIsEditable : f; +} + + +/** + * @brief UniverseModel::universeRefreshed + */ +void UniverseModel::universeRefreshed() { + emit dataChanged(index(0,0), index(rowCount(), columnCount())); + emit recievedUpdate(universe_); +} + + +/** + * @brief UniverseModel::setDataMode + * @param mode + */ +void UniverseModel::setDataMode(const QString mode) +{ + auto metaEnum = QMetaEnum::fromType(); + data_mode_ = static_cast(metaEnum.keyToValue(mode.toLocal8Bit())); + emit dataChanged(index(0,0), index(rowCount(), columnCount())); +} + + +/** + * @brief UniverseModel::setUniverse + * @param universe + */ +void UniverseModel::setUniverse(QSacnUniverse *universe) +{ + if (universe_) + disconnect(universe_, 0, this, 0); + universe_ = universe; + connect(universe_, &QSacnUniverse::changed, + this, &UniverseModel::universeRefreshed); +} + + +/** + * @brief UniverseModel::universe + * @return + */ +QSacnUniverse * UniverseModel::universe() const +{ + return universe_; +} + + +/** + * @brief UniverseModel::dataMode + * @return + */ +UniverseModel::data_modes UniverseModel::dataMode() +{ + return data_mode_; +} diff --git a/example/sACN Explorer/universemodel.h b/example/sACN Explorer/universemodel.h new file mode 100644 index 0000000..f311b59 --- /dev/null +++ b/example/sACN Explorer/universemodel.h @@ -0,0 +1,48 @@ +#pragma once + +#include +#include "qsacnuniverse.h" + +class UniverseModel + : public QAbstractTableModel +{ + Q_OBJECT + +public: + /// @brief The data_modes enum + enum data_modes { + Decimal, + Hex, + Percent + }; + Q_ENUM(data_modes) + + explicit UniverseModel(QObject *parent = nullptr); + + // Model overrides: + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, + int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole) override; + Qt::ItemFlags flags(const QModelIndex& index) const override; + + // Data source: + void setUniverse(QSacnUniverse *universe); + QSacnUniverse * universe() const; + data_modes dataMode(); + +signals: + void recievedUpdate(const QSacnUniverse*); + +public slots: + void universeRefreshed(); + void setDataMode(const QString mode); + +private: + QSacnUniverse * universe_; + data_modes data_mode_; +}; diff --git a/example/sACN Explorer/universeview.cpp b/example/sACN Explorer/universeview.cpp new file mode 100644 index 0000000..b7a9874 --- /dev/null +++ b/example/sACN Explorer/universeview.cpp @@ -0,0 +1,98 @@ +#include "universeview.h" +#include "ui_universeview.h" + +#include +#include +#include + +/** + * @brief UniverseView::UniverseView + * @param parent + */ +UniverseView::UniverseView(QWidget *parent, QSacnUniverse *universe) + : QMainWindow(parent) + , ui(new Ui::UniverseView()) +{ + ui->setupUi(this); + + auto model = new UniverseModel(this); + ui->tableView->setModel(model); + + model->setUniverse(universe); + + // update the status bar whenever the universe refreshes + connect(model, &UniverseModel::recievedUpdate, + this, &UniverseView::updateStatus); + + // add data format combobox to toolbar + auto formatLabel = new QLabel(this); + formatLabel->setText(tr("Data Format") + ": "); + ui->toolBar->addWidget(formatLabel); + auto dataModes = new QComboBox(this); + const QMetaEnum types = QMetaEnum::fromType(); + for (int i=0; i < types.keyCount(); ++i) + dataModes->addItem(types.key(i)); + connect(dataModes, &QComboBox::currentTextChanged, + model, &UniverseModel::setDataMode); + ui->toolBar->addWidget(dataModes); + + ui->toolBar->addSeparator(); + + // add priority picker to the toolbar + auto priorityLabel = new QLabel(this); + priorityLabel->setText(tr("Priority") + ": "); + ui->toolBar->addWidget(priorityLabel); + prioritySpinBox = new QSpinBox(this); + prioritySpinBox->setMinimum(0); + prioritySpinBox->setValue(100); + prioritySpinBox->setMaximum(200); + prioritySpinBox->setEnabled(false); + ui->toolBar->addWidget(prioritySpinBox); + + ui->toolBar->addSeparator(); + + updateStatus(universe); + if (universe->isEditable()) + { + prioritySpinBox->setValue(universe->priority()); + prioritySpinBox->setEnabled(true); + connect(prioritySpinBox, &QSpinBox::valueChanged, + universe, &QSacnUniverse::setPriority); + } +} + + +/** + * @brief UniverseView::~UniverseView + */ +UniverseView::~UniverseView() +{ + delete ui; +} + + +/** + * @brief UniverseView::updateStatusBar + * @param universe + */ +void UniverseView::updateStatus(const QSacnUniverse * universe) +{ + // window title + QString titlestring = QString("%1 " + tr("Universe") + " %2 - \"%3\"").arg( + universe->isEditable() ? tr("Editing") : tr("Viewing"), + QString::number(universe->number()), + universe->description()); + this->setWindowTitle(titlestring); + + if (!universe->isEditable()) + { + // status bar + ui->statusbar->clearMessage(); + QString message = QString("%1 " + tr("Hz")).arg( + QString::number(universe->rxRate())); + ui->statusbar->showMessage(message, 2500); + + // priority spinbox + prioritySpinBox->setValue(universe->priority()); + } +} diff --git a/example/sACN Explorer/universeview.h b/example/sACN Explorer/universeview.h new file mode 100644 index 0000000..f1847a9 --- /dev/null +++ b/example/sACN Explorer/universeview.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +#include "multiversemodel.h" +#include "universemodel.h" + +QT_BEGIN_NAMESPACE +namespace Ui { + class UniverseView; +} +QT_END_NAMESPACE + +class UniverseView + : public QMainWindow +{ + Q_OBJECT + +public: + explicit UniverseView(QWidget *parent = nullptr, + QSacnUniverse* universe = nullptr); + virtual ~UniverseView(); + +public slots: + void updateStatus(const QSacnUniverse*); + +private: + Ui::UniverseView *ui; + QSpinBox *prioritySpinBox; +}; diff --git a/example/sACN Explorer/universeview.ui b/example/sACN Explorer/universeview.ui new file mode 100644 index 0000000..0f2831e --- /dev/null +++ b/example/sACN Explorer/universeview.ui @@ -0,0 +1,55 @@ + + + UniverseView + + + + 0 + 0 + 400 + 800 + + + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOn + + + QAbstractScrollArea::AdjustToContents + + + true + + + QAbstractItemView::SingleSelection + + + 60 + + + + + + + + + + TopToolBarArea + + + false + + + + + + diff --git a/example/sACN Explorer/universeviewdelegate.cpp b/example/sACN Explorer/universeviewdelegate.cpp new file mode 100644 index 0000000..3354256 --- /dev/null +++ b/example/sACN Explorer/universeviewdelegate.cpp @@ -0,0 +1,32 @@ +#include "adduniversedialog.h" +#include "qsacnuniverse.h" +#include "sacn/extended.h" +#include "universeview.h" +#include "universeviewdelegate.h" + + +QWidget * UniverseViewDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + QVariant data = index.data(Qt::EditRole); + + if (data.metaType().id() == qMetaTypeId()) + { + auto univ = data.value(); + auto universeView = new UniverseView(parent, univ); + universeView->show(); + + return new QWidget(parent); + } + + if (index.data().canConvert()) + { + auto disc = data.value(); + auto subscribe = new AddUniverseDialog(parent, disc->universe, + tr("Subscribe to Universe")); + return subscribe; + } + + return QStyledItemDelegate::createEditor(parent, option, index); +} diff --git a/example/sACN Explorer/universeviewdelegate.h b/example/sACN Explorer/universeviewdelegate.h new file mode 100644 index 0000000..017f121 --- /dev/null +++ b/example/sACN Explorer/universeviewdelegate.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +class UniverseViewDelegate + : public QStyledItemDelegate +{ + Q_OBJECT + +public: + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; +}; + diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt new file mode 100644 index 0000000..0b6b64c --- /dev/null +++ b/platform/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(qt) diff --git a/platform/qt/CMakeLists.txt b/platform/qt/CMakeLists.txt index 542ad91..5cc557c 100644 --- a/platform/qt/CMakeLists.txt +++ b/platform/qt/CMakeLists.txt @@ -2,14 +2,8 @@ project(QsACN VERSION 0.1 LANGUAGES CXX) cmake_minimum_required(VERSION 3.20) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") -endif() - -find_package(QT NAMES Qt6 Qt5 COMPONENTS Network Gui REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network Gui REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Network REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED) add_library(${PROJECT_NAME} SHARED) @@ -18,15 +12,16 @@ target_sources(${PROJECT_NAME} qsacnnode.h qsacnuniverse.h PRIVATE + qsacn_global.h qsacnnode.cpp qsacnuniverse.cpp - qsacn_global.h ) -target_link_libraries(${PROJECT_NAME} PUBLIC - Qt${QT_VERSION_MAJOR}::Network - Qt${QT_VERSION_MAJOR}::Gui - OpenLCP) +target_link_libraries(${PROJECT_NAME} + PUBLIC + Qt${QT_VERSION_MAJOR}::Network + LCP + ) target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_LIBRARY) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/protocols/CMakeLists.txt b/protocol/CMakeLists.txt similarity index 92% rename from protocols/CMakeLists.txt rename to protocol/CMakeLists.txt index fe5a11c..1c80a10 100644 --- a/protocols/CMakeLists.txt +++ b/protocol/CMakeLists.txt @@ -1,7 +1,5 @@ -project(OpenLCP VERSION 0.2.0 LANGUAGES CXX) -set(DEFAULT_BUILD_TYPE "Release") - cmake_minimum_required(VERSION 3.20) +project(LCP VERSION 0.2.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/protocols/acn/CMakeLists.txt b/protocol/acn/CMakeLists.txt similarity index 100% rename from protocols/acn/CMakeLists.txt rename to protocol/acn/CMakeLists.txt diff --git a/protocols/acn/component.h b/protocol/acn/component.h similarity index 100% rename from protocols/acn/component.h rename to protocol/acn/component.h diff --git a/protocols/acn/pdu-stream.cpp b/protocol/acn/pdu-stream.cpp similarity index 100% rename from protocols/acn/pdu-stream.cpp rename to protocol/acn/pdu-stream.cpp diff --git a/protocols/acn/pdu-stream.h b/protocol/acn/pdu-stream.h similarity index 100% rename from protocols/acn/pdu-stream.h rename to protocol/acn/pdu-stream.h diff --git a/protocols/acn/pdu.cpp b/protocol/acn/pdu.cpp similarity index 100% rename from protocols/acn/pdu.cpp rename to protocol/acn/pdu.cpp diff --git a/protocols/acn/pdu.h b/protocol/acn/pdu.h similarity index 100% rename from protocols/acn/pdu.h rename to protocol/acn/pdu.h diff --git a/protocols/config.h.in b/protocol/config.h.in similarity index 100% rename from protocols/config.h.in rename to protocol/config.h.in diff --git a/protocols/dmp/CMakeLists.txt b/protocol/dmp/CMakeLists.txt similarity index 100% rename from protocols/dmp/CMakeLists.txt rename to protocol/dmp/CMakeLists.txt diff --git a/protocols/dmp/appliance.cpp b/protocol/dmp/appliance.cpp similarity index 100% rename from protocols/dmp/appliance.cpp rename to protocol/dmp/appliance.cpp diff --git a/protocols/dmp/appliance.h b/protocol/dmp/appliance.h similarity index 100% rename from protocols/dmp/appliance.h rename to protocol/dmp/appliance.h diff --git a/protocols/dmp/controller.cpp b/protocol/dmp/controller.cpp similarity index 100% rename from protocols/dmp/controller.cpp rename to protocol/dmp/controller.cpp diff --git a/protocols/dmp/controller.h b/protocol/dmp/controller.h similarity index 100% rename from protocols/dmp/controller.h rename to protocol/dmp/controller.h diff --git a/protocols/dmp/device.cpp b/protocol/dmp/device.cpp similarity index 100% rename from protocols/dmp/device.cpp rename to protocol/dmp/device.cpp diff --git a/protocols/dmp/device.h b/protocol/dmp/device.h similarity index 100% rename from protocols/dmp/device.h rename to protocol/dmp/device.h diff --git a/protocols/dmp/dmp.cpp b/protocol/dmp/dmp.cpp similarity index 100% rename from protocols/dmp/dmp.cpp rename to protocol/dmp/dmp.cpp diff --git a/protocols/dmp/dmp.h b/protocol/dmp/dmp.h similarity index 100% rename from protocols/dmp/dmp.h rename to protocol/dmp/dmp.h diff --git a/protocols/dmp/event.cpp b/protocol/dmp/event.cpp similarity index 100% rename from protocols/dmp/event.cpp rename to protocol/dmp/event.cpp diff --git a/protocols/dmp/event.h b/protocol/dmp/event.h similarity index 100% rename from protocols/dmp/event.h rename to protocol/dmp/event.h diff --git a/protocols/dmx/CMakeLists.txt b/protocol/dmx/CMakeLists.txt similarity index 100% rename from protocols/dmx/CMakeLists.txt rename to protocol/dmx/CMakeLists.txt diff --git a/protocols/dmx/device.cpp b/protocol/dmx/device.cpp similarity index 100% rename from protocols/dmx/device.cpp rename to protocol/dmx/device.cpp diff --git a/protocols/dmx/device.h b/protocol/dmx/device.h similarity index 100% rename from protocols/dmx/device.h rename to protocol/dmx/device.h diff --git a/protocols/dmx/dmx.h b/protocol/dmx/dmx.h similarity index 100% rename from protocols/dmx/dmx.h rename to protocol/dmx/dmx.h diff --git a/protocols/dmx/patch.cpp b/protocol/dmx/patch.cpp similarity index 100% rename from protocols/dmx/patch.cpp rename to protocol/dmx/patch.cpp diff --git a/protocols/dmx/patch.h b/protocol/dmx/patch.h similarity index 100% rename from protocols/dmx/patch.h rename to protocol/dmx/patch.h diff --git a/protocols/dmx/personality.cpp b/protocol/dmx/personality.cpp similarity index 100% rename from protocols/dmx/personality.cpp rename to protocol/dmx/personality.cpp diff --git a/protocols/dmx/personality.h b/protocol/dmx/personality.h similarity index 100% rename from protocols/dmx/personality.h rename to protocol/dmx/personality.h diff --git a/protocols/dmx/universe.cpp b/protocol/dmx/universe.cpp similarity index 100% rename from protocols/dmx/universe.cpp rename to protocol/dmx/universe.cpp diff --git a/protocols/dmx/universe.h b/protocol/dmx/universe.h similarity index 100% rename from protocols/dmx/universe.h rename to protocol/dmx/universe.h diff --git a/protocols/ept/CMakeLists.txt b/protocol/ept/CMakeLists.txt similarity index 100% rename from protocols/ept/CMakeLists.txt rename to protocol/ept/CMakeLists.txt diff --git a/protocols/ept/broker.cpp b/protocol/ept/broker.cpp similarity index 100% rename from protocols/ept/broker.cpp rename to protocol/ept/broker.cpp diff --git a/protocols/ept/broker.h b/protocol/ept/broker.h similarity index 100% rename from protocols/ept/broker.h rename to protocol/ept/broker.h diff --git a/protocols/ept/client.cpp b/protocol/ept/client.cpp similarity index 100% rename from protocols/ept/client.cpp rename to protocol/ept/client.cpp diff --git a/protocols/ept/client.h b/protocol/ept/client.h similarity index 100% rename from protocols/ept/client.h rename to protocol/ept/client.h diff --git a/protocols/ept/ept.cpp b/protocol/ept/ept.cpp similarity index 100% rename from protocols/ept/ept.cpp rename to protocol/ept/ept.cpp diff --git a/protocols/ept/ept.h b/protocol/ept/ept.h similarity index 100% rename from protocols/ept/ept.h rename to protocol/ept/ept.h diff --git a/protocols/llrp/CMakeLists.txt b/protocol/llrp/CMakeLists.txt similarity index 100% rename from protocols/llrp/CMakeLists.txt rename to protocol/llrp/CMakeLists.txt diff --git a/protocols/llrp/llrp.cpp b/protocol/llrp/llrp.cpp similarity index 100% rename from protocols/llrp/llrp.cpp rename to protocol/llrp/llrp.cpp diff --git a/protocols/llrp/llrp.h b/protocol/llrp/llrp.h similarity index 100% rename from protocols/llrp/llrp.h rename to protocol/llrp/llrp.h diff --git a/protocols/llrp/manager.cpp b/protocol/llrp/manager.cpp similarity index 100% rename from protocols/llrp/manager.cpp rename to protocol/llrp/manager.cpp diff --git a/protocols/llrp/manager.h b/protocol/llrp/manager.h similarity index 100% rename from protocols/llrp/manager.h rename to protocol/llrp/manager.h diff --git a/protocols/llrp/target.cpp b/protocol/llrp/target.cpp similarity index 100% rename from protocols/llrp/target.cpp rename to protocol/llrp/target.cpp diff --git a/protocols/llrp/target.h b/protocol/llrp/target.h similarity index 100% rename from protocols/llrp/target.h rename to protocol/llrp/target.h diff --git a/protocols/otp/CMakeLists.txt b/protocol/otp/CMakeLists.txt similarity index 100% rename from protocols/otp/CMakeLists.txt rename to protocol/otp/CMakeLists.txt diff --git a/protocols/otp/advertisement.cpp b/protocol/otp/advertisement.cpp similarity index 100% rename from protocols/otp/advertisement.cpp rename to protocol/otp/advertisement.cpp diff --git a/protocols/otp/advertisement.h b/protocol/otp/advertisement.h similarity index 100% rename from protocols/otp/advertisement.h rename to protocol/otp/advertisement.h diff --git a/protocols/otp/base.cpp b/protocol/otp/base.cpp similarity index 100% rename from protocols/otp/base.cpp rename to protocol/otp/base.cpp diff --git a/protocols/otp/base.h b/protocol/otp/base.h similarity index 100% rename from protocols/otp/base.h rename to protocol/otp/base.h diff --git a/protocols/otp/otp.h b/protocol/otp/otp.h similarity index 100% rename from protocols/otp/otp.h rename to protocol/otp/otp.h diff --git a/protocols/otp/pdu.cpp b/protocol/otp/pdu.cpp similarity index 100% rename from protocols/otp/pdu.cpp rename to protocol/otp/pdu.cpp diff --git a/protocols/otp/pdu.h b/protocol/otp/pdu.h similarity index 100% rename from protocols/otp/pdu.h rename to protocol/otp/pdu.h diff --git a/protocols/otp/transform.cpp b/protocol/otp/transform.cpp similarity index 100% rename from protocols/otp/transform.cpp rename to protocol/otp/transform.cpp diff --git a/protocols/otp/transform.h b/protocol/otp/transform.h similarity index 100% rename from protocols/otp/transform.h rename to protocol/otp/transform.h diff --git a/protocols/rdm/CMakeLists.txt b/protocol/rdm/CMakeLists.txt similarity index 100% rename from protocols/rdm/CMakeLists.txt rename to protocol/rdm/CMakeLists.txt diff --git a/protocols/rdm/E1.37-1.h b/protocol/rdm/E1.37-1.h similarity index 100% rename from protocols/rdm/E1.37-1.h rename to protocol/rdm/E1.37-1.h diff --git a/protocols/rdm/E1.37-2.h b/protocol/rdm/E1.37-2.h similarity index 100% rename from protocols/rdm/E1.37-2.h rename to protocol/rdm/E1.37-2.h diff --git a/protocols/rdm/E1.37-7.h b/protocol/rdm/E1.37-7.h similarity index 100% rename from protocols/rdm/E1.37-7.h rename to protocol/rdm/E1.37-7.h diff --git a/protocols/rdm/README.md b/protocol/rdm/README.md similarity index 100% rename from protocols/rdm/README.md rename to protocol/rdm/README.md diff --git a/protocols/rdm/controller.cpp b/protocol/rdm/controller.cpp similarity index 100% rename from protocols/rdm/controller.cpp rename to protocol/rdm/controller.cpp diff --git a/protocols/rdm/controller.h b/protocol/rdm/controller.h similarity index 100% rename from protocols/rdm/controller.h rename to protocol/rdm/controller.h diff --git a/protocols/rdm/device.cpp b/protocol/rdm/device.cpp similarity index 100% rename from protocols/rdm/device.cpp rename to protocol/rdm/device.cpp diff --git a/protocols/rdm/device.h b/protocol/rdm/device.h similarity index 100% rename from protocols/rdm/device.h rename to protocol/rdm/device.h diff --git a/protocols/rdm/message.cpp b/protocol/rdm/message.cpp similarity index 100% rename from protocols/rdm/message.cpp rename to protocol/rdm/message.cpp diff --git a/protocols/rdm/message.h b/protocol/rdm/message.h similarity index 100% rename from protocols/rdm/message.h rename to protocol/rdm/message.h diff --git a/protocols/rdm/parameter.cpp b/protocol/rdm/parameter.cpp similarity index 100% rename from protocols/rdm/parameter.cpp rename to protocol/rdm/parameter.cpp diff --git a/protocols/rdm/parameter.h b/protocol/rdm/parameter.h similarity index 100% rename from protocols/rdm/parameter.h rename to protocol/rdm/parameter.h diff --git a/protocols/rdm/rdm.cpp b/protocol/rdm/rdm.cpp similarity index 100% rename from protocols/rdm/rdm.cpp rename to protocol/rdm/rdm.cpp diff --git a/protocols/rdm/rdm.h b/protocol/rdm/rdm.h similarity index 100% rename from protocols/rdm/rdm.h rename to protocol/rdm/rdm.h diff --git a/protocols/rdm/responder.cpp b/protocol/rdm/responder.cpp similarity index 100% rename from protocols/rdm/responder.cpp rename to protocol/rdm/responder.cpp diff --git a/protocols/rdm/responder.h b/protocol/rdm/responder.h similarity index 100% rename from protocols/rdm/responder.h rename to protocol/rdm/responder.h diff --git a/protocols/rdm/sensor.cpp b/protocol/rdm/sensor.cpp similarity index 100% rename from protocols/rdm/sensor.cpp rename to protocol/rdm/sensor.cpp diff --git a/protocols/rdm/sensor.h b/protocol/rdm/sensor.h similarity index 100% rename from protocols/rdm/sensor.h rename to protocol/rdm/sensor.h diff --git a/protocols/rdm/status.h b/protocol/rdm/status.h similarity index 100% rename from protocols/rdm/status.h rename to protocol/rdm/status.h diff --git a/protocols/rdm/uid.h b/protocol/rdm/uid.h similarity index 100% rename from protocols/rdm/uid.h rename to protocol/rdm/uid.h diff --git a/protocols/rdmnet/CMakeLists.txt b/protocol/rdmnet/CMakeLists.txt similarity index 100% rename from protocols/rdmnet/CMakeLists.txt rename to protocol/rdmnet/CMakeLists.txt diff --git a/protocols/rdmnet/broker-protocol.cpp b/protocol/rdmnet/broker-protocol.cpp similarity index 100% rename from protocols/rdmnet/broker-protocol.cpp rename to protocol/rdmnet/broker-protocol.cpp diff --git a/protocols/rdmnet/broker-protocol.h b/protocol/rdmnet/broker-protocol.h similarity index 100% rename from protocols/rdmnet/broker-protocol.h rename to protocol/rdmnet/broker-protocol.h diff --git a/protocols/rdmnet/broker.cpp b/protocol/rdmnet/broker.cpp similarity index 100% rename from protocols/rdmnet/broker.cpp rename to protocol/rdmnet/broker.cpp diff --git a/protocols/rdmnet/broker.h b/protocol/rdmnet/broker.h similarity index 100% rename from protocols/rdmnet/broker.h rename to protocol/rdmnet/broker.h diff --git a/protocols/rdmnet/controller.cpp b/protocol/rdmnet/controller.cpp similarity index 100% rename from protocols/rdmnet/controller.cpp rename to protocol/rdmnet/controller.cpp diff --git a/protocols/rdmnet/controller.h b/protocol/rdmnet/controller.h similarity index 100% rename from protocols/rdmnet/controller.h rename to protocol/rdmnet/controller.h diff --git a/protocols/rdmnet/device.cpp b/protocol/rdmnet/device.cpp similarity index 100% rename from protocols/rdmnet/device.cpp rename to protocol/rdmnet/device.cpp diff --git a/protocols/rdmnet/device.h b/protocol/rdmnet/device.h similarity index 100% rename from protocols/rdmnet/device.h rename to protocol/rdmnet/device.h diff --git a/protocols/rdmnet/implementation.cpp b/protocol/rdmnet/implementation.cpp similarity index 100% rename from protocols/rdmnet/implementation.cpp rename to protocol/rdmnet/implementation.cpp diff --git a/protocols/rdmnet/implementation.h b/protocol/rdmnet/implementation.h similarity index 100% rename from protocols/rdmnet/implementation.h rename to protocol/rdmnet/implementation.h diff --git a/protocols/rdmnet/pdu.cpp b/protocol/rdmnet/pdu.cpp similarity index 100% rename from protocols/rdmnet/pdu.cpp rename to protocol/rdmnet/pdu.cpp diff --git a/protocols/rdmnet/pdu.h b/protocol/rdmnet/pdu.h similarity index 100% rename from protocols/rdmnet/pdu.h rename to protocol/rdmnet/pdu.h diff --git a/protocols/rdmnet/rdmnet.h b/protocol/rdmnet/rdmnet.h similarity index 100% rename from protocols/rdmnet/rdmnet.h rename to protocol/rdmnet/rdmnet.h diff --git a/protocols/rlp/CMakeLists.txt b/protocol/rlp/CMakeLists.txt similarity index 100% rename from protocols/rlp/CMakeLists.txt rename to protocol/rlp/CMakeLists.txt diff --git a/protocols/rlp/component.cpp b/protocol/rlp/component.cpp similarity index 100% rename from protocols/rlp/component.cpp rename to protocol/rlp/component.cpp diff --git a/protocols/rlp/component.h b/protocol/rlp/component.h similarity index 100% rename from protocols/rlp/component.h rename to protocol/rlp/component.h diff --git a/protocols/rlp/rlp.cpp b/protocol/rlp/rlp.cpp similarity index 100% rename from protocols/rlp/rlp.cpp rename to protocol/rlp/rlp.cpp diff --git a/protocols/rlp/rlp.h b/protocol/rlp/rlp.h similarity index 100% rename from protocols/rlp/rlp.h rename to protocol/rlp/rlp.h diff --git a/protocols/rlp/tcp.cpp b/protocol/rlp/tcp.cpp similarity index 100% rename from protocols/rlp/tcp.cpp rename to protocol/rlp/tcp.cpp diff --git a/protocols/rlp/tcp.h b/protocol/rlp/tcp.h similarity index 100% rename from protocols/rlp/tcp.h rename to protocol/rlp/tcp.h diff --git a/protocols/rlp/udp.cpp b/protocol/rlp/udp.cpp similarity index 100% rename from protocols/rlp/udp.cpp rename to protocol/rlp/udp.cpp diff --git a/protocols/rlp/udp.h b/protocol/rlp/udp.h similarity index 100% rename from protocols/rlp/udp.h rename to protocol/rlp/udp.h diff --git a/protocols/rpt/CMakeLists.txt b/protocol/rpt/CMakeLists.txt similarity index 100% rename from protocols/rpt/CMakeLists.txt rename to protocol/rpt/CMakeLists.txt diff --git a/protocols/rpt/broker.cpp b/protocol/rpt/broker.cpp similarity index 100% rename from protocols/rpt/broker.cpp rename to protocol/rpt/broker.cpp diff --git a/protocols/rpt/broker.h b/protocol/rpt/broker.h similarity index 100% rename from protocols/rpt/broker.h rename to protocol/rpt/broker.h diff --git a/protocols/rpt/controller.cpp b/protocol/rpt/controller.cpp similarity index 100% rename from protocols/rpt/controller.cpp rename to protocol/rpt/controller.cpp diff --git a/protocols/rpt/controller.h b/protocol/rpt/controller.h similarity index 100% rename from protocols/rpt/controller.h rename to protocol/rpt/controller.h diff --git a/protocols/rpt/device.cpp b/protocol/rpt/device.cpp similarity index 100% rename from protocols/rpt/device.cpp rename to protocol/rpt/device.cpp diff --git a/protocols/rpt/device.h b/protocol/rpt/device.h similarity index 100% rename from protocols/rpt/device.h rename to protocol/rpt/device.h diff --git a/protocols/rpt/rpt.cpp b/protocol/rpt/rpt.cpp similarity index 100% rename from protocols/rpt/rpt.cpp rename to protocol/rpt/rpt.cpp diff --git a/protocols/rpt/rpt.h b/protocol/rpt/rpt.h similarity index 100% rename from protocols/rpt/rpt.h rename to protocol/rpt/rpt.h diff --git a/protocols/sacn/CMakeLists.txt b/protocol/sacn/CMakeLists.txt similarity index 100% rename from protocols/sacn/CMakeLists.txt rename to protocol/sacn/CMakeLists.txt diff --git a/protocols/sacn/arbitratinguniverse.cpp b/protocol/sacn/arbitratinguniverse.cpp similarity index 100% rename from protocols/sacn/arbitratinguniverse.cpp rename to protocol/sacn/arbitratinguniverse.cpp diff --git a/protocols/sacn/arbitratinguniverse.h b/protocol/sacn/arbitratinguniverse.h similarity index 100% rename from protocols/sacn/arbitratinguniverse.h rename to protocol/sacn/arbitratinguniverse.h diff --git a/protocols/sacn/data.cpp b/protocol/sacn/data.cpp similarity index 100% rename from protocols/sacn/data.cpp rename to protocol/sacn/data.cpp diff --git a/protocols/sacn/data.h b/protocol/sacn/data.h similarity index 100% rename from protocols/sacn/data.h rename to protocol/sacn/data.h diff --git a/protocols/sacn/extended.cpp b/protocol/sacn/extended.cpp similarity index 100% rename from protocols/sacn/extended.cpp rename to protocol/sacn/extended.cpp diff --git a/protocols/sacn/extended.h b/protocol/sacn/extended.h similarity index 100% rename from protocols/sacn/extended.h rename to protocol/sacn/extended.h diff --git a/protocols/sacn/node.cpp b/protocol/sacn/node.cpp similarity index 100% rename from protocols/sacn/node.cpp rename to protocol/sacn/node.cpp diff --git a/protocols/sacn/node.h b/protocol/sacn/node.h similarity index 100% rename from protocols/sacn/node.h rename to protocol/sacn/node.h diff --git a/protocols/sacn/receiver.cpp b/protocol/sacn/receiver.cpp similarity index 100% rename from protocols/sacn/receiver.cpp rename to protocol/sacn/receiver.cpp diff --git a/protocols/sacn/receiver.h b/protocol/sacn/receiver.h similarity index 100% rename from protocols/sacn/receiver.h rename to protocol/sacn/receiver.h diff --git a/protocols/sacn/sacn.h b/protocol/sacn/sacn.h similarity index 100% rename from protocols/sacn/sacn.h rename to protocol/sacn/sacn.h diff --git a/protocols/sacn/source.cpp b/protocol/sacn/source.cpp similarity index 100% rename from protocols/sacn/source.cpp rename to protocol/sacn/source.cpp diff --git a/protocols/sacn/source.h b/protocol/sacn/source.h similarity index 100% rename from protocols/sacn/source.h rename to protocol/sacn/source.h diff --git a/protocols/sacn/universe.cpp b/protocol/sacn/universe.cpp similarity index 100% rename from protocols/sacn/universe.cpp rename to protocol/sacn/universe.cpp diff --git a/protocols/sacn/universe.h b/protocol/sacn/universe.h similarity index 100% rename from protocols/sacn/universe.h rename to protocol/sacn/universe.h diff --git a/protocols/sdt/CMakeLists.txt b/protocol/sdt/CMakeLists.txt similarity index 100% rename from protocols/sdt/CMakeLists.txt rename to protocol/sdt/CMakeLists.txt diff --git a/protocols/sdt/channel.cpp b/protocol/sdt/channel.cpp similarity index 100% rename from protocols/sdt/channel.cpp rename to protocol/sdt/channel.cpp diff --git a/protocols/sdt/channel.h b/protocol/sdt/channel.h similarity index 100% rename from protocols/sdt/channel.h rename to protocol/sdt/channel.h diff --git a/protocols/sdt/identity.cpp b/protocol/sdt/identity.cpp similarity index 100% rename from protocols/sdt/identity.cpp rename to protocol/sdt/identity.cpp diff --git a/protocols/sdt/identity.h b/protocol/sdt/identity.h similarity index 100% rename from protocols/sdt/identity.h rename to protocol/sdt/identity.h diff --git a/protocols/sdt/leader.cpp b/protocol/sdt/leader.cpp similarity index 100% rename from protocols/sdt/leader.cpp rename to protocol/sdt/leader.cpp diff --git a/protocols/sdt/leader.h b/protocol/sdt/leader.h similarity index 100% rename from protocols/sdt/leader.h rename to protocol/sdt/leader.h diff --git a/protocols/sdt/member.cpp b/protocol/sdt/member.cpp similarity index 100% rename from protocols/sdt/member.cpp rename to protocol/sdt/member.cpp diff --git a/protocols/sdt/member.h b/protocol/sdt/member.h similarity index 100% rename from protocols/sdt/member.h rename to protocol/sdt/member.h diff --git a/protocols/sdt/sdt.cpp b/protocol/sdt/sdt.cpp similarity index 100% rename from protocols/sdt/sdt.cpp rename to protocol/sdt/sdt.cpp diff --git a/protocols/sdt/sdt.h b/protocol/sdt/sdt.h similarity index 100% rename from protocols/sdt/sdt.h rename to protocol/sdt/sdt.h diff --git a/protocols/sdt/session.cpp b/protocol/sdt/session.cpp similarity index 100% rename from protocols/sdt/session.cpp rename to protocol/sdt/session.cpp diff --git a/protocols/sdt/session.h b/protocol/sdt/session.h similarity index 100% rename from protocols/sdt/session.h rename to protocol/sdt/session.h diff --git a/protocols/sdt/udp.cpp b/protocol/sdt/udp.cpp similarity index 100% rename from protocols/sdt/udp.cpp rename to protocol/sdt/udp.cpp diff --git a/protocols/sdt/udp.h b/protocol/sdt/udp.h similarity index 100% rename from protocols/sdt/udp.h rename to protocol/sdt/udp.h diff --git a/protocols/uuid/CMakeLists.txt b/protocol/uuid/CMakeLists.txt similarity index 100% rename from protocols/uuid/CMakeLists.txt rename to protocol/uuid/CMakeLists.txt diff --git a/protocols/uuid/uuid.cpp b/protocol/uuid/uuid.cpp similarity index 100% rename from protocols/uuid/uuid.cpp rename to protocol/uuid/uuid.cpp diff --git a/protocols/uuid/uuid.h b/protocol/uuid/uuid.h similarity index 100% rename from protocols/uuid/uuid.h rename to protocol/uuid/uuid.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 89e3012..42d28bc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,7 +5,7 @@ if (GTest_FOUND) add_executable(Tests ${SRCS}) target_link_libraries(Tests PUBLIC GTest::gtest - OpenLCP + LCP ) target_include_directories(Tests PUBLIC ${GTEST_INCLUDE_DIRS} # doesn't do anything on Linux