1
0

- breaking in 2 parts, main program and library

This commit is contained in:
Daniel Tartavel 2023-05-01 16:23:16 +02:00
parent 3d928286b3
commit e5ff3716a7
9 changed files with 0 additions and 2168 deletions

View File

@ -1,19 +0,0 @@
#include <QCoreApplication>
#include <iostream>
using namespace std;
extern int debugLevel;
void debug(QString text, int level)
{
if (level & debugLevel)
{
cout << text.toStdString() << endl;
}
}
void signal_handler(int signal)
{
cout << "Received signal " << signal << endl;
}

View File

@ -1,14 +0,0 @@
#ifndef LIBRARY_H
#define LIBRARY_H
#include <QString>
#define DEBUG 1
#define INFO 2
#define WARNING 3
#define ERROR 4
void debug(QString text, int level);
void signal_handler(int signal);
#endif // LIBRARY_H

View File

@ -1,38 +0,0 @@
#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

View File

@ -1,109 +0,0 @@
#include "serial.inc.h"
#include <unistd.h>
#include "zigateBackend.h"
extern QApplication a;
extern ZigateBackend zigateBkd;
using namespace std;
SerialManager::SerialManager()
{
}
SerialManager::~SerialManager()
{
this->close();
}
void SerialManager::initSerial()
{
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->setDataBits(QSerialPort::Data8);
this->setStopBits(QSerialPort::OneStop);
this->setParity(QSerialPort::NoParity);
this->setPortName(this->serialDevicePath);
do
{
test = this->open(QIODevice::ReadWrite);
if (!test)
{
cout << this->errorString().toStdString() << "=>" << this->serialDevicePath.toStdString() << endl;
sleep(5);
}
}while(!test);
QFutureWatcher<void> watcher;
QFuture<void> future = QtConcurrent::run([=]()
{
do
{
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 SerialManager::write(QByteArray msg)
{
cout << "writing to serial" << endl;
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;
}

View File

@ -1,46 +0,0 @@
#ifndef SERIAL_INC_H
#define SERIAL_INC_H
//#include <QDebug>
#include <sys/wait.h>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QApplication>
#include <iostream>
class SerialManager : public QSerialPort
{
Q_OBJECT
public:
//QSerialPort * sp;
QByteArray dataRead;
QByteArray dataWrite;
qint64 dataWriteSize;
QString serialDevicePath;
QString deviceName;
QString portName;
QString serialDeviceDescription;
QString serialDeviceManufacturer;
QString serialDeviceNumber;
QString serialDeviceVendor;
QString serialDeviceProduct;
quint32 baudRate = 115200;
void write(QByteArray datas);
SerialManager();
~SerialManager();
void initSerial();
bool findSerialDevice();
//void getData();
signals:
void datasReady(QByteArray);
public slots:
};
#endif // SERIAL_INC_H

View File

@ -1,430 +0,0 @@
#include "main.h"
#include <unistd.h>
#include <QFutureWatcher>
#include "serial.inc.h"
class BackEnds;
extern SerialManager serialManager;
extern QMap <QString, BackEnds> backends;
using namespace std;
ZigateBackend zigateBkd;
ZigateBackend::ZigateBackend()
{
BackEnds zigate;
backends["Zigate"] = zigate;
backends["zigate"].name = "Zigate";
backends["zigate"].device = "ZIGATE";
}
ZigateBackend::~ZigateBackend()
{
}
QByteArray ZigateBackend::checksum(QByteArray msgType, QByteArray length, QByteArray datas)
{
quint16 temp = 0;
int i;
QString str;
str = msgType.mid(0,2);
temp ^= str.toInt(nullptr, 16);
str = msgType.mid(2,2);
temp ^= str.toInt(nullptr, 16);
str = length.mid(0,2);
temp ^= str.toInt(nullptr, 16);
str = length.mid(2,2);
temp ^= str.toInt(nullptr, 16);
for (i=0;i<=(datas.count());i+=2)
{
str = datas.mid(i,2);
temp ^= str.toInt(nullptr, 16);
}
return QByteArray::number(temp, 16);
}
QByteArray ZigateBackend::transcode(QByteArray datas)
{
QByteArray msg = "";
int i;
QByteArray byte;
if (datas.count()%2 != 0)
{
return "-1";
}
for (i=0;i<datas.count();i+=2)
{
byte = datas.mid(i,2);
if (byte.toUInt(nullptr, 16) > 15)
{
msg += byte;
}else
{
msg.append("02");
msg.append(QByteArray::number(byte.toUInt(nullptr, 16) ^ 16, 16));
}
}
return msg;
}
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 len;
len = QByteArray::number(datas.count()/2, 16).insert(0,"000").right(4);
msg = QByteArray::fromHex("01");
msg += QByteArray::fromHex(transcode(cmd));
msg += QByteArray::fromHex(transcode(len));
if (!datas.isEmpty())
{
msg += QByteArray::fromHex(checksum(cmd, len, datas));
msg += QByteArray::fromHex(transcode(datas));
}else{
msg += QByteArray::fromHex(checksum(cmd, len, ""));
}
msg += QByteArray::fromHex("03");
serialManager.write(msg);
if (!serialManager.waitForBytesWritten(10000))
{
cout << "error : no acknoledge of bytes written" << endl;
}
//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);
}
*/

View File

@ -1,336 +0,0 @@
#ifndef 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 <QMap>
#include <QHash>
#include <QSerialPort>
#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 ZigateBackend : QObject
{
Q_OBJECT
public slots:
void interpretResult(QByteArray);
public:
ZigateBackend();
~ZigateBackend();
bool initBackend();
QByteArray checksum(QByteArray msgType, QByteArray length, QByteArray datas);
QByteArray transcode(QByteArray datas);
QByteArray unTranscode(QByteArray datas);
void sendCmd(QByteArray cmd, QByteArray datas);
//int interpretResult(QByteArray datas);
//void getResponse();
bool resetCoordinator();
void interpretResult();
// 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)"},
{"0001", " (General: Power Config)"},
{"0002", " (General: Temperature Config)"},
{"0003", " (General: Identify)"},
{"0004", " (General: Groups)"},
{"0005", " (General: Scenes)"},
{"0006", " (General: On/Off)"},
{"0007", " (General: On/Off Config)"},
{"0008", " (General: Level Control)"},
{"0009", " (General: Alarms)"},
{"000A", " (General: Time)"},
{"000F", " (General: Binary Input Basic)"},
{"0020", " (General: Poll Control)"},
{"0019", " (General: OTA)"},
{"0101", " (General: Door Lock"},
{"0201", " (HVAC: Thermostat)"},
{"0202", " (HVAC: Fan Control)"},
{"0300", " (Lighting: Color Control)"},
{"0400", " (Measurement: Illuminance)"},
{"0402", " (Measurement: Temperature)"},
{"0405", " (Measurement: Humidity)"},
{"0406", " (Measurement: Occupancy Sensing)"},
{"0500", " (Security & Safety: IAS Zone)"},
{"0702", " (Smart Energy: Metering)"},
{"0B05", " (Misc: Diagnostics)"},
{"1000", " (ZLL: Commissioning)"},
{"FF01", " Xiaomi private"},
{"FF02", " Xiaomi private"},
{"1234", " Xiaomi private"}
};
};
#endif // ZIGATEBACKEND_H

View File

@ -1,711 +0,0 @@
#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;
}

View File

@ -1,465 +0,0 @@
#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()
{
}
*/