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.

如何在AF_DATA_CONFIRM_CMD获取APS ACK

我想实现路由设备判断协调器是否在线的功能,所以在路由设备发送数据给协调器的时候,在AF_DataRequest函数中或上AF_ACK_REQUEST,然后抓包发现协调器有APS返回。

我在路由设备的AF_DATA_CONFIRM_CMD,中对status进行判断:

afDataConfirm = (afDataConfirm_t *)MSGpkt;
sentEP = afDataConfirm->endpoint;
sentStatus = afDataConfirm->hdr.status;
sentTransID = afDataConfirm->transID;
(void)sentEP;
(void)sentTransID;

if ( sentStatus != ZSuccess )

{}

发现,发送成功的时候sentStatus 为0x00。失败的时候,无论是否开启AF_ACK_REQUEST,收到的都是ZMacNoACK 0xe9。请问为什么没收到ZApsNoAck?

我怎样才能区分开是mac ack还是aps ack?

  • AF_DATA_CONFIRM

    This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE.

    For APS fragmented packets, the value of the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS acknowledgement is received.
  • 感谢回复!!
    我在发送函数中已经或上了AF_ACK_REQUEST,但是接收到的还是ZMacNoACK ,没有ZApsNoAck。
    还有就是AF_DATA_REQUEST和AF_ACK_REQUEST有什么区别?AF_DATA_REQUEST要怎么样使用?
  • ZApsNoAck我的路由设备发送心跳包给协调器,在发送函数在AF_DataRequest函数中或上AF_ACK_REQUEST。

    抓包能够看到协调器回复的APS:

    当我把协调器断电的时候,我在路由设备的AF_DATA_CONFIRM_CMD,中对status进行判断:

    afDataConfirm = (afDataConfirm_t *)MSGpkt;
    sentEP = afDataConfirm->endpoint;
    sentStatus = afDataConfirm->hdr.status;
    sentTransID = afDataConfirm->transID;
    (void)sentEP;
    (void)sentTransID;

    if ( sentStatus != ZSuccess )

    {}

    只能接收到ZMacNoACK ,却接收不到ZApsNoAck。

    是不是还有哪里没配置好,或是在AF_DATA_CONFIRM_CMD中没处理好?

  • 4.4.7 AF_DATA_CONFIRM

    4.4.7.1 Description

    This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS acknowledgement is received.