1
0
Fork 0

changed backend to plugin

This commit is contained in:
Daniel Tartavel 2023-05-08 14:30:32 +02:00
parent 2fe447dd06
commit 7d983766fd
9 changed files with 132 additions and 132 deletions

View File

@ -1,10 +1,10 @@
#include "serial.h"
#include <unistd.h>
#include "zigatebackend.h"
#include "zigateplugin.h"
#include <QtCore>
//extern QApplication a;
extern ZigateBackend zigateBkd;
extern ZigatePlugin zigateBkd;
using namespace std;

View File

@ -1,15 +1,15 @@
#include "zigatebackend.h"
#include "zigateplugin.h"
#include "serial.h"
#include "zigbeeManagerinterface.h"
#include <QByteArray>
extern ZigateBackend zigateBkd;
extern ZigatePlugin zigateBkd;
extern SerialManager serialManager;
extern QHash <QString, ResponseProperties *> responseListIndex;
using namespace std;
bool ZigateBackend::initBackend()
bool ZigatePlugin::initPlugin()
{
bool returnCode = false;
QString var;

View File

@ -1,12 +0,0 @@
#ifndef ZIGATEBACKEND_GLOBAL_H
#define ZIGATEBACKEND_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(ZIGATEBACKEND_LIBRARY)
# define ZIGATEBACKEND_EXPORT Q_DECL_EXPORT
#else
# define ZIGATEBACKEND_EXPORT Q_DECL_IMPORT
#endif
#endif // ZIGATEBACKEND_GLOBAL_H

View File

@ -1,10 +1,10 @@
#include "zigatebackend.h"
#include "zigateplugin.h"
#include <unistd.h>
#include <iostream>
using namespace std;
bool ZigateBackend::resetCoordinator()
bool ZigatePlugin::resetCoordinator()
{
bool returnCode = false;
@ -15,452 +15,452 @@ bool ZigateBackend::resetCoordinator()
return returnCode;
}
void ZigateBackend::getVersion()
void ZigatePlugin::getVersion()
{
sendCmd("0010", "");
}
/*
bool ZigateBackend::setHeartBeat()
bool ZigatePlugin::setHeartBeat()
{
}
bool ZigateBackend::getNetworkState()
bool ZigatePlugin::getNetworkState()
{
}
bool ZigateBackend::erasePersistentData()
bool ZigatePlugin::erasePersistentData()
{
}
bool ZigateBackend::factoryNewReset()
bool ZigatePlugin::factoryNewReset()
{
}
bool ZigateBackend::permitJoin()
bool ZigatePlugin::permitJoin()
{
}
bool ZigateBackend::setExpendedPANID()
bool ZigatePlugin::setExpendedPANID()
{
}
bool ZigateBackend::setChannelMask()
bool ZigatePlugin::setChannelMask()
{
}
bool ZigateBackend::setSecurityStateKey()
bool ZigatePlugin::setSecurityStateKey()
{
}
bool ZigateBackend::setDeviceType()
bool ZigatePlugin::setDeviceType()
{
}
bool ZigateBackend::startNetwork()
bool ZigatePlugin::startNetwork()
{
}
bool ZigateBackend::startNetworkScan()
bool ZigatePlugin::startNetworkScan()
{
}
bool ZigateBackend::removeDevice()
bool ZigatePlugin::removeDevice()
{
}
bool ZigateBackend::enablePermissionsControlledJoins()
bool ZigatePlugin::enablePermissionsControlledJoins()
{
}
bool ZigateBackend::authenticateDevice()
bool ZigatePlugin::authenticateDevice()
{
}
bool ZigateBackend::outOfBandCommissioningDataRequest()
bool ZigatePlugin::outOfBandCommissioningDataRequest()
{
}
bool ZigateBackend::userDescriptorSet()
bool ZigatePlugin::userDescriptorSet()
{
}
bool ZigateBackend::userDescriptorRequest()
bool ZigatePlugin::userDescriptorRequest()
{
}
bool ZigateBackend::bind()
bool ZigatePlugin::bind()
{
}
bool ZigateBackend::unbind()
bool ZigatePlugin::unbind()
{
}
bool ZigateBackend::complexDescriptorRequest()
bool ZigatePlugin::complexDescriptorRequest()
{
}
bool ZigateBackend::networkAddressRequest()
bool ZigatePlugin::networkAddressRequest()
{
}
bool ZigateBackend::iEEEAddressRequest()
bool ZigatePlugin::iEEEAddressRequest()
{
}
bool ZigateBackend::nodeDescriptorRequest()
bool ZigatePlugin::nodeDescriptorRequest()
{
}
bool ZigateBackend::simpleDescriptorRequest()
bool ZigatePlugin::simpleDescriptorRequest()
{
}
bool ZigateBackend::powerDescriptorRequest()
bool ZigatePlugin::powerDescriptorRequest()
{
}
bool ZigateBackend::activeEndpointRequest()
bool ZigatePlugin::activeEndpointRequest()
{
}
bool ZigateBackend::matchDescriptorRequest()
bool ZigatePlugin::matchDescriptorRequest()
{
}
bool ZigateBackend::managementLeaveRequest()
bool ZigatePlugin::managementLeaveRequest()
{
}
bool ZigateBackend::permitJoiningRequest()
bool ZigatePlugin::permitJoiningRequest()
{
}
bool ZigateBackend::managementNetworkUpdateRequest()
bool ZigatePlugin::managementNetworkUpdateRequest()
{
}
bool ZigateBackend::systemServerDiscoveryRequest()
bool ZigatePlugin::systemServerDiscoveryRequest()
{
}
bool ZigateBackend::managementLQIRequest()
bool ZigatePlugin::managementLQIRequest()
{
}
bool ZigateBackend::addGroup()
bool ZigatePlugin::addGroup()
{
}
bool ZigateBackend::viewGroup()
bool ZigatePlugin::viewGroup()
{
}
bool ZigateBackend::getGroupMembership()
bool ZigatePlugin::getGroupMembership()
{
}
bool ZigateBackend::removeGroup()
bool ZigatePlugin::removeGroup()
{
}
bool ZigateBackend::removeAllGroups()
bool ZigatePlugin::removeAllGroups()
{
}
bool ZigateBackend::addGroupIfIdentify()
bool ZigatePlugin::addGroupIfIdentify()
{
}
bool ZigateBackend::identifySend()
bool ZigatePlugin::identifySend()
{
}
bool ZigateBackend::identifyQuery()
bool ZigatePlugin::identifyQuery()
{
}
bool ZigateBackend::moveToLevel()
bool ZigatePlugin::moveToLevel()
{
}
bool ZigateBackend::moveToLevelWithWithoutOnOoff()
bool ZigatePlugin::moveToLevelWithWithoutOnOoff()
{
}
bool ZigateBackend::moveStep()
bool ZigatePlugin::moveStep()
{
}
bool ZigateBackend::moveStopMove()
bool ZigatePlugin::moveStopMove()
{
}
bool ZigateBackend::moveStopWithOnOff()
bool ZigatePlugin::moveStopWithOnOff()
{
}
bool ZigateBackend::onOffWithNEffects()
bool ZigatePlugin::onOffWithNEffects()
{
}
bool ZigateBackend::onOffWithEffects()
bool ZigatePlugin::onOffWithEffects()
{
}
bool ZigateBackend::onOffTimedSend()
bool ZigatePlugin::onOffTimedSend()
{
}
bool ZigateBackend::onOffTimed()
bool ZigatePlugin::onOffTimed()
{
}
bool ZigateBackend::onOffWithEffectsSend()
bool ZigatePlugin::onOffWithEffectsSend()
{
}
bool ZigateBackend::viewScene()
bool ZigatePlugin::viewScene()
{
}
bool ZigateBackend::addScene()
bool ZigatePlugin::addScene()
{
}
bool ZigateBackend::removeScene()
bool ZigatePlugin::removeScene()
{
}
bool ZigateBackend::removeAllScenes()
bool ZigatePlugin::removeAllScenes()
{
}
bool ZigateBackend::storeScene()
bool ZigatePlugin::storeScene()
{
}
bool ZigateBackend::recallScene()
bool ZigatePlugin::recallScene()
{
}
bool ZigateBackend::sceneMembershipRequest()
bool ZigatePlugin::sceneMembershipRequest()
{
}
bool ZigateBackend::addEnhancedScene()
bool ZigatePlugin::addEnhancedScene()
{
}
bool ZigateBackend::viewEnhancedHostToNodeScene()
bool ZigatePlugin::viewEnhancedHostToNodeScene()
{
}
bool ZigateBackend::copyScene()
bool ZigatePlugin::copyScene()
{
}
bool ZigateBackend::moveToHue()
bool ZigatePlugin::moveToHue()
{
}
bool ZigateBackend::moveHue()
bool ZigatePlugin::moveHue()
{
}
bool ZigateBackend::stepHue()
bool ZigatePlugin::stepHue()
{
}
bool ZigateBackend::moveToSaturation()
bool ZigatePlugin::moveToSaturation()
{
}
bool ZigateBackend::moveSaturation()
bool ZigatePlugin::moveSaturation()
{
}
bool ZigateBackend::stepSaturation()
bool ZigatePlugin::stepSaturation()
{
}
bool ZigateBackend::moveToHueAndSaturation()
bool ZigatePlugin::moveToHueAndSaturation()
{
}
bool ZigateBackend::moveToColour()
bool ZigatePlugin::moveToColour()
{
}
bool ZigateBackend::moveColour()
bool ZigatePlugin::moveColour()
{
}
bool ZigateBackend::stepColour()
bool ZigatePlugin::stepColour()
{
}
bool ZigateBackend::enhancedMoveToHue()
bool ZigatePlugin::enhancedMoveToHue()
{
}
bool ZigateBackend::enhancedMoveHue()
bool ZigatePlugin::enhancedMoveHue()
{
}
bool ZigateBackend::enhancedStepHue()
bool ZigatePlugin::enhancedStepHue()
{
}
bool ZigateBackend::enhancedMoveToHueAndSaturation()
bool ZigatePlugin::enhancedMoveToHueAndSaturation()
{
}
bool ZigateBackend::colourLoopSet()
bool ZigatePlugin::colourLoopSet()
{
}
bool ZigateBackend::stopMoveStep()
bool ZigatePlugin::stopMoveStep()
{
}
bool ZigateBackend::moveToColourTemperature()
bool ZigatePlugin::moveToColourTemperature()
{
}
bool ZigateBackend::moveColourTemperature()
bool ZigatePlugin::moveColourTemperature()
{
}
bool ZigateBackend::stepColourTemperature()
bool ZigatePlugin::stepColourTemperature()
{
}
bool ZigateBackend::initiateTouchlink()
bool ZigatePlugin::initiateTouchlink()
{
}
bool ZigateBackend::touchLinkFactoryResetTarget()
bool ZigatePlugin::touchLinkFactoryResetTarget()
{
}
bool ZigateBackend::identifyTriggerEffect()
bool ZigatePlugin::identifyTriggerEffect()
{
}
bool ZigateBackend::lockUnlockDoor()
bool ZigatePlugin::lockUnlockDoor()
{
}
bool ZigateBackend::readAttributerequest()
bool ZigatePlugin::readAttributerequest()
{
}
bool ZigateBackend::writeAttributeRequest()
bool ZigatePlugin::writeAttributeRequest()
{
}
bool ZigateBackend::configureReportingRequest()
bool ZigatePlugin::configureReportingRequest()
{
}
bool ZigateBackend::attributeDiscoveryRequest()
bool ZigatePlugin::attributeDiscoveryRequest()
{
}
bool ZigateBackend::iASZoneEnrollResponse()
bool ZigatePlugin::iASZoneEnrollResponse()
{
}
bool ZigateBackend::rawAPSDataRequest()
bool ZigatePlugin::rawAPSDataRequest()
{
}

View File

@ -1,4 +1,4 @@
#include "zigatebackend.h"
#include "zigateplugin.h"
#include <unistd.h>
#include <QFutureWatcher>
#include "serial.h"
@ -6,17 +6,17 @@
SerialManager serialManager;
using namespace std;
ZigateBackend zigateBkd;
ZigatePlugin zigateBkd;
ZigateBackend::ZigateBackend()
ZigatePlugin::ZigatePlugin()
{
}
ZigateBackend::~ZigateBackend()
ZigatePlugin::~ZigatePlugin()
{
}
QByteArray ZigateBackend::checksum(QByteArray msgType, QByteArray length, QByteArray datas)
QByteArray ZigatePlugin::checksum(QByteArray msgType, QByteArray length, QByteArray datas)
{
quint16 temp = 0;
int i;
@ -38,7 +38,7 @@ QByteArray ZigateBackend::checksum(QByteArray msgType, QByteArray length, QByteA
return QByteArray::number(temp, 16);
}
QByteArray ZigateBackend::transcode(QByteArray datas)
QByteArray ZigatePlugin::transcode(QByteArray datas)
{
QByteArray msg = "";
int i;
@ -62,7 +62,7 @@ QByteArray ZigateBackend::transcode(QByteArray datas)
return msg;
}
QByteArray ZigateBackend::unTranscode(QByteArray datas)
QByteArray ZigatePlugin::unTranscode(QByteArray datas)
{
QByteArray result;
int i;
@ -92,7 +92,7 @@ QByteArray ZigateBackend::unTranscode(QByteArray datas)
return result;
}
void ZigateBackend::sendCmd(QByteArray cmd, QByteArray datas)
void ZigatePlugin::sendCmd(QByteArray cmd, QByteArray datas)
{
QByteArray msg;
QByteArray len;
@ -117,7 +117,7 @@ void ZigateBackend::sendCmd(QByteArray cmd, QByteArray datas)
//this->interpretResult(this->dataRead);
}
void ZigateBackend::interpretResult(QByteArray payload)
void ZigatePlugin::interpretResult(QByteArray payload)
{
uint tab = 0;
int length = 0;

View File

@ -1,5 +1,5 @@
#ifndef ZIGATEBACKEND_H
#define ZIGATEBACKEND_H
#ifndef ZIGATEPLUGIN_H
#define ZIGATEPLUGIN_H
#define DEVICE_ANNOUNCE "004D"
#define STATUS_RETURNED "8000"
@ -109,21 +109,21 @@ void dataIndicationManager(Response *);
class ZigbeeMgr;
class ZigateBackend : public QObject, ZigbeeManagerInterface
class ZigatePlugin : public QObject, ZigbeeManagerInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.zigbeemanager" FILE "zigatebackend.json")
Q_PLUGIN_METADATA(IID "org.zigbeemanager" FILE "zigateplugin.json")
Q_INTERFACES(ZigbeeManagerInterface)
public slots:
void interpretResult(QByteArray);
public:
ZigateBackend();
~ZigateBackend();
ZigatePlugin();
~ZigatePlugin();
bool initBackend();
bool initPlugin();
QByteArray checksum(QByteArray msgType, QByteArray length, QByteArray datas);
QByteArray transcode(QByteArray datas);
QByteArray unTranscode(QByteArray datas);
@ -333,4 +333,4 @@ class ZigateBackend : public QObject, ZigbeeManagerInterface
};
#endif // ZIGATEBACKEND_H
#endif // ZIGATEPLUGIN_H

View File

@ -7,7 +7,7 @@ QT += KConfigCore KConfigGui
QT += KCoreAddons
TEMPLATE = lib
DEFINES += ZIGATEBACKEND_LIBRARY
DEFINES += ZIGATEPLUGIN_LIBRARY
CONFIG += c++17
@ -16,19 +16,19 @@ CONFIG += c++17
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
zigatebackend.cpp \
zigateplugin.cpp \
zigatecmd.cpp \
zigateInit.cpp \
library.cpp \
serial.cpp \
HEADERS += \
zigatebackend.h \
zigateplugin.h \
version.h \
responseClasses.h \
library.h \
serial.h \
zigbeeManagerBackends.h \
zigbeeManagerPlugins.h \
zigbeeManagerinterface.h
# Default rules for deployment.
@ -38,4 +38,4 @@ unix {
!isEmpty(target.path): INSTALLS += target
DISTFILES += \
zigatebackend.json
zigateplugin.json

12
zigbeeManagerPlugins.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef ZIGBEEMANAGERPLUGINS_H
#define ZIGBEEMANAGERPLUGINS_H
#include <QtCore/qglobal.h>
#if defined(ZIGBEEMANAGERPLUGINS_H)
# define ZIGBEEMANAGERPLUGINS_EXPORT Q_DECL_EXPORT
#else
# define ZIGBEEMANAGERPLUGINS_EXPORT Q_DECL_IMPORT
#endif
#endif // ZIGBEEMANAGERPLUGINS_H