#ifndef ZIGATEBACKEND_H #define ZIGATEBACKEND_H #include "serial.inc.h" #include #include #include //#include class ZigbeeMgr; class ZigateBackend : public ZigbeeMgr { Q_OBJECT public: QMap resultCodes; QString portName; QString serialDeviceDescription; QString serialDeviceManufacturer; QString serialDeviceNumber; QString serialDeviceVendor; QString serialDeviceProduct; quint32 baudRate = 115200; //ZigbeeMgr serial; ZigateBackend(); ~ZigateBackend(); QByteArray checksum(QByteArray msgType, QByteArray length, QByteArray datas); QByteArray transcode(QByteArray datas); void sendCmd(QByteArray cmd, QByteArray len, QByteArray datas); bool findSerialDevice(); QMap clusters { {"0000", " (General: Basic)"}, {"0001", " (General: Power Config)"}, {"0002", " (General: Temperature Config)"}, {"0003", " (General: Identify)"}, {"0004", " (General: Groups)"}, {"0005", " (General: Scenes)"}, {"0006", " (General: On/Off)"}, {"0007", " (General: On/Off Config)"}, {"0008", " (General: Level Control)"}, {"0009", " (General: Alarms)"}, {"000A", " (General: Time)"}, {"000F", " (General: Binary Input Basic)"}, {"0020", " (General: Poll Control)"}, {"0019", " (General: OTA)"}, {"0101", " (General: Door Lock"}, {"0201", " (HVAC: Thermostat)"}, {"0202", " (HVAC: Fan Control)"}, {"0300", " (Lighting: Color Control)"}, {"0400", " (Measurement: Illuminance)"}, {"0402", " (Measurement: Temperature)"}, {"0405", " (Measurement: Humidity)"}, {"0406", " (Measurement: Occupancy Sensing)"}, {"0500", " (Security & Safety: IAS Zone)"}, {"0702", " (Smart Energy: Metering)"}, {"0B05", " (Misc: Diagnostics)"}, {"1000", " (ZLL: Commissioning)"}, {"FF01", " Xiaomi private"}, {"FF02", " Xiaomi private"}, {"1234", " Xiaomi private"} }; /*Zigate -> Obj 0x0008 Set heartBeat enable/disable (ZiGatev2 Firm v3.20) 0 – disable (by default) 1 – enable Status */ QList heartbeatEnable = {"0008", "0001", "0210"}; /*Zigate -> Obj 0x0009 Get Network State (Firm v3.0d) Status Network State Response */ QByteArray networkState = "0009"; /* Zigate -> Obj 0x0010 Get Version Status Version List */ QList getVersion = {"0010", "0000", ""}; /* Zigate -> Obj 0x0011 Reset Status, followed by chip reset */ QByteArray reset = "0011"; /* Zigate -> Obj 0x0012 Erase Persistent Data Status */ QByteArray erasePersistentData = "0012"; /* Zigate -> Obj 0x0013 ZLO/ZLL “Factory New” Reset No payload Status, followed by chip reset Resets (“Factory New”) the Control Bridge but persists the frame counters. */ QByteArray factoryReset = "0013"; /* Zigate -> Obj 0x0014 Permit Join Status, followed by “Permit join” status response */ QByteArray permitJoin = "0014"; /* Zigate -> Obj 0x0015 Get devices list Get devices authentified in the ZiGate’s PDM. Status, followed by “Get devices list” response */ QByteArray getDevicesList = "0015"; /* Zigate -> Obj 0x0016 Set Time server (v3.0f) from 2000-01-01 00:00:00 Status */ QByteArray setTimeServer = "0016"; /* Zigate -> Obj 0x0017 GetTime server (v3.0f) Status Get_timer_server_response */ QByteArray getTimerServerResponse = "0017"; /* Zigate -> Obj 0x0018 SetLed (v3.0f) 0 – Off 1- On Status */ QByteArray setLed = "0018"; /* Zigate -> Obj 0x0019 Set Certification (v3.0f) 1- CE 2- FCC Status */ QByteArray setCertification = "0019"; /* Zigate -> Obj 0x0020 Set Expended PANID <64-bit Extended PAN ID:uint64_t> Status */ QByteArray setExpended = "0020"; /* Zigate -> Obj 0x0021 Set Channel Mask Status */ QByteArray setChannelMask = "0021"; /* Zigate -> Obj 0x0022 Set Security State + Key Status */ QByteArray setSecurityState = "0022"; /* Zigate -> Obj 0x0023 Set device Type Status Device Types: 0 = Coordinator 1 = Router */ QByteArray setDeviceType = "0023"; /* Zigate -> Obj 0x0024 Start Network Status Network Joined / Formed */ QByteArray startNetwork = "0024"; /* Zigate -> Obj 0x0025 Start Network Scan Status Network Joined / Formed */ QByteArray StartNetworkScan = "0025"; /* Zigate -> Obj 0x0026 Remove Device Status Leave indication */ QByteArray removeDevice = "0026"; /* Zigate -> Obj 0x0027 Enable Permissions Controlled Joins Status 1 – Enable 2 – Disable */ QByteArray enablePermControlledJoins = "0027"; /* Zigate -> Obj 0x0028 Authenticate Device Status Authenticate response */ QByteArray authenticateDevice = "0028"; /* Zigate -> Obj 0x0029 Out of Band Commissioning Data Request
Status Out of Band Commissioning Data Response */ QByteArray outOfBandCDR = "0029"; /* Zigate -> Obj 0x002B User Descriptor Set < target short address: uint16_t> Status < Address of interest: uint16_t> User descriptor notify response < string length: uint8_t> */ QByteArray userDescriptorSet = "002B"; /* Zigate -> Obj 0x002C User Descritpor Request < target short address: uint16_t> Status < Address of interest: uint16_t> User Descriptor response */ QByteArray userDescriptorRequest = "002C"; /* Zigate -> Obj 0x0531 Complex Descriptor request < target short address: uint16_t> Status < Address of interest: uint16_t> Complex Descriptor Response */ QByteArray complexDescriptorRequest = "0531"; /*Zigate -> Obj 0x0030 Bind Status Bind response */ QByteArray bind = "0030"; /* Zigate -> Obj 0x0031 Unbind Status Unbind response */ QByteArray unBind = "0031"; /* Zigate -> Obj 0x0040 Network Address request Status Network Address response Request Type: 0 = Single Request 1 = Extended Request */ QByteArray networkAddressRequest = "0040"; /* Zigate -> Obj 0x0041 IEEE Address request Status IEEE Address response Request Type: 0 = Single 1 = Extended */ QByteArray ieeeAddressRequest = "0041"; /* Zigate -> Obj 0x0042 Node Descriptor request Status Node Descriptor response */ QByteArray nodeDescriptorRequest = "0042"; /* Zigate -> Obj 0x0043 Simple Descriptor request Status Simple Descriptor response */ QByteArray simpleDescriptorRequest = "0043"; /* Zigate -> Obj 0x0044 Power Descriptor request Status Power Descriptor response */ QByteArray powerDescriptorRequest = "0044"; /* Zigate -> Obj 0x0045 Active Endpoint request Status Active Endpoint response */ QByteArray activeEndpointRequest = "0045"; /* Zigate -> Obj 0x0046 Match Descriptor request Status Match Descriptor response */ QByteArray matchDescriptorRequest = "0046"; /* Zigate -> Obj 0x0047 Management Leave request Status Management Leave response Leave indication Rejoin, 0 = Do not rejoin 1 = Rejoin Remove Children 0 = Leave, do not remove children 1 = Leave, removing children */ QByteArray managementLeaveRequest = "0047"; /* Zigate -> Obj 0x0049 Permit Joining request Status Target address: May be address of gateway node or broadcast (0xfffc) Interval: 0 = Disable Joining 1 – 254 = Time in seconds to allow joins 255 = Allow all joins TCsignificance: 0 = No change in authentication 1 = Authentication policy as spec */ QByteArray permitJoiningRequest = "0049"; /* Zigate -> Obj 0x004A Management Network Update request Status Management Network Update response Channel Mask: Mask of channels to scan Scan Duration: 0 – 0xFF Multiple of superframe duration. Scan count: Scan repeats 0 – 5 Network Update ID: 0 – 0xFF Transaction ID for scan */ QByteArray manaementNetworkUpdateRequest = "004A"; /* Zigate -> Obj 0x004B System Server Discovery request Status System Server Discovery response Bitmask according to spec. */ QByteArray systemServerDiscoveryRequest = "004B"; /* Zigate -> Obj 0x004C Leave Request Status Leave indication Leave indication (0x8048) Rejoin, 0 = Do not rejoin 1 = Rejoin Remove Children 0 = Leave, do not remove children 1 = Leave, removing children */ QByteArray leaveRequest = "004C"; /* Zigate -> Obj 0x004E Management LQI request Status Management LQI response */ QByteArray managementLqiRequest = "004E"; /* Zigate -> Obj 0x0051 Free PDM internal address map table (From v.322 ZiGate+) Status */ QByteArray freePdmTable = "0051"; /* Zigate -> Obj 0x0052 Get PDM child table size (From v.322 ZiGate+) Status PDM child table size response */ QByteArray getPdmChildTableSize = "0052"; }; #endif // ZIGATEBACKEND_H