Compare commits
12 Commits
0.1
...
3870af9918
Author | SHA1 | Date | |
---|---|---|---|
3870af9918 | |||
e3d48adb8d | |||
26d042eac3 | |||
e2c9e20ee9 | |||
2b430512e5 | |||
50621141bf | |||
be86c44846 | |||
8030843ed3 | |||
933c73dc04 | |||
790562783a | |||
1444d614f1 | |||
bb25d60c25 |
Binary file not shown.
BIN
docs/Stack_zigbee_3.ods
Normal file
BIN
docs/Stack_zigbee_3.ods
Normal file
Binary file not shown.
BIN
docs/ZiGate_API_Developper.ods
Normal file
BIN
docs/ZiGate_API_Developper.ods
Normal file
Binary file not shown.
BIN
docs/docs-05-3474-21-0csg-zigbee-specification.pdf
Normal file
BIN
docs/docs-05-3474-21-0csg-zigbee-specification.pdf
Normal file
Binary file not shown.
115
docs/properties.txt
Normal file
115
docs/properties.txt
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
MAC capability
|
||||||
|
Packet Type
|
||||||
|
Optional additional error information
|
||||||
|
Log level
|
||||||
|
Power source
|
||||||
|
Battery
|
||||||
|
AC Power
|
||||||
|
MIC
|
||||||
|
Event status
|
||||||
|
Server mask
|
||||||
|
Descriptor capability
|
||||||
|
Mac flags
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
startStatus
|
||||||
|
restartStatus
|
||||||
|
// *****************************************************************************
|
||||||
|
* 0 - STARTUP
|
||||||
|
* 2 - NFN_START
|
||||||
|
* 6 - RUNNING
|
||||||
|
* The node is not yet provisioned.
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
networkJoinedStatus
|
||||||
|
// ****************************************************************************
|
||||||
|
// Status:
|
||||||
|
// 0 = Joined existing network
|
||||||
|
// 1 = Formed new network
|
||||||
|
// 128 – 244 = Failed (ZigBee event codes)
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
permitJoinStatus
|
||||||
|
// ****************************************************************************
|
||||||
|
// 0 - Off
|
||||||
|
// 1 - On
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
Bit fields (8042, 8043, 8044)
|
||||||
|
/*
|
||||||
|
// ****************************************************************************
|
||||||
|
// Bitfields:
|
||||||
|
// Logical type (bits 0-2
|
||||||
|
// 0 - Coordinator
|
||||||
|
// 1 - Router
|
||||||
|
// 2 - End Device)
|
||||||
|
// Complex descriptor available (bit 3)
|
||||||
|
// User descriptor available (bit 4)
|
||||||
|
// Reserved (bit 5-7)
|
||||||
|
// APS flags (bit 8-10 – currently 0)
|
||||||
|
// Frequency band(11-15 set to 3 (2.4Ghz))
|
||||||
|
// Server mask bits:
|
||||||
|
// 0 - Primary trust center
|
||||||
|
// 1 - Back up trust center
|
||||||
|
// 2 - Primary binding cache
|
||||||
|
// 3 - Backup binding cache
|
||||||
|
// 4 - Primary discovery cache
|
||||||
|
// 5 - Backup discovery cache
|
||||||
|
// 6 - Network manager
|
||||||
|
// 7 to15 - Reserved
|
||||||
|
// MAC capability
|
||||||
|
// Bit 0 - Alternate PAN Coordinator
|
||||||
|
// Bit 1 - Device Type
|
||||||
|
// Bit 2 - Power source
|
||||||
|
// Bit 3 - Receiver On when Idle
|
||||||
|
// Bit 4-5 - Reserved
|
||||||
|
// Bit 6 - Security capability
|
||||||
|
// Bit 7 - Allocate Address
|
||||||
|
// Descriptor capability:
|
||||||
|
// 0 - extended Active endpoint list available
|
||||||
|
// 1 - Extended simple descriptor list available
|
||||||
|
// 2 to 7 - Reserved
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
8043
|
||||||
|
// ****************************************************************************
|
||||||
|
// Bit fields:
|
||||||
|
// Device version: 4 bits (bits 0-4)
|
||||||
|
// Reserved: 4 bits (bits4-7)
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
8044
|
||||||
|
// ****************************************************************************
|
||||||
|
// Bit fields
|
||||||
|
// 0 to 3: current power mode
|
||||||
|
// 4 to 7: available power source
|
||||||
|
// 8 to 11: current power source
|
||||||
|
// 12 to 15: current power source level
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
804E
|
||||||
|
// ****************************************************************************
|
||||||
|
// Note: If Neighbour Table list count is 0, there are no elements in the list.
|
||||||
|
// NWK Address : uint16_t
|
||||||
|
// Extended PAN ID : uint64_t
|
||||||
|
// IEEE Address : uint64_t
|
||||||
|
// Depth : uint_t
|
||||||
|
// Link Quality : uint8_t
|
||||||
|
// Bit map of attributes Described below: uint8_t
|
||||||
|
// bit 0-1 Device Type
|
||||||
|
// (0-Coordinator 1-Router 2-End Device)
|
||||||
|
// bit 2-3 Permit Join status
|
||||||
|
// (1- On 0-Off)
|
||||||
|
// bit 4-5 Relationship
|
||||||
|
// (0-Parent 1-Child 2-Sibling)
|
||||||
|
// bit 6-7 Rx On When Idle status
|
||||||
|
// (1-On 0-Off)
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
8140
|
||||||
|
// ****************************************************************************
|
||||||
|
// Complete:
|
||||||
|
// 0 – more attributes to follow
|
||||||
|
// 1 – this was the last attribute
|
||||||
|
//*******************************************************************************
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef LIBRARY_H
|
#ifndef LIBRARY_H
|
||||||
#define LIBRARY_H
|
#define LIBRARY_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#define INFO 2
|
#define INFO 2
|
||||||
#define WARNING 3
|
#define WARNING 3
|
||||||
|
27
main.cpp
27
main.cpp
@ -2,21 +2,32 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
extern ZigateBackend zigateBkd;
|
||||||
int debugLevel = DEBUG | INFO | WARNING | ERROR;
|
int debugLevel = DEBUG | INFO | WARNING | ERROR;
|
||||||
|
//ResponseList responseList;
|
||||||
|
SerialManager serialManager;
|
||||||
|
QMap <QString, BackEnds> backends;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("zigbeemanager");
|
QCoreApplication::setOrganizationName("zigbeemanager");
|
||||||
QCoreApplication::setApplicationName("zigbeemanager");
|
QCoreApplication::setApplicationName("zigbeemanager");
|
||||||
|
|
||||||
ZigateBackend zigateBkd;
|
initBackends();
|
||||||
// zigbeemgr();
|
|
||||||
|
|
||||||
//QObject::connect(&zigbeemgr, SIGNAL(readyRead()), &zigbeemgr, SLOT(getData()));
|
|
||||||
//QObject::connect(&zigbeemgr, SIGNAL(bytesWritten(qint64)), &zigbeemgr, SLOT(confirmWrite(qint64)));
|
|
||||||
|
|
||||||
zigateBkd.sendCmd(zigateBkd.getVersion.at(0), zigateBkd.getVersion.at(1), zigateBkd.getVersion.at(2));
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool initBackends()
|
||||||
|
{
|
||||||
|
/* foreach (backend, backends)
|
||||||
|
{
|
||||||
|
temp = new ResponseProperties();
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
responseListIndex.insert(var, temp) ;
|
||||||
|
}*/
|
||||||
|
zigateBkd.initBackend();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
11
main.h
11
main.h
@ -18,4 +18,15 @@
|
|||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include "zigateBackend.h"
|
#include "zigateBackend.h"
|
||||||
|
|
||||||
|
bool initBackends();
|
||||||
|
|
||||||
|
class BackEnds
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString name;
|
||||||
|
QString device;
|
||||||
|
QVariant backend;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // MAIN_H
|
#endif // MAIN_H
|
||||||
|
38
responseClasses.h
Normal file
38
responseClasses.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef RESPONSECLASSES_H
|
||||||
|
#define RESPONSECLASSES_H
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QList>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
//void (*propertyManager)(QByteArray);
|
||||||
|
|
||||||
|
class Response
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray code;
|
||||||
|
QByteArray datas;
|
||||||
|
QString description;
|
||||||
|
void manager(Response *);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ResponseProperties
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray code;
|
||||||
|
QByteArray datas;
|
||||||
|
QString description;
|
||||||
|
QMap <uint, QList<QVariant>> properties;
|
||||||
|
QMap <uint, QMap<uint,QString>> propertyDetail;
|
||||||
|
QHash <uint, void (*)(QByteArray)> propertyManagerList;
|
||||||
|
void (*manager)(Response *);
|
||||||
|
};
|
||||||
|
|
||||||
|
void infoOutput(Response *);
|
||||||
|
void defaultManager(Response *);
|
||||||
|
//void (*manager)(Response *);
|
||||||
|
void macCapabilityManager(QByteArray);
|
||||||
|
|
||||||
|
#endif // RESPONSECLASSES_H
|
114
serial.inc.cpp
114
serial.inc.cpp
@ -1,65 +1,109 @@
|
|||||||
#include "serial.inc.h"
|
#include "serial.inc.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "zigateBackend.h"
|
||||||
|
|
||||||
extern QApplication a;
|
extern QApplication a;
|
||||||
|
extern ZigateBackend zigateBkd;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ZigbeeMgr::ZigbeeMgr()
|
SerialManager::SerialManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SerialManager::~SerialManager()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SerialManager::initSerial()
|
||||||
{
|
{
|
||||||
//QMessageBox::StandardButton reply;
|
|
||||||
bool test;
|
bool test;
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
result = this->findSerialDevice();
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
debug("Device found :" + this->serialDevicePath, INFO);
|
||||||
|
break;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
cout << "Device not found, waiting 10 seconds before retrying" << endl;
|
||||||
|
sleep(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->setBaudRate(115200);
|
this->setBaudRate(115200);
|
||||||
this->setDataBits(QSerialPort::Data8);
|
this->setDataBits(QSerialPort::Data8);
|
||||||
this->setStopBits(QSerialPort::OneStop);
|
this->setStopBits(QSerialPort::OneStop);
|
||||||
this->setParity(QSerialPort::NoParity);
|
this->setParity(QSerialPort::NoParity);
|
||||||
this->setPortName(this->serialDevicePath);
|
this->setPortName(this->serialDevicePath);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
test = this->open(QIODevice::ReadWrite);
|
test = this->open(QIODevice::ReadWrite);
|
||||||
if (!test)
|
if (!test)
|
||||||
{
|
{
|
||||||
cout << this->errorString().toStdString() << "=>" << this->serialDevicePath.toStdString() << endl;
|
cout << this->errorString().toStdString() << "=>" << this->serialDevicePath.toStdString() << endl;
|
||||||
/*QString str = "Device can not be openened : " + errorString() + "=>" + this->device;
|
|
||||||
reply = QMessageBox::question(
|
|
||||||
nullptr,
|
|
||||||
a.applicationName(),
|
|
||||||
str,
|
|
||||||
QMessageBox::Retry|QMessageBox::Abort,
|
|
||||||
QMessageBox::Retry
|
|
||||||
);
|
|
||||||
if (reply == QMessageBox::Abort)
|
|
||||||
{
|
|
||||||
exit(1);
|
|
||||||
}*/
|
|
||||||
sleep(5);
|
sleep(5);
|
||||||
}
|
}
|
||||||
}while(!test);
|
}while(!test);
|
||||||
}
|
|
||||||
|
|
||||||
ZigbeeMgr::~ZigbeeMgr()
|
|
||||||
{
|
|
||||||
this->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZigbeeMgr::getData()
|
QFutureWatcher<void> watcher;
|
||||||
{
|
QFuture<void> future = QtConcurrent::run([=]()
|
||||||
dataRead = this->readAll();
|
|
||||||
cout << dataRead.toHex().toStdString() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZigbeeMgr::confirmWrite(qint16 byte)
|
|
||||||
{
|
|
||||||
QString str;
|
|
||||||
if (byte != dataWriteSize)
|
|
||||||
{
|
{
|
||||||
str = "Bytes written not egal to bytes sent : " + QString::number(byte) + " written for " + dataWriteSize + " sent";
|
do
|
||||||
cout << str.toStdString() << endl;
|
{
|
||||||
}
|
this->dataRead.clear();
|
||||||
|
//cout << "getData()" << endl;
|
||||||
|
if (this->waitForReadyRead())
|
||||||
|
{
|
||||||
|
while (!this->atEnd())
|
||||||
|
{
|
||||||
|
cout << "reading datas" << endl;
|
||||||
|
this->dataRead += this->readAll();
|
||||||
|
//cout << this->dataRead.toHex().toStdString() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit this->datasReady(this->dataRead);
|
||||||
|
//zigateBkd.interpretResult(this->dataRead);
|
||||||
|
}while(1);
|
||||||
|
});
|
||||||
|
watcher.setFuture(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZigbeeMgr::write(QString datas)
|
|
||||||
|
|
||||||
|
void SerialManager::write(QByteArray msg)
|
||||||
{
|
{
|
||||||
dataWriteSize = datas.count();
|
cout << "writing to serial" << endl;
|
||||||
this->writeData(datas.toStdString().c_str(), datas.count());
|
dataWriteSize = msg.count();
|
||||||
|
cout << "size = " << dataWriteSize << endl;
|
||||||
|
this->writeData(msg, msg.count()+1);
|
||||||
|
cout << msg.toHex().toStdString() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SerialManager::findSerialDevice()
|
||||||
|
{
|
||||||
|
const auto serialPortInfos = QSerialPortInfo::availablePorts();
|
||||||
|
for (const QSerialPortInfo &portInfo : serialPortInfos)
|
||||||
|
{
|
||||||
|
cout << portInfo.serialNumber().toStdString() << this->deviceName.toStdString() << endl;
|
||||||
|
if (portInfo.serialNumber().contains(this->deviceName))
|
||||||
|
{
|
||||||
|
this->portName = portInfo.portName();
|
||||||
|
this->serialDevicePath = portInfo.systemLocation();
|
||||||
|
this->serialDeviceDescription = portInfo.description();
|
||||||
|
this->serialDeviceManufacturer = portInfo.manufacturer();
|
||||||
|
this->serialDeviceNumber = portInfo.serialNumber();
|
||||||
|
this->serialDeviceVendor = portInfo.vendorIdentifier();
|
||||||
|
this->serialDeviceProduct = portInfo.productIdentifier();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
serial.inc.h
33
serial.inc.h
@ -1,13 +1,14 @@
|
|||||||
#ifndef SERIAL_INC_H
|
#ifndef SERIAL_INC_H
|
||||||
#define SERIAL_INC_H
|
#define SERIAL_INC_H
|
||||||
|
|
||||||
#include <QDebug>
|
//#include <QDebug>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
|
#include <QSerialPortInfo>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class ZigbeeMgr : public QSerialPort
|
class SerialManager : public QSerialPort
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -17,19 +18,29 @@ class ZigbeeMgr : public QSerialPort
|
|||||||
QByteArray dataWrite;
|
QByteArray dataWrite;
|
||||||
qint64 dataWriteSize;
|
qint64 dataWriteSize;
|
||||||
QString serialDevicePath;
|
QString serialDevicePath;
|
||||||
|
QString deviceName;
|
||||||
|
QString portName;
|
||||||
|
QString serialDeviceDescription;
|
||||||
|
QString serialDeviceManufacturer;
|
||||||
|
QString serialDeviceNumber;
|
||||||
|
QString serialDeviceVendor;
|
||||||
|
QString serialDeviceProduct;
|
||||||
|
quint32 baudRate = 115200;
|
||||||
|
void write(QByteArray datas);
|
||||||
|
|
||||||
//QAbstractButton * reply;
|
SerialManager();
|
||||||
//QString serialDevicePath;
|
~SerialManager();
|
||||||
|
|
||||||
void write(QString datas);
|
void initSerial();
|
||||||
ZigbeeMgr();
|
bool findSerialDevice();
|
||||||
~ZigbeeMgr();
|
//void getData();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void datasReady(QByteArray);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
private slots:
|
|
||||||
void getData();
|
|
||||||
void confirmWrite(qint16 byte);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // SERIAL_INC_H
|
#endif // SERIAL_INC_H
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <QFutureWatcher>
|
||||||
|
#include "serial.inc.h"
|
||||||
|
|
||||||
|
class BackEnds;
|
||||||
|
extern SerialManager serialManager;
|
||||||
|
extern QMap <QString, BackEnds> backends;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
ZigateBackend zigateBkd;
|
||||||
|
|
||||||
ZigateBackend::ZigateBackend()
|
ZigateBackend::ZigateBackend()
|
||||||
{
|
{
|
||||||
bool result;
|
BackEnds zigate;
|
||||||
|
backends["Zigate"] = zigate;
|
||||||
this->resultCodes.insert(0x8000, "Status");
|
backends["zigate"].name = "Zigate";
|
||||||
while (1)
|
backends["zigate"].device = "ZIGATE";
|
||||||
{
|
|
||||||
result = this->findSerialDevice();
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
debug("Device found :" + this->serialDevicePath, INFO);
|
|
||||||
break;
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
cout << "Device not found, waiting 10 seconds before retrying" << endl;
|
|
||||||
sleep(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//resultCodes.insert();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZigateBackend::~ZigateBackend()
|
ZigateBackend::~ZigateBackend()
|
||||||
@ -32,16 +26,20 @@ QByteArray ZigateBackend::checksum(QByteArray msgType, QByteArray length, QByteA
|
|||||||
{
|
{
|
||||||
quint16 temp = 0;
|
quint16 temp = 0;
|
||||||
int i;
|
int i;
|
||||||
|
QString str;
|
||||||
|
|
||||||
QString str = msgType.mid(0,2);
|
str = msgType.mid(0,2);
|
||||||
cout << str.toStdString() << endl;
|
temp ^= str.toInt(nullptr, 16);
|
||||||
temp ^= qFromLittleEndian<quint16>(msgType[0] + msgType[1]);
|
str = msgType.mid(2,2);
|
||||||
temp ^= qFromLittleEndian<quint16>(msgType[2] + msgType[3]);
|
temp ^= str.toInt(nullptr, 16);
|
||||||
temp ^= qFromLittleEndian<quint16>(length[0] + length[1]);
|
str = length.mid(0,2);
|
||||||
temp ^= qFromLittleEndian<quint16>(length[2] + length[3]);
|
temp ^= str.toInt(nullptr, 16);
|
||||||
|
str = length.mid(2,2);
|
||||||
|
temp ^= str.toInt(nullptr, 16);
|
||||||
for (i=0;i<=(datas.count());i+=2)
|
for (i=0;i<=(datas.count());i+=2)
|
||||||
{
|
{
|
||||||
temp ^= qFromLittleEndian<quint16>(datas[i] + datas[i+1]);
|
str = datas.mid(i,2);
|
||||||
|
temp ^= str.toInt(nullptr, 16);
|
||||||
}
|
}
|
||||||
return QByteArray::number(temp, 16);
|
return QByteArray::number(temp, 16);
|
||||||
}
|
}
|
||||||
@ -51,7 +49,6 @@ QByteArray ZigateBackend::transcode(QByteArray datas)
|
|||||||
QByteArray msg = "";
|
QByteArray msg = "";
|
||||||
int i;
|
int i;
|
||||||
QByteArray byte;
|
QByteArray byte;
|
||||||
|
|
||||||
if (datas.count()%2 != 0)
|
if (datas.count()%2 != 0)
|
||||||
{
|
{
|
||||||
return "-1";
|
return "-1";
|
||||||
@ -59,25 +56,54 @@ QByteArray ZigateBackend::transcode(QByteArray datas)
|
|||||||
for (i=0;i<datas.count();i+=2)
|
for (i=0;i<datas.count();i+=2)
|
||||||
{
|
{
|
||||||
byte = datas.mid(i,2);
|
byte = datas.mid(i,2);
|
||||||
cout << byte.toStdString() << " => " << byte.toUInt(nullptr, 16) << endl;
|
if (byte.toUInt(nullptr, 16) > 15)
|
||||||
if (byte.toUInt(nullptr, 16)>0x10)
|
|
||||||
{
|
{
|
||||||
msg += byte;
|
msg += byte;
|
||||||
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
msg.append("02");
|
msg.append("02");
|
||||||
msg.append(QByteArray::number(byte.toUInt(nullptr, 16) ^ 0x10, 16));
|
msg.append(QByteArray::number(byte.toUInt(nullptr, 16) ^ 16, 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZigateBackend::sendCmd(QByteArray cmd, QByteArray len, QByteArray datas)
|
QByteArray ZigateBackend::unTranscode(QByteArray datas)
|
||||||
|
{
|
||||||
|
QByteArray result;
|
||||||
|
int i;
|
||||||
|
char tmp;
|
||||||
|
|
||||||
|
if (datas.isEmpty())
|
||||||
|
{
|
||||||
|
return "-1";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=1;i<=datas.count()-2;i++)
|
||||||
|
{
|
||||||
|
tmp = datas.at(i);
|
||||||
|
if (tmp == 0x02)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
result.append(datas[i] ^ 16);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if (tmp != 0 and tmp != 1)
|
||||||
|
{
|
||||||
|
result += tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout << result.toHex(' ').toStdString() << endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZigateBackend::sendCmd(QByteArray cmd, QByteArray datas)
|
||||||
{
|
{
|
||||||
QByteArray msg;
|
QByteArray msg;
|
||||||
|
QByteArray len;
|
||||||
|
|
||||||
|
len = QByteArray::number(datas.count()/2, 16).insert(0,"000").right(4);
|
||||||
msg = QByteArray::fromHex("01");
|
msg = QByteArray::fromHex("01");
|
||||||
msg += QByteArray::fromHex(transcode(cmd));
|
msg += QByteArray::fromHex(transcode(cmd));
|
||||||
msg += QByteArray::fromHex(transcode(len));
|
msg += QByteArray::fromHex(transcode(len));
|
||||||
@ -86,29 +112,319 @@ void ZigateBackend::sendCmd(QByteArray cmd, QByteArray len, QByteArray datas)
|
|||||||
msg += QByteArray::fromHex(checksum(cmd, len, datas));
|
msg += QByteArray::fromHex(checksum(cmd, len, datas));
|
||||||
msg += QByteArray::fromHex(transcode(datas));
|
msg += QByteArray::fromHex(transcode(datas));
|
||||||
}else{
|
}else{
|
||||||
msg += QByteArray::fromHex(checksum(cmd, len, "0"));
|
msg += QByteArray::fromHex(checksum(cmd, len, ""));
|
||||||
}
|
}
|
||||||
msg += QByteArray::fromHex("03");
|
msg += QByteArray::fromHex("03");
|
||||||
cout << msg.toStdString() << endl;
|
serialManager.write(msg);
|
||||||
}
|
if (!serialManager.waitForBytesWritten(10000))
|
||||||
|
|
||||||
bool ZigateBackend::findSerialDevice()
|
|
||||||
{
|
|
||||||
const auto serialPortInfos = QSerialPortInfo::availablePorts();
|
|
||||||
for (const QSerialPortInfo &portInfo : serialPortInfos)
|
|
||||||
{
|
{
|
||||||
if (portInfo.serialNumber() == "ZIGATE+")
|
cout << "error : no acknoledge of bytes written" << endl;
|
||||||
{
|
|
||||||
this->portName = portInfo.portName();
|
|
||||||
this->serialDevicePath = portInfo.systemLocation();
|
|
||||||
this->serialDeviceDescription = portInfo.description();
|
|
||||||
this->serialDeviceManufacturer = portInfo.manufacturer();
|
|
||||||
this->serialDeviceNumber = portInfo.serialNumber();
|
|
||||||
this->serialDeviceVendor = portInfo.vendorIdentifier();
|
|
||||||
this->serialDeviceProduct = portInfo.productIdentifier();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
//this->interpretResult(this->dataRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void ZigateBackend::getResponse()
|
||||||
|
{
|
||||||
|
//this->getData();
|
||||||
|
this->interpretResult(this->dataRead);
|
||||||
|
this->dataRead.clear();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void ZigateBackend::interpretResult(QByteArray payload)
|
||||||
|
{
|
||||||
|
uint tab = 0;
|
||||||
|
int length = 0;
|
||||||
|
quint8 crctmp = 0;
|
||||||
|
uint i = 0;
|
||||||
|
int datasResultLength = 0;
|
||||||
|
Response responseObject;
|
||||||
|
QByteArray type;
|
||||||
|
uint ln;
|
||||||
|
quint8 crc;
|
||||||
|
QByteArray datasResult;
|
||||||
|
QByteArray quality;
|
||||||
|
QByteArray payloadD;
|
||||||
|
payloadD = unTranscode(payload);
|
||||||
|
length = payloadD.count();
|
||||||
|
|
||||||
|
while(length > 5)
|
||||||
|
{
|
||||||
|
crctmp = 0;
|
||||||
|
//type de message
|
||||||
|
type = payloadD.mid(0, 2);
|
||||||
|
ln = payloadD.mid(2, 2).toHex().toUInt(nullptr, 16);
|
||||||
|
|
||||||
|
if ((unsigned char)type[0] == 128 or (unsigned char)type[0] == 0 or (unsigned char)type[0] == 153)
|
||||||
|
{
|
||||||
|
crctmp = crctmp ^ payloadD.at(0) ^ payloadD.at(1);
|
||||||
|
crctmp = crctmp ^ payloadD.at(2) ^ payloadD.at(3);
|
||||||
|
//acquisition du CRC
|
||||||
|
crc = payloadD.at(4);
|
||||||
|
//datasResult
|
||||||
|
datasResult = "";
|
||||||
|
for(i=0;i<ln;i++)
|
||||||
|
{
|
||||||
|
datasResult += payloadD.at(5+i);
|
||||||
|
crctmp ^= payloadD.at(5+i);
|
||||||
|
}
|
||||||
|
quality = payloadD.right(1);
|
||||||
|
|
||||||
|
datasResultLength = datasResult.count();
|
||||||
|
|
||||||
|
//verification du CRC
|
||||||
|
if (crc == crctmp)
|
||||||
|
{
|
||||||
|
if (responseListIndex[type.toHex()]->manager != nullptr)
|
||||||
|
{
|
||||||
|
responseObject.code = type;
|
||||||
|
responseObject.datas = datasResult;
|
||||||
|
// responseObject.properties = responseListIndex[type]->properties
|
||||||
|
responseListIndex[type.toHex()]->manager(&responseObject);
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
cout << "unknown command or command not implemented :" << type.toHex().toStdString() << endl;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
tab=-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
payloadD.remove(0,ln+6);
|
||||||
|
length = payloadD.count();
|
||||||
|
}
|
||||||
|
//return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
void defaultManager(Response *responseObject)
|
||||||
|
{
|
||||||
|
int nbyte;
|
||||||
|
int isValue;
|
||||||
|
int offset = 0;
|
||||||
|
QByteArray datas = responseObject->datas;
|
||||||
|
QByteArray result;
|
||||||
|
QByteArray code = responseObject->code.toHex();
|
||||||
|
|
||||||
|
cout << responseObject->code.toStdString() << endl;
|
||||||
|
QMap <uint, QList<QVariant>>::iterator i = zigateBkd.responseListIndex[code]->properties.begin();
|
||||||
|
QList <QVariant> propertyList;
|
||||||
|
QMap <uint, QString> propertyDetail;
|
||||||
|
QMap<uint,QString> var;
|
||||||
|
|
||||||
|
infoOutput(responseObject);
|
||||||
|
while (i != zigateBkd.responseListIndex[code]->properties.end())
|
||||||
|
{
|
||||||
|
propertyList = i.value();
|
||||||
|
propertyDetail = zigateBkd.responseListIndex[code]->propertyDetail.value(i.key());
|
||||||
|
cout << propertyList.at(0).toString().toStdString() << ": ";
|
||||||
|
nbyte = propertyList.at(1).toInt();
|
||||||
|
isValue = propertyList.at(2).toInt();
|
||||||
|
result = datas.mid(offset, nbyte);
|
||||||
|
offset += nbyte;
|
||||||
|
|
||||||
|
switch (isValue)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
cout << result.toHex().toStdString() << endl;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
cout << result.toHex().toStdString() << endl;
|
||||||
|
//foreach (var, propertyDetail)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (propertyDetail.contains(result.toUInt()))
|
||||||
|
{
|
||||||
|
cout << propertyDetail.value(result.toUInt()).toStdString() << endl;
|
||||||
|
}else if (propertyDetail.contains(-1))
|
||||||
|
{
|
||||||
|
cout << propertyDetail.value(-1).toStdString() << endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
zigateBkd.responseListIndex[responseObject->code]->propertyManagerList[i.key()](result);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
cout << "Liste" << endl;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
cout << result.toStdString() << endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void macCapabilityManager(QByteArray mac)
|
||||||
|
{
|
||||||
|
cout << "macCapabilityManger" << mac.toStdString() << endl;
|
||||||
|
}
|
||||||
|
/* void deviceAnnounceManager()
|
||||||
|
{
|
||||||
|
infoOutput(responseListIndex(""));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void dataIndicationManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clustersListManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void attributesListManager()
|
||||||
|
{
|
||||||
|
infoOutput(attributesList);
|
||||||
|
}
|
||||||
|
|
||||||
|
void commandsListManager()
|
||||||
|
{
|
||||||
|
infoOutput(commandsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
void statusManager()
|
||||||
|
{
|
||||||
|
infoOutput(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
void status2Manager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void versionListManager()
|
||||||
|
{
|
||||||
|
infoOutput(versionList);
|
||||||
|
}
|
||||||
|
// ****************************************************************************
|
||||||
|
// 0 - Off
|
||||||
|
// 1 - On
|
||||||
|
// *******************************************************************************
|
||||||
|
|
||||||
|
void permitJoinManager()
|
||||||
|
{
|
||||||
|
infoOutput(permitJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void networkJoinedFormedManager()
|
||||||
|
{
|
||||||
|
infoOutput(networkJoinedFormed);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void deviceListManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
// **************************************************************
|
||||||
|
// <device list – data each entry is 13 bytes>
|
||||||
|
// <ID: uint8_t>
|
||||||
|
// <Short address: uint16_t>
|
||||||
|
// <IEEE address: uint64_t>
|
||||||
|
// <Power source: bool_t> 0 – battery 1- AC power
|
||||||
|
// <LinkQuality : uint8_t> 1-255
|
||||||
|
// **************************************************************
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void bindResponseManager()
|
||||||
|
{
|
||||||
|
infoOutput(bindResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unbindResponseManager()
|
||||||
|
{
|
||||||
|
infoOutput(unbindResponse);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void networkAddressManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void iEEEAddressManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nodeDescriptorManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void simpleDescriptorManager(Response * response)
|
||||||
|
{
|
||||||
|
infoOutput(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void powerDescriptorManager()
|
||||||
|
{
|
||||||
|
infoOutput(powerDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void activeEndpointManager()
|
||||||
|
{
|
||||||
|
infoOutput(activeEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void matchDescriptorManager()
|
||||||
|
{
|
||||||
|
infoOutput(matchDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void userDescriptorNotifyManager()
|
||||||
|
{
|
||||||
|
infoOutput(userDescriptorNotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
void userDescriptorManager()
|
||||||
|
{
|
||||||
|
infoOutput(userDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void complexDescriptorManager()
|
||||||
|
{
|
||||||
|
infoOutput(complexDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void managementLeaveManager()
|
||||||
|
{
|
||||||
|
infoOutput(managementLeave);
|
||||||
|
}
|
||||||
|
|
||||||
|
void leaveIndicationManager()
|
||||||
|
{
|
||||||
|
infoOutput(leaveIndication);
|
||||||
|
}
|
||||||
|
|
||||||
|
void managementNetworkUpdateManager()
|
||||||
|
{
|
||||||
|
infoOutput(managementNetworkUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void systemServerDiscoveryManager()
|
||||||
|
{
|
||||||
|
infoOutput(systemServerDiscovery);
|
||||||
|
}
|
||||||
|
// ********************************* //
|
||||||
|
// Bitmask according to spec". //
|
||||||
|
// ********************************* //
|
||||||
|
|
||||||
|
void managementLQIManager()
|
||||||
|
{
|
||||||
|
infoOutput(managementLQI);
|
||||||
|
}
|
||||||
|
|
||||||
|
void attributeDiscoveryManager()
|
||||||
|
{
|
||||||
|
infoOutput(attributeDiscovery);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
608
zigateBackend.h
608
zigateBackend.h
@ -1,39 +1,304 @@
|
|||||||
#ifndef ZIGATEBACKEND_H
|
#ifndef ZIGATEBACKEND_H
|
||||||
#define ZIGATEBACKEND_H
|
#define ZIGATEBACKEND_H
|
||||||
|
|
||||||
|
#define DEVICE_ANNOUNCE "004D"
|
||||||
|
#define STATUS_RETURNED "8000"
|
||||||
|
#define LOG_MESSAGE "8001"
|
||||||
|
#define DATA_INDICATION "8002"
|
||||||
|
#define CLUSTERS_LIST "8003"
|
||||||
|
#define ATTRIBUTES_LIST "8004"
|
||||||
|
#define COMMANDS_LIST "8005"
|
||||||
|
#define STATUS "8006"
|
||||||
|
#define STATUS2 "8007"
|
||||||
|
#define VERSION_LIST "8010"
|
||||||
|
#define PERMIT_JOIN "8014"
|
||||||
|
#define NETWORK_JOINED_FORMED "8024"
|
||||||
|
#define BIND_RESPONSE "8030"
|
||||||
|
#define UNBIND_RESPONSE "8031"
|
||||||
|
#define NETWORK_ADDRESS "8040"
|
||||||
|
#define IEEE_ADDRESS "8041"
|
||||||
|
#define NODE_DESCRIPTOR "8042"
|
||||||
|
#define SIMPLE_DESCRIPTOR "8043"
|
||||||
|
#define POWER_DESCRIPTOR "8044"
|
||||||
|
#define ACTIVE_ENDPOINT "8045"
|
||||||
|
#define MATCH_DESCRIPTOR "8046"
|
||||||
|
#define USER_DESCRIPTOR_NOTIFY "802B"
|
||||||
|
#define USER_DESCRIPTOR "802C"
|
||||||
|
#define MANAGEMENT_LEAVE "8047"
|
||||||
|
#define LEAVE_INDICATION "8048"
|
||||||
|
#define MANAGEMENT_NETWORK_UPDATE "804A"
|
||||||
|
#define SYSTEM_SERVER_DISCOVERY "804B"
|
||||||
|
#define MANAGEMENT_LQI "804E"
|
||||||
|
#define ATTRIBUTE_DISCOVERY "8140"
|
||||||
|
#define HEARTBEAT "8008"
|
||||||
|
#define NETWORK_STATE "8009"
|
||||||
|
#define ACK_DATA "8011"
|
||||||
|
#define DATA_CONFIRM "8012"
|
||||||
|
#define DEVICES_LIST "8015"
|
||||||
|
#define TIME_SERVER "8017"
|
||||||
|
#define AUTHENTICATE_RESPONSE "8028"
|
||||||
|
#define PDM_EVENT "8035"
|
||||||
|
#define PERMIT_JOINING "8049"
|
||||||
|
#define PDM_CHILD_TABLE_SIZE "8052"
|
||||||
|
#define ADD_GROUP "8060"
|
||||||
|
#define VIEW_GROUP "8061"
|
||||||
|
#define GROUP_MEMBERSHIP "8062"
|
||||||
|
#define REMOVE_GROUP "8063"
|
||||||
|
#define LEVEL_UPDATE "8085"
|
||||||
|
#define ON_OFF "8095"
|
||||||
|
#define VIEW_SCENE "80A0"
|
||||||
|
#define ADD_SCENE "80A1"
|
||||||
|
#define REMOVE_SCENE "80A2"
|
||||||
|
#define REMOVE_ALL_SCENE "80A3"
|
||||||
|
#define STORE_SCENE "80A4"
|
||||||
|
#define SCENE_MEMBERSHIP "80A6"
|
||||||
|
#define SCENES_UPDATE "80A7"
|
||||||
|
#define READ_INDIVIDUAL_ATTRIBUTE "8100"
|
||||||
|
#define DEFAULT_RESPONSE "8101"
|
||||||
|
#define REPORT_INDIVIDUAL_ATTRIBUTE "8102"
|
||||||
|
#define WRITE_ATTRIBUTE "8110"
|
||||||
|
#define CONFIGURE_REPORTING "8120"
|
||||||
|
#define READ_REPORT_CONFIG "8122"
|
||||||
|
#define COMPLEX_DESCRIPTOR "8531"
|
||||||
|
#define ROUTER_DISCOVERY "8701"
|
||||||
|
#define APS_DATA_CONFIRM_FAIL "8702"
|
||||||
|
#define EXTENDED_ERROR "9999"
|
||||||
|
|
||||||
|
#include "library.h"
|
||||||
#include "serial.inc.h"
|
#include "serial.inc.h"
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QSerialPortInfo>
|
#include <QHash>
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
//#include <QArray>
|
#include "responseClasses.h"
|
||||||
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
|
//void deviceAnnounceManager(Response *);
|
||||||
|
//void commandReturnStatusManager(Response *);
|
||||||
|
//void logMessageManager(Response *);
|
||||||
|
//void dataIndicationManager(Response *);
|
||||||
|
void clustersListManager(Response *);
|
||||||
|
//void attributesListManager(Response *);
|
||||||
|
//void commandsListManager(Response *);
|
||||||
|
//void statusManager(Response *);
|
||||||
|
//void status2Manager(Response *);
|
||||||
|
//void versionListManager(Response *);
|
||||||
|
//void permitJoinManager(Response *);
|
||||||
|
//void networkJoinedFormedManager(Response *);
|
||||||
|
//void bindResponseManager(Response *);
|
||||||
|
//void unbindResponseManager(Response *);
|
||||||
|
//void networkAddressManager(Response *);
|
||||||
|
void iEEEAddressManager(Response *);
|
||||||
|
void nodeDescriptorManager(Response *);
|
||||||
|
void simpleDescriptorManager(Response *);
|
||||||
|
//void powerDescriptorManager(Response *);
|
||||||
|
//void activeEndpointManager(Response *);
|
||||||
|
//void matchDescriptorManager(Response *);
|
||||||
|
//void userDescriptorNotifyManager(Response *);
|
||||||
|
//void userDescriptorManager(Response *);
|
||||||
|
//void complexDescriptorManager(Response *);
|
||||||
|
//void managementLeaveManager(Response *);
|
||||||
|
//void leaveIndicationManager(Response *);
|
||||||
|
//void managementNetworkUpdateManager(Response *);
|
||||||
|
//void systemServerDiscoveryManager(Response *);
|
||||||
|
//void managementLQIManager(Response *);
|
||||||
|
//void attributeDiscoveryManager(Response *);
|
||||||
|
void deviceListManager(Response *);
|
||||||
|
void networkAddressManager(Response *);
|
||||||
|
void dataIndicationManager(Response *);
|
||||||
|
|
||||||
class ZigbeeMgr;
|
class ZigbeeMgr;
|
||||||
|
|
||||||
class ZigateBackend : public ZigbeeMgr
|
class ZigateBackend : QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public slots:
|
||||||
QMap <int, QString> resultCodes;
|
void interpretResult(QByteArray);
|
||||||
QString portName;
|
|
||||||
QString serialDeviceDescription;
|
|
||||||
QString serialDeviceManufacturer;
|
|
||||||
QString serialDeviceNumber;
|
|
||||||
QString serialDeviceVendor;
|
|
||||||
QString serialDeviceProduct;
|
|
||||||
quint32 baudRate = 115200;
|
|
||||||
//ZigbeeMgr serial;
|
|
||||||
|
|
||||||
|
public:
|
||||||
ZigateBackend();
|
ZigateBackend();
|
||||||
~ZigateBackend();
|
~ZigateBackend();
|
||||||
|
|
||||||
|
bool initBackend();
|
||||||
QByteArray checksum(QByteArray msgType, QByteArray length, QByteArray datas);
|
QByteArray checksum(QByteArray msgType, QByteArray length, QByteArray datas);
|
||||||
QByteArray transcode(QByteArray datas);
|
QByteArray transcode(QByteArray datas);
|
||||||
void sendCmd(QByteArray cmd, QByteArray len, QByteArray datas);
|
QByteArray unTranscode(QByteArray datas);
|
||||||
bool findSerialDevice();
|
void sendCmd(QByteArray cmd, QByteArray datas);
|
||||||
|
//int interpretResult(QByteArray datas);
|
||||||
|
//void getResponse();
|
||||||
|
bool resetCoordinator();
|
||||||
|
void interpretResult();
|
||||||
|
|
||||||
QMap <QString, QString> clusters
|
// commands
|
||||||
|
void getVersion();
|
||||||
|
|
||||||
|
// commands
|
||||||
|
void getVersion();
|
||||||
|
|
||||||
|
QMap <int, QString> resultCodes;
|
||||||
|
QMap <QString, QList <QByteArray>> cmdList =
|
||||||
|
{
|
||||||
|
{"setHeartBeat", {"0008", "0000", ""}},
|
||||||
|
{"getNetWorkState", {"0009", "0000", ""}},
|
||||||
|
{"getVersion", {"0010", "0000", ""}},
|
||||||
|
{"reset", {"0011", "0000", ""}},
|
||||||
|
{"erasePersistentData", {"0012", "0000", ""}},
|
||||||
|
{"factoryReset", {"0013", "0000", ""}},
|
||||||
|
{"permitJoin", {"0014", "0000", ""}},
|
||||||
|
{"setExpendedPANID", {"0020", "0008", ""}},
|
||||||
|
{"setChannelMask", {"0021", "0004", ""}},
|
||||||
|
{"setSecurityStateandKey", {"0022", "0000", ""}},
|
||||||
|
{"setDeviceType", {"0023", "0001", ""}},
|
||||||
|
{"startNetwork", {"0024", "0000", ""}},
|
||||||
|
{"startNetworkScan", {"0025", "0000", ""}},
|
||||||
|
{"removeDevice", {"0026", "0010", ""}},
|
||||||
|
{"enablePermissionsControlledJoins", {"0027", "0001", ""}},
|
||||||
|
{"authenticateDevice", {"0028", "0018", ""}},
|
||||||
|
{"outOfBandCommissioningDataRequest", {"0029", "0018", ""}},
|
||||||
|
{"userDescriptorSet", {"002B", "0000", ""}},
|
||||||
|
{"userDescritporRequest", {"002C", "0000", ""}},
|
||||||
|
{"bind", {"0030", "", ""}},
|
||||||
|
{"unbind", {"0031", "", ""}},
|
||||||
|
{"complexDescriptorRequest", {"0034", "0004", ""}},
|
||||||
|
{"networkAddressRequest", {"0040", "0012", ""}},
|
||||||
|
{"ieeeAddressRequest", {"0041", "0006", ""}},
|
||||||
|
{"nodeDescriptorRequest", {"0042", "0002", ""}},
|
||||||
|
{"simpleDescriptorRequest", {"0043", "0003", ""}},
|
||||||
|
{"powerDescriptorRequest", {"0044", "0002", ""}},
|
||||||
|
{"activeEndpointRequest", {"0045", "0002", ""}},
|
||||||
|
{"matchDescriptorRequest", {"0046", "", ""}},
|
||||||
|
{"managementLeaveRequest", {"0047", "001C", ""}},
|
||||||
|
{"permitJoiningRequest", {"0049", "0004", ""}},
|
||||||
|
{"managementNetworkUpdateRequest", {"004A", "000B", ""}},
|
||||||
|
{"systemServerDiscoveryRequest", {"004B", "0004", ""}},
|
||||||
|
{"managementLQIRequest", {"004E", "0003", ""}},
|
||||||
|
{"addGroup", {"0060", "0007", ""}},
|
||||||
|
{"viewGroup", {"0061", "0007", ""}},
|
||||||
|
{"getGroupMembership", {"0062", "", ""}},
|
||||||
|
{"removeGroup", {"0063", "0007", ""}},
|
||||||
|
{"removeAllGroups", {"0064", "0005", ""}},
|
||||||
|
{"addGroupIfIdentify", {"0065", "0007", ""}},
|
||||||
|
{"identifySend", {"0070", "0007", ""}},
|
||||||
|
{"identifyQuery", {"0071", "0005", ""}},
|
||||||
|
{"moveToLevel", {"0080", "0008", ""}},
|
||||||
|
{"moveToLevelWithWithoutOnOff", {"0081", "0009", ""}},
|
||||||
|
{"moveStep", {"0082", "000A", "0000"}},
|
||||||
|
{"moveStopMove", {"0083", "0005", ""}},
|
||||||
|
{"moveStopWithOnOff", {"0084", "0005", ""}},
|
||||||
|
{"onOffWithNoEffects", {"0092", "0006", ""}},
|
||||||
|
{"onOffTimedSend", {"0093", "000A", ""}},
|
||||||
|
{"onOffWithEffectsSend", {"0094", "0007", ""}},
|
||||||
|
{"viewScene", {"00A0", "0008", ""}},
|
||||||
|
{"addScene", {"00A1", "000D", ""}},
|
||||||
|
{"removeScene", {"00A2", "0008", ""}},
|
||||||
|
{"removeAllScenes", {"00A3", "0007", ""}},
|
||||||
|
{"storeScene", {"00A4", "0008", ""}},
|
||||||
|
{"recallScene", {"00A5", "0008", ""}},
|
||||||
|
{"sceneMembershipRequest", {"00A6", "0007", ""}},
|
||||||
|
{"addEnhancedScene", {"00A7", "", ""}},
|
||||||
|
{"viewEnhancedHostToNodeScene", {"00A8", "0008", ""}},
|
||||||
|
{"copyScene", {"00A9", "000C", ""}},
|
||||||
|
{"moveToHue", {"00B0", "0009", ""}},
|
||||||
|
{"moveHue", {"00B1", "0007", ""}},
|
||||||
|
{"stepHue", {"00B2", "0008", ""}},
|
||||||
|
{"moveToSaturation", {"00B3", "0008", ""}},
|
||||||
|
{"moveSaturation", {"00B4", "0006", ""}},
|
||||||
|
{"stepSaturation", {"00B5", "0008", ""}},
|
||||||
|
{"moveToHueAndSaturation", {"00B6", "0008", ""}},
|
||||||
|
{"moveToColour", {"00B7", "000B", ""}},
|
||||||
|
{"moveColour", {"00B8", "0009", ""}},
|
||||||
|
{"stepColour", {"00B9", "000B", ""}},
|
||||||
|
{"enhancedMoveToHue", {"00BA", "000A", ""}},
|
||||||
|
{"enhancedMoveHue", {"00BB", "0007", ""}},
|
||||||
|
{"enhancedStepHue", {"00BC", "0008", ""}},
|
||||||
|
{"enhancedMoveToHueAndSaturation", {"00BD", "000E", ""}},
|
||||||
|
{"colourLoopSet", {"00BE", "000D", ""}},
|
||||||
|
{"stopMoveStep", {"00BF", "0005", ""}},
|
||||||
|
{"moveToColourTemperature", {"00C0", "0009", ""}},
|
||||||
|
{"moveColourTemperature", {"00C1", "000D", ""}},
|
||||||
|
{"stepColourTemperature", {"00C2", "000E", ""}},
|
||||||
|
{"Initiate Touchlink", {"00D0", "0000", ""}},
|
||||||
|
{"touchLinkFactoryResetTarget", {"00D2", "0000", ""}},
|
||||||
|
{"identifyTriggerEffect", {"00E0", "0007", ""}},
|
||||||
|
{"lockUnlockDoor", {"00F0", "0006", ""}},
|
||||||
|
{"readAttributeRequest", {"0100", "", ""}},
|
||||||
|
{"writeAttributeRequest", {"0110", "000", ""}},
|
||||||
|
{"configureReportingRequest", {"0120", "", ""}},
|
||||||
|
{"attributeDiscoveryRequest", {"0140", "000E", ""}},
|
||||||
|
{"iASZoneEnrollResponse", {"0400", "0007", ""}},
|
||||||
|
{"rawApsDataRequest", {"0530", "000D", ""}}
|
||||||
|
};
|
||||||
|
QHash <QString, ResponseProperties *> responseListIndex;
|
||||||
|
|
||||||
|
QList <QString> responseListCode
|
||||||
|
{
|
||||||
|
"004D",
|
||||||
|
"8000",
|
||||||
|
"8001",
|
||||||
|
"8002",
|
||||||
|
"8003",
|
||||||
|
"8004",
|
||||||
|
"8005",
|
||||||
|
"8006",
|
||||||
|
"8007",
|
||||||
|
"8010",
|
||||||
|
"8014",
|
||||||
|
"8024",
|
||||||
|
"8030",
|
||||||
|
"8031",
|
||||||
|
"8040",
|
||||||
|
"8041",
|
||||||
|
"8042",
|
||||||
|
"8043",
|
||||||
|
"8044",
|
||||||
|
"8045",
|
||||||
|
"8046",
|
||||||
|
"802B",
|
||||||
|
"802C",
|
||||||
|
"8047",
|
||||||
|
"8048",
|
||||||
|
"804A",
|
||||||
|
"804B",
|
||||||
|
"804E",
|
||||||
|
"8140",
|
||||||
|
"8008",
|
||||||
|
"8009",
|
||||||
|
"8011",
|
||||||
|
"8012",
|
||||||
|
"8015",
|
||||||
|
"8017",
|
||||||
|
"8028",
|
||||||
|
"8035",
|
||||||
|
"8049",
|
||||||
|
"8052",
|
||||||
|
"8060",
|
||||||
|
"8061",
|
||||||
|
"8062",
|
||||||
|
"8063",
|
||||||
|
"8085",
|
||||||
|
"8095",
|
||||||
|
"80A0",
|
||||||
|
"80A1",
|
||||||
|
"80A2",
|
||||||
|
"80A3",
|
||||||
|
"80A4",
|
||||||
|
"80A6",
|
||||||
|
"80A7",
|
||||||
|
"8100",
|
||||||
|
"8101",
|
||||||
|
"8102",
|
||||||
|
"8110",
|
||||||
|
"8120",
|
||||||
|
"8122",
|
||||||
|
"8531",
|
||||||
|
"8701",
|
||||||
|
"8702",
|
||||||
|
"9999"
|
||||||
|
};
|
||||||
|
|
||||||
|
//ZigbeeMgr serial;
|
||||||
|
QMap <QByteArray, QString> clusters
|
||||||
{
|
{
|
||||||
{"0000", " (General: Basic)"},
|
{"0000", " (General: Basic)"},
|
||||||
{"0001", " (General: Power Config)"},
|
{"0001", " (General: Power Config)"},
|
||||||
@ -65,314 +330,7 @@ class ZigateBackend : public ZigbeeMgr
|
|||||||
{"FF02", " Xiaomi private"},
|
{"FF02", " Xiaomi private"},
|
||||||
{"1234", " Xiaomi private"}
|
{"1234", " Xiaomi private"}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Zigate -> Obj 0x0008 Set heartBeat enable/disable (ZiGatev2 Firm v3.20) <enable/disable : uint8_t >
|
|
||||||
0 – disable (by default)
|
|
||||||
1 – enable
|
|
||||||
Status
|
|
||||||
*/
|
|
||||||
QList <QByteArray> heartbeatEnable = {"0008", "0001", "0210"};
|
|
||||||
|
|
||||||
/*Zigate -> Obj 0x0009 Get Network State (Firm v3.0d) Status
|
|
||||||
Network State Response
|
|
||||||
*/
|
|
||||||
QByteArray networkState = "0009";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0010 Get Version Status
|
|
||||||
Version List
|
|
||||||
*/
|
|
||||||
QList <QByteArray> getVersion = {"0010", "0000", ""};
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0011 Reset Status, followed by chip reset
|
|
||||||
*/
|
|
||||||
QByteArray reset = "0011";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0012 Erase Persistent Data Status
|
|
||||||
*/
|
|
||||||
QByteArray erasePersistentData = "0012";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0013 ZLO/ZLL “Factory New” Reset No payload Status, followed by chip reset
|
|
||||||
Resets (“Factory New”) the Control Bridge but persists the frame counters.
|
|
||||||
*/
|
|
||||||
QByteArray factoryReset = "0013";
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0014 Permit Join Status, followed by “Permit join” status response
|
|
||||||
*/
|
|
||||||
QByteArray permitJoin = "0014";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0015 Get devices list Get devices authentified in the ZiGate’s PDM. Status, followed by “Get devices list” response
|
|
||||||
*/
|
|
||||||
QByteArray getDevicesList = "0015";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0016 Set Time server (v3.0f) <timestamp UTC: uQByteArray32_t> from 2000-01-01 00:00:00 Status
|
|
||||||
*/
|
|
||||||
QByteArray setTimeServer = "0016";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0017 GetTime server (v3.0f) Status
|
|
||||||
Get_timer_server_response
|
|
||||||
*/
|
|
||||||
QByteArray getTimerServerResponse = "0017";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0018 SetLed (v3.0f) <on/off : uint8_t >
|
|
||||||
0 – Off
|
|
||||||
1- On
|
|
||||||
Status
|
|
||||||
*/
|
|
||||||
QByteArray setLed = "0018";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0019 Set Certification (v3.0f) <type : uint8_t >
|
|
||||||
1- CE
|
|
||||||
2- FCC
|
|
||||||
Status
|
|
||||||
*/
|
|
||||||
QByteArray setCertification = "0019";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0020 Set Expended PANID <64-bit Extended PAN ID:uint64_t> Status
|
|
||||||
*/
|
|
||||||
QByteArray setExpended = "0020";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0021 Set Channel Mask <channel mask:uint32_t> Status
|
|
||||||
*/
|
|
||||||
QByteArray setChannelMask = "0021";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0022 Set Security State + Key <key type: uint8_t> Status
|
|
||||||
<key: data>
|
|
||||||
*/
|
|
||||||
QByteArray setSecurityState = "0022";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0023 Set device Type <device type: uint8_t> Status
|
|
||||||
Device Types:
|
|
||||||
0 = Coordinator
|
|
||||||
1 = Router
|
|
||||||
*/
|
|
||||||
QByteArray setDeviceType = "0023";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0024 Start Network Status
|
|
||||||
Network Joined / Formed
|
|
||||||
*/
|
|
||||||
QByteArray startNetwork = "0024";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0025 Start Network Scan Status
|
|
||||||
Network Joined / Formed
|
|
||||||
*/
|
|
||||||
QByteArray StartNetworkScan = "0025";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0026 Remove Device <Parent IEEE address: uint64_t> Status
|
|
||||||
<Child IEEE address: uint64_t> Leave indication
|
|
||||||
*/
|
|
||||||
QByteArray removeDevice = "0026";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0027 Enable Permissions Controlled Joins <Enable/Disable : uint8_t> Status
|
|
||||||
1 – Enable
|
|
||||||
2 – Disable
|
|
||||||
*/
|
|
||||||
QByteArray enablePermControlledJoins = "0027";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0028 Authenticate Device <IEEE address "; uint64_t> Status
|
|
||||||
<Key : 16 elements byte each> Authenticate response
|
|
||||||
*/
|
|
||||||
QByteArray authenticateDevice = "0028";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0029 Out of Band Commissioning Data Request <Address of interest : uint64_t> Status
|
|
||||||
<Key : 16 elements byte each> Out of Band Commissioning Data Response
|
|
||||||
*/
|
|
||||||
QByteArray outOfBandCDR = "0029";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x002B User Descriptor Set < target short address: uint16_t> Status
|
|
||||||
< Address of interest: uint16_t> User descriptor notify response
|
|
||||||
< string length: uint8_t>
|
|
||||||
<data: uint8_t stream >
|
|
||||||
*/
|
|
||||||
QByteArray userDescriptorSet = "002B";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x002C User Descritpor Request < target short address: uint16_t> Status
|
|
||||||
< Address of interest: uint16_t> User Descriptor response
|
|
||||||
*/
|
|
||||||
QByteArray userDescriptorRequest = "002C";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0531 Complex Descriptor request < target short address: uint16_t> Status
|
|
||||||
< Address of interest: uint16_t> Complex Descriptor Response
|
|
||||||
*/
|
|
||||||
QByteArray complexDescriptorRequest = "0531";
|
|
||||||
|
|
||||||
/*Zigate -> Obj 0x0030 Bind <target extended address: uint64_t> Status
|
|
||||||
<target endpoint: uint8_t> Bind response
|
|
||||||
<cluster ID: uint16_t>
|
|
||||||
<destination address mode: uint8_t>
|
|
||||||
<destination address:uint16_t or uint64_t>
|
|
||||||
<destination endpoint (value ignored for group address): uint8_t>
|
|
||||||
*/
|
|
||||||
QByteArray bind = "0030";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0031 Unbind <target extended address: uint64_t> Status
|
|
||||||
<target endpoint: uint8_t> Unbind response
|
|
||||||
<cluster ID: uint16_t>
|
|
||||||
<destination address mode: uint8_t>
|
|
||||||
<destination address: uint16_t or uint64_t>
|
|
||||||
<destination endpoint(value ignored for group address): uint8_t>
|
|
||||||
*/
|
|
||||||
QByteArray unBind = "0031";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0040 Network Address request <target short address: uint16_t> <extended address:uint64_t> Status
|
|
||||||
<request type: uint8_t> Network Address response
|
|
||||||
<start index: uint8_t>
|
|
||||||
Request Type:
|
|
||||||
0 = Single Request
|
|
||||||
1 = Extended Request
|
|
||||||
*/
|
|
||||||
QByteArray networkAddressRequest = "0040";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0041 IEEE Address request <target short address: uint16_t> Status
|
|
||||||
<short address: uint16_t> IEEE Address response
|
|
||||||
<request type: uint8_t>
|
|
||||||
<start index: uint8_t>
|
|
||||||
Request Type:
|
|
||||||
0 = Single
|
|
||||||
1 = Extended
|
|
||||||
*/
|
|
||||||
QByteArray ieeeAddressRequest = "0041";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0042 Node Descriptor request <target short address: uint16_t> Status
|
|
||||||
Node Descriptor response
|
|
||||||
*/
|
|
||||||
QByteArray nodeDescriptorRequest = "0042";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0043 Simple Descriptor request <target short address: uint16_t> Status
|
|
||||||
<endpoint: uint8_t> Simple Descriptor response
|
|
||||||
*/
|
|
||||||
QByteArray simpleDescriptorRequest = "0043";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0044 Power Descriptor request <target short address: uint16_t> Status
|
|
||||||
Power Descriptor response
|
|
||||||
*/
|
|
||||||
QByteArray powerDescriptorRequest = "0044";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0045 Active Endpoint request <target short address: uint16_t> Status
|
|
||||||
Active Endpoint response
|
|
||||||
*/
|
|
||||||
QByteArray activeEndpointRequest = "0045";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0046 Match Descriptor request <target short address: uint16_t> Status
|
|
||||||
<profile id: uint16_t> Match Descriptor response
|
|
||||||
<number of input clusters: uint8_t>
|
|
||||||
<input cluster list:data: each entry is uint16_t >
|
|
||||||
<number of output clusters: uint8_t>
|
|
||||||
<output cluster list:data: each entry is uint16_t>
|
|
||||||
*/
|
|
||||||
QByteArray matchDescriptorRequest = "0046";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0047 Management Leave request <target short address: uint16_t> Status
|
|
||||||
<extended address: uint64_t> Management Leave response
|
|
||||||
<Rejoin: uint8_t> Leave indication
|
|
||||||
<Remove Children: uint8_t>
|
|
||||||
Rejoin,
|
|
||||||
0 = Do not rejoin
|
|
||||||
1 = Rejoin
|
|
||||||
Remove Children
|
|
||||||
0 = Leave, do not remove children
|
|
||||||
1 = Leave, removing children
|
|
||||||
*/
|
|
||||||
QByteArray managementLeaveRequest = "0047";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0049 Permit Joining request <target short address: uint16_t> Status
|
|
||||||
<interval: uint8_t>
|
|
||||||
<TCsignificance: uint8_t>
|
|
||||||
Target address: May be address of gateway node or broadcast (0xfffc)
|
|
||||||
Interval:
|
|
||||||
0 = Disable Joining
|
|
||||||
1 – 254 = Time in seconds to allow joins
|
|
||||||
255 = Allow all joins
|
|
||||||
TCsignificance:
|
|
||||||
0 = No change in authentication
|
|
||||||
1 = Authentication policy as spec
|
|
||||||
*/
|
|
||||||
QByteArray permitJoiningRequest = "0049";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x004A Management Network Update request <target short address: uint16_t> Status
|
|
||||||
<channel mask: uint32_t> Management Network Update response
|
|
||||||
<scan duration: uint8_t>
|
|
||||||
<scan count: uint8_t>
|
|
||||||
<network update ID: uint8_t>
|
|
||||||
<network manager short address: uint16_t>
|
|
||||||
Channel Mask:
|
|
||||||
Mask of channels to scan
|
|
||||||
Scan Duration:
|
|
||||||
0 – 0xFF Multiple of superframe duration.
|
|
||||||
Scan count:
|
|
||||||
Scan repeats 0 – 5
|
|
||||||
Network Update ID:
|
|
||||||
0 – 0xFF Transaction ID for scan
|
|
||||||
*/
|
|
||||||
QByteArray manaementNetworkUpdateRequest = "004A";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x004B System Server Discovery request <target short address: uint16_t> Status
|
|
||||||
<Server mask: uint16_t> System Server Discovery response
|
|
||||||
Bitmask according to spec.
|
|
||||||
*/
|
|
||||||
QByteArray systemServerDiscoveryRequest = "004B";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x004C Leave Request <extended address: uint64_t> Status
|
|
||||||
<Rejoin: uint8_t> Leave indication Leave indication (0x8048)
|
|
||||||
<Remove Children: uint8_t>
|
|
||||||
Rejoin,
|
|
||||||
0 = Do not rejoin
|
|
||||||
1 = Rejoin
|
|
||||||
Remove Children
|
|
||||||
0 = Leave, do not remove children
|
|
||||||
1 = Leave, removing children
|
|
||||||
*/
|
|
||||||
QByteArray leaveRequest = "004C";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x004E Management LQI request <Target Address : uint16_t> Status
|
|
||||||
<Start Index : uint8_t> Management LQI response
|
|
||||||
*/
|
|
||||||
QByteArray managementLqiRequest = "004E";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0051 Free PDM internal address map table (From v.322 ZiGate+) Status
|
|
||||||
*/
|
|
||||||
QByteArray freePdmTable = "0051";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Zigate -> Obj 0x0052 Get PDM child table size (From v.322 ZiGate+) Status
|
|
||||||
PDM child table size response
|
|
||||||
*/
|
|
||||||
QByteArray getPdmChildTableSize = "0052";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // ZIGATEBACKEND_H
|
#endif // ZIGATEBACKEND_H
|
||||||
|
711
zigateInit.cpp
Normal file
711
zigateInit.cpp
Normal file
@ -0,0 +1,711 @@
|
|||||||
|
#include "zigateBackend.h"
|
||||||
|
#include "serial.inc.h"
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
extern ZigateBackend zigateBkd;
|
||||||
|
extern SerialManager serialManager;
|
||||||
|
extern QHash <QString, ResponseProperties *> responseListIndex;
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
bool ZigateBackend::initBackend()
|
||||||
|
{
|
||||||
|
bool returnCode = false;
|
||||||
|
QString var;
|
||||||
|
ResponseProperties * temp;
|
||||||
|
|
||||||
|
foreach (var, responseListCode)
|
||||||
|
{
|
||||||
|
temp = new ResponseProperties();
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
responseListIndex.insert(var, temp) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = responseListIndex["004D"];
|
||||||
|
temp->code = QByteArray::fromHex("004D");
|
||||||
|
temp->description = "Device announce";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
// {rang, {designation, nbyte, isvalue}}
|
||||||
|
// isvalue = 0 => display value
|
||||||
|
// = 1 => is array of bits
|
||||||
|
// = 2 => is index of string in list
|
||||||
|
// = 3 => launch a subroutine pointed by propertyManagerList
|
||||||
|
// = 4 => is a list of objects
|
||||||
|
{0, {"Short address", 2, 0}}, // uint16_t
|
||||||
|
{1, {"IEEE address", 4, 0}}, // uint64_t
|
||||||
|
{2, {"MAC capability", 1, 3}}
|
||||||
|
};
|
||||||
|
temp->propertyManagerList[2] = &macCapabilityManager;
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[2] =
|
||||||
|
{
|
||||||
|
{1, "Alternate PAN Coordinator"},
|
||||||
|
{2, "Device Type"},
|
||||||
|
{4, "Power source"},
|
||||||
|
{8, "Receiver On when Idle"},
|
||||||
|
{64, "Security capability"},
|
||||||
|
{128, "Allocate Address"}
|
||||||
|
};
|
||||||
|
// *****************************************************************************
|
||||||
|
// MAC capability
|
||||||
|
// Bit 0 - Alternate PAN Coordinator
|
||||||
|
// Bit 1 - Device Type
|
||||||
|
// Bit 2 - Power source
|
||||||
|
// Bit 3 - Receiver On when Idle
|
||||||
|
// Bit 4,5 - Reserved
|
||||||
|
// Bit 6 - Security capability
|
||||||
|
// Bit 7 - Allocate Address
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
temp = responseListIndex["8000"];
|
||||||
|
temp->code = QByteArray::fromHex("8000");
|
||||||
|
temp->description = "Status returned by command";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status", 1, 2}}, // <uint8_t>
|
||||||
|
{1, {"Sequence number", 1, 0}}, // <uint8_t>
|
||||||
|
{2, {"Packet Type", 2, 0}}, // <uint16_t>
|
||||||
|
{3, {"Optional additional error information", -1, 5}} // <string>
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Success"},
|
||||||
|
{1, "Incorrect parameters"},
|
||||||
|
{2, "Unhandled command"},
|
||||||
|
{3, "Command failed"},
|
||||||
|
{4, "Busy (Node is carrying out a lengthy operation and is currently unable to handle the incoming command)"},
|
||||||
|
{5, "Stack already started (no new configuration accepted)"},
|
||||||
|
{-1, "Failed"}
|
||||||
|
};
|
||||||
|
// *****************************************************************************
|
||||||
|
// // Status :
|
||||||
|
// // 0 = Success
|
||||||
|
// // 1 = Incorrect parameters
|
||||||
|
// // 2 = Unhandled command
|
||||||
|
// // 3 = Command failed
|
||||||
|
// // 4 = Busy (Node is carrying out a lengthy operation and is currently unable to handle the incoming command)
|
||||||
|
// // 5 = Stack already started (no new configuration accepted)
|
||||||
|
// // 128 – 244 = Failed (ZigBee event codes)
|
||||||
|
// // Packet Type: The value of the initiating command request.
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
temp = responseListIndex["8001"];
|
||||||
|
temp->code = QByteArray::fromHex("8001");
|
||||||
|
temp->description = "Log message";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Log level", 1, 2}}, // uint8_t
|
||||||
|
{1, {"Log message", -1, 5}} // string
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Emergency"},
|
||||||
|
{1, "Alert"},
|
||||||
|
{2, "Critical"},
|
||||||
|
{3, "Error"},
|
||||||
|
{4, "Warning"},
|
||||||
|
{5, "Notice"},
|
||||||
|
{6, "Information"},
|
||||||
|
{7, "Debug"}
|
||||||
|
};
|
||||||
|
// *********************************************************************************
|
||||||
|
// 0 = Emergency
|
||||||
|
// 1 = Alert
|
||||||
|
// 2 = Critical
|
||||||
|
// 3 = Error
|
||||||
|
// 4 = Warning
|
||||||
|
// 5 = Notice
|
||||||
|
// 6 = Information
|
||||||
|
// 7 = Debug
|
||||||
|
// *********************************************************************************
|
||||||
|
temp = responseListIndex["8002"];
|
||||||
|
temp->code = QByteArray::fromHex("8002");
|
||||||
|
temp->description = "Data indication";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"status", 1, 1}}, // uint8_t
|
||||||
|
{1, {"Profile ID", 2, 0}}, // uint16_t
|
||||||
|
{2, {"Cluster ID", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Source endpoint", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Destination endpoint", 1, 0}}, // uint8_t
|
||||||
|
{5, {"Source address mode", 1, 0}}, // uint8_t TODO
|
||||||
|
{6, {"Source address", 2, 0}}, // uint16_t or uint64_t
|
||||||
|
{7, {"Destination address mode", 0}}, // uint8_t TODO
|
||||||
|
{8, {"Destination address", 2}}, // uint16_t or uint64_t
|
||||||
|
{9, {"Payload size", 1}}, // uint8_t
|
||||||
|
{10, {"Payload", -1}} // data each element is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager; //dataIndicationManager
|
||||||
|
|
||||||
|
temp = responseListIndex["8003"];
|
||||||
|
temp->code = QByteArray::fromHex("8003");
|
||||||
|
temp->description = "list of object's clusters";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Source endpoint", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Profile ID", 2, 0}}, // uint16_t
|
||||||
|
{2, {"Cluster list", 0, 0}}, // data each entry is uint16_t
|
||||||
|
{3, {"Source endpoint", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Profile ID", 2, 0}}, // uint16_t
|
||||||
|
{5, {"Cluster ID", 2, 0}}, // uint16_t
|
||||||
|
{6, {"Attribute list", 2 ,0}} // data each entry is uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &clustersListManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8004"];
|
||||||
|
temp->code = QByteArray::fromHex("8004");
|
||||||
|
temp->description = "list of object's attributes";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Source endpoint", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Profile ID", 2, 0}}, // uint16_t
|
||||||
|
{2, {"Cluster ID", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Attribute list", 2, 0}} // data each entry is uint16_t>
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager; //TODO
|
||||||
|
|
||||||
|
temp = responseListIndex["8005"];
|
||||||
|
temp->code = QByteArray::fromHex("8005");
|
||||||
|
temp->description = "List of object's commands";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Source endpoint", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Profile ID", 1, 0}}, // uint16_t
|
||||||
|
{2, {"Cluster ID", 1, 0}}, // uint16_t
|
||||||
|
{3, {"Command ID list", -1, 0}} // data each entry is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager; //TODO
|
||||||
|
|
||||||
|
temp = responseListIndex["8006"];
|
||||||
|
temp->code = QByteArray::fromHex("8006");
|
||||||
|
temp->description = "Status after restart";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status after restart: ", 1, 2}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Startup"},
|
||||||
|
{1, "NFN_START"},
|
||||||
|
{2, "RUNNING"},
|
||||||
|
};
|
||||||
|
// *****************************************************************************
|
||||||
|
// 0 - STARTUP
|
||||||
|
// 2 - NFN_START
|
||||||
|
// 6 - RUNNING
|
||||||
|
// The node is provisioned from previous restart.
|
||||||
|
// *****************************************************************************
|
||||||
|
|
||||||
|
temp = responseListIndex["8007"];
|
||||||
|
temp->code = QByteArray::fromHex("8007");
|
||||||
|
temp->description = "Status after start";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status after start: ", 1, 2}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Startup"},
|
||||||
|
{1, "NFN_START"},
|
||||||
|
{2, "RUNNING"},
|
||||||
|
};
|
||||||
|
temp = responseListIndex["8008"];
|
||||||
|
temp->code = QByteArray::fromHex("8008");
|
||||||
|
temp->description = "HeartBeat";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"UTC time :", 4, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8009"];
|
||||||
|
temp->code = QByteArray::fromHex("8009");
|
||||||
|
temp->description = "Network state";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Short Address: ", 2, 0}},
|
||||||
|
{1, {"Extended Address: ", 8, 0}},
|
||||||
|
{2, {"PAN ID: ", 2, 0}},
|
||||||
|
{3, {"Extended PAN ID: ", 8, 0}},
|
||||||
|
{4, {"Channel: ", 8, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8010"];
|
||||||
|
temp->code = QByteArray::fromHex("8010");
|
||||||
|
temp->description = "Version List";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Major version number", 2, 0}}, // uint16_t
|
||||||
|
{1, {"Installer version number", 2, 0}} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8011"];
|
||||||
|
temp->code = QByteArray::fromHex("8011");
|
||||||
|
temp->description = "Ack Data";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status: ", 1, 0}},
|
||||||
|
{1, {"Destination address: ", 2, 0}},
|
||||||
|
{2, {"Destination endpoint: ", 1, 0}},
|
||||||
|
{3, {"Cluster ID :", 2, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8012"];
|
||||||
|
temp->code = QByteArray::fromHex("8012");
|
||||||
|
temp->description = "DATA_CONFIRM";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status: ", 1, }},
|
||||||
|
{1, {"Source Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Destination endpoint: ", 1, 0}},
|
||||||
|
{3, {"Destination Address mode:", 1, 0}},
|
||||||
|
{4, {"Destination IEEE address: ", 8, 0}},
|
||||||
|
{5, {"APS Sequence number: ", 1, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8014"];
|
||||||
|
temp->code = QByteArray::fromHex("8014");
|
||||||
|
temp->description = "Permit join status response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status", 1, 2}} // bool_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Off"},
|
||||||
|
{1, "On"}
|
||||||
|
};
|
||||||
|
|
||||||
|
temp = responseListIndex["8015"];
|
||||||
|
temp->code = QByteArray::fromHex("8015");
|
||||||
|
temp->description = "Device list";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Device List", 1, 4}} // bool_t
|
||||||
|
};
|
||||||
|
temp->manager = &deviceListManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8017"];
|
||||||
|
temp->code = QByteArray::fromHex("8017");
|
||||||
|
temp->description = "Time server";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"UTC Time: ", 1, 0}} // <Timestamp UTC: uint32_t> from 2000-01-01 00:00:00
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8024"];
|
||||||
|
temp->code = QByteArray::fromHex("8024");
|
||||||
|
temp->description = "Network joined/formed";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Status", 1, 2}}, // uint8_t
|
||||||
|
{1, {"Short address", 2, 0}}, // uint16_t
|
||||||
|
{2, {"Extended address", 4, 0}}, // uint64_t
|
||||||
|
{3, {"Channel", 1, 0}} // uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "Joined"},
|
||||||
|
{1, "Formed new network"},
|
||||||
|
{-1, "Failed"}
|
||||||
|
};
|
||||||
|
|
||||||
|
temp = responseListIndex["8028"];
|
||||||
|
temp->code = QByteArray::fromHex("8028");
|
||||||
|
temp->description = "Authenticate response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"IEEE address of the Gateway: ", 8, 0}},
|
||||||
|
{1, {"Encrypted Key: ", 16, 0}},
|
||||||
|
{2, {"MIC: ", 4, 0}},
|
||||||
|
{3, {"IEEE address of the initiating node: ", 8, 0}},
|
||||||
|
{4, {"Active Key Sequence number: ", 1, 0}},
|
||||||
|
{5, {"Channel: ", 1, 0}},
|
||||||
|
{6, {"Short PAN Id: ", 2, 0}},
|
||||||
|
{7, {"Extended PAN ID: ", 8, 0}},
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["802B"];
|
||||||
|
temp->code = QByteArray::fromHex("802B");
|
||||||
|
temp->description = "User Descriptor Notify";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uin8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Network address of interest", 2, 0}} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["802C"];
|
||||||
|
temp->code = QByteArray::fromHex("802C");
|
||||||
|
temp->description = "User Descriptor Response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uin8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Network address of interest", 2, 0}}, // uint16_6
|
||||||
|
{3, {"Length", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Data", -1}} // uint8_t stream
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8030"];
|
||||||
|
temp->code = QByteArray::fromHex("8030");
|
||||||
|
temp->description = "Bind response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1}}, // uint8_t
|
||||||
|
{2, {"Source address mode: ", 1, 0}}, // uint8_t> (only from v3.1a)
|
||||||
|
{3, {"Source Address: ", 2, 0}} // uint16_t> (only from v3.1a)
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8031"];
|
||||||
|
temp->code = QByteArray::fromHex("8031");
|
||||||
|
temp->description = "Unbind response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1}}, // uint8_t
|
||||||
|
{1, {"Status", 1}}, // uint8_t
|
||||||
|
{2, {"Source address mode: ", 1, 0}}, // uint8_t> (only from v3.1a)
|
||||||
|
{3, {"Source Address: ", 2, 0}} // uint16_t> (only from v3.1a)
|
||||||
|
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8035"];
|
||||||
|
temp->code = QByteArray::fromHex("8035");
|
||||||
|
temp->description = "PDM event";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Event status: ", 1, 2}}, // uint8_t
|
||||||
|
{1, {"record ID: ", 4, 0}} // uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
temp->propertyDetail[0] =
|
||||||
|
{
|
||||||
|
{0, "E_PDM_SYSTEM_EVENT_WEAR_COUNT_TRIGGER_VALUE_REACHED"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_DESCRIPTOR_SAVE_FAILED"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_PDM_NOT_ENOUGH_SPACE"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_LARGEST_RECORD_FULL_SAVE_NO_LONGER_POSSIBLE"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEGMENT_DATA_CHECKSUM_FAIL"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEGMENT_SAVE_OK"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_EEPROM_SEGMENT_HEADER_REPAIRED"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SYSTEM_INTERNAL_BUFFER_WEAR_COUNT_SWAP"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SYSTEM_DUPLICATE_FILE_SEGMENT_DETECTED"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SYSTEM_ERROR"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEGMENT_PREWRITE"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEGMENT_POSTWRITE"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEQUENCE_DUPLICATE_DETECTED"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_SEQUENCE_VERIFY_FAIL"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_PDM_SMART_SAVE"},
|
||||||
|
{1, "E_PDM_SYSTEM_EVENT_PDM_FULL_SAVE"}
|
||||||
|
};
|
||||||
|
|
||||||
|
temp = responseListIndex["8040"];
|
||||||
|
temp->code = QByteArray::fromHex("8040");
|
||||||
|
temp->description = "Network Address response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uin8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"IEEE address", 4, 0}}, // uint64_t
|
||||||
|
{3, {"Short address", 2, 0}}, // uint16_t
|
||||||
|
{4, {"Number of associated devices", 1, 0}}, // uint8_t
|
||||||
|
{5, {"Start index", 1, 0}}, // uint8_t
|
||||||
|
{6, {"Device list", -1, 4}} // data each entry is uint16_t>
|
||||||
|
};
|
||||||
|
temp->manager = &networkAddressManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8041"];
|
||||||
|
temp->code = QByteArray::fromHex("8041");
|
||||||
|
temp->description = "IEEE Address response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uin8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"IEEE address", 4, 0}}, // uint64_t
|
||||||
|
{3, {"Short address", 2, 0}}, // uint16_t
|
||||||
|
{4, {"Number of associated devices", 1, 0}}, // uint8_t
|
||||||
|
{5, {"Start index", 1, 0}}, // uint8_t
|
||||||
|
{6, {"Device list", -1, 4}} // data each entry is uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &iEEEAddressManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8042"];
|
||||||
|
temp->code = QByteArray::fromHex("8042");
|
||||||
|
temp->description = "Node Descriptor response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Network address", 2, 0}}, // uint16_t
|
||||||
|
{2, {"Manufacturer code", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Max Rx Size", 2, 0}}, // uint16_t
|
||||||
|
{4, {"Max Tx Size", 2, 0}}, // uint16_t
|
||||||
|
{5, {"Server mask", 2, 0}}, // uint16_t
|
||||||
|
{6, {"Descriptor capability", 1, 0}}, // uint8_t
|
||||||
|
{7, {"Mac flags", 1, 0}}, // uint8_t
|
||||||
|
{8, {"Max buffer size", 1, 0}}, // uint8_t
|
||||||
|
{9, {"Bit fields", 2, -1}} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &nodeDescriptorManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8043"];
|
||||||
|
temp->code = QByteArray::fromHex("8043");
|
||||||
|
temp->description = "Simple Descriptor response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"NwkAddress", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Length", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Endpoint", 1, 0}}, // uint8_t
|
||||||
|
{5, {"Profile", 2, 0}}, // uint16_t
|
||||||
|
{6, {"Device id", 2, 0}}, // uint16_t
|
||||||
|
{7, {"Bit fields", 1, 0}}, // uint8_t
|
||||||
|
{8, {"InClusterCount", 1, 0}}, // uint8_t
|
||||||
|
{9, {"In cluster list", 0, 0}}, // data each entry is uint16_t>
|
||||||
|
{10, {"Out Cluster Count", 1, 0}}, // uint8_t
|
||||||
|
{11, {"Out cluster list", -1, 0}} // data each entry is uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager; //TODO
|
||||||
|
|
||||||
|
temp = responseListIndex["8044"];
|
||||||
|
temp->code = QByteArray::fromHex("8044");
|
||||||
|
temp->description = "Power Descriptor response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uin8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"bit field", 2, }} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
// ******************************************
|
||||||
|
// 0 to 3: current power mode
|
||||||
|
// 4 to 7: available power source
|
||||||
|
// 8 to 11: current power source
|
||||||
|
// 12 to 15: current power source level
|
||||||
|
// ******************************************
|
||||||
|
|
||||||
|
temp = responseListIndex["8045"];
|
||||||
|
temp->code = QByteArray::fromHex("8045");
|
||||||
|
temp->description = "Active Endpoint response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Address", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Endpoint count", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Active endpoint list", -1, 0}} // each data element of the type uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8046"];
|
||||||
|
temp->code = QByteArray::fromHex("8046");
|
||||||
|
temp->description = "Match Descriptor response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Network address", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Length of list", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Match list", -1, 0}} // data each entry is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8047"];
|
||||||
|
temp->code = QByteArray::fromHex("8047");
|
||||||
|
temp->description = "Management Leave response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1, 0}} // uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8048"];
|
||||||
|
temp->code = QByteArray::fromHex("8048");
|
||||||
|
temp->description = "Leave indication";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Extended address", 4, 0}}, // uint64_t
|
||||||
|
{1, {"Rejoin status", 1, 0}} // uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8049"];
|
||||||
|
temp->code = QByteArray::fromHex("8049");
|
||||||
|
temp->description = "PDM child table size";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Number of child: ", 1, 0}} // data each entry is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["804A"];
|
||||||
|
temp->code = QByteArray::fromHex("804A");
|
||||||
|
temp->description = "Management Network Update response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Total transmission", 2, 0}}, // uint16_t
|
||||||
|
{3, {"Transmission failures", 2, 0}}, // uint16_t
|
||||||
|
{4, {"Scanned channels", 4, 0}}, // uint32_t
|
||||||
|
{5, {"Scanned channel list count", 1, 0}}, // uint8_t
|
||||||
|
{6, {"Channel list", -1, 0}} // list each element is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["804B"];
|
||||||
|
temp->code = QByteArray::fromHex("804B");
|
||||||
|
temp->description = "System Server Discovery response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Server mask", 2, 0}} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["804E"];
|
||||||
|
temp->code = QByteArray::fromHex("804E");
|
||||||
|
temp->description = "Management LQI response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number", 1, 0}}, // uint8_t
|
||||||
|
{1, {"status", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Neighbour Table Entries ", 1, 0}}, // uint8_t
|
||||||
|
{3, {"Neighbour Table List Count ", 1, 0}}, // uint8_t
|
||||||
|
{4, {"Start Index ", 1, 0}}, // uint8_t
|
||||||
|
{5, {"List of Entries elements described below", -1, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8060"];
|
||||||
|
temp->code = QByteArray::fromHex("8060");
|
||||||
|
temp->description = "Add group";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Status: ", 1, 0}}, //(added only from 3.0f version)
|
||||||
|
{4, {"Group id :", 2, 0}}, //(added only from 3.0f version)
|
||||||
|
{5, {"Source Address: ", 2, 0}}, //(added only from 3.0f version)
|
||||||
|
{6, {"Number of child: ", 1, 0}} // data each entry is uint8_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8061"];
|
||||||
|
temp->code = QByteArray::fromHex("8061");
|
||||||
|
temp->description = "View group";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Status: ", 1, 0}}, //(added only from 3.0f version)
|
||||||
|
{4, {"Group id :", 2, 0}}, //(added only from 3.0f version)
|
||||||
|
{5, {"Source Address: ", 2, 0}} //(added only from 3.0f version)
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8062"];
|
||||||
|
temp->code = QByteArray::fromHex("8062");
|
||||||
|
temp->description = "Group membership";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Source Address:", 2, 0}}, //(added only from 3.0d version)
|
||||||
|
{4, {"Capacity: ", 1, 0}},
|
||||||
|
{5, {"Group count: ", 1, 0}},
|
||||||
|
{6, {"List of Group id: ", 2, 0}}, //list each data item uint16_t>
|
||||||
|
{7, {"Source Addr: ", 2, 0}} //(added only from 3.0f version)
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8063"];
|
||||||
|
temp->code = QByteArray::fromHex("8063");
|
||||||
|
temp->description = "Remove group";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Source Address:", 2, 0}}, //(added only from 3.0d version)
|
||||||
|
{4, {"Status: ", 1, 0}},
|
||||||
|
{5, {"Group ID: ", 2, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8085"];
|
||||||
|
temp->code = QByteArray::fromHex("8085");
|
||||||
|
temp->description = "Level update";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Source Address mode:", 1, 0}}, //(added only from 3.0d version)
|
||||||
|
{4, {"Source Address:", 2, 0}}, //(added only from 3.0d version)
|
||||||
|
{5, {"Status: ", 1, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8095"];
|
||||||
|
temp->code = QByteArray::fromHex("8095");
|
||||||
|
temp->description = "On/Off";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Sequence number: ", 1, 0}},
|
||||||
|
{1, {"Endpoint: ", 1, 0}},
|
||||||
|
{2, {"Cluster id: ", 2, 0}},
|
||||||
|
{3, {"Source Address mode:", 1, 0}}, //(added only from 3.0d version)
|
||||||
|
{4, {"Source Address:", 2, 0}}, //(added only from 3.0d version)
|
||||||
|
{5, {"Status: ", 1, 0}}
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
temp = responseListIndex["8140"];
|
||||||
|
temp->code = QByteArray::fromHex("8140");
|
||||||
|
temp->description = "Attribute Discovery response";
|
||||||
|
temp->properties =
|
||||||
|
{
|
||||||
|
{0, {"Complete", 1, 0}}, // uint8_t
|
||||||
|
{1, {"Attribute type", 1, 0}}, // uint8_t
|
||||||
|
{2, {"Attribute id", 2, 0}} // uint16_t
|
||||||
|
};
|
||||||
|
temp->manager = &defaultManager;
|
||||||
|
|
||||||
|
serialManager.initSerial();
|
||||||
|
connect(&serialManager, SIGNAL(datasReady(QByteArray)), this, SLOT(interpretResult(QByteArray)));
|
||||||
|
|
||||||
|
resetCoordinator();
|
||||||
|
getVersion();
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void infoOutput(Response *object)
|
||||||
|
{
|
||||||
|
cout << object->code.toHex().toStdString() << " : " << object->description.toStdString() << endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
465
zigatecmd.cpp
Normal file
465
zigatecmd.cpp
Normal file
@ -0,0 +1,465 @@
|
|||||||
|
#include "zigateBackend.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
bool ZigateBackend::resetCoordinator()
|
||||||
|
{
|
||||||
|
bool returnCode = false;
|
||||||
|
|
||||||
|
cout << "Sending reset to coordinator" << endl;
|
||||||
|
sendCmd("0011", "");
|
||||||
|
cout << "***************************************************" << endl;
|
||||||
|
sleep(5);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZigateBackend::getVersion()
|
||||||
|
{
|
||||||
|
sendCmd("0010", "");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
bool ZigateBackend::setHeartBeat()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::getNetworkState()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::erasePersistentData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::factoryNewReset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::permitJoin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::setExpendedPANID()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::setChannelMask()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::setSecurityStateKey()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::setDeviceType()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::startNetwork()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::startNetworkScan()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::removeDevice()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::enablePermissionsControlledJoins()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::authenticateDevice()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::outOfBandCommissioningDataRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::userDescriptorSet()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::userDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::bind()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::unbind()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::complexDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::networkAddressRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::iEEEAddressRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::nodeDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::simpleDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::powerDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::activeEndpointRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::matchDescriptorRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::managementLeaveRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::permitJoiningRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::managementNetworkUpdateRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::systemServerDiscoveryRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::managementLQIRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::addGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::viewGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::getGroupMembership()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::removeGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::removeAllGroups()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::addGroupIfIdentify()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::identifySend()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::identifyQuery()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToLevel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToLevelWithWithoutOnOoff()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveStep()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveStopMove()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveStopWithOnOff()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::onOffWithNEffects()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::onOffWithEffects()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::onOffTimedSend()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::onOffTimed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::onOffWithEffectsSend()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::viewScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::addScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::removeScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::removeAllScenes()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::storeScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::recallScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::sceneMembershipRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::addEnhancedScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::viewEnhancedHostToNodeScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::copyScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::stepHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToSaturation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveSaturation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::stepSaturation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToHueAndSaturation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToColour()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveColour()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::stepColour()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::enhancedMoveToHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::enhancedMoveHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::enhancedStepHue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::enhancedMoveToHueAndSaturation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::colourLoopSet()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::stopMoveStep()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveToColourTemperature()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::moveColourTemperature()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::stepColourTemperature()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::initiateTouchlink()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::touchLinkFactoryResetTarget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::identifyTriggerEffect()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::lockUnlockDoor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::readAttributerequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::writeAttributeRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::configureReportingRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::attributeDiscoveryRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::iASZoneEnrollResponse()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ZigateBackend::rawAPSDataRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
@ -1,8 +1,10 @@
|
|||||||
QT += core gui
|
QT += core
|
||||||
QT += serialport
|
QT += serialport
|
||||||
QT += widgets
|
QT += widgets
|
||||||
QT += KConfigCore KConfigGui
|
QT += KConfigCore KConfigGui
|
||||||
QT += KCoreAddons
|
QT += KCoreAddons
|
||||||
|
QT += concurrent
|
||||||
|
|
||||||
CONFIG += c++17 console
|
CONFIG += c++17 console
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
@ -14,15 +16,20 @@ SOURCES += \
|
|||||||
library.cpp \
|
library.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
serial.inc.cpp \
|
serial.inc.cpp \
|
||||||
zigateBackend.cpp
|
zigateBackend.cpp \
|
||||||
|
zigateInit.cpp \
|
||||||
|
zigatecmd.cpp
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /usr/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
library.h \
|
library.h \
|
||||||
main.h \
|
main.h \
|
||||||
|
zigateBackend.h \
|
||||||
|
responseClasses.h \
|
||||||
serial.inc.h \
|
serial.inc.h \
|
||||||
zigateBackend.h
|
version.h
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 9.0.1, 2023-04-08T05:18:14. -->
|
<!-- Written by QtCreator 9.0.1, 2023-04-27T18:58:28. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -14,7 +14,7 @@ BuildRequires: make
|
|||||||
BuildRequires: pkgconfig(Qt5Core)
|
BuildRequires: pkgconfig(Qt5Core)
|
||||||
BuildRequires: pkgconfig(Qt5SerialPort)
|
BuildRequires: pkgconfig(Qt5SerialPort)
|
||||||
BuildRequires: pkgconfig(Qt5Widgets)
|
BuildRequires: pkgconfig(Qt5Widgets)
|
||||||
#BuildRequires: pkgconfig(Qt5Xml)
|
BuildRequires: pkgconfig(Qt5Xml)
|
||||||
#BuildRequires: pkgconfig(libmagic)
|
#BuildRequires: pkgconfig(libmagic)
|
||||||
#BuildRequires: cmake(KF5Completion)
|
#BuildRequires: cmake(KF5Completion)
|
||||||
BuildRequires: cmake(KF5CoreAddons)
|
BuildRequires: cmake(KF5CoreAddons)
|
||||||
@ -26,7 +26,7 @@ BuildRequires: cmake(KF5Config)
|
|||||||
#BuildRequires: boost-devel
|
#BuildRequires: boost-devel
|
||||||
#BuildRequires: qt5keychain-devel
|
#BuildRequires: qt5keychain-devel
|
||||||
#Requires: kitemviews
|
#Requires: kitemviews
|
||||||
#Requires: kcompletion
|
#Requires: kcompletions
|
||||||
#Requires: kcoreaddons
|
#Requires: kcoreaddons
|
||||||
#Requires: kdbusaddons
|
#Requires: kdbusaddons
|
||||||
#Requires: rsync
|
#Requires: rsync
|
||||||
@ -47,8 +47,9 @@ qmake-qt5 .
|
|||||||
%install
|
%install
|
||||||
INSTALL_ROOT=%{buildroot} make install
|
INSTALL_ROOT=%{buildroot} make install
|
||||||
|
|
||||||
#%find_lang %{name} --with-qt
|
##find_lang %{name} --with-qt
|
||||||
|
|
||||||
#%files -f %{name}.lang
|
%files
|
||||||
|
##-f {name}.lang
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
%{_docdir}/%{name}/README*
|
##{_docdir}/{name}/README*
|
||||||
|
Reference in New Issue
Block a user