diff --git a/docs/Stack_zigbee_3.ods b/docs/Stack_zigbee_3.ods index e53ad9a..48f5c60 100644 Binary files a/docs/Stack_zigbee_3.ods and b/docs/Stack_zigbee_3.ods differ diff --git a/docs/properties.txt b/docs/properties.txt new file mode 100644 index 0000000..4d5f294 --- /dev/null +++ b/docs/properties.txt @@ -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 +//******************************************************************************* diff --git a/library.h b/library.h index 097e61f..2b783a1 100644 --- a/library.h +++ b/library.h @@ -1,6 +1,8 @@ #ifndef LIBRARY_H #define LIBRARY_H +#include + #define DEBUG 1 #define INFO 2 #define WARNING 3 diff --git a/responseClasses.h b/responseClasses.h index c8e58b8..5f37568 100644 --- a/responseClasses.h +++ b/responseClasses.h @@ -5,6 +5,18 @@ #include #include #include +#include + +//void (*propertyManager)(QByteArray); + +class Response +{ + public: + QByteArray code; + QByteArray datas; + QString description; + void manager(Response *); +}; class ResponseProperties { @@ -14,16 +26,13 @@ class ResponseProperties QString description; QMap > properties; QMap > propertyDetail; - QFunctionPointer manager; + QHash propertyManagerList; + void (*manager)(Response *); }; -class Response -{ - public: - QByteArray code; - QByteArray datas; - QString description; - QFunctionPointer manager; -}; +void infoOutput(Response *); +void defaultManager(Response *); +//void (*manager)(Response *); +void macCapabilityManager(QByteArray); #endif // RESPONSECLASSES_H diff --git a/zigateBackend.cpp b/zigateBackend.cpp index f2f593b..16fd212 100644 --- a/zigateBackend.cpp +++ b/zigateBackend.cpp @@ -1,5 +1,4 @@ -#include "main.h" -#include "responseClasses.h" +#include "zigateBackend.h" #include using namespace std; @@ -35,6 +34,8 @@ ZigateBackend::~ZigateBackend() { } + + QByteArray ZigateBackend::checksum(QByteArray msgType, QByteArray length, QByteArray datas) { quint16 temp = 0; @@ -150,14 +151,14 @@ int ZigateBackend::interpretResult(QByteArray payload) quint8 crctmp = 0; uint i = 0; int datasResultLength = 0; - ResponseProperties * responseObject = nullptr; + Response responseObject; QByteArray type; uint ln; quint8 crc; QByteArray datasResult; QByteArray quality; QByteArray payloadD; - + uint typeA; payloadD = unTranscode(payload); length = payloadD.count(); @@ -166,39 +167,44 @@ int ZigateBackend::interpretResult(QByteArray payload) crctmp = 0; //type de message type = payloadD.mid(0, 2); - crctmp = crctmp ^ payloadD.at(0) ^ payloadD.at(1); ln = payloadD.mid(2, 2).toHex().toUInt(nullptr, 16); - crctmp = crctmp ^ payloadD.at(2) ^ payloadD.at(3); - //acquisition du CRC - crc = payloadD.at(4); - //datasResult - datasResult = ""; - for(i=0;idatas = datasResult; - responseObject->manager(); + 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 { - cout << "unknown command" << endl; + tab=-2; } - }else - { - tab=-2; } - payloadD.remove(0,i+6); + payloadD.remove(0,ln+6); length = payloadD.count(); } return tab; diff --git a/zigateBackend.h b/zigateBackend.h index ab4e05e..1a66d5f 100644 --- a/zigateBackend.h +++ b/zigateBackend.h @@ -1,43 +1,109 @@ #ifndef ZIGATEBACKEND_H #define ZIGATEBACKEND_H -#include "main.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 #include #include #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(); +//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; @@ -152,7 +218,6 @@ class ZigateBackend : public ZigbeeMgr {"iASZoneEnrollResponse", {"0400", "0007", ""}}, {"rawApsDataRequest", {"0530", "000D", ""}} }; - QHash responseListIndex; QList responseListCode @@ -256,66 +321,5 @@ class ZigateBackend : public ZigbeeMgr }; }; -#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 diff --git a/zigateInit.cpp b/zigateInit.cpp index cce0e6a..618c615 100644 --- a/zigateInit.cpp +++ b/zigateInit.cpp @@ -1,8 +1,8 @@ -#include "responseClasses.h" #include "zigateBackend.h" #include extern ZigateBackend zigateBkd; +extern QHash responseListIndex; using namespace std; @@ -15,6 +15,7 @@ bool ZigateBackend::initBackend() foreach (var, responseListCode) { temp = new ResponseProperties(); + temp->manager = &defaultManager; responseListIndex.insert(var, temp) ; } @@ -26,12 +27,15 @@ bool ZigateBackend::initBackend() // {rang, {designation, nbyte, isvalue}} // isvalue = 0 => display value // = 1 => is array of bits - // = 2 => is index in string list + // = 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, 1}} + {2, {"MAC capability", 1, 3}} }; - temp->manager = &deviceAnnounceManager; + temp->propertyManagerList[2] = &macCapabilityManager; + temp->manager = &defaultManager; temp->propertyDetail[2] = { {1, "Alternate PAN Coordinator"}, @@ -60,9 +64,9 @@ bool ZigateBackend::initBackend() {0, {"Status", 1, 2}}, // {1, {"Sequence number", 1, 0}}, // {2, {"Packet Type", 2, 0}}, // - {3, {"Optional additional error information", -1, 0}} // + {3, {"Optional additional error information", -1, 5}} // }; - temp->manager = &commandReturnStatusManager; + temp->manager = &defaultManager; temp->propertyDetail[0] = { {0, "Success"}, @@ -74,15 +78,15 @@ bool ZigateBackend::initBackend() {-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. + // // 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"]; @@ -90,42 +94,62 @@ bool ZigateBackend::initBackend() temp->description = "Log message"; temp->properties = { - {0, {"Log level", 1}}, // uint8_t - {1, {"Log message", -1}} // string + {0, {"Log level", 1, 2}}, // uint8_t + {1, {"Log message", -1, 5}} // string }; - temp->manager = &logMessageManager; - + 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}}, // uint8_t - {1, {"Profile ID", 2}}, // uint16_t - {2, {"Cluster ID", 2}}, // uint16_t - {3, {"Source endpoint", 1}}, // uint8_t - {4, {"Destination endpoint", 1}}, // uint8_t - {5, {"Source address mode", 1}}, // uint8_t - {6, {"Source address", 2}}, // uint16_t or uint64_t - {7, {"Destination address mode", 1}}, // uint8_t + {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 = &dataIndicationManager; + 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}}, // uint8_t - {1, {"Profile ID", 2}}, // uint16_t - {2, {"Cluster list", 0}}, // data each entry is uint16_t - {3, {"Source endpoint", 1}}, // uint8_t - {4, {"Profile ID", 2}}, // uint16_t - {5, {"Cluster ID", 2}}, // uint16_t - {6, {"Attribute list", 2}} // data each entry is uint16_t + {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; @@ -134,243 +158,274 @@ bool ZigateBackend::initBackend() temp->description = "list of object's attributes"; temp->properties = { - {0, {"Source endpoint", 1}}, // uint8_t - {1, {"Profile ID", 2}}, // uint16_t - {2, {"Cluster ID", 2}}, // uint16_t - {3, {"Attribute list", 2}} // data each entry is uint16_t> + {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 = &attributesListManager; + 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}}, // uint8_t - {1, {"Profile ID", 1}}, // uint16_t - {2, {"Cluster ID", 1}}, // uint16_t - {3, {"Command ID list", -1}} // data each entry is uint8_t + {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 = &commandsListManager; + temp->manager = &defaultManager; //TODO temp = responseListIndex["8006"]; temp->code = QByteArray::fromHex("8006"); - temp->description = "Status"; + temp->description = "Status after restart"; temp->properties = { - {0, {"Status", 1}} + {0, {"Status after restart: ", 1, 2}} }; - temp->manager = &statusManager; + 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"; + temp->description = "Status after start"; temp->properties = { - {0, {"Status", 1}} + {0, {"Status after start: ", 1, 2}} + }; + temp->manager = &defaultManager; + temp->propertyDetail[0] = + { + {0, "Startup"}, + {1, "NFN_START"}, + {2, "RUNNING"}, }; - temp->manager = &statusManager; - temp = responseListIndex["8008"]; temp->code = QByteArray::fromHex("8008"); temp->description = "HeartBeat"; temp->properties = { - {0, {"UTC time :", 4}} + {0, {"UTC time :", 4, 0}} }; - temp->manager = &hearbeatManager; + temp->manager = &defaultManager; temp = responseListIndex["8009"]; temp->code = QByteArray::fromHex("8009"); temp->description = "Network state"; temp->properties = { - {0, {"Short Address: ", 2}}, - {1, {"Extended Address: ", 8}}, - {2, {"PAN ID: ", 2}}, - {3, {"Extended PAN ID: ", 8}}, - {4, {"Channel: ", 8}} + {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 = &networkStateManager; + temp->manager = &defaultManager; temp = responseListIndex["8010"]; temp->code = QByteArray::fromHex("8010"); temp->description = "Version List"; temp->properties = { - {0, {"Major version number", 2}}, // uint16_t - {1, {"Installer version number", 2}} // uint16_t + {0, {"Major version number", 2, 0}}, // uint16_t + {1, {"Installer version number", 2, 0}} // uint16_t }; - temp->manager = &versionListManager; + temp->manager = &defaultManager; temp = responseListIndex["8011"]; temp->code = QByteArray::fromHex("8011"); temp->description = "Ack Data"; temp->properties = { - {0, {"Status: ", 1}}, - {1, {"Destination address: ", 2}}, - {2, {"Destination endpoint: ", 1}}, - {3, {"Cluster ID :", 2}} + {0, {"Status: ", 1, 0}}, + {1, {"Destination address: ", 2, 0}}, + {2, {"Destination endpoint: ", 1, 0}}, + {3, {"Cluster ID :", 2, 0}} }; - temp->manager = &ackDataManager; + temp->manager = &defaultManager; temp = responseListIndex["8012"]; temp->code = QByteArray::fromHex("8012"); temp->description = "DATA_CONFIRM"; temp->properties = { - {0, {"Status: ", 1}}, - {1, {"Source Endpoint: ", 1}}, - {2, {"Destination endpoint: ", 1}}, - {3, {"Destination Address mode:", 1}}, - {4, {"Destination IEEE address: ", 8}}, - {5, {"APS Sequence number: ", 1}} + {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 = &dataConfirmManager; + temp->manager = &defaultManager; temp = responseListIndex["8014"]; temp->code = QByteArray::fromHex("8014"); temp->description = "Permit join status response"; temp->properties = { - {0, {"Status", 1}} // bool_t + {0, {"Status", 1, 2}} // bool_t + }; + temp->manager = &defaultManager; + temp->propertyDetail[0] = + { + {0, "Off"}, + {1, "On"} }; - temp->manager = &permitJoinManager; temp = responseListIndex["8015"]; temp->code = QByteArray::fromHex("8015"); temp->description = "Device list"; temp->properties = { - {0, {"Status", 1}} // bool_t + {0, {"Device List", 1, 4}} // bool_t }; - temp->manager = &permitJoinManager; + temp->manager = &deviceListManager; temp = responseListIndex["8017"]; temp->code = QByteArray::fromHex("8017"); temp->description = "Time server"; temp->properties = { - {0, {"ID: ", 1}}, - {1, {"Short address: ", 2}}, - {2, {"IEEE address: ", 8}}, - {3, {"Power source: ", 1}}, - {4, {"LinkQuality : ", 1}} - }; - temp->manager = &permitJoinManager; - temp->propertyDetail[3] = - { - {0, "Battery"}, - {1, "AC Power"} + {0, {"UTC Time: ", 1, 0}} // 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}}, // uint8_t - {1, {"Short address", 2}}, // uint16_t - {2, {"Extended address", 4}}, // uint64_t - {3, {"Channel", 1}} // uint8_t + {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 = &networkJoinedFormedManager; - - temp = responseListIndex["8024"]; - temp->code = QByteArray::fromHex("8024"); - temp->description = "Network joined/formed"; - temp->properties = - { - {0, {"Status", 1}}, // uint8_t - {1, {"Short address", 2}}, // uint16_t - {2, {"Extended address", 4}}, // uint64_t - {3, {"Channel", 1}} // uint8_t + temp->manager = &defaultManager; + temp->propertyDetail[0] = + { + {0, "Joined"}, + {1, "Formed new network"}, + {-1, "Failed"} }; - temp->manager = &networkJoinedFormedManager; temp = responseListIndex["8028"]; temp->code = QByteArray::fromHex("8028"); temp->description = "Authenticate response"; temp->properties = { - {0, {"IEEE address of the Gateway: ", 8}}, - {1, {"Encrypted Key: ", 16}}, - {2, {"MIC: ", 4}}, - {3, {"IEEE address of the initiating node: ", 8}}, - {4, {"Active Key Sequence number: ", 1}}, - {5, {"Channel: ", 1}}, - {6, {"Short PAN Id: ", 2}}, - {7, {"Extended PAN ID: ", 8}}, + {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 = &authenticateResponse; + temp->manager = &defaultManager; temp = responseListIndex["802B"]; temp->code = QByteArray::fromHex("802B"); temp->description = "User Descriptor Notify"; temp->properties = { - {0, {"Sequence number", 1}}, // uin8_t - {1, {"Status", 1}}, // uint8_t - {2, {"Network address of interest", 2}} // uint16_t + {0, {"Sequence number", 1, 0}}, // uin8_t + {1, {"Status", 1, 0}}, // uint8_t + {2, {"Network address of interest", 2, 0}} // uint16_t }; - temp->manager = &userDescriptorNotifyManager; + temp->manager = &defaultManager; temp = responseListIndex["802C"]; temp->code = QByteArray::fromHex("802C"); temp->description = "User Descriptor Response"; temp->properties = { - {0, {"Sequence number", 1}}, // uin8_t - {1, {"Status", 1}}, // uint8_t - {2, {"Network address of interest", 2}}, // uint16_6 - {3, {"Length", 1}}, // uint8_t + {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 = &userDescriptorManager; + temp->manager = &defaultManager; temp = responseListIndex["8030"]; temp->code = QByteArray::fromHex("8030"); temp->description = "Bind response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Status", 1}} // uint8_t + {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 = &bindResponseManager; + 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 + {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 = &unbindResponseManager; + temp->manager = &defaultManager; temp = responseListIndex["8035"]; temp->code = QByteArray::fromHex("8035"); temp->description = "PDM event"; temp->properties = { - {0, {"Event status: ", 1}}, // uint8_t - {1, {"record ID: ", 4}} // uint8_t + {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->manager = &pdmEventManager; temp = responseListIndex["8040"]; temp->code = QByteArray::fromHex("8040"); temp->description = "Network Address response"; temp->properties = { - {0, {"Sequence number", 1}}, // uin8_t - {1, {"Status", 1}}, // uint8_t - {2, {"IEEE address", 4}}, // uint64_t - {3, {"Short address", 2}}, // uint16_t - {4, {"Number of associated devices", 1}}, // uint8_t - {5, {"Start index", 1}}, // uint8_t - {6, {"Device list", -1}} // data each entry is uint16_t> + {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; @@ -379,13 +434,13 @@ bool ZigateBackend::initBackend() temp->description = "IEEE Address response"; temp->properties = { - {0, {"Sequence number", 1}}, // uin8_t - {1, {"Status", 1}}, // uint8_t - {2, {"IEEE address", 4}}, // uint64_t - {3, {"Short address", 2}}, // uint16_t - {4, {"Number of associated devices", 1}}, // uint8_t - {5, {"Start index", 1}}, // uint8_t - {6, {"Device list", -1}} // data each entry is uint16_t + {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; @@ -394,16 +449,16 @@ bool ZigateBackend::initBackend() temp->description = "Node Descriptor response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Network address", 2}}, // uint16_t - {2, {"Manufacturer code", 2}}, // uint16_t - {3, {"Max Rx Size", 2}}, // uint16_t - {4, {"Max Tx Size", 2}}, // uint16_t - {5, {"Server mask", 2}}, // uint16_t - {6, {"Descriptor capability", 1}}, // uint8_t - {7, {"Mac flags", 1}}, // uint8_t - {8, {"Max buffer size", 1}}, // uint8_t - {9, {"Bit fields", 2}} // uint16_t + {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; @@ -412,274 +467,261 @@ bool ZigateBackend::initBackend() temp->description = "Simple Descriptor response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Status", 1}}, // uint8_t - {2, {"NwkAddress", 2}}, // uint16_t - {3, {"Length", 1}}, // uint8_t - {4, {"Endpoint", 1}}, // uint8_t - {5, {"Profile", 2}}, // uint16_t - {6, {"Device id", 2}}, // uint16_t - {7, {"Bit fields", 1}}, // uint8_t - {8, {"InClusterCount", 1}}, // uint8_t - {9, {"In cluster list", 0}}, // data each entry is uint16_t> - {10, {"Out Cluster Count", 1}}, // uint8_t - {11, {"Out cluster list", -1}} // data each entry is uint16_t + {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 = &simpleDescriptorManager; + temp->manager = &defaultManager; //TODO temp = responseListIndex["8044"]; temp->code = QByteArray::fromHex("8044"); temp->description = "Power Descriptor response"; temp->properties = { - {0, {"Sequence number", 1}}, // uin8_t - {1, {"Status", 1}}, // uint8_t - {2, {"bit field", 2}} // uint16_t + {0, {"Sequence number", 1, 0}}, // uin8_t + {1, {"Status", 1, 0}}, // uint8_t + {2, {"bit field", 2, }} // uint16_t }; - temp->manager = &powerDescriptorManager; + 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}}, // uint8_t - {1, {"Status", 1}}, // uint8_t - {2, {"Address", 2}}, // uint16_t - {3, {"Endpoint count", 1}}, // uint8_t - {4, {"Active endpoint list", -1}} // each data element of the type uint8_t + {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 = &activeEndpointManager; + temp->manager = &defaultManager; temp = responseListIndex["8046"]; temp->code = QByteArray::fromHex("8046"); temp->description = "Match Descriptor response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Status", 1}}, // uint8_t - {2, {"Network address", 2}}, // uint16_t - {3, {"Length of list", 1}}, // uint8_t - {4, {"Match list", -1}} // data each entry is uint8_t + {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 = &matchDescriptorManager; + temp->manager = &defaultManager; temp = responseListIndex["8047"]; temp->code = QByteArray::fromHex("8047"); temp->description = "Management Leave response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Status", 1}} // uint8_t + {0, {"Sequence number", 1, 0}}, // uint8_t + {1, {"Status", 1, 0}} // uint8_t }; - temp->manager = &managementLeaveManager; + temp->manager = &defaultManager; temp = responseListIndex["8048"]; temp->code = QByteArray::fromHex("8048"); temp->description = "Leave indication"; temp->properties = { - {0, {"Extended address", 4}}, // uint64_t - {1, {"Rejoin status", 1}} // uint8_t + {0, {"Extended address", 4, 0}}, // uint64_t + {1, {"Rejoin status", 1, 0}} // uint8_t }; - temp->manager = &leaveIndicationManager; + temp->manager = &defaultManager; temp = responseListIndex["8049"]; temp->code = QByteArray::fromHex("8049"); temp->description = "PDM child table size"; temp->properties = { - {0, {"Number of child: ", 1}} // data each entry is uint8_t + {0, {"Number of child: ", 1, 0}} // data each entry is uint8_t }; - temp->manager = &pdmChildTableSizeManager; + temp->manager = &defaultManager; temp = responseListIndex["804A"]; temp->code = QByteArray::fromHex("804A"); temp->description = "Management Network Update response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"Status", 1}}, // uint8_t - {2, {"Total transmission", 2}}, // uint16_t - {3, {"Transmission failures", 2}}, // uint16_t - {4, {"Scanned channels", 4}}, // uint32_t - {5, {"Scanned channel list count", 1}}, // uint8_t - {6, {"Channel list", -1}} // list each element is uint8_t + {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 = &managementNetworkUpdateManager; + temp->manager = &defaultManager; temp = responseListIndex["804B"]; temp->code = QByteArray::fromHex("804B"); temp->description = "System Server Discovery response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"status", 1}}, // uint8_t - {2, {"Server mask", 2}} // uint16_t + {0, {"Sequence number", 1, 0}}, // uint8_t + {1, {"status", 1, 0}}, // uint8_t + {2, {"Server mask", 2, 0}} // uint16_t }; - temp->manager = &systemServerDiscoveryManager; + temp->manager = &defaultManager; temp = responseListIndex["804E"]; temp->code = QByteArray::fromHex("804E"); temp->description = "Management LQI response"; temp->properties = { - {0, {"Sequence number", 1}}, // uint8_t - {1, {"status", 1}}, // uint8_t - {2, {"Neighbour Table Entries ", 1}}, // uint8_t - {3, {"Neighbour Table List Count ", 1}}, // uint8_t - {4, {"Start Index ", 1}}, // uint8_t - {5, {"List of Entries elements described below", -1}} + {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 = &managementLQIManager; + temp->manager = &defaultManager; temp = responseListIndex["8060"]; temp->code = QByteArray::fromHex("8060"); temp->description = "Add group"; temp->properties = { - {0, {"Sequence number: ", 1}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Status: ", 1}}, //(added only from 3.0f version) - {4, {"Group id :", 2}}, //(added only from 3.0f version) - {5, {"Source Address: ", 2}}, //(added only from 3.0f version) - {6, {"Number of child: ", 1}} // data each entry is uint8_t + {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 = &addGroupManager; + temp->manager = &defaultManager; temp = responseListIndex["8061"]; temp->code = QByteArray::fromHex("8061"); temp->description = "View group"; temp->properties = { - {0, {"Sequence number: ", 1}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Status: ", 1}}, //(added only from 3.0f version) - {4, {"Group id :", 2}}, //(added only from 3.0f version) - {5, {"Source Address: ", 2}} //(added only from 3.0f version) - }; // data each entry is uint8_t - temp->manager = &viewGroupManager; + {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}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Source Address:", 2}}, //(added only from 3.0d version) - {4, {"Capacity: ", 1}}, - {5, {"Group count: ", 1}}, - {6, {"List of Group id: ", 2}}, //list each data item uint16_t> - {7, {"Source Addr: ", 2}} //(added only from 3.0f version) + {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 = &groupMemberShipManager; + temp->manager = &defaultManager; temp = responseListIndex["8063"]; temp->code = QByteArray::fromHex("8063"); temp->description = "Remove group"; temp->properties = { - {0, {"Sequence number: ", 1}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Source Address:", 2}}, //(added only from 3.0d version) - {4, {"Status: ", 1}}, - {5, {"Group ID: ", 2}} + {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 = &removeGroupManager; + temp->manager = &defaultManager; temp = responseListIndex["8085"]; temp->code = QByteArray::fromHex("8085"); temp->description = "Level update"; temp->properties = { - {0, {"Sequence number: ", 1}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Source Address mode:", 1}}, //(added only from 3.0d version) - {4, {"Source Address:", 2}}, //(added only from 3.0d version) - {5, {"Status: ", 1}} + {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 = &levelUpdateManager; + temp->manager = &defaultManager; temp = responseListIndex["8095"]; temp->code = QByteArray::fromHex("8095"); temp->description = "On/Off"; temp->properties = { - {0, {"Sequence number: ", 1}}, - {1, {"Endpoint: ", 1}}, - {2, {"Cluster id: ", 2}}, - {3, {"Source Address mode:", 1}}, //(added only from 3.0d version) - {4, {"Source Address:", 2}}, //(added only from 3.0d version) - {5, {"Status: ", 1}} + {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 = &onOffManager; - - - - + temp->manager = &defaultManager; temp = responseListIndex["8140"]; temp->code = QByteArray::fromHex("8140"); temp->description = "Attribute Discovery response"; temp->properties = { - {0, {"Complete", 1}}, // uint8_t - {1, {"Attribute type", 1}}, // uint8_t - {2, {"Attribute id", 2}} // uint16_t + {0, {"Complete", 1, 0}}, // uint8_t + {1, {"Attribute type", 1, 0}}, // uint8_t + {2, {"Attribute id", 2, 0}} // uint16_t }; - temp->manager = &attributeDiscoveryManager; + temp->manager = &defaultManager; resetCoordinator(); return returnCode; } -void infoOutput(ResponseProperties object) +void infoOutput(Response *object) { - cout << object.code.toHex().toStdString() << " : " << object.description.toStdString() << endl; + cout << object->code.toHex().toStdString() << " : " << object->description.toStdString() << endl; } -void defaultManager() -{ - infoOutput(zigateBkd.responseListIndex("")); -} - -void deviceAnnounceManager() -{ - infoOutput(zigateBkd.responseListIndex("")); -} - -void commandReturnStatusManager() +void defaultManager(Response *responseObject) { int nbyte; int isValue; int offset = 0; - QByteArray datas = commandReturnStatus.datas; + QByteArray datas = responseObject->datas; QByteArray result; - QMap >::iterator i = commandReturnStatus.properties.begin(); + QByteArray code = responseObject->code.toHex(); + + cout << responseObject->code.toStdString() << endl; + QMap >::iterator i = zigateBkd.responseListIndex[code]->properties.begin(); QList propertyList; QMap propertyDetail; QMap var; - infoOutput(commandReturnStatus); - /* - * {"Status", 1}, // - {"Sequence number", 1}, // - {"Packet Type", 2}, // - {"Optional additional error information", -1} // - */ - //keys = commandReturnStatus.properties.keys(); - - while (i != commandReturnStatus.properties.end()) + infoOutput(responseObject); + while (i != zigateBkd.responseListIndex[code]->properties.end()) { propertyList = i.value(); - propertyDetail = commandReturnStatus.propertyDetail.value(i.key()); + propertyDetail = zigateBkd.responseListIndex[code]->propertyDetail.value(i.key()); cout << propertyList.at(0).toString().toStdString() << ": "; nbyte = propertyList.at(1).toInt(); isValue = propertyList.at(2).toInt(); @@ -690,13 +732,14 @@ void commandReturnStatusManager() { case 0: cout << result.toHex().toStdString() << endl; - break; + break; case 1: - /*foreach (var, propertyDetail) - { + cout << result.toHex().toStdString() << endl; + //foreach (var, propertyDetail) + //{ - }*/ - break; + //} + break; case 2: if (propertyDetail.contains(result.toUInt())) { @@ -705,97 +748,42 @@ void commandReturnStatusManager() { cout << propertyDetail.value(-1).toStdString() << endl; } - break; - } - - - - -/* - switch (i.key()) - { - case 0: - switch (result.toUInt()) - { - case 0: - cout << "Success" << endl; - break; - case 1: - cout << "Incorrect Parameters" << endl; - break; - case 2: - cout << "Unhandled Command" << endl; - break; - case 3: - cout << "Command Failed" << endl; - break; - case 4: - cout << "Busy (Node is carrying out a lengthy operation and is currently unable to handle the incoming command)" << endl; - break; - case 5: - cout << "Stack Already Started (no new configuration accepted)" << endl;; - break; - default: - { - cout << "ZigBee Error Code : " << result.toHex().toStdString(); - } - break; - } - break; - case 1: - cout << "SQN : " << result.toHex().toStdString() << endl;; - break; - case 2: - cout << result.toHex().toStdString() << " - The value of the initiating command request" << endl; break; case 3: - cout << result.toHex().toStdString() << endl; + zigateBkd.responseListIndex[responseObject->code]->propertyManagerList[i.key()](result); break; - }*/ + case 4: + cout << "Liste" << endl; + break; + case 5: + cout << result.toStdString() << endl; + break; + } i++; } - - /* - } - 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;*/ } - -void logMessageManager() +void macCapabilityManager(QByteArray mac) { - infoOutput(logMessage); - + cout << "macCapabilityManger" << mac.toStdString() << endl; } - -/***************************************************************************** - * Log Level : - * Use the Linux / Unix log levels - * 0 = Emergency - * 1 = Alert - * 2 = Critical - * 3 = Error - * 4 = Warning - * 5 = Notice - * 6 = Information - * 7 = Debug - ******************************************************************************/ -void dataIndicationManager() +/* void deviceAnnounceManager() { - infoOutput(dataIndication); + infoOutput(responseListIndex("")); } +*/ -void clustersListManager() +void dataIndicationManager(Response * response) { - infoOutput(clustersList); + infoOutput(response); } +void clustersListManager(Response * response) +{ + infoOutput(response); +} + +/* void attributesListManager() { infoOutput(attributesList); @@ -810,32 +798,20 @@ void statusManager() { infoOutput(status); } -/***************************************************************************** -* 0 - STARTUP -* 2 - NFN_START -* 6 - RUNNING -* The node is provisioned from previous restart. -******************************************************************************/ -/*void status2Manager() +void status2Manager() { } -***************************************************************************** -* 0 - STARTUP -* 2 - NFN_START -* 6 - RUNNING -* The node is not yet provisioned. -******************************************************************************/ void versionListManager() { infoOutput(versionList); } -/***************************************************************************** -* 0 - Off -* 1 - On -******************************************************************************/ +// **************************************************************************** +// 0 - Off +// 1 - On +// ******************************************************************************* void permitJoinManager() { @@ -846,13 +822,22 @@ void networkJoinedFormedManager() { infoOutput(networkJoinedFormed); } -/***************************************************************************** -* Status: -* 0 = Joined existing network -* 1 = Formed new network -* 128 – 244 = Failed (ZigBee event codes) -******************************************************************************/ +*/ +void deviceListManager(Response * response) +{ + infoOutput(response); + // ************************************************************** + // + // + // + // + // 0 – battery 1- AC power + // 1-255 + // ************************************************************** + } + +/* void bindResponseManager() { infoOutput(bindResponse); @@ -862,76 +847,34 @@ void unbindResponseManager() { infoOutput(unbindResponse); } +*/ -void networkAddressManager() +void networkAddressManager(Response * response) { - infoOutput(networkAddress); + infoOutput(response); } -void iEEEAddressManager() + +void iEEEAddressManager(Response * response) { - infoOutput(iEEEAddress); + infoOutput(response); } -void nodeDescriptorManager() +void nodeDescriptorManager(Response * response) { - infoOutput(nodeDescriptor); + infoOutput(response); } -/***************************************************************************** -* 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 -******************************************************************************/ -void simpleDescriptorManager() +void simpleDescriptorManager(Response * response) { - infoOutput(simpleDescriptor); + infoOutput(response); } -/***************************************************************************** -* Bit fields: -* Device version: 4 bits (bits 0-4) -* Reserved: 4 bits (bits4-7) -******************************************************************************/ +/* void powerDescriptorManager() { infoOutput(powerDescriptor); } -/***************************************************************************** -* 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 -******************************************************************************/ void activeEndpointManager() { @@ -977,38 +920,17 @@ void systemServerDiscoveryManager() { infoOutput(systemServerDiscovery); } -/******************************** -* Bitmask according to spec". * -********************************/ +// ********************************* // +// Bitmask according to spec". // +// ********************************* // void managementLQIManager() { infoOutput(managementLQI); } -/***************************************************************************** - * 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) - ******************************************************************************/ void attributeDiscoveryManager() { infoOutput(attributeDiscovery); } -/***************************************************************************** -* Complete: -* 0 – more attributes to follow -* 1 – this was the last attribute -******************************************************************************/ +*/ diff --git a/zigatecmd.cpp b/zigatecmd.cpp index c8b9a64..62896a3 100644 --- a/zigatecmd.cpp +++ b/zigatecmd.cpp @@ -1,4 +1,4 @@ -#include "main.h" +#include "zigateBackend.h" using namespace std; @@ -11,6 +11,8 @@ bool ZigateBackend::resetCoordinator() getResponse(); getResponse(); getResponse(); + getResponse(); + getResponse(); cout << "***************************************************" << endl; sleep(10); return returnCode; diff --git a/zigbeemanager.pro b/zigbeemanager.pro index 92e0023..4edee0f 100644 --- a/zigbeemanager.pro +++ b/zigbeemanager.pro @@ -26,7 +26,7 @@ else: unix:!android: target.path = /usr/bin HEADERS += \ library.h \ main.h \ + zigateBackend.h \ responseClasses.h \ serial.inc.h \ - version.h \ - zigateBackend.h + version.h diff --git a/zigbeemanager.pro.user b/zigbeemanager.pro.user deleted file mode 100644 index 3b8b43e..0000000 --- a/zigbeemanager.pro.user +++ /dev/null @@ -1,430 +0,0 @@ - - - - - - EnvironmentId - {a3117c94-e673-4dca-aa4c-050bbea034fe} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - false - true - false - 1 - true - true - 0 - 8 - true - false - 1 - true - true - true - *.md, *.MD, Makefile - true - true - true - - - - ProjectExplorer.Project.PluginSettings - - - true - false - true - true - true - true - - - 0 - true - - true - true - Builtin.DefaultTidyAndClazy - 2 - - - - true - - - true - - - - - ProjectExplorer.Project.Target.0 - - Desktop - Qt 5.15.7 (qt5) - Qt 5.15.7 (qt5) - {a8a6d767-5e05-45c7-b70b-532f99112b6a} - 0 - 0 - 0 - - 0 - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Qt_5_15_7_qt5-Debug - /home/daniel/develop/build-zigbeemanager-Qt_5_15_7_qt5-Debug - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Qt_5_15_7_qt5-Release - /home/daniel/develop/build-zigbeemanager-Qt_5_15_7_qt5-Release - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Qt_5_15_7_qt5-Profile - /home/daniel/develop/build-zigbeemanager-Qt_5_15_7_qt5-Profile - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - zigbeemanager - Qt4ProjectManager.Qt4RunConfiguration:/home/daniel/develop/zigbeemanager/zigbeemanager.pro - /home/daniel/develop/zigbeemanager/zigbeemanager.pro - false - true - true - false - true - /home/daniel/develop/build-zigbeemanager-Qt_5_15_7_qt5-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop - Desktop - Desktop - {893f9ca6-0efa-4c08-a4a6-5a818f60a8a0} - 0 - 0 - 0 - - 0 - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Desktop-Debug - /home/daniel/develop/build-zigbeemanager-Desktop-Debug - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Desktop-Release - /home/daniel/develop/build-zigbeemanager-Desktop-Release - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - /home/daniel/develop/zigbeemanager/../build-zigbeemanager-Desktop-Profile - /home/daniel/develop/build-zigbeemanager-Desktop-Profile - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - -