📄 mt_zdo.lst
字号:
677 *msg++ = HI_UINT16( *AssocDevList );
678 *msg++ = LO_UINT16( *AssocDevList );
679 AssocDevList++;
680 }
681 else
682 {
683 *msg++ = 0;
684 *msg++ = 0;
685 }
686 }
687
688 MT_BuildAndSendZToolCB( type, len, pBuf );
689
690 osal_mem_free( pBuf );
691 }
692 }
693 #endif // ZDO_NWKADDR_REQUEST || ZDO_IEEEADDR_REQUEST
694
695 #if defined ( ZDO_NODEDESC_REQUEST )
696 /*********************************************************************
697 * @fn zdo_MTCB_NodeDescRspCB()
698 *
699 * @brief
700 *
701 * Called by ZDO when a Node_Desc_rsp message is received.
702 *
703 * @param SrcAddr - Source address
704 * @param Status - response status
705 * @param nwkAddr - 16 bit network address of device
706 * @param pNodeDesc - pointer to the devices Node Descriptor
707 * NULL if Status != ZDP_SUCCESS
708 *
709 * @return none
710 */
711 void zdo_MTCB_NodeDescRspCB( zAddrType_t *SrcAddr, byte Status, uint16 nwkAddr,
712 NodeDescriptorFormat_t *pNodeDesc )
713 {
714 byte buf[18];
715 byte *msg;
716
717 msg = buf;
718
719 //Fill up the data bytes
720 *msg++ = Status;
721 *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
722 *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
723
724 *msg++ = HI_UINT16( nwkAddr );
725 *msg++ = LO_UINT16( nwkAddr );
726
727 *msg++ = (byte)(pNodeDesc->LogicalType);
728
729 // Since Z-Tool can't treat V1.0 and V1.1 differently,
730 // we just output these two byte in both cases, although
731 // in V1.0, they are always zeros.
732 *msg++ = (byte) pNodeDesc->ComplexDescAvail;
733 *msg++ = (byte) pNodeDesc->UserDescAvail;
734
735 *msg++ = pNodeDesc->APSFlags;
736 *msg++ = pNodeDesc->FrequencyBand;
737 *msg++ = pNodeDesc->CapabilityFlags;
738 *msg++ = pNodeDesc->ManufacturerCode[1];
739 *msg++ = pNodeDesc->ManufacturerCode[0];
740 *msg++ = pNodeDesc->MaxBufferSize;
741 *msg++ = pNodeDesc->MaxTransferSize[1];
742 *msg++ = pNodeDesc->MaxTransferSize[0];
743 *msg++ = HI_UINT16( pNodeDesc->ServerMask);
744 *msg++ = LO_UINT16( pNodeDesc->ServerMask);
745
746 MT_BuildAndSendZToolCB( SPI_CB_ZDO_NODE_DESC_RSP, 18, buf );
747 }
748 #endif // ZDO_NODEDESC_REQUEST
749
750 #if defined ( ZDO_POWERDESC_REQUEST )
751 /*********************************************************************
752 * @fn zdo_MTCB_PowerDescRspCB()
753 *
754 * @brief
755 *
756 * Called by ZDO when a Power_Desc_rsp message is received.
757 *
758 * @param SrcAddr - Source address
759 * @param Status - response status
760 * @param nwkAddr - 16 bit network address of device
761 * @param pPwrDesc - pointer to the devices Power Descriptor
762 * NULL if Status != ZDP_SUCCESS
763 *
764 * @return none
765 */
766 void zdo_MTCB_PowerDescRspCB( zAddrType_t *SrcAddr, byte Status,
767 uint16 nwkAddr, NodePowerDescriptorFormat_t *pPwrDesc )
768 {
769 byte buf[9];
770 byte *msg;
771
772 msg = buf;
773
774 //Fill up the data bytes
775 *msg++ = Status;
776 *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
777 *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
778 *msg++ = HI_UINT16( nwkAddr );
779 *msg++ = LO_UINT16( nwkAddr );
780
781 *msg++ = pPwrDesc->PowerMode;
782 *msg++ = pPwrDesc->AvailablePowerSources;
783 *msg++ = pPwrDesc->CurrentPowerSource;
784 *msg = pPwrDesc->CurrentPowerSourceLevel;
785
786 MT_BuildAndSendZToolCB( SPI_CB_ZDO_POWER_DESC_RSP, 9, buf );
787 }
788 #endif // ZDO_POWERDESC_REQUEST
789
790 #if defined ( ZDO_SIMPLEDESC_REQUEST )
791 #define ZDO_SIMPLE_DESC_CB_LEN 78
792 /*********************************************************************
793 * @fn zdo_MTCB_SimpleDescRspCB()
794 *
795 * @brief
796 *
797 * Called by ZDO when a Simple_Desc_rsp message is received.
798 *
799 * @param SrcAddr - Source address
800 * @param Status - response status
801 * @param nwkAddr - 16 bit network address of device
802 * @param EPIntf - Endpoint/Interface for description
803 * @param pSimpleDesc - pointer to the devices Simple Descriptor
804 * NULL if Status != ZDP_SUCCESS
805 *
806 * @return none
807 */
808 void zdo_MTCB_SimpleDescRspCB( zAddrType_t *SrcAddr, byte Status,
809 uint16 nwkAddr, byte EPIntf, SimpleDescriptionFormat_t *pSimpleDesc )
810 {
811 byte *msgPtr;
812 byte *msg;
813 byte x;
814
815 msgPtr = osal_mem_alloc( ZDO_SIMPLE_DESC_CB_LEN );
816 if ( msgPtr )
817 {
818 msg = msgPtr;
819
820 //Fill up the data bytes
821 *msg++ = Status;
822 *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
823 *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
824 *msg++ = HI_UINT16( nwkAddr );
825 *msg++ = LO_UINT16( nwkAddr );
826
827 *msg++ = EPIntf;
828
829 *msg++ = HI_UINT16( pSimpleDesc->AppProfId );
830 *msg++ = LO_UINT16( pSimpleDesc->AppProfId );
831 *msg++ = HI_UINT16( pSimpleDesc->AppDeviceId );
832 *msg++ = LO_UINT16( pSimpleDesc->AppDeviceId );
833
834 *msg++ = pSimpleDesc->AppDevVer;
835 *msg++ = pSimpleDesc->Reserved;
836
837 *msg++ = pSimpleDesc->AppNumInClusters;
838 // ZTool supports 16 bits the code has taken it into account
839 for ( x = 0; x < 16; x++ )
840 {
841 if ( x < pSimpleDesc->AppNumInClusters )
842 {
843 *msg++ = HI_UINT16( pSimpleDesc->pAppInClusterList[x]);
844 *msg++ = LO_UINT16( pSimpleDesc->pAppInClusterList[x]);
845 }
846 else
847 {
848 *msg++ = 0;
849 *msg++ = 0;
850 }
851 }
852 *msg++ = pSimpleDesc->AppNumOutClusters;
853
854 for ( x = 0; x < 16; x++ )
855 {
856 if ( x < pSimpleDesc->AppNumOutClusters )
857 {
858 *msg++ = HI_UINT16( pSimpleDesc->pAppOutClusterList[x]);
859 *msg++ = LO_UINT16( pSimpleDesc->pAppOutClusterList[x]);
860 }
861 else
862 {
863 *msg++ = 0;
864 *msg++ = 0;
865 }
866 }
867
868 MT_BuildAndSendZToolCB( SPI_CB_ZDO_SIMPLE_DESC_RSP, ZDO_SIMPLE_DESC_CB_LEN, msgPtr );
869
870 osal_mem_free( msgPtr );
871 }
872 }
873 #endif // ZDO_SIMPLEDESC_REQUEST
874
875 #if defined ( ZDO_ACTIVEEP_REQUEST ) || defined ( ZDO_MATCH_REQUEST )
876 /*********************************************************************
877 * @fn zdo_MTCB_ActiveEPRspCB()
878 *
879 * @brief
880 *
881 * Called by ZDO when a Active_EP_rsp or Match_Desc_rsp message is received.
882 *
883 * @param SrcAddr - Source address
884 * @param Status - response status
885 * @param nwkAddr - Device's short address that this response describes
886 * @param epIntfCnt - number of epIntfList items
887 * @param epIntfList - array of active endpoint/interfaces.
888 *
889 * @return none
890 */
891 void zdo_MTCB_MatchActiveEPRspCB( uint16 type, zAddrType_t *SrcAddr, byte Status,
892 uint16 nwkAddr, byte epIntfCnt, byte *epIntfList )
893 {
894 byte buf[22];
895 byte *msg;
896 byte x;
897
898 msg = buf;
899
900 //Fill up the data bytes
901 *msg++ = Status;
902 *msg++ = HI_UINT16( SrcAddr->addr.shortAddr );
903 *msg++ = LO_UINT16( SrcAddr->addr.shortAddr );
904 *msg++ = HI_UINT16( nwkAddr );
905 *msg++ = LO_UINT16( nwkAddr );
906
907 *msg++ = epIntfCnt;
908
909 for ( x = 0; x < 16; x++ )
910 {
911 if ( x < epIntfCnt )
912 *msg++ = *epIntfList++;
913 else
914 *msg++ = 0;
915 }
916
917 MT_BuildAndSendZToolCB( type, 22, buf );
918 }
919 #endif // ZDO_ACTIVEEP_REQUEST || ZDO_MATCH_REQUEST
920
921 #if defined ( ZDO_BIND_UNBIND_REQUEST ) || defined ( ZDO_ENDDEVICEBIND_REQUEST )
922 /*********************************************************************
923 * @fn zdo_MTCB_BindRspCB()
924 *
925 * @brief
926 *
927 * Called to send MT callback response for binding responses
928 *
929 * @param type - binding type (end device, bind, unbind)
930 * @param SrcAddr - Source address
931 * @param Status - response status
932 *
933 * @return none
934 */
935 void zdo_MTCB_BindRspCB( uint16 type, zAddrType_t *SrcAddr, byte Status )
936 {
937 byte buf[3];
938 buf[0] = Status;
939 buf[1] = HI_UINT16( SrcAddr->addr.shortAddr );
940 buf[2] = LO_UINT16( SrcAddr->addr.shortAddr );
941 MT_BuildAndSendZToolCB( type, 3, buf );
942 }
943 #endif // ZDO_BIND_UNBIND_REQUEST || ZDO_ENDDEVICEBIND_REQUEST
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -