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.

使用afDataRequest发送数据,option要求了ack,但是在af.c里的afDataConfirm里得到的status总是0xB7,这是状态码什么意思呢?

为什么状态不是0呢?这个0xB7有没有地方说明它的意思。

void afDataConfirm( uint8 endPoint, uint8 transID, ZStatus_t status )
{
endPointDesc_t *epDesc;
afDataConfirm_t *msgPtr;

// Find the endpoint description
epDesc = afFindEndPointDesc( endPoint );
if ( epDesc == NULL )
return;

// Determine the incoming command type
msgPtr = (afDataConfirm_t *)osal_msg_allocate( sizeof(afDataConfirm_t) );
if ( msgPtr )
{
// Build the Data Confirm message
msgPtr->hdr.event = AF_DATA_CONFIRM_CMD;
msgPtr->hdr.status = status;
msgPtr->endpoint = endPoint;
msgPtr->transID = transID;

#if defined ( MT_AF_CB_FUNC )
/* If MT has subscribed for this callback, don't send as a message. */
if ( AFCB_CHECK(CB_ID_AF_DATA_CNF,*(epDesc->task_id)) )
{
/* Send callback if it's subscribed */
MT_AfDataConfirm ((void *)msgPtr);
/* Release the memory. */
osal_msg_deallocate( (void *)msgPtr );
}
else
#endif
{
/* send message through task message */
osal_msg_send( *(epDesc->task_id), (byte *)msgPtr );
}
}
}

  • void afSendStateReport(void) //send to air
    {
    //uint16 parentaddr;
    static uint8 reportNr=0;
    uint8 pData[SENSOR_REPORT_LENGTH];
    uint8 txOptions;

    //parentaddr = parentShortAddr;
    //parentaddr = NLME_GetCoordShortAddr();

    uint16 v = ReadVoltage1();
    pData[SENSOR_TEMP_OFFSET] = HI_UINT16(v);
    pData[SENSOR_VOLTAGE_OFFSET] = LO_UINT16(v);

    pData[SENSOR_PARENT_OFFSET] = LO_UINT16(parentShortAddr);
    pData[SENSOR_PARENT_OFFSET+ 1] = HI_UINT16(parentShortAddr);

    /*
    if ( ++reportNr<ACK_REQ_INTERVAL && reportFailureNr==0 )
    {
    txOptions = AF_TX_OPTIONS_NONE;
    }
    else
    {
    txOptions = AF_MSG_ACK_REQUEST;
    reportNr = 0;
    }*/
    txOptions = AF_MSG_ACK_REQUEST;

    //afSendDataRequest16( 0x0000, SENSOR_REPORT_CMD_ID, SENSOR_REPORT_LENGTH, pData, 0, txOptions, 0 );
    afSendDataRequest16( 0x0000, SENSOR_REPORT_CMD_ID, SENSOR_REPORT_LENGTH, pData, 0, txOptions, 0 );
    }

    void afSendDataRequest16 ( uint16 destination, uint16 commandId, uint8 len, uint8 *pData,
    uint8 handle, uint8 txOptions, uint8 radius )
    {
    afStatus_t status;
    afAddrType_t dstAddr;

    txOptions |= AF_DISCV_ROUTE;
    if ( ADDR_NOT_BCAST != NLME_IsAddressBroadcast( destination ) )
    {
    txOptions &= ~AF_ACK_REQUEST;
    }

    // Use short address
    dstAddr.addr.shortAddr = destination;
    dstAddr.addrMode = afAddr16Bit;
    dstAddr.panId = zgConfigPANID; // Not an inter-pan message.
    dstAddr.endPoint = sapi_epDesc.detailDesc->EndPoint; // Set the endpoint.

    // Send the message
    status = AF_DataRequest(&dstAddr, &sapi_epDesc, commandId, len, pData, &handle, txOptions, radius);

    if (status != afStatus_SUCCESS)
    {
    SAPI_SendCback( SAPICB_DATA_CNF, status, handle );
    }
    }
  • 设备类型为router的时候status是0没问题,设置为enddevice的时候,隔一会就出现status为0x11或0xB7
  • 找到了,在comdef文件里面ZApsNoAck 0xb7,但不知道是什么原因?为什么设置为router就不产生这种错误码?