This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ZHA 的SampleLight & SampleSwitch 搭配的问题



我将SampleSwitch 制作成ZC, SampleLight 制作成Zed.
可以正确的在SampleSwitch 上控制SampleLight 的LED 灯.
我发现它是调用zclGeneral_SendOnOff_CmdToggle() 来​​送出Packet.
请问: zclGeneral_SendOnOff_CmdToggle() 的"destination address" 结构内容都是0, 那它是如何指定Destination 的Address 呢?
谢谢.

  • address mode 是設定成 AddrNotPresent

    所以是使用 binding table 的值來送出 packet

    #ifdef ZCL_ON_OFF
    // Set destination address to indirect
    zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
    zclSampleSw_DstAddr.endPoint = 0;
    zclSampleSw_DstAddr.addr.shortAddr = 0;
    #endif

  • 感謝你的回答,

    可以再請問一下, Packet 外送的 Binding table 是存放在那一個 Structure 呢?

    實際將 Packet 送出的表置在那裡呢?

    Thank you

  • 你可以看一下

    BindingTable.h

    BindingTable.c

    typedef struct
    {
                            // No src address since the src is always the local device
      uint8 srcEP;
      uint8 dstGroupMode;   // Destination address type; 0 - Normal address index, 1 - Group address
      uint16 dstIdx;        // This field is used in both modes (group and non-group) to save NV and RAM space
                            // dstGroupMode = 0 - Address Manager index
                            // dstGroupMode = 1 - Group Address
      uint8 dstEP;
      uint8 numClusterIds;
      uint16 clusterIdList[MAX_BINDING_CLUSTER_IDS];
                          // Don't use MAX_BINDING_CLUSTERS_ID when
                          // using the clusterIdList field.  Use
                          // gMAX_BINDING_CLUSTER_IDS
    } BindingEntry_t;

  • 謝謝.

    我先研究一下.

    希望我搞的出來.

    不行的話, 可能又要麻煩你指點了.