1
0

restarting from scratch

This commit is contained in:
Daniel Tartavel 2023-05-18 11:51:14 +02:00
parent a032bc3f04
commit 0727e73f75
7 changed files with 0 additions and 170 deletions

View File

@ -1,21 +0,0 @@
#include "zigbeemanager.h"
#include "zigbeeManagerinterface.h"
using namespace std;
//int debugLevel = DEBUG | INFO | WARNING | ERROR;
QMap <QString, Plugins> plugins;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("zigbeemanager");
QCoreApplication::setApplicationName("zigbeemanager");
ZigbeeManager zigbeeManager;
return a.exec();
}

View File

@ -1 +0,0 @@
/home/daniel/develop/zigbee/build-zigatebackend-Qt_5_15_7_qt5-Debug/libzigatebackend.so.1.0.0

View File

@ -1,8 +0,0 @@
#ifndef VERSION_H
#define VERSION_H
QString version = "0.1";
#endif // VERSION_H

View File

@ -1,23 +0,0 @@
#ifndef ZIGBEEMANAGERINTERFACE_H
#define ZIGBEEMANAGERINTERFACE_H
#include <QObject>
#include <QString>
#include <QtPlugin>
class ZigbeeManagerInterface
{
public:
virtual ~ZigbeeManagerInterface() = default;
virtual bool initPlugin();
};
QT_BEGIN_NAMESPACE
#define ZigbeeManagerInterface_iid "org.zigbeemanager"
Q_DECLARE_INTERFACE(ZigbeeManagerInterface, ZigbeeManagerInterface_iid)
QT_END_NAMESPACE
#endif // ZIGBEEMANAGERINTERFACE_H

View File

@ -1,43 +0,0 @@
#include "zigbeemanager.h"
#include "zigbeeManagerinterface.h"
#include <QDir>
#include <QPluginLoader>
using namespace std;
class ZigbeeManagerInterface;
ZigbeeManager::ZigbeeManager()
{
if (!loadPlugins())
{
cout << "no plugins found in " << QCoreApplication::applicationDirPath().toStdString() << "/plugins" <<endl;
exit (1);
}
}
bool ZigbeeManager::loadPlugins()
{
QDir pluginsDir(QCoreApplication::applicationDirPath());
if (pluginsDir.cd("plugins"))
{
const QStringList entries = pluginsDir.entryList(QDir::Files);
for (const QString &fileName : entries) {
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = pluginLoader.instance();
if (plugin) {
zigbeeManagerInterface = qobject_cast<ZigbeeManagerInterface *>(plugin);
if (zigbeeManagerInterface)
{
zigbeeManagerInterface->initPlugin();
return true;
}
pluginLoader.unload();
}else
{
cout << pluginLoader.errorString().toStdString() << endl;
}
}
}
return false;
}

View File

@ -1,45 +0,0 @@
#ifndef MAIN_H
#define MAIN_H
#include <QSettings>
#include <cstring>
#include <stdio.h>
#include <cstdio>
#include <QApplication>
#include <QStringBuilder>
#include <QString>
#include <QCoreApplication>
#include <csignal>
#include <iostream>
#include <unistd.h>
//#include <string>
//#include <QtEndian>
#include <QDebug>
//#include "library.h"
#include "zigbeeManagerinterface.h"
class ZigbeeManagerInterface;
class ZigbeeManager : public QObject
{
Q_OBJECT
public:
ZigbeeManager();
private:
ZigbeeManagerInterface *zigbeeManagerInterface;
bool loadPlugins();
};
class Plugins
{
public:
QString name;
QString device;
QVariant plugin;
};
#endif // MAIN_H

View File

@ -1,29 +0,0 @@
QT += core
QT += serialport
QT += widgets
QT += KConfigCore KConfigGui
QT += KCoreAddons
QT += concurrent
CONFIG += c++17 console
CONFIG -= app_bundle
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
zigbeemanager.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /usr/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
version.h \
zigbeeManagerinterface.h \
zigbeemanager.h