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.

请问Zstack 3.0 默认协调器的网络地址是多少?

Other Parts Discussed in Thread: Z-STACK

协调器发送消息给终端,正常。

终端发送消息给协调器,发送一次后,就再也接收不到消息了

  • 有沒有抓包看看狀況
  • 我做的串口透传,协调器和终端

    串口透传.psd

  • 0x0000(协调器)给0xD6C7(终端)发送数据正常,
    终端给协调器发送数据,显示发送出去了,但是协调器接收不到。程序和都是类似的,为什么不行?
  • 查看了一下,正确时 源端口号 为0 目的端口号为0x30
    不能接受数据时,源端口号为30 ,目的端口号为30。
    请问这个有什么影响么?需要我把工程文件上传么?
  • 这个程序完全按照zstack 2.5.1写的,没有用3.0的zcl,太麻烦了。而且documents中也没有关于新建和使用自己ID的说明,genericApp的应用更是少之又少。
  • const cId_t MyApp_ClusterList[MYAPP_MAX_CLUSTERS] =
    {
    MYAPP_SENDADDR_CLUSTERID,
    MYAPP_DTU_CLUSTERID,
    };

    const SimpleDescriptionFormat_t MyApp_SimpleDesc =
    {
    MYAPP_ENDPOINT_ADDR, // int Endpoint;
    MYAPP_PROFID, // uint16 AppProfId[2];
    MYAPP_DEVICEID, // uint16 AppDeviceId[2];
    MYAPP_DEVICE_VERSION, // int AppDevVer:4;
    MYAPP_FLAGS, // int AppFlags:4;
    MYAPP_MAX_CLUSTERS, // byte AppNumInClusters;
    (cId_t *)MyApp_ClusterList, // byte *pAppInClusterList;
    MYAPP_MAX_CLUSTERS, // byte AppNumInClusters;
    (cId_t *)MyApp_ClusterList // byte *pAppInClusterList;
    };
    endPointDesc_t MyApp_epDesc;

    经调试发现:只发送MYAPP_SENDADDR_CLUSTERID或者只发送MYAPP_DTU_CLUSTERID消息,时没问题。发送其中一个后,另外一个就接受不到了。
  •  你自己的发送的地址的端口号不对发出不了。请看你的自己包,只有一个。

     GenericApp_DstAddr.addrMode =(afAddrMode_t)Addr16Bit;

     GenericApp_DstAddr.addr.shortAddr = 0x0000;

     GenericApp_DstAddr.endPoint = 0;

  • 正确时 源端口号 为0 目的端口号为0x30

    endpoint 0是ZDO層用的,應用程序不應該用端口号 为0

    不能接受数据时,源端口号为30 ,目的端口号为30

    我看這一類数据發出來除了有mac ack,連aps ack都有,代表你的協調器收到了

  • 嗯,发送的目的地址
    //设置发送目的地址是这样设置
    MyApp_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    MyApp_DstAddr.addr.shortAddr = 0x0000;
    MyApp_DstAddr.endPoint = 0x30;
    发送的源地址为什么是0x0000?
  • 发送的源地址为什么是0x0000?
    这个仅仅是个举例,具体你自己去填写。
  • MyApp_DstAddr.addr.shortAddr = 0x0000;

    這個是发送目的地址不是源地址

  • MyApp_epDesc.endPoint = MYAPP_ENDPOINT_ADDR;
    MyApp_epDesc.task_id = &zclMyApp_TaskID;
    MyApp_epDesc.simpleDesc
    = (SimpleDescriptionFormat_t *)&MyApp_SimpleDesc;
    MyApp_epDesc.latencyReq = noLatencyReqs;

    afRegister( &MyApp_epDesc );//注册自定义的端口号描述符

    我自己注册端口号0x30,程序如上。这样是不是有问题?
    afRegister( &MyApp_epDesc );会导致网络状态改变事件连续发生两次。如果注释掉就是正常的一次。
  • 说错了,是发送的源端口号为什么是0?怎么设置?
  • 源端口号0是ZDO層用的,應用程序发送消息不應該用端口号 为0发送
  • 有没有一个Zstack3.0 完整的教程啊。我想用协议栈2.5.1的形式进行通信。
    3.0.2协议栈通信,必须用zcl么,zcl的CLUSTERID注册,不用规范里的,用自己定义的行不行,这些文档里都没有介绍。
  • 哦~,我没有用端口0 进行发送啊,发送端口号怎么设定呢???????
  • 文档都在
    C:\Texas Instruments\Z-Stack 3.0.2\Documents

    ENDPOINT 是你双方协商的,你可以类似于demo 定义为9或者8
  • 查看了一下,正确时 源端口号 为0 目的端口号为0x30

    你自己說正確時源端口号 为0,如果不是你發送的是誰發送?

  • 我怀疑是端口号、简单描述符、in\outCluster那个地方弄错了。
    //协议栈中原有的端口号、简单描述符如下:(这个我自己的应用没有使用,也没做修改)
    const cId_t zclMyApp_InClusterList[] =
    {
    ZCL_CLUSTER_ID_GEN_BASIC,
    ZCL_CLUSTER_ID_GEN_IDENTIFY,
    };
    #define ZCLMYAPP_MAX_INCLUSTERS (sizeof(zclMyApp_InClusterList) / sizeof(zclMyApp_InClusterList[0]))

    const cId_t zclMyApp_OutClusterList[] =
    {
    ZCL_CLUSTER_ID_GEN_BASIC,
    };
    #define ZCLMYAPP_MAX_OUTCLUSTERS (sizeof(zclMyApp_OutClusterList) / sizeof(zclMyApp_OutClusterList[0]))

    SimpleDescriptionFormat_t zclMyApp_SimpleDesc =
    {
    MYAPP_ENDPOINT, // int Endpoint;
    ZCL_HA_PROFILE_ID, // uint16 AppProfId;
    // MYAPP_TODO: Replace ZCL_HA_DEVICEID_ON_OFF_LIGHT with MyApp specific device ID
    ZCL_HA_DEVICEID_ON_OFF_LIGHT, // uint16 AppDeviceId;
    MYAPP_DEVICE_VERSION, // int AppDevVer:4;
    MYAPP_FLAGS, // int AppFlags:4;
    ZCLMYAPP_MAX_INCLUSTERS, // byte AppNumInClusters;
    (cId_t *)zclMyApp_InClusterList, // byte *pAppInClusterList;
    ZCLMYAPP_MAX_OUTCLUSTERS, // byte AppNumInClusters;
    (cId_t *)zclMyApp_OutClusterList // byte *pAppInClusterList;
    };

    //我自己添加了额外的端口号,和简单描述符
    const cId_t MyApp_ClusterList[MYAPP_MAX_CLUSTERS] =
    {
    MYAPP_SENDADDR_CLUSTERID, //0x1001
    MYAPP_DTU_CLUSTERID, //0x1002
    };

    const SimpleDescriptionFormat_t MyApp_SimpleDesc =
    {
    MYAPP_ENDPOINT_ADDR, // int Endpoint; 0x30
    MYAPP_PROFID, // uint16 AppProfId[2]; 0x0F04
    MYAPP_DEVICEID, // uint16 AppDeviceId[2]; 0x0001
    MYAPP_DEVICE_VERSION, // int AppDevVer:4; 0
    MYAPP_FLAGS, // int AppFlags:4; 0
    MYAPP_MAX_CLUSTERS, // byte AppNumInClusters;
    (cId_t *)MyApp_ClusterList, // byte *pAppInClusterList;
    MYAPP_MAX_CLUSTERS, // byte AppNumInClusters;
    (cId_t *)MyApp_ClusterList // byte *pAppInClusterList;
    };
    endPointDesc_t MyApp_epDesc;

    然后再初始化程序中注册:
    void zclMyApp_Init( byte task_id )
    {
    ……
    MyApp_epDesc.endPoint = MYAPP_ENDPOINT_ADDR;
    MyApp_epDesc.task_id = &zclMyApp_TaskID;
    MyApp_epDesc.simpleDesc
    = (SimpleDescriptionFormat_t *)&MyApp_SimpleDesc;
    MyApp_epDesc.latencyReq = noLatencyReqs;

    afRegister( &MyApp_epDesc );//注册自定义的端口号描述符
    ……
    }

    请问这样对么?
  • 在Z-Stack 3.0.2中應該是用bdb_RegisterSimpleDescriptor去註冊自定义的SimpleDescriptor/endpoint