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.

假如协调器从串口收到了终端子设备的长地址,可以直接给该终端发送消息吗 ,该从哪儿着手改代码呢?

Other Parts Discussed in Thread: Z-STACK

如提。

  • 你协调器用的是什麼程序?
  • 就用的TI的zstack 2007_profile
  • 那個Z-Stack 版本跟例程
  • 我先试着把空中来的数据,改成64bit输出到串口看看,从下面这个ZDApp.c来看,是ZDP_IncomingData函数收到了数据,
    void ZDApp_ProcessOSALMsg( osal_event_hdr_t *msgPtr )
    {
    // Data Confirmation message fields
    uint8 sentEP; // This should always be 0
    uint8 sentStatus;
    afDataConfirm_t *afDataConfirm;
    uint8 tmp;

    switch ( msgPtr->event )
    {
    // Incoming ZDO Message
    case AF_INCOMING_MSG_CMD:
    ZDP_IncomingData( (afIncomingMSGPacket_t *)msgPtr );
    break;

    case ZDO_CB_MSG:
    ZDApp_ProcessMsgCBs( (zdoIncomingMsg_t *)msgPtr );
    break;

    case AF_DATA_CONFIRM_CMD:
    // This message is received as a confirmation of a data packet sent.
    // The status is of ZStatus_t type [defined in NLMEDE.h]
    // The message fields are defined in AF.h
    afDataConfirm = (afDataConfirm_t *)msgPtr;
    sentEP = afDataConfirm->endpoint;
    sentStatus = afDataConfirm->hdr.status;
    ...
    }


    然后再跳到这个函数,就不知道改哪儿了

    void ZDP_IncomingData( afIncomingMSGPacket_t *pData )
    {
    uint8 x = 0;
    uint8 handled;
    zdoIncomingMsg_t inMsg;

    inMsg.srcAddr.addrMode = Addr16Bit;
    inMsg.srcAddr.addr.shortAddr = pData->srcAddr.addr.shortAddr;
    osal_memcpy(inMsg.srcAddr.addr.extAddr, pData->srcAddr.addr.extAddr, 8); //zjt
    inMsg.wasBroadcast = pData->wasBroadcast;
    inMsg.clusterID = pData->clusterId;
    inMsg.SecurityUse = pData->SecurityUse;

    inMsg.asduLen = pData->cmd.DataLength-1;
    inMsg.asdu = pData->cmd.Data+1;
    inMsg.TransSeq = pData->cmd.Data[0];
    inMsg.macDestAddr = pData->macDestAddr;

    handled = ZDO_SendMsgCBs( &inMsg );

    #if (defined MT_ZDO_CB_FUNC)
    #if !defined MT_TASK
    if (zgZdoDirectCB)
    #endif
    {
    MT_ZdoDirectCB( pData, &inMsg );
    }
    #endif

    while ( zdpMsgProcs[x].clusterID != 0xFFFF )
    {
    if ( zdpMsgProcs[x].clusterID == inMsg.clusterID )
    {
    zdpMsgProcs[x].pFn( &inMsg );
    return;
    }
    x++;
    }

    // Handle unhandled messages
    if ( !handled )
    ZDApp_InMsgCB( &inMsg );
    }