zigbee-herdsman 0.57.2 → 0.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release_please.yml +1 -1
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/adapter/adapter.d.ts +1 -1
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.js +2 -1
- package/dist/adapter/adapter.js.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +13 -12
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +0 -14
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +69 -114
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.js +1 -2
- package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.js +15 -15
- package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
- package/dist/adapter/ember/uart/ash.js +2 -2
- package/dist/adapter/ember/uart/ash.js.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +27 -26
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
- package/dist/adapter/ezsp/driver/driver.d.ts +1 -2
- package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/driver.js +33 -11
- package/dist/adapter/ezsp/driver/driver.js.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.js +4 -4
- package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
- package/dist/adapter/ezsp/driver/uart.js +3 -3
- package/dist/adapter/ezsp/driver/uart.js.map +1 -1
- package/dist/adapter/serialPort.js +5 -5
- package/dist/adapter/serialPort.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js +9 -9
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts +3 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.js +5 -6
- package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +1 -2
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +113 -112
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
- package/dist/adapter/z-stack/unpi/frame.js +2 -2
- package/dist/adapter/z-stack/unpi/frame.js.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +0 -4
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.js +6 -101
- package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
- package/dist/adapter/z-stack/znp/definition.d.ts +13 -1
- package/dist/adapter/z-stack/znp/definition.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/definition.js +164 -75
- package/dist/adapter/z-stack/znp/definition.js.map +1 -1
- package/dist/adapter/z-stack/znp/parameterType.d.ts +0 -4
- package/dist/adapter/z-stack/znp/parameterType.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/parameterType.js +0 -4
- package/dist/adapter/z-stack/znp/parameterType.js.map +1 -1
- package/dist/adapter/z-stack/znp/tstype.d.ts +26 -8
- package/dist/adapter/z-stack/znp/tstype.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/utils.d.ts +3 -0
- package/dist/adapter/z-stack/znp/utils.d.ts.map +1 -0
- package/dist/adapter/z-stack/znp/utils.js +11 -0
- package/dist/adapter/z-stack/znp/utils.js.map +1 -0
- package/dist/adapter/z-stack/znp/znp.d.ts +0 -1
- package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/znp.js +15 -35
- package/dist/adapter/z-stack/znp/znp.js.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.d.ts +7 -7
- package/dist/adapter/z-stack/znp/zpiObject.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.js +35 -43
- package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.js +21 -20
- package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
- package/dist/adapter/zboss/driver.js +16 -16
- package/dist/adapter/zboss/driver.js.map +1 -1
- package/dist/adapter/zboss/uart.d.ts.map +1 -1
- package/dist/adapter/zboss/uart.js +6 -5
- package/dist/adapter/zboss/uart.js.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.js +20 -19
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.js +1 -2
- package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
- package/dist/adapter/zigate/driver/frame.js +1 -1
- package/dist/adapter/zigate/driver/frame.js.map +1 -1
- package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/zigate.js +11 -11
- package/dist/adapter/zigate/driver/zigate.js.map +1 -1
- package/dist/buffalo/buffalo.d.ts.map +1 -1
- package/dist/buffalo/buffalo.js +1 -2
- package/dist/buffalo/buffalo.js.map +1 -1
- package/dist/controller/controller.d.ts +3 -1
- package/dist/controller/controller.d.ts.map +1 -1
- package/dist/controller/controller.js +8 -6
- package/dist/controller/controller.js.map +1 -1
- package/dist/controller/greenPower.d.ts.map +1 -1
- package/dist/controller/greenPower.js +8 -7
- package/dist/controller/greenPower.js.map +1 -1
- package/dist/controller/helpers/requestQueue.js +1 -1
- package/dist/controller/helpers/requestQueue.js.map +1 -1
- package/dist/controller/model/device.d.ts +6 -2
- package/dist/controller/model/device.d.ts.map +1 -1
- package/dist/controller/model/device.js +39 -41
- package/dist/controller/model/device.js.map +1 -1
- package/dist/controller/model/endpoint.d.ts.map +1 -1
- package/dist/controller/model/endpoint.js +12 -13
- package/dist/controller/model/endpoint.js.map +1 -1
- package/dist/controller/model/group.d.ts +5 -2
- package/dist/controller/model/group.d.ts.map +1 -1
- package/dist/controller/model/group.js +21 -19
- package/dist/controller/model/group.js.map +1 -1
- package/dist/utils/logger.d.ts +4 -4
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +4 -4
- package/dist/utils/logger.js.map +1 -1
- package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/cluster.js +1 -0
- package/dist/zspec/zcl/definition/cluster.js.map +1 -1
- package/dist/zspec/zdo/buffaloZdo.d.ts +199 -85
- package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
- package/dist/zspec/zdo/buffaloZdo.js +434 -404
- package/dist/zspec/zdo/buffaloZdo.js.map +1 -1
- package/dist/zspec/zdo/definition/clusters.d.ts +1 -1
- package/dist/zspec/zdo/definition/clusters.d.ts.map +1 -1
- package/dist/zspec/zdo/definition/clusters.js +1 -1
- package/dist/zspec/zdo/definition/clusters.js.map +1 -1
- package/dist/zspec/zdo/definition/enums.d.ts +10 -0
- package/dist/zspec/zdo/definition/enums.d.ts.map +1 -1
- package/dist/zspec/zdo/definition/enums.js +12 -1
- package/dist/zspec/zdo/definition/enums.js.map +1 -1
- package/dist/zspec/zdo/definition/tstypes.d.ts +7 -5
- package/dist/zspec/zdo/definition/tstypes.d.ts.map +1 -1
- package/dist/zspec/zdo/index.d.ts +1 -0
- package/dist/zspec/zdo/index.d.ts.map +1 -1
- package/dist/zspec/zdo/index.js +3 -1
- package/dist/zspec/zdo/index.js.map +1 -1
- package/dist/zspec/zdo/utils.js +2 -2
- package/eslint.config.mjs +2 -2
- package/package.json +6 -6
|
@@ -569,7 +569,7 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
569
569
|
throw new Error(`Malformed TLV. Invalid data length for tagId=${tagId}, expected ${length}.`);
|
|
570
570
|
}
|
|
571
571
|
const nextTLVStart = this.getPosition() + length;
|
|
572
|
-
//
|
|
572
|
+
// undefined == unknown tag
|
|
573
573
|
let tlv;
|
|
574
574
|
if (tagId < enums_1.GlobalTLV.MANUFACTURER_SPECIFIC) {
|
|
575
575
|
/* istanbul ignore else */
|
|
@@ -608,18 +608,112 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
608
608
|
return tlvs;
|
|
609
609
|
}
|
|
610
610
|
//-- REQUESTS
|
|
611
|
+
static buildRequest(hasZdoMessageOverhead, clusterId, ...args) {
|
|
612
|
+
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), hasZdoMessageOverhead ? consts_2.ZDO_MESSAGE_OVERHEAD : 0);
|
|
613
|
+
switch (clusterId) {
|
|
614
|
+
case clusters_1.ClusterId.NETWORK_ADDRESS_REQUEST: {
|
|
615
|
+
return buffalo.buildNetworkAddressRequest(...args);
|
|
616
|
+
}
|
|
617
|
+
case clusters_1.ClusterId.IEEE_ADDRESS_REQUEST: {
|
|
618
|
+
return buffalo.buildIeeeAddressRequest(...args);
|
|
619
|
+
}
|
|
620
|
+
case clusters_1.ClusterId.NODE_DESCRIPTOR_REQUEST: {
|
|
621
|
+
return buffalo.buildNodeDescriptorRequest(...args);
|
|
622
|
+
}
|
|
623
|
+
case clusters_1.ClusterId.POWER_DESCRIPTOR_REQUEST: {
|
|
624
|
+
return buffalo.buildPowerDescriptorRequest(...args);
|
|
625
|
+
}
|
|
626
|
+
case clusters_1.ClusterId.SIMPLE_DESCRIPTOR_REQUEST: {
|
|
627
|
+
return buffalo.buildSimpleDescriptorRequest(...args);
|
|
628
|
+
}
|
|
629
|
+
case clusters_1.ClusterId.ACTIVE_ENDPOINTS_REQUEST: {
|
|
630
|
+
return buffalo.buildActiveEndpointsRequest(...args);
|
|
631
|
+
}
|
|
632
|
+
case clusters_1.ClusterId.MATCH_DESCRIPTORS_REQUEST: {
|
|
633
|
+
return buffalo.buildMatchDescriptorRequest(...args);
|
|
634
|
+
}
|
|
635
|
+
case clusters_1.ClusterId.SYSTEM_SERVER_DISCOVERY_REQUEST: {
|
|
636
|
+
return buffalo.buildSystemServiceDiscoveryRequest(...args);
|
|
637
|
+
}
|
|
638
|
+
case clusters_1.ClusterId.PARENT_ANNOUNCE: {
|
|
639
|
+
return buffalo.buildParentAnnounce(...args);
|
|
640
|
+
}
|
|
641
|
+
case clusters_1.ClusterId.BIND_REQUEST: {
|
|
642
|
+
return buffalo.buildBindRequest(...args);
|
|
643
|
+
}
|
|
644
|
+
case clusters_1.ClusterId.UNBIND_REQUEST: {
|
|
645
|
+
return buffalo.buildUnbindRequest(...args);
|
|
646
|
+
}
|
|
647
|
+
case clusters_1.ClusterId.CLEAR_ALL_BINDINGS_REQUEST: {
|
|
648
|
+
return buffalo.buildClearAllBindingsRequest(...args);
|
|
649
|
+
}
|
|
650
|
+
case clusters_1.ClusterId.LQI_TABLE_REQUEST: {
|
|
651
|
+
return buffalo.buildLqiTableRequest(...args);
|
|
652
|
+
}
|
|
653
|
+
case clusters_1.ClusterId.ROUTING_TABLE_REQUEST: {
|
|
654
|
+
return buffalo.buildRoutingTableRequest(...args);
|
|
655
|
+
}
|
|
656
|
+
case clusters_1.ClusterId.BINDING_TABLE_REQUEST: {
|
|
657
|
+
return buffalo.buildBindingTableRequest(...args);
|
|
658
|
+
}
|
|
659
|
+
case clusters_1.ClusterId.LEAVE_REQUEST: {
|
|
660
|
+
return buffalo.buildLeaveRequest(...args);
|
|
661
|
+
}
|
|
662
|
+
case clusters_1.ClusterId.PERMIT_JOINING_REQUEST: {
|
|
663
|
+
return buffalo.buildPermitJoining(...args);
|
|
664
|
+
}
|
|
665
|
+
case clusters_1.ClusterId.NWK_UPDATE_REQUEST: {
|
|
666
|
+
return buffalo.buildNwkUpdateRequest(...args);
|
|
667
|
+
}
|
|
668
|
+
case clusters_1.ClusterId.NWK_ENHANCED_UPDATE_REQUEST: {
|
|
669
|
+
return buffalo.buildNwkEnhancedUpdateRequest(...args);
|
|
670
|
+
}
|
|
671
|
+
case clusters_1.ClusterId.NWK_IEEE_JOINING_LIST_REQUEST: {
|
|
672
|
+
return buffalo.buildNwkIEEEJoiningListRequest(...args);
|
|
673
|
+
}
|
|
674
|
+
case clusters_1.ClusterId.NWK_BEACON_SURVEY_REQUEST: {
|
|
675
|
+
return buffalo.buildNwkBeaconSurveyRequest(...args);
|
|
676
|
+
}
|
|
677
|
+
case clusters_1.ClusterId.START_KEY_NEGOTIATION_REQUEST: {
|
|
678
|
+
return buffalo.buildStartKeyNegotiationRequest(...args);
|
|
679
|
+
}
|
|
680
|
+
case clusters_1.ClusterId.RETRIEVE_AUTHENTICATION_TOKEN_REQUEST: {
|
|
681
|
+
return buffalo.buildRetrieveAuthenticationTokenRequest(...args);
|
|
682
|
+
}
|
|
683
|
+
case clusters_1.ClusterId.GET_AUTHENTICATION_LEVEL_REQUEST: {
|
|
684
|
+
return buffalo.buildGetAuthenticationLevelRequest(...args);
|
|
685
|
+
}
|
|
686
|
+
case clusters_1.ClusterId.SET_CONFIGURATION_REQUEST: {
|
|
687
|
+
return buffalo.buildSetConfigurationRequest(...args);
|
|
688
|
+
}
|
|
689
|
+
case clusters_1.ClusterId.GET_CONFIGURATION_REQUEST: {
|
|
690
|
+
return buffalo.buildGetConfigurationRequest(...args);
|
|
691
|
+
}
|
|
692
|
+
case clusters_1.ClusterId.START_KEY_UPDATE_REQUEST: {
|
|
693
|
+
return buffalo.buildStartKeyUpdateRequest(...args);
|
|
694
|
+
}
|
|
695
|
+
case clusters_1.ClusterId.DECOMMISSION_REQUEST: {
|
|
696
|
+
return buffalo.buildDecommissionRequest(...args);
|
|
697
|
+
}
|
|
698
|
+
case clusters_1.ClusterId.CHALLENGE_REQUEST: {
|
|
699
|
+
return buffalo.buildChallengeRequest(...args);
|
|
700
|
+
}
|
|
701
|
+
default: {
|
|
702
|
+
throw new Error(`Unsupported request building for cluster ID '${clusterId}'.`);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
611
706
|
/**
|
|
612
707
|
* @see ClusterId.NETWORK_ADDRESS_REQUEST
|
|
613
708
|
* @param target IEEE address for the request
|
|
614
709
|
* @param reportKids True to request that the target list their children in the response. [request type = 0x01]
|
|
615
710
|
* @param childStartIndex The index of the first child to list in the response. Ignored if reportKids is false.
|
|
616
711
|
*/
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
return buffalo.getWritten();
|
|
712
|
+
buildNetworkAddressRequest(target, reportKids, childStartIndex) {
|
|
713
|
+
this.writeIeeeAddr(target);
|
|
714
|
+
this.writeUInt8(reportKids ? 1 : 0);
|
|
715
|
+
this.writeUInt8(childStartIndex);
|
|
716
|
+
return this.getWritten();
|
|
623
717
|
}
|
|
624
718
|
/**
|
|
625
719
|
* @see ClusterId.IEEE_ADDRESS_REQUEST
|
|
@@ -628,20 +722,18 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
628
722
|
* @param reportKids True to request that the target list their children in the response. [request type = 0x01]
|
|
629
723
|
* @param childStartIndex The index of the first child to list in the response. Ignored if reportKids is false.
|
|
630
724
|
*/
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return buffalo.getWritten();
|
|
725
|
+
buildIeeeAddressRequest(target, reportKids, childStartIndex) {
|
|
726
|
+
this.writeUInt16(target);
|
|
727
|
+
this.writeUInt8(reportKids ? 1 : 0);
|
|
728
|
+
this.writeUInt8(childStartIndex);
|
|
729
|
+
return this.getWritten();
|
|
637
730
|
}
|
|
638
731
|
/**
|
|
639
732
|
* @see ClusterId.NODE_DESCRIPTOR_REQUEST
|
|
640
733
|
* @param target NWK address for the request
|
|
641
734
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
buffalo.writeUInt16(target);
|
|
735
|
+
buildNodeDescriptorRequest(target, fragmentationParameters) {
|
|
736
|
+
this.writeUInt16(target);
|
|
645
737
|
if (fragmentationParameters) {
|
|
646
738
|
let length = 2;
|
|
647
739
|
/* istanbul ignore else */
|
|
@@ -652,38 +744,35 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
652
744
|
if (fragmentationParameters.maxIncomingTransferUnit) {
|
|
653
745
|
length += 2;
|
|
654
746
|
}
|
|
655
|
-
|
|
747
|
+
this.writeGlobalTLV({ tagId: enums_1.GlobalTLV.FRAGMENTATION_PARAMETERS, length, tlv: fragmentationParameters });
|
|
656
748
|
}
|
|
657
|
-
return
|
|
749
|
+
return this.getWritten();
|
|
658
750
|
}
|
|
659
751
|
/**
|
|
660
752
|
* @see ClusterId.POWER_DESCRIPTOR_REQUEST
|
|
661
753
|
* @param target NWK address for the request
|
|
662
754
|
*/
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
return buffalo.getWritten();
|
|
755
|
+
buildPowerDescriptorRequest(target) {
|
|
756
|
+
this.writeUInt16(target);
|
|
757
|
+
return this.getWritten();
|
|
667
758
|
}
|
|
668
759
|
/**
|
|
669
760
|
* @see ClusterId.SIMPLE_DESCRIPTOR_REQUEST
|
|
670
761
|
* @param target NWK address for the request
|
|
671
762
|
* @param targetEndpoint The endpoint on the destination
|
|
672
763
|
*/
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return buffalo.getWritten();
|
|
764
|
+
buildSimpleDescriptorRequest(target, targetEndpoint) {
|
|
765
|
+
this.writeUInt16(target);
|
|
766
|
+
this.writeUInt8(targetEndpoint);
|
|
767
|
+
return this.getWritten();
|
|
678
768
|
}
|
|
679
769
|
/**
|
|
680
770
|
* @see ClusterId.ACTIVE_ENDPOINTS_REQUEST
|
|
681
771
|
* @param target NWK address for the request
|
|
682
772
|
*/
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return buffalo.getWritten();
|
|
773
|
+
buildActiveEndpointsRequest(target) {
|
|
774
|
+
this.writeUInt16(target);
|
|
775
|
+
return this.getWritten();
|
|
687
776
|
}
|
|
688
777
|
/**
|
|
689
778
|
* @see ClusterId.MATCH_DESCRIPTORS_REQUEST
|
|
@@ -692,36 +781,33 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
692
781
|
* @param inClusterList List of Input ClusterIDs to be used for matching
|
|
693
782
|
* @param outClusterList List of Output ClusterIDs to be used for matching
|
|
694
783
|
*/
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
return buffalo.getWritten();
|
|
784
|
+
buildMatchDescriptorRequest(target, profileId, inClusterList, outClusterList) {
|
|
785
|
+
this.writeUInt16(target);
|
|
786
|
+
this.writeUInt16(profileId);
|
|
787
|
+
this.writeUInt8(inClusterList.length);
|
|
788
|
+
this.writeListUInt16(inClusterList);
|
|
789
|
+
this.writeUInt8(outClusterList.length);
|
|
790
|
+
this.writeListUInt16(outClusterList);
|
|
791
|
+
return this.getWritten();
|
|
704
792
|
}
|
|
705
793
|
/**
|
|
706
794
|
* @see ClusterId.SYSTEM_SERVER_DISCOVERY_REQUEST
|
|
707
795
|
* @param serverMask See Table 2-34 for bit assignments.
|
|
708
796
|
*/
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
return buffalo.getWritten();
|
|
797
|
+
buildSystemServiceDiscoveryRequest(serverMask) {
|
|
798
|
+
this.writeUInt16(Utils.createServerMask(serverMask));
|
|
799
|
+
return this.getWritten();
|
|
713
800
|
}
|
|
714
801
|
/**
|
|
715
802
|
* @see ClusterId.PARENT_ANNOUNCE
|
|
716
803
|
* @param children The IEEE addresses of the children bound to the parent.
|
|
717
804
|
*/
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
buffalo.writeUInt8(children.length);
|
|
805
|
+
buildParentAnnounce(children) {
|
|
806
|
+
this.writeUInt8(children.length);
|
|
721
807
|
for (const child of children) {
|
|
722
|
-
|
|
808
|
+
this.writeIeeeAddr(child);
|
|
723
809
|
}
|
|
724
|
-
return
|
|
810
|
+
return this.getWritten();
|
|
725
811
|
}
|
|
726
812
|
/**
|
|
727
813
|
* @see ClusterId.BIND_REQUEST
|
|
@@ -734,26 +820,25 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
734
820
|
* @param groupAddress The destination address for the binding entry. Group ID for ::MULTICAST_BINDING.
|
|
735
821
|
* @param destinationEndpoint The destination endpoint for the binding entry. Only if ::UNICAST_BINDING.
|
|
736
822
|
*/
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
buffalo.writeUInt8(type);
|
|
823
|
+
buildBindRequest(source, sourceEndpoint, clusterId, type, destination, groupAddress, destinationEndpoint) {
|
|
824
|
+
this.writeIeeeAddr(source);
|
|
825
|
+
this.writeUInt8(sourceEndpoint);
|
|
826
|
+
this.writeUInt16(clusterId);
|
|
827
|
+
this.writeUInt8(type);
|
|
743
828
|
switch (type) {
|
|
744
829
|
case consts_2.UNICAST_BINDING: {
|
|
745
|
-
|
|
746
|
-
|
|
830
|
+
this.writeIeeeAddr(destination);
|
|
831
|
+
this.writeUInt8(destinationEndpoint);
|
|
747
832
|
break;
|
|
748
833
|
}
|
|
749
834
|
case consts_2.MULTICAST_BINDING: {
|
|
750
|
-
|
|
835
|
+
this.writeUInt16(groupAddress);
|
|
751
836
|
break;
|
|
752
837
|
}
|
|
753
838
|
default:
|
|
754
839
|
throw new zdoStatusError_1.ZdoStatusError(status_1.Status.NOT_SUPPORTED);
|
|
755
840
|
}
|
|
756
|
-
return
|
|
841
|
+
return this.getWritten();
|
|
757
842
|
}
|
|
758
843
|
/**
|
|
759
844
|
* @see ClusterId.UNBIND_REQUEST
|
|
@@ -766,67 +851,62 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
766
851
|
* @param groupAddress The destination address for the binding entry. Group ID for ::MULTICAST_BINDING.
|
|
767
852
|
* @param destinationEndpoint The destination endpoint for the binding entry. Only if ::UNICAST_BINDING.
|
|
768
853
|
*/
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
buffalo.writeUInt8(type);
|
|
854
|
+
buildUnbindRequest(source, sourceEndpoint, clusterId, type, destination, groupAddress, destinationEndpoint) {
|
|
855
|
+
this.writeIeeeAddr(source);
|
|
856
|
+
this.writeUInt8(sourceEndpoint);
|
|
857
|
+
this.writeUInt16(clusterId);
|
|
858
|
+
this.writeUInt8(type);
|
|
775
859
|
switch (type) {
|
|
776
860
|
case consts_2.UNICAST_BINDING: {
|
|
777
|
-
|
|
778
|
-
|
|
861
|
+
this.writeIeeeAddr(destination);
|
|
862
|
+
this.writeUInt8(destinationEndpoint);
|
|
779
863
|
break;
|
|
780
864
|
}
|
|
781
865
|
case consts_2.MULTICAST_BINDING: {
|
|
782
|
-
|
|
866
|
+
this.writeUInt16(groupAddress);
|
|
783
867
|
break;
|
|
784
868
|
}
|
|
785
869
|
default:
|
|
786
870
|
throw new zdoStatusError_1.ZdoStatusError(status_1.Status.NOT_SUPPORTED);
|
|
787
871
|
}
|
|
788
|
-
return
|
|
872
|
+
return this.getWritten();
|
|
789
873
|
}
|
|
790
874
|
/**
|
|
791
875
|
* @see ClusterId.CLEAR_ALL_BINDINGS_REQUEST
|
|
792
876
|
*/
|
|
793
|
-
|
|
794
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
877
|
+
buildClearAllBindingsRequest(tlv) {
|
|
795
878
|
// ClearAllBindingsReqEUI64TLV: Local: ID: 0x00
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
879
|
+
this.writeUInt8(0x00);
|
|
880
|
+
this.writeUInt8(tlv.eui64List.length * consts_1.EUI64_SIZE + 1 - 1);
|
|
881
|
+
this.writeUInt8(tlv.eui64List.length);
|
|
799
882
|
for (const entry of tlv.eui64List) {
|
|
800
|
-
|
|
883
|
+
this.writeIeeeAddr(entry);
|
|
801
884
|
}
|
|
802
|
-
return
|
|
885
|
+
return this.getWritten();
|
|
803
886
|
}
|
|
804
887
|
/**
|
|
805
888
|
* @see ClusterId.LQI_TABLE_REQUEST
|
|
806
889
|
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
807
890
|
*/
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
return buffalo.getWritten();
|
|
891
|
+
buildLqiTableRequest(startIndex) {
|
|
892
|
+
this.writeUInt8(startIndex);
|
|
893
|
+
return this.getWritten();
|
|
812
894
|
}
|
|
813
895
|
/**
|
|
814
896
|
* @see ClusterId.ROUTING_TABLE_REQUEST
|
|
815
897
|
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
816
898
|
*/
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
return buffalo.getWritten();
|
|
899
|
+
buildRoutingTableRequest(startIndex) {
|
|
900
|
+
this.writeUInt8(startIndex);
|
|
901
|
+
return this.getWritten();
|
|
821
902
|
}
|
|
822
903
|
/**
|
|
823
904
|
* @see ClusterId.BINDING_TABLE_REQUEST
|
|
824
905
|
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
825
906
|
*/
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
return buffalo.getWritten();
|
|
907
|
+
buildBindingTableRequest(startIndex) {
|
|
908
|
+
this.writeUInt8(startIndex);
|
|
909
|
+
return this.getWritten();
|
|
830
910
|
}
|
|
831
911
|
/**
|
|
832
912
|
* @see ClusterId.LEAVE_REQUEST
|
|
@@ -834,11 +914,10 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
834
914
|
* the EUI64 of a child of the target device to remove that child.
|
|
835
915
|
* @param leaveRequestFlags A bitmask of leave options. Include ::AND_REJOIN if the target is to rejoin the network immediately after leaving.
|
|
836
916
|
*/
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
return buffalo.getWritten();
|
|
917
|
+
buildLeaveRequest(deviceAddress, leaveRequestFlags) {
|
|
918
|
+
this.writeIeeeAddr(deviceAddress);
|
|
919
|
+
this.writeUInt8(leaveRequestFlags);
|
|
920
|
+
return this.getWritten();
|
|
842
921
|
}
|
|
843
922
|
/**
|
|
844
923
|
* @see ClusterId.PERMIT_JOINING_REQUEST
|
|
@@ -847,15 +926,14 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
847
926
|
* This field SHALL always have a value of 1, indicating a request to change the Trust Center policy.
|
|
848
927
|
* If a frame is received with a value of 0, it shall be treated as having a value of 1.
|
|
849
928
|
*/
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
buffalo.writeUInt8(authentication);
|
|
929
|
+
buildPermitJoining(duration, authentication, tlvs) {
|
|
930
|
+
this.writeUInt8(duration);
|
|
931
|
+
this.writeUInt8(authentication);
|
|
854
932
|
// BeaconAppendixEncapsulationGlobalTLV
|
|
855
933
|
// - SupportedKeyNegotiationMethodsGlobalTLV
|
|
856
934
|
// - FragmentationParametersGlobalTLV
|
|
857
|
-
|
|
858
|
-
return
|
|
935
|
+
this.writeGlobalTLVs(tlvs);
|
|
936
|
+
return this.getWritten();
|
|
859
937
|
}
|
|
860
938
|
/**
|
|
861
939
|
* @see ClusterId.NWK_UPDATE_REQUEST
|
|
@@ -873,42 +951,41 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
873
951
|
* @param nwkManagerAddr This field SHALL be present only if the duration is set to 0xff, and, where present,
|
|
874
952
|
* indicates the NWK address for the device with the Network Manager bit set in its Node Descriptor.
|
|
875
953
|
*/
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
buffalo.writeUInt8(count);
|
|
954
|
+
buildNwkUpdateRequest(channels, duration, count, nwkUpdateId, nwkManagerAddr) {
|
|
955
|
+
this.writeUInt32(ZSpecUtils.channelsToUInt32Mask(channels));
|
|
956
|
+
this.writeUInt8(duration);
|
|
957
|
+
if (count !== undefined && duration >= 0x00 && duration <= 0x05) {
|
|
958
|
+
this.writeUInt8(count);
|
|
882
959
|
}
|
|
883
960
|
// TODO: What does "This value is set by the Network Channel Manager prior to sending the message." mean exactly??
|
|
884
961
|
// (isn't used/mentioned in EmberZNet, confirmed working if not set at all for channel change)
|
|
885
|
-
// for now, allow to bypass with
|
|
886
|
-
if (nwkUpdateId
|
|
887
|
-
|
|
962
|
+
// for now, allow to bypass with undefined, otherwise should throw if undefined and duration passes below conditions (see NwkEnhancedUpdateRequest)
|
|
963
|
+
if (nwkUpdateId !== undefined && (duration === 0xfe || duration === 0xff)) {
|
|
964
|
+
this.writeUInt8(nwkUpdateId);
|
|
888
965
|
}
|
|
889
|
-
if (nwkManagerAddr
|
|
890
|
-
|
|
966
|
+
if (nwkManagerAddr !== undefined && duration === 0xff) {
|
|
967
|
+
this.writeUInt16(nwkManagerAddr);
|
|
891
968
|
}
|
|
892
|
-
return
|
|
893
|
-
}
|
|
894
|
-
/**
|
|
895
|
-
* Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
896
|
-
*/
|
|
897
|
-
static buildScanChannelsRequest(scanChannels, duration, count) {
|
|
898
|
-
return BuffaloZdo.buildNwkUpdateRequest(scanChannels, duration, count, null, null);
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
902
|
-
*/
|
|
903
|
-
static buildChannelChangeRequest(channel, nwkUpdateId) {
|
|
904
|
-
return BuffaloZdo.buildNwkUpdateRequest([channel], 0xfe, null, nwkUpdateId, null);
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
908
|
-
*/
|
|
909
|
-
static buildSetActiveChannelsAndNwkManagerIdRequest(channels, nwkUpdateId, nwkManagerAddr) {
|
|
910
|
-
return BuffaloZdo.buildNwkUpdateRequest(channels, 0xff, null, nwkUpdateId, nwkManagerAddr);
|
|
969
|
+
return this.getWritten();
|
|
911
970
|
}
|
|
971
|
+
// /**
|
|
972
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
973
|
+
// */
|
|
974
|
+
// private buildScanChannelsRequest(scanChannels: number[], duration: number, count: number): Buffer {
|
|
975
|
+
// return this.buildNwkUpdateRequest(scanChannels, duration, count, undefined, undefined);
|
|
976
|
+
// }
|
|
977
|
+
// /**
|
|
978
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
979
|
+
// */
|
|
980
|
+
// private buildChannelChangeRequest(channel: number, nwkUpdateId: number | undefined): Buffer {
|
|
981
|
+
// return this.buildNwkUpdateRequest([channel], 0xfe, undefined, nwkUpdateId, undefined);
|
|
982
|
+
// }
|
|
983
|
+
// /**
|
|
984
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
985
|
+
// */
|
|
986
|
+
// private buildSetActiveChannelsAndNwkManagerIdRequest(channels: number[], nwkUpdateId: number | undefined, nwkManagerAddr: NodeId): Buffer {
|
|
987
|
+
// return this.buildNwkUpdateRequest(channels, 0xff, undefined, nwkUpdateId, nwkManagerAddr);
|
|
988
|
+
// }
|
|
912
989
|
/**
|
|
913
990
|
* @see ClusterId.NWK_ENHANCED_UPDATE_REQUEST
|
|
914
991
|
* @param channelPages The set of channels (32-bit bitmap) for each channel page.
|
|
@@ -937,136 +1014,132 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
937
1014
|
* And in case of Enhanced Active scan EBR shall be sent with EPID filter instead of PJOIN filter.
|
|
938
1015
|
* Bit 1-7: Reserved
|
|
939
1016
|
*/
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
buffalo.writeUInt8(channelPages.length);
|
|
1017
|
+
buildNwkEnhancedUpdateRequest(channelPages, duration, count, nwkUpdateId, nwkManagerAddr, configurationBitmask) {
|
|
1018
|
+
this.writeUInt8(channelPages.length);
|
|
943
1019
|
for (const channelPage of channelPages) {
|
|
944
|
-
|
|
1020
|
+
this.writeUInt32(channelPage);
|
|
945
1021
|
}
|
|
946
|
-
|
|
947
|
-
if (count
|
|
948
|
-
|
|
1022
|
+
this.writeUInt8(duration);
|
|
1023
|
+
if (count !== undefined && duration >= 0x00 && duration <= 0x05) {
|
|
1024
|
+
this.writeUInt8(count);
|
|
949
1025
|
}
|
|
950
|
-
if (nwkUpdateId
|
|
951
|
-
|
|
1026
|
+
if (nwkUpdateId !== undefined && (duration === 0xfe || duration === 0xff)) {
|
|
1027
|
+
this.writeUInt8(nwkUpdateId);
|
|
952
1028
|
}
|
|
953
|
-
if (nwkManagerAddr
|
|
954
|
-
|
|
1029
|
+
if (nwkManagerAddr !== undefined && duration === 0xff) {
|
|
1030
|
+
this.writeUInt16(nwkManagerAddr);
|
|
955
1031
|
}
|
|
956
1032
|
/* istanbul ignore else */
|
|
957
|
-
if (configurationBitmask
|
|
958
|
-
|
|
1033
|
+
if (configurationBitmask !== undefined) {
|
|
1034
|
+
this.writeUInt8(configurationBitmask);
|
|
959
1035
|
}
|
|
960
|
-
return
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
964
|
-
*/
|
|
965
|
-
static buildEnhancedScanChannelsRequest(channelPages, duration, count, configurationBitmask) {
|
|
966
|
-
return BuffaloZdo.buildNwkEnhancedUpdateRequest(channelPages, duration, count, null, null, configurationBitmask);
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
970
|
-
*/
|
|
971
|
-
static buildEnhancedChannelChangeRequest(channelPage, nwkUpdateId, configurationBitmask) {
|
|
972
|
-
return BuffaloZdo.buildNwkEnhancedUpdateRequest([channelPage], 0xfe, null, nwkUpdateId, null, configurationBitmask);
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
976
|
-
*/
|
|
977
|
-
static buildEnhancedSetActiveChannelsAndNwkManagerIdRequest(channelPages, nwkUpdateId, nwkManagerAddr, configurationBitmask) {
|
|
978
|
-
return BuffaloZdo.buildNwkEnhancedUpdateRequest(channelPages, 0xff, null, nwkUpdateId, nwkManagerAddr, configurationBitmask);
|
|
1036
|
+
return this.getWritten();
|
|
979
1037
|
}
|
|
1038
|
+
// /**
|
|
1039
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1040
|
+
// */
|
|
1041
|
+
// private buildEnhancedScanChannelsRequest(channelPages: number[], duration: number, count: number, configurationBitmask: number | undefined): Buffer {
|
|
1042
|
+
// return this.buildNwkEnhancedUpdateRequest(channelPages, duration, count, undefined, undefined, configurationBitmask);
|
|
1043
|
+
// }
|
|
1044
|
+
// /**
|
|
1045
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1046
|
+
// */
|
|
1047
|
+
// private buildEnhancedChannelChangeRequest(channelPage: number, nwkUpdateId: number | undefined, configurationBitmask: number | undefined): Buffer {
|
|
1048
|
+
// return this.buildNwkEnhancedUpdateRequest([channelPage], 0xfe, undefined, nwkUpdateId, undefined, configurationBitmask);
|
|
1049
|
+
// }
|
|
1050
|
+
// /**
|
|
1051
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1052
|
+
// */
|
|
1053
|
+
// private buildEnhancedSetActiveChannelsAndNwkManagerIdRequest(
|
|
1054
|
+
// channelPages: number[],
|
|
1055
|
+
// nwkUpdateId: number | undefined,
|
|
1056
|
+
// nwkManagerAddr: NodeId,
|
|
1057
|
+
// configurationBitmask: number | undefined,
|
|
1058
|
+
// ): Buffer {
|
|
1059
|
+
// return this.buildNwkEnhancedUpdateRequest(channelPages, 0xff, undefined, nwkUpdateId, nwkManagerAddr, configurationBitmask);
|
|
1060
|
+
// }
|
|
980
1061
|
/**
|
|
981
1062
|
* @see ClusterId.NWK_IEEE_JOINING_LIST_REQUEST
|
|
982
1063
|
* @param startIndex The starting index into the receiving device’s nwkIeeeJoiningList that SHALL be sent back.
|
|
983
1064
|
*/
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
return buffalo.getWritten();
|
|
1065
|
+
buildNwkIEEEJoiningListRequest(startIndex) {
|
|
1066
|
+
this.writeUInt8(startIndex);
|
|
1067
|
+
return this.getWritten();
|
|
988
1068
|
}
|
|
989
1069
|
/**
|
|
990
1070
|
* @see ClusterId.NWK_BEACON_SURVEY_REQUEST
|
|
991
1071
|
*/
|
|
992
|
-
|
|
993
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1072
|
+
buildNwkBeaconSurveyRequest(tlv) {
|
|
994
1073
|
// BeaconSurveyConfigurationTLV: Local: ID: 0x00
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
return
|
|
1074
|
+
this.writeUInt8(0x00);
|
|
1075
|
+
this.writeUInt8(2 + tlv.scanChannelList.length * 4 - 1);
|
|
1076
|
+
this.writeUInt8(tlv.scanChannelList.length);
|
|
1077
|
+
this.writeListUInt32(tlv.scanChannelList);
|
|
1078
|
+
this.writeUInt8(tlv.configurationBitmask);
|
|
1079
|
+
return this.getWritten();
|
|
1001
1080
|
}
|
|
1002
1081
|
/**
|
|
1003
1082
|
* @see ClusterId.START_KEY_NEGOTIATION_REQUEST
|
|
1004
1083
|
*/
|
|
1005
|
-
|
|
1006
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1084
|
+
buildStartKeyNegotiationRequest(tlv) {
|
|
1007
1085
|
// Curve25519PublicPointTLV: Local: ID: 0x00
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
return
|
|
1086
|
+
this.writeUInt8(0x00);
|
|
1087
|
+
this.writeUInt8(consts_1.EUI64_SIZE + consts_2.CURVE_PUBLIC_POINT_SIZE - 1);
|
|
1088
|
+
this.writeIeeeAddr(tlv.eui64);
|
|
1089
|
+
this.writeBuffer(tlv.publicPoint, consts_2.CURVE_PUBLIC_POINT_SIZE);
|
|
1090
|
+
return this.getWritten();
|
|
1013
1091
|
}
|
|
1014
1092
|
/**
|
|
1015
1093
|
* @see ClusterId.RETRIEVE_AUTHENTICATION_TOKEN_REQUEST
|
|
1016
1094
|
*/
|
|
1017
|
-
|
|
1018
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1095
|
+
buildRetrieveAuthenticationTokenRequest(tlv) {
|
|
1019
1096
|
// AuthenticationTokenIdTLV: Local: ID: 0x00
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
return
|
|
1097
|
+
this.writeUInt8(0x00);
|
|
1098
|
+
this.writeUInt8(1 - 1);
|
|
1099
|
+
this.writeUInt8(tlv.tlvTypeTagId);
|
|
1100
|
+
return this.getWritten();
|
|
1024
1101
|
}
|
|
1025
1102
|
/**
|
|
1026
1103
|
* @see ClusterId.GET_AUTHENTICATION_LEVEL_REQUEST
|
|
1027
1104
|
*/
|
|
1028
|
-
|
|
1029
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1105
|
+
buildGetAuthenticationLevelRequest(tlv) {
|
|
1030
1106
|
// TargetIEEEAddressTLV: Local: ID: 0x00
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
return
|
|
1107
|
+
this.writeUInt8(0x00);
|
|
1108
|
+
this.writeUInt8(consts_1.EUI64_SIZE - 1);
|
|
1109
|
+
this.writeIeeeAddr(tlv.ieee);
|
|
1110
|
+
return this.getWritten();
|
|
1035
1111
|
}
|
|
1036
1112
|
/**
|
|
1037
1113
|
* @see ClusterId.SET_CONFIGURATION_REQUEST
|
|
1038
1114
|
*/
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
return buffalo.getWritten();
|
|
1115
|
+
buildSetConfigurationRequest(nextPanIdChange, nextChannelChange, configurationParameters) {
|
|
1116
|
+
this.writeGlobalTLV({ tagId: enums_1.GlobalTLV.NEXT_PAN_ID_CHANGE, length: consts_1.PAN_ID_SIZE, tlv: nextPanIdChange });
|
|
1117
|
+
this.writeGlobalTLV({ tagId: enums_1.GlobalTLV.NEXT_CHANNEL_CHANGE, length: 4, tlv: nextChannelChange });
|
|
1118
|
+
this.writeGlobalTLV({ tagId: enums_1.GlobalTLV.CONFIGURATION_PARAMETERS, length: 2, tlv: configurationParameters });
|
|
1119
|
+
return this.getWritten();
|
|
1045
1120
|
}
|
|
1046
1121
|
/**
|
|
1047
1122
|
* @see ClusterId.GET_CONFIGURATION_REQUEST
|
|
1048
1123
|
* @param tlvIds The IDs of each TLV that are being requested.
|
|
1049
1124
|
* Maximum number dependent on the underlying maximum size of the message as allowed by fragmentation.
|
|
1050
1125
|
*/
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
buffalo.writeUInt8(tlvIds.length);
|
|
1126
|
+
buildGetConfigurationRequest(tlvIds) {
|
|
1127
|
+
this.writeUInt8(tlvIds.length);
|
|
1054
1128
|
for (const tlvId of tlvIds) {
|
|
1055
|
-
|
|
1129
|
+
this.writeUInt8(tlvId);
|
|
1056
1130
|
}
|
|
1057
|
-
return
|
|
1131
|
+
return this.getWritten();
|
|
1058
1132
|
}
|
|
1059
1133
|
/**
|
|
1060
1134
|
* @see ClusterId.START_KEY_UPDATE_REQUEST
|
|
1061
1135
|
*/
|
|
1062
|
-
|
|
1063
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1136
|
+
buildStartKeyUpdateRequest(selectedKeyNegotiationMethod, fragmentationParameters) {
|
|
1064
1137
|
// SelectedKeyNegotiationMethodTLV: Local: ID: 0x00
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1138
|
+
this.writeUInt8(0x00);
|
|
1139
|
+
this.writeUInt8(consts_1.EUI64_SIZE + 2 - 1);
|
|
1140
|
+
this.writeUInt8(selectedKeyNegotiationMethod.protocol);
|
|
1141
|
+
this.writeUInt8(selectedKeyNegotiationMethod.presharedSecret);
|
|
1142
|
+
this.writeIeeeAddr(selectedKeyNegotiationMethod.sendingDeviceEui64);
|
|
1070
1143
|
{
|
|
1071
1144
|
let length = 2;
|
|
1072
1145
|
/* istanbul ignore else */
|
|
@@ -1077,39 +1150,40 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1077
1150
|
if (fragmentationParameters.maxIncomingTransferUnit) {
|
|
1078
1151
|
length += 2;
|
|
1079
1152
|
}
|
|
1080
|
-
|
|
1153
|
+
this.writeGlobalTLV({ tagId: enums_1.GlobalTLV.FRAGMENTATION_PARAMETERS, length, tlv: fragmentationParameters });
|
|
1081
1154
|
}
|
|
1082
|
-
return
|
|
1155
|
+
return this.getWritten();
|
|
1083
1156
|
}
|
|
1084
1157
|
/**
|
|
1085
1158
|
* @see ClusterId.DECOMMISSION_REQUEST
|
|
1086
1159
|
*/
|
|
1087
|
-
|
|
1088
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1160
|
+
buildDecommissionRequest(tlv) {
|
|
1089
1161
|
// DeviceEUI64ListTLV: Local: ID: 0x00
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1162
|
+
this.writeUInt8(0x00);
|
|
1163
|
+
this.writeUInt8(tlv.eui64List.length * consts_1.EUI64_SIZE + 1 - 1);
|
|
1164
|
+
this.writeUInt8(tlv.eui64List.length);
|
|
1093
1165
|
for (const eui64 of tlv.eui64List) {
|
|
1094
|
-
|
|
1166
|
+
this.writeIeeeAddr(eui64);
|
|
1095
1167
|
}
|
|
1096
|
-
return
|
|
1168
|
+
return this.getWritten();
|
|
1097
1169
|
}
|
|
1098
1170
|
/**
|
|
1099
1171
|
* @see ClusterId.CHALLENGE_REQUEST
|
|
1100
1172
|
*/
|
|
1101
|
-
|
|
1102
|
-
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), consts_2.ZDO_MESSAGE_OVERHEAD);
|
|
1173
|
+
buildChallengeRequest(tlv) {
|
|
1103
1174
|
// APSFrameCounterChallengeTLV: Local: ID: 0x00
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
return
|
|
1175
|
+
this.writeUInt8(0x00);
|
|
1176
|
+
this.writeUInt8(consts_1.EUI64_SIZE + consts_2.CHALLENGE_VALUE_SIZE - 1);
|
|
1177
|
+
this.writeIeeeAddr(tlv.senderEui64);
|
|
1178
|
+
this.writeBuffer(tlv.challengeValue, consts_2.CHALLENGE_VALUE_SIZE);
|
|
1179
|
+
return this.getWritten();
|
|
1109
1180
|
}
|
|
1110
1181
|
//-- RESPONSES
|
|
1111
|
-
static
|
|
1112
|
-
|
|
1182
|
+
static checkStatus(result) {
|
|
1183
|
+
return result[0] === status_1.Status.SUCCESS;
|
|
1184
|
+
}
|
|
1185
|
+
static readResponse(hasZdoMessageOverhead, clusterId, buffer) {
|
|
1186
|
+
const buffalo = new BuffaloZdo(buffer, hasZdoMessageOverhead ? consts_2.ZDO_MESSAGE_OVERHEAD : 0); // set pos to skip `transaction sequence number`
|
|
1113
1187
|
switch (clusterId) {
|
|
1114
1188
|
case clusters_1.ClusterId.NETWORK_ADDRESS_RESPONSE: {
|
|
1115
1189
|
return buffalo.readNetworkAddressResponse();
|
|
@@ -1171,7 +1245,7 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1171
1245
|
case clusters_1.ClusterId.NWK_ENHANCED_UPDATE_RESPONSE: {
|
|
1172
1246
|
return buffalo.readNwkEnhancedUpdateResponse();
|
|
1173
1247
|
}
|
|
1174
|
-
case clusters_1.ClusterId.
|
|
1248
|
+
case clusters_1.ClusterId.NWK_IEEE_JOINING_LIST_RESPONSE: {
|
|
1175
1249
|
return buffalo.readNwkIEEEJoiningListResponse();
|
|
1176
1250
|
}
|
|
1177
1251
|
case clusters_1.ClusterId.NWK_UNSOLICITED_ENHANCED_UPDATE_RESPONSE: {
|
|
@@ -1213,12 +1287,10 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1213
1287
|
* @see ClusterId.NETWORK_ADDRESS_RESPONSE
|
|
1214
1288
|
*/
|
|
1215
1289
|
readNetworkAddressResponse() {
|
|
1290
|
+
// INV_REQUESTTYPE or DEVICE_NOT_FOUND
|
|
1216
1291
|
const status = this.readUInt8();
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1220
|
-
}
|
|
1221
|
-
else {
|
|
1292
|
+
let result;
|
|
1293
|
+
if (status == status_1.Status.SUCCESS) {
|
|
1222
1294
|
const eui64 = this.readIeeeAddr();
|
|
1223
1295
|
const nwkAddress = this.readUInt16();
|
|
1224
1296
|
let assocDevCount = 0;
|
|
@@ -1229,24 +1301,23 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1229
1301
|
startIndex = this.readUInt8();
|
|
1230
1302
|
assocDevList = this.readListUInt16(assocDevCount);
|
|
1231
1303
|
}
|
|
1232
|
-
|
|
1304
|
+
result = {
|
|
1233
1305
|
eui64,
|
|
1234
1306
|
nwkAddress,
|
|
1235
1307
|
startIndex,
|
|
1236
1308
|
assocDevList,
|
|
1237
1309
|
};
|
|
1238
1310
|
}
|
|
1311
|
+
return [status, result];
|
|
1239
1312
|
}
|
|
1240
1313
|
/**
|
|
1241
1314
|
* @see ClusterId.IEEE_ADDRESS_RESPONSE
|
|
1242
1315
|
*/
|
|
1243
1316
|
readIEEEAddressResponse() {
|
|
1317
|
+
// INV_REQUESTTYPE or DEVICE_NOT_FOUND
|
|
1244
1318
|
const status = this.readUInt8();
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1248
|
-
}
|
|
1249
|
-
else {
|
|
1319
|
+
let result;
|
|
1320
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1250
1321
|
const eui64 = this.readIeeeAddr();
|
|
1251
1322
|
const nwkAddress = this.readUInt16();
|
|
1252
1323
|
let assocDevCount = 0;
|
|
@@ -1257,24 +1328,23 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1257
1328
|
startIndex = this.readUInt8();
|
|
1258
1329
|
assocDevList = this.readListUInt16(assocDevCount);
|
|
1259
1330
|
}
|
|
1260
|
-
|
|
1331
|
+
result = {
|
|
1261
1332
|
eui64,
|
|
1262
1333
|
nwkAddress,
|
|
1263
1334
|
startIndex,
|
|
1264
1335
|
assocDevList,
|
|
1265
1336
|
};
|
|
1266
1337
|
}
|
|
1338
|
+
return [status, result];
|
|
1267
1339
|
}
|
|
1268
1340
|
/**
|
|
1269
1341
|
* @see ClusterId.NODE_DESCRIPTOR_RESPONSE
|
|
1270
1342
|
*/
|
|
1271
1343
|
readNodeDescriptorResponse() {
|
|
1344
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1272
1345
|
const status = this.readUInt8();
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1276
|
-
}
|
|
1277
|
-
else {
|
|
1346
|
+
let result;
|
|
1347
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1278
1348
|
const nwkAddress = this.readUInt16();
|
|
1279
1349
|
// in bits: [logical type: 3] [deprecated: 1] [deprecated: 1] [fragmentation supported (R23): 1] [reserved/unused: 2]
|
|
1280
1350
|
const nodeDescByte1 = this.readUInt8();
|
|
@@ -1289,10 +1359,10 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1289
1359
|
const deprecated1 = this.readUInt8();
|
|
1290
1360
|
// Global: FragmentationParametersGlobalTLV
|
|
1291
1361
|
const tlvs = this.readTLVs();
|
|
1292
|
-
|
|
1362
|
+
result = {
|
|
1293
1363
|
nwkAddress,
|
|
1294
1364
|
logicalType: nodeDescByte1 & 0x07,
|
|
1295
|
-
fragmentationSupported: serverMask.
|
|
1365
|
+
fragmentationSupported: serverMask.stackComplianceRevision >= 23 ? (nodeDescByte1 & 0x20) >> 5 === 1 : undefined,
|
|
1296
1366
|
apsFlags: nodeDescByte2 & 0x07,
|
|
1297
1367
|
frequencyBand: (nodeDescByte2 & 0xf8) >> 3,
|
|
1298
1368
|
capabilities: macCapFlags,
|
|
@@ -1305,21 +1375,20 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1305
1375
|
tlvs,
|
|
1306
1376
|
};
|
|
1307
1377
|
}
|
|
1378
|
+
return [status, result];
|
|
1308
1379
|
}
|
|
1309
1380
|
/**
|
|
1310
1381
|
* @see ClusterId.POWER_DESCRIPTOR_RESPONSE
|
|
1311
1382
|
*/
|
|
1312
1383
|
readPowerDescriptorResponse() {
|
|
1384
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1313
1385
|
const status = this.readUInt8();
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1317
|
-
}
|
|
1318
|
-
else {
|
|
1386
|
+
let result;
|
|
1387
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1319
1388
|
const nwkAddress = this.readUInt16();
|
|
1320
1389
|
const byte1 = this.readUInt8();
|
|
1321
1390
|
const byte2 = this.readUInt8();
|
|
1322
|
-
|
|
1391
|
+
result = {
|
|
1323
1392
|
nwkAddress,
|
|
1324
1393
|
currentPowerMode: byte1 & 0xf,
|
|
1325
1394
|
availPowerSources: (byte1 >> 4) & 0xf,
|
|
@@ -1327,20 +1396,18 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1327
1396
|
currentPowerSourceLevel: (byte2 >> 4) & 0xf,
|
|
1328
1397
|
};
|
|
1329
1398
|
}
|
|
1399
|
+
return [status, result];
|
|
1330
1400
|
}
|
|
1331
1401
|
/**
|
|
1332
1402
|
* @see ClusterId.SIMPLE_DESCRIPTOR_RESPONSE
|
|
1333
1403
|
*/
|
|
1334
1404
|
readSimpleDescriptorResponse() {
|
|
1405
|
+
// INVALID_EP, NOT_ACTIVE, DEVICE_NOT_FOUND, INV_REQUESTTYPE or NO_DESCRIPTOR
|
|
1335
1406
|
const status = this.readUInt8();
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1339
|
-
}
|
|
1340
|
-
else {
|
|
1407
|
+
let result;
|
|
1408
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1341
1409
|
const nwkAddress = this.readUInt16();
|
|
1342
1410
|
// Length in bytes of the Simple Descriptor to follow. [0x00-0xff]
|
|
1343
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1344
1411
|
const length = this.readUInt8();
|
|
1345
1412
|
const endpoint = this.readUInt8();
|
|
1346
1413
|
const profileId = this.readUInt16();
|
|
@@ -1350,8 +1417,9 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1350
1417
|
const inClusterList = this.readListUInt16(inClusterCount); // empty if inClusterCount==0
|
|
1351
1418
|
const outClusterCount = this.readUInt8();
|
|
1352
1419
|
const outClusterList = this.readListUInt16(outClusterCount); // empty if outClusterCount==0
|
|
1353
|
-
|
|
1420
|
+
result = {
|
|
1354
1421
|
nwkAddress,
|
|
1422
|
+
length,
|
|
1355
1423
|
endpoint,
|
|
1356
1424
|
profileId,
|
|
1357
1425
|
deviceId,
|
|
@@ -1360,44 +1428,43 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1360
1428
|
outClusterList,
|
|
1361
1429
|
};
|
|
1362
1430
|
}
|
|
1431
|
+
return [status, result];
|
|
1363
1432
|
}
|
|
1364
1433
|
/**
|
|
1365
1434
|
* @see ClusterId.ACTIVE_ENDPOINTS_RESPONSE
|
|
1366
1435
|
*/
|
|
1367
1436
|
readActiveEndpointsResponse() {
|
|
1437
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1368
1438
|
const status = this.readUInt8();
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1372
|
-
}
|
|
1373
|
-
else {
|
|
1439
|
+
let result;
|
|
1440
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1374
1441
|
const nwkAddress = this.readUInt16();
|
|
1375
1442
|
const endpointCount = this.readUInt8();
|
|
1376
1443
|
const endpointList = this.readListUInt8(endpointCount);
|
|
1377
|
-
|
|
1444
|
+
result = {
|
|
1378
1445
|
nwkAddress,
|
|
1379
1446
|
endpointList,
|
|
1380
1447
|
};
|
|
1381
1448
|
}
|
|
1449
|
+
return [status, result];
|
|
1382
1450
|
}
|
|
1383
1451
|
/**
|
|
1384
1452
|
* @see ClusterId.MATCH_DESCRIPTORS_RESPONSE
|
|
1385
1453
|
*/
|
|
1386
1454
|
readMatchDescriptorsResponse() {
|
|
1455
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1387
1456
|
const status = this.readUInt8();
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1391
|
-
}
|
|
1392
|
-
else {
|
|
1457
|
+
let result;
|
|
1458
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1393
1459
|
const nwkAddress = this.readUInt16();
|
|
1394
1460
|
const endpointCount = this.readUInt8();
|
|
1395
1461
|
const endpointList = this.readListUInt8(endpointCount);
|
|
1396
|
-
|
|
1462
|
+
result = {
|
|
1397
1463
|
nwkAddress,
|
|
1398
1464
|
endpointList,
|
|
1399
1465
|
};
|
|
1400
1466
|
}
|
|
1467
|
+
return [status, result];
|
|
1401
1468
|
}
|
|
1402
1469
|
/**
|
|
1403
1470
|
* @see ClusterId.END_DEVICE_ANNOUNCE
|
|
@@ -1407,89 +1474,76 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1407
1474
|
const eui64 = this.readIeeeAddr();
|
|
1408
1475
|
/** @see MACCapabilityFlags */
|
|
1409
1476
|
const capabilities = this.readUInt8();
|
|
1410
|
-
return { nwkAddress, eui64, capabilities: Utils.getMacCapFlags(capabilities) };
|
|
1477
|
+
return [status_1.Status.SUCCESS, { nwkAddress, eui64, capabilities: Utils.getMacCapFlags(capabilities) }];
|
|
1411
1478
|
}
|
|
1412
1479
|
/**
|
|
1413
1480
|
* @see ClusterId.SYSTEM_SERVER_DISCOVERY_RESPONSE
|
|
1414
1481
|
*/
|
|
1415
1482
|
readSystemServerDiscoveryResponse() {
|
|
1483
|
+
// never expected !== SUCCESS
|
|
1416
1484
|
const status = this.readUInt8();
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1420
|
-
}
|
|
1421
|
-
else {
|
|
1485
|
+
let result;
|
|
1486
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1422
1487
|
const serverMask = Utils.getServerMask(this.readUInt16());
|
|
1423
|
-
|
|
1488
|
+
result = {
|
|
1424
1489
|
serverMask,
|
|
1425
1490
|
};
|
|
1426
1491
|
}
|
|
1492
|
+
return [status, result];
|
|
1427
1493
|
}
|
|
1428
1494
|
/**
|
|
1429
1495
|
* @see ClusterId.PARENT_ANNOUNCE_RESPONSE
|
|
1430
1496
|
*/
|
|
1431
1497
|
readParentAnnounceResponse() {
|
|
1498
|
+
// NOT_SUPPORTED
|
|
1432
1499
|
const status = this.readUInt8();
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1436
|
-
}
|
|
1437
|
-
else {
|
|
1500
|
+
let result;
|
|
1501
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1438
1502
|
const numberOfChildren = this.readUInt8();
|
|
1439
1503
|
const children = [];
|
|
1440
1504
|
for (let i = 0; i < numberOfChildren; i++) {
|
|
1441
1505
|
const childEui64 = this.readIeeeAddr();
|
|
1442
1506
|
children.push(childEui64);
|
|
1443
1507
|
}
|
|
1444
|
-
|
|
1508
|
+
result = { children };
|
|
1445
1509
|
}
|
|
1510
|
+
return [status, result];
|
|
1446
1511
|
}
|
|
1447
1512
|
/**
|
|
1448
1513
|
* @see ClusterId.BIND_RESPONSE
|
|
1449
1514
|
* @returns No response payload, throws if not success
|
|
1450
1515
|
*/
|
|
1451
1516
|
readBindResponse() {
|
|
1517
|
+
// NOT_SUPPORTED, INVALID_EP, TABLE_FULL, or NOT_AUTHORIZED
|
|
1452
1518
|
const status = this.readUInt8();
|
|
1453
|
-
|
|
1454
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1455
|
-
// NOT_SUPPORTED, INVALID_EP, TABLE_FULL, or NOT_AUTHORIZED
|
|
1456
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1457
|
-
}
|
|
1519
|
+
return [status, undefined];
|
|
1458
1520
|
}
|
|
1459
1521
|
/**
|
|
1460
1522
|
* @see ClusterId.UNBIND_RESPONSE
|
|
1461
1523
|
* @returns No response payload, throws if not success
|
|
1462
1524
|
*/
|
|
1463
1525
|
readUnbindResponse() {
|
|
1526
|
+
// NOT_SUPPORTED, INVALID_EP, NO_ENTRY or NOT_AUTHORIZED
|
|
1464
1527
|
const status = this.readUInt8();
|
|
1465
|
-
|
|
1466
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1467
|
-
// NOT_SUPPORTED, INVALID_EP, NO_ENTRY or NOT_AUTHORIZED
|
|
1468
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1469
|
-
}
|
|
1528
|
+
return [status, undefined];
|
|
1470
1529
|
}
|
|
1471
1530
|
/**
|
|
1472
1531
|
* @see ClusterId.CLEAR_ALL_BINDINGS_RESPONSE
|
|
1473
1532
|
* @returns No response payload, throws if not success
|
|
1474
1533
|
*/
|
|
1475
1534
|
readClearAllBindingsResponse() {
|
|
1535
|
+
// NOT_SUPPORTED, NOT_AUTHORIZED, INV_REQUESTTYPE, or NO_MATCH.
|
|
1476
1536
|
const status = this.readUInt8();
|
|
1477
|
-
|
|
1478
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1479
|
-
// NOT_SUPPORTED, NOT_AUTHORIZED, INV_REQUESTTYPE, or NO_MATCH.
|
|
1480
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1481
|
-
}
|
|
1537
|
+
return [status, undefined];
|
|
1482
1538
|
}
|
|
1483
1539
|
/**
|
|
1484
1540
|
* @see ClusterId.LQI_TABLE_RESPONSE
|
|
1485
1541
|
*/
|
|
1486
1542
|
readLQITableResponse() {
|
|
1543
|
+
// NOT_SUPPORTED or any status code returned from the NLME-GET.confirm primitive.
|
|
1487
1544
|
const status = this.readUInt8();
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1491
|
-
}
|
|
1492
|
-
else {
|
|
1545
|
+
let result;
|
|
1546
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1493
1547
|
const neighborTableEntries = this.readUInt8();
|
|
1494
1548
|
const startIndex = this.readUInt8();
|
|
1495
1549
|
// [0x00-0x02]
|
|
@@ -1517,23 +1571,22 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1517
1571
|
lqi,
|
|
1518
1572
|
});
|
|
1519
1573
|
}
|
|
1520
|
-
|
|
1574
|
+
result = {
|
|
1521
1575
|
neighborTableEntries,
|
|
1522
1576
|
startIndex,
|
|
1523
1577
|
entryList,
|
|
1524
1578
|
};
|
|
1525
1579
|
}
|
|
1580
|
+
return [status, result];
|
|
1526
1581
|
}
|
|
1527
1582
|
/**
|
|
1528
1583
|
* @see ClusterId.ROUTING_TABLE_RESPONSE
|
|
1529
1584
|
*/
|
|
1530
1585
|
readRoutingTableResponse() {
|
|
1586
|
+
// NOT_SUPPORTED or any status code returned from the NLMEGET.confirm primitive.
|
|
1531
1587
|
const status = this.readUInt8();
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1535
|
-
}
|
|
1536
|
-
else {
|
|
1588
|
+
let result;
|
|
1589
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1537
1590
|
const routingTableEntries = this.readUInt8();
|
|
1538
1591
|
const startIndex = this.readUInt8();
|
|
1539
1592
|
// [0x00-0xFF]
|
|
@@ -1545,7 +1598,7 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1545
1598
|
const nextHopAddress = this.readUInt16();
|
|
1546
1599
|
entryList.push({
|
|
1547
1600
|
destinationAddress,
|
|
1548
|
-
status: statusByte & 0x07,
|
|
1601
|
+
status: enums_1.RoutingTableStatus[statusByte & 0x07],
|
|
1549
1602
|
memoryConstrained: (statusByte & 0x08) >> 3,
|
|
1550
1603
|
manyToOne: (statusByte & 0x10) >> 4,
|
|
1551
1604
|
routeRecordRequired: (statusByte & 0x20) >> 5,
|
|
@@ -1553,23 +1606,22 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1553
1606
|
nextHopAddress,
|
|
1554
1607
|
});
|
|
1555
1608
|
}
|
|
1556
|
-
|
|
1609
|
+
result = {
|
|
1557
1610
|
routingTableEntries,
|
|
1558
1611
|
startIndex,
|
|
1559
1612
|
entryList,
|
|
1560
1613
|
};
|
|
1561
1614
|
}
|
|
1615
|
+
return [status, result];
|
|
1562
1616
|
}
|
|
1563
1617
|
/**
|
|
1564
1618
|
* @see ClusterId.BINDING_TABLE_RESPONSE
|
|
1565
1619
|
*/
|
|
1566
1620
|
readBindingTableResponse() {
|
|
1621
|
+
// NOT_SUPPORTED or any status code returned from the APSMEGET.confirm primitive.
|
|
1567
1622
|
const status = this.readUInt8();
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1571
|
-
}
|
|
1572
|
-
else {
|
|
1623
|
+
let result;
|
|
1624
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1573
1625
|
const bindingTableEntries = this.readUInt8();
|
|
1574
1626
|
const startIndex = this.readUInt8();
|
|
1575
1627
|
// [0x00-0xFF]
|
|
@@ -1595,95 +1647,86 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1595
1647
|
destEndpoint,
|
|
1596
1648
|
});
|
|
1597
1649
|
}
|
|
1598
|
-
|
|
1650
|
+
result = {
|
|
1599
1651
|
bindingTableEntries,
|
|
1600
1652
|
startIndex,
|
|
1601
1653
|
entryList,
|
|
1602
1654
|
};
|
|
1603
1655
|
}
|
|
1656
|
+
return [status, result];
|
|
1604
1657
|
}
|
|
1605
1658
|
/**
|
|
1606
1659
|
* @see ClusterId.LEAVE_RESPONSE
|
|
1607
1660
|
* @returns No response payload, throws if not success
|
|
1608
1661
|
*/
|
|
1609
1662
|
readLeaveResponse() {
|
|
1663
|
+
// NOT_SUPPORTED, NOT_AUTHORIZED or any status code returned from the NLMELEAVE.confirm primitive.
|
|
1610
1664
|
const status = this.readUInt8();
|
|
1611
|
-
|
|
1612
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1613
|
-
// NOT_SUPPORTED, NOT_AUTHORIZED or any status code returned from the NLMELEAVE.confirm primitive.
|
|
1614
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1615
|
-
}
|
|
1665
|
+
return [status, undefined];
|
|
1616
1666
|
}
|
|
1617
1667
|
/**
|
|
1618
1668
|
* @see ClusterId.PERMIT_JOINING_RESPONSE
|
|
1619
1669
|
* @returns No response payload, throws if not success
|
|
1620
1670
|
*/
|
|
1621
1671
|
readPermitJoiningResponse() {
|
|
1672
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED, or any status code returned from the NLME-PERMIT-JOINING.confirm primitive.
|
|
1622
1673
|
const status = this.readUInt8();
|
|
1623
|
-
|
|
1624
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1625
|
-
// INV_REQUESTTYPE, NOT_AUTHORIZED, or any status code returned from the NLME-PERMIT-JOINING.confirm primitive.
|
|
1626
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1627
|
-
}
|
|
1674
|
+
return [status, undefined];
|
|
1628
1675
|
}
|
|
1629
1676
|
/**
|
|
1630
1677
|
* @see ClusterId.NWK_UPDATE_RESPONSE
|
|
1631
1678
|
*/
|
|
1632
1679
|
readNwkUpdateResponse() {
|
|
1680
|
+
// INV_REQUESTTYPE, NOT_SUPPORTED, or any status values returned from the MLME-SCAN.confirm primitive
|
|
1633
1681
|
const status = this.readUInt8();
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1637
|
-
}
|
|
1638
|
-
else {
|
|
1682
|
+
let result;
|
|
1683
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1639
1684
|
const scannedChannels = this.readUInt32();
|
|
1640
1685
|
const totalTransmissions = this.readUInt16();
|
|
1641
1686
|
const totalFailures = this.readUInt16();
|
|
1642
1687
|
// [0x00-0xFF]
|
|
1643
1688
|
const entryCount = this.readUInt8();
|
|
1644
1689
|
const entryList = this.readListUInt8(entryCount);
|
|
1645
|
-
|
|
1690
|
+
result = {
|
|
1646
1691
|
scannedChannels,
|
|
1647
1692
|
totalTransmissions,
|
|
1648
1693
|
totalFailures,
|
|
1649
1694
|
entryList,
|
|
1650
1695
|
};
|
|
1651
1696
|
}
|
|
1697
|
+
return [status, result];
|
|
1652
1698
|
}
|
|
1653
1699
|
/**
|
|
1654
1700
|
* @see ClusterId.NWK_ENHANCED_UPDATE_RESPONSE
|
|
1655
1701
|
*/
|
|
1656
1702
|
readNwkEnhancedUpdateResponse() {
|
|
1703
|
+
// INV_REQUESTTYPE, NOT_SUPPORTED, or any status values returned from the MLME-SCAN.confirm primitive.
|
|
1657
1704
|
const status = this.readUInt8();
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1661
|
-
}
|
|
1662
|
-
else {
|
|
1705
|
+
let result;
|
|
1706
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1663
1707
|
const scannedChannels = this.readUInt32();
|
|
1664
1708
|
const totalTransmissions = this.readUInt16();
|
|
1665
1709
|
const totalFailures = this.readUInt16();
|
|
1666
1710
|
// [0x00-0xFF]
|
|
1667
1711
|
const entryCount = this.readUInt8();
|
|
1668
1712
|
const entryList = this.readListUInt8(entryCount);
|
|
1669
|
-
|
|
1713
|
+
result = {
|
|
1670
1714
|
scannedChannels,
|
|
1671
1715
|
totalTransmissions,
|
|
1672
1716
|
totalFailures,
|
|
1673
1717
|
entryList,
|
|
1674
1718
|
};
|
|
1675
1719
|
}
|
|
1720
|
+
return [status, result];
|
|
1676
1721
|
}
|
|
1677
1722
|
/**
|
|
1678
1723
|
* @see ClusterId.NWK_IEEE_JOINING_LIST_REPONSE
|
|
1679
1724
|
*/
|
|
1680
1725
|
readNwkIEEEJoiningListResponse() {
|
|
1726
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
1681
1727
|
const status = this.readUInt8();
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1685
|
-
}
|
|
1686
|
-
else {
|
|
1728
|
+
let result;
|
|
1729
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1687
1730
|
const updateId = this.readUInt8();
|
|
1688
1731
|
const joiningPolicy = this.readUInt8();
|
|
1689
1732
|
// [0x00-0xFF]
|
|
@@ -1699,7 +1742,7 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1699
1742
|
entryList.push(ieee);
|
|
1700
1743
|
}
|
|
1701
1744
|
}
|
|
1702
|
-
|
|
1745
|
+
result = {
|
|
1703
1746
|
updateId,
|
|
1704
1747
|
joiningPolicy,
|
|
1705
1748
|
entryListTotal,
|
|
@@ -1707,23 +1750,22 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1707
1750
|
entryList,
|
|
1708
1751
|
};
|
|
1709
1752
|
}
|
|
1753
|
+
return [status, result];
|
|
1710
1754
|
}
|
|
1711
1755
|
/**
|
|
1712
1756
|
* @see ClusterId.NWK_UNSOLICITED_ENHANCED_UPDATE_RESPONSE
|
|
1713
1757
|
*/
|
|
1714
1758
|
readNwkUnsolicitedEnhancedUpdateResponse() {
|
|
1759
|
+
// ??
|
|
1715
1760
|
const status = this.readUInt8();
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1719
|
-
}
|
|
1720
|
-
else {
|
|
1761
|
+
let result;
|
|
1762
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1721
1763
|
const channelInUse = this.readUInt32();
|
|
1722
1764
|
const macTxUCastTotal = this.readUInt16();
|
|
1723
1765
|
const macTxUCastFailures = this.readUInt16();
|
|
1724
1766
|
const macTxUCastRetries = this.readUInt16();
|
|
1725
1767
|
const timePeriod = this.readUInt8();
|
|
1726
|
-
|
|
1768
|
+
result = {
|
|
1727
1769
|
channelInUse,
|
|
1728
1770
|
macTxUCastTotal,
|
|
1729
1771
|
macTxUCastFailures,
|
|
@@ -1731,17 +1773,16 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1731
1773
|
timePeriod,
|
|
1732
1774
|
};
|
|
1733
1775
|
}
|
|
1776
|
+
return [status, result];
|
|
1734
1777
|
}
|
|
1735
1778
|
/**
|
|
1736
1779
|
* @see ClusterId.NWK_BEACON_SURVEY_RESPONSE
|
|
1737
1780
|
*/
|
|
1738
1781
|
readNwkBeaconSurveyResponse() {
|
|
1782
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
1739
1783
|
const status = this.readUInt8();
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1743
|
-
}
|
|
1744
|
-
else {
|
|
1784
|
+
let result;
|
|
1785
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1745
1786
|
const localTLVs = new Map([
|
|
1746
1787
|
// Local: ID: 0x01: BeaconSurveyResultsTLV
|
|
1747
1788
|
[0x01, this.readBeaconSurveyResultsTLV],
|
|
@@ -1749,146 +1790,135 @@ class BuffaloZdo extends buffalo_1.default {
|
|
|
1749
1790
|
[0x02, this.readPotentialParentsTLV],
|
|
1750
1791
|
]);
|
|
1751
1792
|
const tlvs = this.readTLVs(localTLVs);
|
|
1752
|
-
|
|
1793
|
+
result = {
|
|
1753
1794
|
tlvs,
|
|
1754
1795
|
};
|
|
1755
1796
|
}
|
|
1797
|
+
return [status, result];
|
|
1756
1798
|
}
|
|
1757
1799
|
/**
|
|
1758
1800
|
* @see ClusterId.START_KEY_NEGOTIATION_RESPONSE
|
|
1759
1801
|
*/
|
|
1760
1802
|
readStartKeyNegotiationResponse() {
|
|
1803
|
+
// INVALID_TLV, MISSING_TLV, TEMPORARY_FAILURE, NOT_AUTHORIZED
|
|
1761
1804
|
const status = this.readUInt8();
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1765
|
-
}
|
|
1766
|
-
else {
|
|
1805
|
+
let result;
|
|
1806
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1767
1807
|
const localTLVs = new Map([
|
|
1768
1808
|
// Local: ID: 0x00: Curve25519PublicPointTLV
|
|
1769
1809
|
[0x00, this.readCurve25519PublicPointTLV],
|
|
1770
1810
|
]);
|
|
1771
1811
|
const tlvs = this.readTLVs(localTLVs);
|
|
1772
|
-
|
|
1812
|
+
result = {
|
|
1773
1813
|
tlvs,
|
|
1774
1814
|
};
|
|
1775
1815
|
}
|
|
1816
|
+
return [status, result];
|
|
1776
1817
|
}
|
|
1777
1818
|
/**
|
|
1778
1819
|
* @see ClusterId.RETRIEVE_AUTHENTICATION_TOKEN_RESPONSE
|
|
1779
1820
|
*/
|
|
1780
1821
|
readRetrieveAuthenticationTokenResponse() {
|
|
1781
1822
|
const status = this.readUInt8();
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
}
|
|
1785
|
-
else {
|
|
1823
|
+
let result;
|
|
1824
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1786
1825
|
// no local TLV
|
|
1787
1826
|
const tlvs = this.readTLVs();
|
|
1788
|
-
|
|
1827
|
+
result = {
|
|
1789
1828
|
tlvs,
|
|
1790
1829
|
};
|
|
1791
1830
|
}
|
|
1831
|
+
return [status, result];
|
|
1792
1832
|
}
|
|
1793
1833
|
/**
|
|
1794
1834
|
* @see ClusterId.GET_AUTHENTICATION_LEVEL_RESPONSE
|
|
1795
1835
|
*/
|
|
1796
1836
|
readGetAuthenticationLevelResponse() {
|
|
1837
|
+
// NOT_SUPPORTED, INV_REQUESTTYPE, MISSING_TLV, and NOT_AUTHORIZED
|
|
1797
1838
|
const status = this.readUInt8();
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1801
|
-
}
|
|
1802
|
-
else {
|
|
1839
|
+
let result;
|
|
1840
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1803
1841
|
const localTLVs = new Map([
|
|
1804
1842
|
// Local: ID: 0x00: DeviceAuthenticationLevelTLV
|
|
1805
1843
|
[0x00, this.readDeviceAuthenticationLevelTLV],
|
|
1806
1844
|
]);
|
|
1807
1845
|
const tlvs = this.readTLVs(localTLVs);
|
|
1808
|
-
|
|
1846
|
+
result = {
|
|
1809
1847
|
tlvs,
|
|
1810
1848
|
};
|
|
1811
1849
|
}
|
|
1850
|
+
return [status, result];
|
|
1812
1851
|
}
|
|
1813
1852
|
/**
|
|
1814
1853
|
* @see ClusterId.SET_CONFIGURATION_RESPONSE
|
|
1815
1854
|
*/
|
|
1816
1855
|
readSetConfigurationResponse() {
|
|
1856
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
1817
1857
|
const status = this.readUInt8();
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1821
|
-
}
|
|
1822
|
-
else {
|
|
1858
|
+
let result;
|
|
1859
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1823
1860
|
const localTLVs = new Map([
|
|
1824
1861
|
// Local: ID: 0x00: ProcessingStatusTLV
|
|
1825
1862
|
[0x00, this.readProcessingStatusTLV],
|
|
1826
1863
|
]);
|
|
1827
1864
|
const tlvs = this.readTLVs(localTLVs);
|
|
1828
|
-
|
|
1865
|
+
result = {
|
|
1829
1866
|
tlvs,
|
|
1830
1867
|
};
|
|
1831
1868
|
}
|
|
1869
|
+
return [status, result];
|
|
1832
1870
|
}
|
|
1833
1871
|
/**
|
|
1834
1872
|
* @see ClusterId.GET_CONFIGURATION_RESPONSE
|
|
1835
1873
|
*/
|
|
1836
1874
|
readGetConfigurationResponse() {
|
|
1875
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
1837
1876
|
const status = this.readUInt8();
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1841
|
-
}
|
|
1842
|
-
else {
|
|
1877
|
+
let result;
|
|
1878
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1843
1879
|
// Global: IDs: x, y, z
|
|
1844
1880
|
const tlvs = this.readTLVs();
|
|
1845
|
-
|
|
1881
|
+
result = {
|
|
1846
1882
|
tlvs,
|
|
1847
1883
|
};
|
|
1848
1884
|
}
|
|
1885
|
+
return [status, result];
|
|
1849
1886
|
}
|
|
1850
1887
|
/**
|
|
1851
1888
|
* @see ClusterId.START_KEY_UPDATE_RESPONSE
|
|
1852
1889
|
* @returns No response payload, throws if not success
|
|
1853
1890
|
*/
|
|
1854
1891
|
readStartKeyUpdateResponse() {
|
|
1892
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
1855
1893
|
const status = this.readUInt8();
|
|
1856
|
-
|
|
1857
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1858
|
-
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
1859
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1860
|
-
}
|
|
1894
|
+
return [status, undefined];
|
|
1861
1895
|
}
|
|
1862
1896
|
/**
|
|
1863
1897
|
* @see ClusterId.DECOMMISSION_RESPONSE
|
|
1864
1898
|
* @returns No response payload, throws if not success
|
|
1865
1899
|
*/
|
|
1866
1900
|
readDecommissionResponse() {
|
|
1901
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
1867
1902
|
const status = this.readUInt8();
|
|
1868
|
-
|
|
1869
|
-
if (status !== status_1.Status.SUCCESS) {
|
|
1870
|
-
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
1871
|
-
throw new zdoStatusError_1.ZdoStatusError(status);
|
|
1872
|
-
}
|
|
1903
|
+
return [status, undefined];
|
|
1873
1904
|
}
|
|
1874
1905
|
/**
|
|
1875
1906
|
* @see ClusterId.CHALLENGE_RESPONSE
|
|
1876
1907
|
*/
|
|
1877
1908
|
readChallengeResponse() {
|
|
1878
1909
|
const status = this.readUInt8();
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1882
|
-
else {
|
|
1910
|
+
let result;
|
|
1911
|
+
if (status === status_1.Status.SUCCESS) {
|
|
1883
1912
|
const localTLVs = new Map([
|
|
1884
1913
|
// Local: ID: 0x00: APSFrameCounterResponseTLV
|
|
1885
1914
|
[0x00, this.readAPSFrameCounterResponseTLV],
|
|
1886
1915
|
]);
|
|
1887
1916
|
const tlvs = this.readTLVs(localTLVs);
|
|
1888
|
-
|
|
1917
|
+
result = {
|
|
1889
1918
|
tlvs,
|
|
1890
1919
|
};
|
|
1891
1920
|
}
|
|
1921
|
+
return [status, result];
|
|
1892
1922
|
}
|
|
1893
1923
|
}
|
|
1894
1924
|
exports.BuffaloZdo = BuffaloZdo;
|