save
This commit is contained in:
parent
933c73dc04
commit
8030843ed3
Binary file not shown.
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.
20
main.cpp
20
main.cpp
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
extern ZigateBackend zigateBkd;
|
||||||
int debugLevel = DEBUG | INFO | WARNING | ERROR;
|
int debugLevel = DEBUG | INFO | WARNING | ERROR;
|
||||||
|
//ResponseList responseList;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -10,13 +12,15 @@ int main(int argc, char *argv[])
|
|||||||
QCoreApplication::setOrganizationName("zigbeemanager");
|
QCoreApplication::setOrganizationName("zigbeemanager");
|
||||||
QCoreApplication::setApplicationName("zigbeemanager");
|
QCoreApplication::setApplicationName("zigbeemanager");
|
||||||
|
|
||||||
ZigateBackend zigateBkd;
|
initBackends();
|
||||||
// zigbeemgr();
|
cout << "sending command 0x0010" << endl;
|
||||||
|
zigateBkd.sendCmd("0010", "");
|
||||||
//QObject::connect(&zigateBkd, SIGNAL(readyRead()), &zigateBkd, SLOT(getData()));
|
zigateBkd.getResponse();
|
||||||
// QObject::connect(&zigateBkd, SIGNAL(bytesWritten()), &zigateBkd, SLOT(confirmWrite()));
|
|
||||||
|
|
||||||
zigateBkd.sendCmd("0049","FFFC1E");
|
|
||||||
|
|
||||||
//return a.exec();
|
//return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool initBackends()
|
||||||
|
{
|
||||||
|
zigateBkd.initBackend();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
2
main.h
2
main.h
@ -18,4 +18,6 @@
|
|||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include "zigateBackend.h"
|
#include "zigateBackend.h"
|
||||||
|
|
||||||
|
bool initBackends();
|
||||||
|
|
||||||
#endif // MAIN_H
|
#endif // MAIN_H
|
||||||
|
29
responseClasses.h
Normal file
29
responseClasses.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef RESPONSECLASSES_H
|
||||||
|
#define RESPONSECLASSES_H
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
class ResponseProperties
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray code;
|
||||||
|
QByteArray datas;
|
||||||
|
QString description;
|
||||||
|
QMap <uint, QList<QVariant>> properties;
|
||||||
|
QMap <uint, QMap<uint,QString>> propertyDetail;
|
||||||
|
QFunctionPointer manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Response
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray code;
|
||||||
|
QByteArray datas;
|
||||||
|
QString description;
|
||||||
|
QFunctionPointer manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RESPONSECLASSES_H
|
@ -38,10 +38,13 @@ void ZigbeeMgr::getData()
|
|||||||
{
|
{
|
||||||
cout << "getData()" << endl;
|
cout << "getData()" << endl;
|
||||||
if (this->waitForReadyRead(20000))
|
if (this->waitForReadyRead(20000))
|
||||||
|
{
|
||||||
|
while (!atEnd())
|
||||||
{
|
{
|
||||||
cout << "reading datas" << endl;
|
cout << "reading datas" << endl;
|
||||||
this->dataRead = this->readAll();
|
this->dataRead += this->readAll();
|
||||||
cout << this->dataRead.toHex().toStdString() << endl;
|
cout << this->dataRead.toHex().toStdString() << endl;
|
||||||
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
cout << "Reading datas has timed out" << endl;
|
cout << "Reading datas has timed out" << endl;
|
||||||
@ -50,7 +53,7 @@ void ZigbeeMgr::getData()
|
|||||||
|
|
||||||
void ZigbeeMgr::write(QByteArray msg)
|
void ZigbeeMgr::write(QByteArray msg)
|
||||||
{
|
{
|
||||||
cout << "write" << endl;
|
cout << "writing to serial" << endl;
|
||||||
dataWriteSize = msg.count();
|
dataWriteSize = msg.count();
|
||||||
cout << "size = " << dataWriteSize << endl;
|
cout << "size = " << dataWriteSize << endl;
|
||||||
this->writeData(msg, msg.count()+1);
|
this->writeData(msg, msg.count()+1);
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "responseClasses.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
ZigateBackend zigateBkd;
|
||||||
|
|
||||||
ZigateBackend::ZigateBackend()
|
ZigateBackend::ZigateBackend()
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
cmdList["heartbeatEnable"].append({"0008", "0001", "0210"});
|
// cmdList["heartbeatEnable"].append({"0008", "0001", "0210"});
|
||||||
|
|
||||||
this->deviceName = "ZIGATE";
|
this->deviceName = "ZIGATE";
|
||||||
while (1)
|
while (1)
|
||||||
@ -23,8 +26,9 @@ ZigateBackend::ZigateBackend()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->init();
|
this->init();
|
||||||
this->resultCodes.insert(0x8000, "Status");
|
// this->resultCodes.insert(0x8000, "Status");
|
||||||
//resultCodes.insert();
|
// resultCodes.insert();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZigateBackend::~ZigateBackend()
|
ZigateBackend::~ZigateBackend()
|
||||||
@ -58,7 +62,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";
|
||||||
@ -78,12 +81,42 @@ QByteArray ZigateBackend::transcode(QByteArray datas)
|
|||||||
return msg;
|
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)
|
void ZigateBackend::sendCmd(QByteArray cmd, QByteArray datas)
|
||||||
{
|
{
|
||||||
QByteArray msg;
|
QByteArray msg;
|
||||||
QByteArray len;
|
QByteArray len;
|
||||||
|
|
||||||
len = QByteArray::number(datas.count()/2+1, 16).insert(0,"000").right(4);
|
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));
|
||||||
@ -92,211 +125,81 @@ void ZigateBackend::sendCmd(QByteArray cmd, 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.toHex().toStdString() << endl;
|
|
||||||
this->write(msg);
|
this->write(msg);
|
||||||
if (!this->waitForBytesWritten(10000))
|
if (!this->waitForBytesWritten(10000))
|
||||||
{
|
{
|
||||||
cout << "error : no acknoledge of bytes written" << endl;
|
cout << "error : no acknoledge of bytes written" << endl;
|
||||||
}
|
}
|
||||||
|
//this->interpretResult(this->dataRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZigateBackend::getResponse()
|
||||||
|
{
|
||||||
this->getData();
|
this->getData();
|
||||||
this->interpretResult(this->dataRead);
|
this->interpretResult(this->dataRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint ZigateBackend::interpretResult(QByteArray datas)
|
|
||||||
|
int ZigateBackend::interpretResult(QByteArray payload)
|
||||||
{
|
{
|
||||||
uint tab = 0;
|
uint tab = 0;
|
||||||
int length = strlen(datas);
|
int length = 0;
|
||||||
uint crctmp;
|
quint8 crctmp = 0;
|
||||||
uint i;
|
uint i = 0;
|
||||||
int payloadLength;
|
int datasResultLength = 0;
|
||||||
|
ResponseProperties * responseObject = nullptr;
|
||||||
QByteArray type;
|
QByteArray type;
|
||||||
QByteArray ln;
|
uint ln;
|
||||||
QByteArray crc;
|
quint8 crc;
|
||||||
QByteArray payload;
|
QByteArray datasResult;
|
||||||
QByteArray quality;
|
QByteArray quality;
|
||||||
|
QByteArray payloadD;
|
||||||
|
|
||||||
if (length >= 12)
|
payloadD = unTranscode(payload);
|
||||||
|
length = payloadD.count();
|
||||||
|
|
||||||
|
while(length > 5)
|
||||||
{
|
{
|
||||||
crctmp = 0;
|
crctmp = 0;
|
||||||
//type de message
|
//type de message
|
||||||
type = datas.mid(0, 4); //[0].$datas[1].$datas[2].$datas[3];
|
type = payloadD.mid(0, 2);
|
||||||
crctmp ^= datas.mid(0, 2).toUInt(); //[0].$datas[1]) ^ hexdec($datas[2].$datas[3]);
|
crctmp = crctmp ^ payloadD.at(0) ^ payloadD.at(1);
|
||||||
//taille message
|
ln = payloadD.mid(2, 2).toHex().toUInt(nullptr, 16);
|
||||||
ln = datas.mid(4, 4); // [4].$datas[5].$datas[6].$datas[7];
|
crctmp = crctmp ^ payloadD.at(2) ^ payloadD.at(3);
|
||||||
crctmp ^= datas.mid(4, 2).toUInt() ^ datas.mid(6, 2).toUInt();
|
|
||||||
//acquisition du CRC
|
//acquisition du CRC
|
||||||
crc = datas.mid(8, 2); //].$datas[9];
|
crc = payloadD.at(4);
|
||||||
//payload
|
//datasResult
|
||||||
payload = "";
|
datasResult = "";
|
||||||
for(i=0;i<ln.toUInt();i++)
|
for(i=0;i<ln;i++)
|
||||||
{
|
{
|
||||||
payload += datas.mid(10+(i*2), 2); //.$datas[10+(($i*2)+1)];
|
datasResult += payloadD.at(5+i);
|
||||||
crctmp ^= datas.mid(10+(i*2), 2).toUInt(); //.$datas[10+(($i*2)+1)]);
|
crctmp ^= payloadD.at(5+i);
|
||||||
}
|
}
|
||||||
quality = datas.mid(10+(i*2)-2, 2); //.$datas[10+($i*2)-1];
|
quality = payloadD.right(1);
|
||||||
|
|
||||||
payloadLength = payload.count() - 2;
|
datasResultLength = datasResult.count();
|
||||||
|
|
||||||
//verification du CRC
|
//verification du CRC
|
||||||
if (crc.toUInt() == crctmp)
|
if (crc == crctmp)
|
||||||
{
|
{
|
||||||
//Traitement PAYLOAD
|
//responseObject = responseListIndex[type.toHex()];
|
||||||
/*switch (type)
|
if (responseObject != nullptr)
|
||||||
{
|
{
|
||||||
|
responseObject->datas = datasResult;
|
||||||
case "8000" :
|
responseObject->manager();
|
||||||
|
}else
|
||||||
echo " (Status)"."\n";
|
|
||||||
echo " Length: ".substr($payload,0,4)."\n";
|
|
||||||
echo " Status: ".substr($payload,4,2)."\n";
|
|
||||||
switch (substr($payload,4,2))
|
|
||||||
{
|
{
|
||||||
case "00":
|
cout << "unknown command" << endl;
|
||||||
{
|
|
||||||
echo " (Success)"."\n";
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case "01":
|
|
||||||
{
|
|
||||||
echo " (Incorrect Parameters)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "02":
|
|
||||||
{
|
|
||||||
echo " (Unhandled Command)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "03":
|
|
||||||
{
|
|
||||||
echo " (Command Failed)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "04":
|
|
||||||
{
|
|
||||||
echo " (Busy)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "05":
|
|
||||||
{
|
|
||||||
echo " (Stack Already Started)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
echo " (ZigBee Error Code)"."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
echo "SQN: : ".substr($payload,6,2)."\n";
|
|
||||||
|
|
||||||
if (hexdec(substr($payload,0,4)) > 2)
|
|
||||||
{
|
|
||||||
echo " Message: ";
|
|
||||||
echo hex2str(substr($payload,8,strlen($payload)-2))."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "8001" :
|
|
||||||
echo " (Log)";
|
|
||||||
echo "\n";
|
|
||||||
echo " Level: 0x".substr($payload,0,2);
|
|
||||||
echo "\n";
|
|
||||||
echo " Message: ";
|
|
||||||
echo hex2str(substr($payload,2,strlen($payload)-2))."\n";
|
|
||||||
break;
|
|
||||||
case "8010" :
|
|
||||||
echo "(Version)\n";
|
|
||||||
echo "Application : ".hexdec(substr($payload,0,4))."\n";
|
|
||||||
echo "SDK : ".hexdec(substr($payload,4,4))."\n";
|
|
||||||
break;
|
|
||||||
case "8102" :
|
|
||||||
echo "[".date("Y-m-d H:i:s")."]\n";
|
|
||||||
echo "(Attribute Report)\n";
|
|
||||||
echo "Src Addr : ".substr($payload,2,4)."\n";
|
|
||||||
echo "Cluster ID : ".substr($payload,8,4)."\n";
|
|
||||||
echo "Attr ID : ".substr($payload,12,4)."\n";
|
|
||||||
echo "Attr Type : ".substr($payload,16,4)."\n";
|
|
||||||
echo "Attr Size : ".substr($payload,20,4)."\n";
|
|
||||||
echo "Quality : ".$quality."\n";
|
|
||||||
if ((substr($payload,8,4)=="0000") && (substr($payload,12,4)=="0001"))
|
|
||||||
{
|
|
||||||
echo "DATAS: ".substr($payload,24,(strlen($payload)-24))."\n\n";
|
|
||||||
}elseif ((substr($payload,8,4)=="0000") && (substr($payload,12,4)=="0005"))
|
|
||||||
{
|
|
||||||
echo "DATAS: ".hex2str(substr($payload,24,(substr($payload,20,4))*2))."\n\n";
|
|
||||||
}else{
|
|
||||||
echo "DATAS: ".substr($payload,24,(substr($payload,20,4))*2)."\n\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "004d" :
|
|
||||||
echo "(Device announce)\n";
|
|
||||||
echo "Src Addr : ".substr($payload,0,4)."\n";
|
|
||||||
echo "IEEE : ".substr($payload,4,8)."\n";
|
|
||||||
echo "MAC capa : ".substr($payload,12,2)."\n";
|
|
||||||
echo "Quality : ".$quality;
|
|
||||||
break;
|
|
||||||
case "8702" :
|
|
||||||
echo "(APS Data Confirm Fail)\n";
|
|
||||||
echo "Status : ".substr($payload,0,2)."\n";
|
|
||||||
echo "Source Endpoint : ".substr($payload,2,2)."\n";
|
|
||||||
echo "Destination Endpoint : ".substr($payload,4,2)."\n";
|
|
||||||
echo "Destination Mode : ".substr($payload,6,2)."\n";
|
|
||||||
echo "Destination Address : ".substr($payload,8,4)."\n";
|
|
||||||
echo "SQN: : ".substr($payload,12,2)."\n";
|
|
||||||
break;
|
|
||||||
case "8101" :
|
|
||||||
echo "(Default Response)\n";
|
|
||||||
echo "SQN : ".substr($payload,0,2)."\n";
|
|
||||||
echo "EndPoint : ".substr($payload,2,2)."\n";
|
|
||||||
displayClusterId(substr($payload,4,4));
|
|
||||||
echo "Command : ".substr($payload,8,2)."\n";
|
|
||||||
echo "Status : ".substr($payload,10,2)."\n";
|
|
||||||
break;
|
|
||||||
case "8045" :
|
|
||||||
echo "(Active Endpoints Response)\n";
|
|
||||||
echo "SQN : ".substr($payload,0,2)."\n";
|
|
||||||
echo "Status : ".substr($payload,2,2)."\n";
|
|
||||||
echo "Short Address : ".substr($payload,4,4)."\n";
|
|
||||||
echo "Endpoint Count : ".substr($payload,8,2)."\n";
|
|
||||||
echo "Endpoint List :" ."\n";
|
|
||||||
for ($i = 0; $i < (intval(substr($payload,8,2)) *2); $i+=2)
|
|
||||||
{
|
|
||||||
echo "Endpoint : ".substr($payload,(8+$i),2)."\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "8043" :
|
|
||||||
echo "(Simple Descriptor Response)\n";
|
|
||||||
echo "SQN : ".substr($payload,0,2)."\n";
|
|
||||||
echo "Status : ".substr($payload,2,2)."\n";
|
|
||||||
echo "Short Address : ".substr($payload,4,4)."\n";
|
|
||||||
echo "Length : ".substr($payload,8,2)."\n";
|
|
||||||
if (intval(substr($payload,8,2))>0)
|
|
||||||
{
|
|
||||||
echo "Endpoint : ".substr($payload,10,2)."\n";
|
|
||||||
//PAS FINI
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
tab=-2;
|
tab=-2;
|
||||||
}
|
}
|
||||||
}else
|
payloadD.remove(0,i+6);
|
||||||
{
|
length = payloadD.count();
|
||||||
tab=-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
557
zigateBackend.h
557
zigateBackend.h
@ -1,10 +1,43 @@
|
|||||||
#ifndef ZIGATEBACKEND_H
|
#ifndef ZIGATEBACKEND_H
|
||||||
#define ZIGATEBACKEND_H
|
#define ZIGATEBACKEND_H
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
#include "serial.inc.h"
|
#include "serial.inc.h"
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QHash>
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
//#include <QArray>
|
#include "responseClasses.h"
|
||||||
|
|
||||||
|
void deviceAnnounceManager();
|
||||||
|
void commandReturnStatusManager();
|
||||||
|
void logMessageManager();
|
||||||
|
void dataIndicationManager();
|
||||||
|
void clustersListManager();
|
||||||
|
void attributesListManager();
|
||||||
|
void commandsListManager();
|
||||||
|
void statusManager();
|
||||||
|
void status2Manager();
|
||||||
|
void versionListManager();
|
||||||
|
void permitJoinManager();
|
||||||
|
void networkJoinedFormedManager();
|
||||||
|
void bindResponseManager();
|
||||||
|
void unbindResponseManager();
|
||||||
|
void networkAddressManager();
|
||||||
|
void iEEEAddressManager();
|
||||||
|
void nodeDescriptorManager();
|
||||||
|
void simpleDescriptorManager();
|
||||||
|
void powerDescriptorManager();
|
||||||
|
void activeEndpointManager();
|
||||||
|
void matchDescriptorManager();
|
||||||
|
void userDescriptorNotifyManager();
|
||||||
|
void userDescriptorManager();
|
||||||
|
void complexDescriptorManager();
|
||||||
|
void managementLeaveManager();
|
||||||
|
void leaveIndicationManager();
|
||||||
|
void managementNetworkUpdateManager();
|
||||||
|
void systemServerDiscoveryManager();
|
||||||
|
void managementLQIManager();
|
||||||
|
void attributeDiscoveryManager();
|
||||||
|
|
||||||
class ZigbeeMgr;
|
class ZigbeeMgr;
|
||||||
|
|
||||||
@ -17,11 +50,14 @@ class ZigateBackend : public ZigbeeMgr
|
|||||||
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);
|
||||||
|
QByteArray unTranscode(QByteArray datas);
|
||||||
void sendCmd(QByteArray cmd, QByteArray datas);
|
void sendCmd(QByteArray cmd, QByteArray datas);
|
||||||
uint interpretResult(QByteArray datas);
|
int interpretResult(QByteArray datas);
|
||||||
|
void getResponse();
|
||||||
|
bool resetCoordinator();
|
||||||
|
|
||||||
QMap <int, QString> resultCodes;
|
QMap <int, QString> resultCodes;
|
||||||
QMap <QString, QList <QByteArray>> cmdList =
|
QMap <QString, QList <QByteArray>> cmdList =
|
||||||
@ -117,455 +153,75 @@ class ZigateBackend : public ZigbeeMgr
|
|||||||
{"rawApsDataRequest", {"0530", "000D", ""}}
|
{"rawApsDataRequest", {"0530", "000D", ""}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const QMap <QByteArray, QMap <QString, QByteArray>> responseList //outerMap responseList
|
QHash <QString, ResponseProperties *> responseListIndex;
|
||||||
{
|
|
||||||
|
QList <QString> responseListCode
|
||||||
{
|
{
|
||||||
"004D",
|
"004D",
|
||||||
{
|
|
||||||
{"Description", "Device announce"},
|
|
||||||
{"Short address", "00"}, // uint16_t
|
|
||||||
{"IEEE address", "0000"}, // uint64_t
|
|
||||||
{"MAC capability", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 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
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8000",
|
"8000",
|
||||||
{
|
|
||||||
{"Description", "Status"},
|
|
||||||
{"Status", "0"}, // <uint8_t>
|
|
||||||
{"Sequence number", "0"}, // <uint8_t>
|
|
||||||
{"Packet Type", "00"}, // <uint16_t>
|
|
||||||
{"Optional additional error information", ""} // <string>
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 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.
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8001",
|
"8001",
|
||||||
{
|
|
||||||
{"Description", "Log message"},
|
|
||||||
{"Log level", "0"}, // uint8_t
|
|
||||||
{"Log message", ""} // string
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* Log Level :
|
|
||||||
* Use the Linux / Unix log levels
|
|
||||||
* 0 = Emergency
|
|
||||||
* 1 = Alert
|
|
||||||
* 2 = Critical
|
|
||||||
* 3 = Error
|
|
||||||
* 4 = Warning
|
|
||||||
* 5 = Notice
|
|
||||||
* 6 = Information
|
|
||||||
* 7 = Debug
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8002",
|
"8002",
|
||||||
{
|
|
||||||
{"Description", "Data indication"},
|
|
||||||
{"status", "0"}, // uint8_t
|
|
||||||
{"Profile ID", "00"}, // uint16_t
|
|
||||||
{"Cluster ID", "00"}, // uint16_t
|
|
||||||
{"Source endpoint", "0"}, // uint8_t
|
|
||||||
{"Destination endpoint", "0"}, // uint8_t
|
|
||||||
{"Source address mode", "0"}, // uint8_t
|
|
||||||
{"Source address", "0"}, // uint16_t or uint64_t
|
|
||||||
{"Destination address mode", "0"}, // uint8_t
|
|
||||||
{"Destination address", "0"}, // uint16_t or uint64_t
|
|
||||||
{"Payload size", "0"}, // uint8_t>
|
|
||||||
{"Payload", ""} // data each element is uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8003",
|
"8003",
|
||||||
{
|
|
||||||
{"Description", "Liste des clusters de l'objet"},
|
|
||||||
{"Source endpoint", "0"}, // uint8_t
|
|
||||||
{"Profile ID", "0"}, // uint16_t
|
|
||||||
{"Cluster list", ""}, // data each entry is uint16_t>
|
|
||||||
{"Source endpoint", "0"}, // uint8_t
|
|
||||||
{"Profile ID", "00"}, // uint16_t>
|
|
||||||
{"Cluster ID", "00"}, // uint16_t
|
|
||||||
{"Attribute list", ""} // data each entry is uint16_t>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8004",
|
"8004",
|
||||||
{
|
|
||||||
{"Description", "Liste des attributs de l'objet"},
|
|
||||||
{"Source endpoint", "0"}, // uint8_t
|
|
||||||
{"Profile ID", "00"}, // uint16_t
|
|
||||||
{"Cluster ID", "00"}, // uint16_t
|
|
||||||
{"Attribute list", ""} // data each entry is uint16_t>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8005",
|
"8005",
|
||||||
{
|
|
||||||
{"Description", "Liste des commandes de l'objet"},
|
|
||||||
{"Source endpoint", "0"}, // uint8_t
|
|
||||||
{"Profile ID", "0"}, // uint16_t
|
|
||||||
{"Cluster ID", "00"}, // uint16_t
|
|
||||||
{"Command ID list", ""} // data each entry is uint8_t>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8006",
|
"8006",
|
||||||
{
|
|
||||||
{"Description", "Status"},
|
|
||||||
{"Status", ""}
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 0 - STARTUP
|
|
||||||
* 2 - NFN_START
|
|
||||||
* 6 - RUNNING
|
|
||||||
* The node is provisioned from previous restart.
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8007",
|
"8007",
|
||||||
{
|
|
||||||
{"Description", "Status"},
|
|
||||||
{"Status", "0"}
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 0 - STARTUP
|
|
||||||
* 2 - NFN_START
|
|
||||||
* 6 - RUNNING
|
|
||||||
* The node is not yet provisioned.
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8010",
|
"8010",
|
||||||
{
|
|
||||||
{"Description", "Version list"},
|
|
||||||
{"Major version number", "00"}, // uint16_t
|
|
||||||
{"Installer version number", "00"} // uint16_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8014",
|
"8014",
|
||||||
{
|
|
||||||
{"Description", "Permit join status response"},
|
|
||||||
{"Status", "0"} // bool_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 0 - Off
|
|
||||||
* 1 - On
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8024",
|
"8024",
|
||||||
{
|
|
||||||
{"Description", "Network joined/formed"},
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Short address", "00"}, // uint16_t
|
|
||||||
{"Extended address", "00"}, // uint64_t
|
|
||||||
{"Channel", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* Status:
|
|
||||||
* 0 = Joined existing network
|
|
||||||
* 1 = Formed new network
|
|
||||||
* 128 – 244 = Failed (ZigBee event codes)
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8030",
|
"8030",
|
||||||
{
|
|
||||||
{"Description", "Bind response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8031",
|
"8031",
|
||||||
{
|
|
||||||
{"Description", "Unbind response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8040",
|
"8040",
|
||||||
{
|
|
||||||
{"Description", "Network Address response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"IEEE address", "0"}, // uint64_t
|
|
||||||
{"Short address", "00"}, // uint16_t
|
|
||||||
{"Number of associated devices", "0"}, // uint8_t
|
|
||||||
{"Start index", "0"}, // uint8_t
|
|
||||||
{"Device list", ""} // data each entry is uint16_t>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8041",
|
"8041",
|
||||||
{
|
|
||||||
{"Description", "IEEE Address response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"IEEE address", "0000"}, // uint64_t
|
|
||||||
{"Short address", "00"}, // uint16_t
|
|
||||||
{"Number of associated devices", "0"}, // uint8_t
|
|
||||||
{"Start index", "0"}, // uint8_t
|
|
||||||
{"Device list", ""} // data each entry is uint16_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8042",
|
"8042",
|
||||||
{
|
|
||||||
{"Description", "Node Descriptor response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Network address", "0"}, // uint16_t
|
|
||||||
{"Manufacturer code", "00"}, // uint16_t
|
|
||||||
{"Max Rx Size", "00"}, // uint16_t
|
|
||||||
{"Max Tx Size", "00"}, // uint16_t
|
|
||||||
{"Server mask", "00"}, // uint16_t
|
|
||||||
{"Descriptor capability", "0"}, // uint8_t
|
|
||||||
{"Mac flags", "0"}, // uint8_t
|
|
||||||
{"Max buffer size", "0"}, // uint8_t
|
|
||||||
{"Bit fields", "00"} // uint16_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 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",
|
"8043",
|
||||||
{
|
|
||||||
{"Description", "Simple Descriptor response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"NwkAddress", "00"}, // uint16_t
|
|
||||||
{"Length", "0"}, // uint8_t
|
|
||||||
{"Endpoint", "0"}, // uint8_t
|
|
||||||
{"Profile", "00"}, // uint16_t
|
|
||||||
{"Device id", "00"}, // uint16_t
|
|
||||||
{"Bit fields", "0"}, // uint8_t
|
|
||||||
{"InClusterCount", "0"}, // uint8_t
|
|
||||||
{"In cluster list", ""}, // data each entry is uint16_t>
|
|
||||||
{"Out Cluster Count", ""}, // uint8_t
|
|
||||||
{"Out cluster list", ""} // data each entry is uint16_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* Bit fields:
|
|
||||||
* Device version: 4 bits (bits 0-4)
|
|
||||||
* Reserved: 4 bits (bits4-7)
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8044",
|
"8044",
|
||||||
{
|
|
||||||
{"Description", "Power Descriptor response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"bit field", "0"} // uint16_t
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 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
|
|
||||||
******************************************************************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8045",
|
"8045",
|
||||||
{
|
|
||||||
{"Description", "Active Endpoint response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Address", "00"}, // uint16_t
|
|
||||||
{"Endpoint count", "0"}, // uint8_t
|
|
||||||
{"Active endpoint list", ""} // each data element of the type uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8046",
|
"8046",
|
||||||
{
|
|
||||||
{"Description", "Match Descriptor response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Network address", "00"}, // uint16_t
|
|
||||||
{"Length of list", "0"}, // uint8_t
|
|
||||||
{"Match list", ""} // data each entry is uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"802B",
|
"802B",
|
||||||
{
|
|
||||||
{"Description", "User Descriptor Notify"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Network address of interest", "00"} // uint16_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"802C",
|
"802C",
|
||||||
{
|
|
||||||
{"Description", "User Descriptor Response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Network address of interest", "00"}, // uint16_6
|
|
||||||
{"Length", "0"}, // uint8_t
|
|
||||||
{"Data", ""} // uint8_t stream
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8034",
|
|
||||||
{
|
|
||||||
{"Description", "Complex Descriptor response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"status", "0"}, // uint8_t
|
|
||||||
{"Network address of interest", "0"}, // uint16_t
|
|
||||||
{"Length", "0"}, // uint8_t
|
|
||||||
{"xml tag", "0"}, // uint8_t
|
|
||||||
{"field count", "0"}, // uint8_t
|
|
||||||
{"field values", ""} // uint8_t stream
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8047",
|
"8047",
|
||||||
{
|
|
||||||
{"Description", "Management Leave response"},
|
|
||||||
{"Sequence number", "0"}, // uin8_t
|
|
||||||
{"Status", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"8048",
|
"8048",
|
||||||
{
|
|
||||||
{"Description", "Leave indication"},
|
|
||||||
{"Extended address", "0000"}, // uint64_t
|
|
||||||
{"Rejoin status", "0"} // uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"804A",
|
"804A",
|
||||||
{
|
|
||||||
{"Description", "Management Network Update response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"Status", "0"}, // uint8_t
|
|
||||||
{"Total transmission", "00"}, // uint16_t
|
|
||||||
{"Transmission failures", "00"}, // uint16_t
|
|
||||||
{"Scanned channels", "0000"}, // uint32_t
|
|
||||||
{"Scanned channel list count", "0"}, // uint8_t
|
|
||||||
{"Channel list", "0"} // list each element is uint8_t
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"804B",
|
"804B",
|
||||||
{
|
|
||||||
{"Description", "System Server Discovery response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"status", "0"}, // uint8_t
|
|
||||||
{"Server mask", "00"} // uint16_t
|
|
||||||
}
|
|
||||||
/********************************
|
|
||||||
* Bitmask according to spec". *
|
|
||||||
********************************/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"804E",
|
"804E",
|
||||||
{
|
|
||||||
{"Description", "Management LQI response"},
|
|
||||||
{"Sequence number", "0"}, // uint8_t
|
|
||||||
{"status", "0"}, // uint8_t
|
|
||||||
{"Neighbour Table Entries ", "0"}, // uint8_t
|
|
||||||
{"Neighbour Table List Count ", "0"}, // uint8_t
|
|
||||||
{"Start Index ", "0"}, // uint8_t
|
|
||||||
{"List of Entries elements described below", ""}
|
|
||||||
}
|
|
||||||
/*****************************************************************************
|
|
||||||
* 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",
|
"8140",
|
||||||
{
|
"8008",
|
||||||
{"Description", "Attribute Discovery response"},
|
"8009",
|
||||||
{"Complete", "0"}, // uint8_t
|
"8011",
|
||||||
{"Attribute type", "0"}, // uint8_t
|
"8012",
|
||||||
{"Attribute id", "00"} // uint16_t
|
"8015",
|
||||||
}
|
"8017",
|
||||||
/*****************************************************************************
|
"8028",
|
||||||
* Complete:
|
"8035",
|
||||||
* 0 – more attributes to follow
|
"8049",
|
||||||
* 1 – this was the last attribute
|
"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;
|
//ZigbeeMgr serial;
|
||||||
|
|
||||||
QMap <QByteArray, QString> clusters
|
QMap <QByteArray, QString> clusters
|
||||||
{
|
{
|
||||||
{"0000", " (General: Basic)"},
|
{"0000", " (General: Basic)"},
|
||||||
@ -599,4 +255,67 @@ class ZigateBackend : public ZigbeeMgr
|
|||||||
{"1234", " Xiaomi private"}
|
{"1234", " Xiaomi private"}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#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"
|
||||||
#endif // ZIGATEBACKEND_H
|
#endif // ZIGATEBACKEND_H
|
||||||
|
1014
zigateInit.cpp
Normal file
1014
zigateInit.cpp
Normal file
File diff suppressed because it is too large
Load Diff
17
zigatecmd.cpp
Normal file
17
zigatecmd.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
bool ZigateBackend::resetCoordinator()
|
||||||
|
{
|
||||||
|
bool returnCode;
|
||||||
|
|
||||||
|
cout << "Sending reset to coordinator" << endl;
|
||||||
|
sendCmd("0011", "");
|
||||||
|
getResponse();
|
||||||
|
getResponse();
|
||||||
|
getResponse();
|
||||||
|
cout << "***************************************************" << endl;
|
||||||
|
sleep(10);
|
||||||
|
return returnCode;
|
||||||
|
}
|
@ -14,7 +14,9 @@ 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
|
||||||
@ -24,6 +26,7 @@ else: unix:!android: target.path = /usr/bin
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
library.h \
|
library.h \
|
||||||
main.h \
|
main.h \
|
||||||
|
responseClasses.h \
|
||||||
serial.inc.h \
|
serial.inc.h \
|
||||||
version.h \
|
version.h \
|
||||||
zigateBackend.h
|
zigateBackend.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-13T00:23:41. -->
|
<!-- Written by QtCreator 9.0.1, 2023-04-19T22:36:16. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
Reference in New Issue
Block a user