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.

组播时,目标地址端点的值

组播时地址模式如下:

SampleApp_Flash_DstAddr.addrMode = (afAddrMode_t)afAddrGroup;//组播
SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;
SampleApp_Flash_DstAddr.addr.shortAddr = SAMPLEAPP_FLASH_GROUP;

SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;

SAMPLEAPP_ENDPOINT必须是这个同一个吗?

我不同的endPoint,比如:

endPoint =SAMPLEAPP_ENDPOINT加入SAMPLEAPP_FLASH_GROUP组,另一个端点

endPoint =SAMPLEAPP_ENDPOINT+1,也加入同一个组,不同端点号的端点能不能加入同一个组,端点号相同的时候,目标地址端点号如上表示,如果加入同一组的端点端点号不同,组播的时候,

SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT,还是

SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT+1呢?

还是等于其他什么数?


  • 目的end point 是对方目的设备工作的end point的,你需要通过Active Endpoint Request去获取对方的endpoint

  •  谢谢 VV大神

    因为是组播,是发给一组的终端,如果我需要,挨个去获取端点号,我还有什么必要用组播呢,直接点对点通信好了。

    再说,我也不可能知道一组中的终端的具体信息,地址,怎么去获取端点号?

    就算是获取了一些终端端点号,发送组播时组播时地址模式如下:

    SampleApp_Flash_DstAddr.addrMode = (afAddrMode_t)afAddrGroup;//组播
    SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;
    SampleApp_Flash_DstAddr.addr.shortAddr = SAMPLEAPP_FLASH_GROUP;

    端点号一致好说,不一致时,端点号endPoint该是什么值?

  • 组播就上组地址啊

    //组群设置
    uint16 WorkGroupID = 1;

    aps_Group_t SampleApp_WorkGroups[16]={{0xFF00,"First Group"},
    {0x0001,"room01"},
    {0x0002,"room02"},
    {0x0003,"room03"},
    {0x0004,"room04"},
    {0x0005,"room05"}};

    //传感器报告 组播
    SampleApp_ReportSensor_DstAddr.addrMode = (afAddrMode_t)afAddrGroup; //组播
    SampleApp_ReportSensor_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;
    //SampleApp_ReportSensor_DstAddr.addr.shortAddr = TagetID; //发给指定组

    SampleApp_ReportSensor_DstAddr.addr.shortAddr = WorkGroups[WorkGroupID]; //发给指定组

  • 发完才发现手抖了 应该是

    SampleApp_ReportSensor_DstAddr.addr.shortAddr = SampleApp_WorkGroups[WorkGroupID].ID; //发给指定组

    -----

    简单的说通讯时需要显式声明以下几个参数

    接收端 PanID(域名)
    接收端 地址类型(广播 组播 点播)
    接收端 地址-短地址(IP)/长地址(MAC) 优先使用短地址
    接收端 EndPoint(端口)ID
    接收端 ClusterID 任务流ID(应该时接收端的)

    TaskID 任务ID 发送端-接收端相同

    发送端 EndPoint(端口)描述符

    \数据长度
    数据指针

    位掩码选项
    通讯半径

    ----

    EndPoint是app自定义的 并且要用SimpleDescriptionFormat_t 声明其支持的ClusterList

    简单任务可以所有节点都使用相同的ep和clust即可

    //设备简单描述符
    const SimpleDescriptionFormat_t SampleApp_SimpleDesc =
    {
    SAMPLEAPP_ENDPOINT, // int Endpoint; 端口号
    SAMPLEAPP_PROFID, // uint16 AppProfId[2];配置编号
    SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2];设备编号
    SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4;版本号
    SAMPLEAPP_FLAGS, // int AppFlags:4;
    SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;输入命令数量
    (cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList; 输入命令指针
    SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;输出命令数量
    (cId_t *)SampleApp_ClusterList // uint8 *pAppInClusterList;输出命令指针
    };

  • 谢谢 cong

    您说的那些我都知道

    这个地址模式我知道,

    SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;

    SAMPLEAPP_ENDPOINT必须是这个一个号吗?

    我不同的endPoint,比如:

    endPoint =SAMPLEAPP_ENDPOINT加入SAMPLEAPP_FLASH_GROUP组,另一个端点

    endPoint =SAMPLEAPP_ENDPOINT+1,也加入同一个组,

    组播的时候,

    SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT,还是

    SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT+1呢?

    还是等于其他什么数?

  • “1、Endpoint

        每个设备都是一个节点,每个节点都有长短两个地址,每个设备有241个endpoint(0保留,1~240由应用层分配,241~254保留,255用于向所有的端点广播),每次通信的时候都需要对方的网络地址和endpoint号。其实endpoint就相当于TCP/IP通信中的端口号。一个应用程序只要有一个endpoint。每个endpoint都有一个简单描述符(zigbee simple descriptor,即SimpleDescriptionFormat_t)。每个endpoint都能接收(用于输入)或发送(用于输出)串格式的数据。
    2、Cluster

        一个endpoint是一个逻辑设备,可以包含多个Cluster,每个Cluster包含不同的属性(开、关是“灯控制” Cluster对应不同情况的attribute)。另外,网络拓扑结构中提到的cluster是集群树,包括家长(parent)及其子女(child)。网络拓扑中的Cluster是指的节点(物理设备)之间的关系,而通信中的Cluster号指的通信事务的标号。在有些文章中,cluster定义成设备通信的“串”。
        ZCL通过判断ClusterID来达到相应的作用。ID和功能形成一一对应关系,这样,在无线传输过程当中,就不需要传输大量指令,只需传输clusterID,然后通过clusterID就可以判断需要执行的命令了。这样既保证了数据的安全性和通信可靠性,又提高了通信效率。
    3、Node

        node是物理设备,相当于Internet网络中的无线网卡。endpoint是逻辑工作端。"
    具体使用哪个np端口是由用户应用自定义的 只要在”设备简单描述符“里定义好就行了

    //设备简单描述符
    const SimpleDescriptionFormat_t SampleApp_SimpleDesc =
    {
    SAMPLEAPP_ENDPOINT, // int Endpoint; 端口号
    SAMPLEAPP_PROFID, // uint16 AppProfId[2];配置编号
    SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2];设备编号
    SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4;版本号
    SAMPLEAPP_FLAGS, // int AppFlags:4;
    SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;输入命令数量
    (cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList; 输入命令指针 包含该端口所有可用输入命令
    SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;输出命令数量
    (cId_t *)SampleApp_ClusterList // uint8 *pAppInClusterList;输出命令指针 包含该端口所有可用输出命令
    };

  • cong lin 谢谢指教

    你说的这些我都已经熟悉,现在在场景应用中要发送组播。

    这几个问题是我要弄明白的

    1、加入一个组的终端必须使用统一的端点号吗?不同端点号,就不能加入同一个组吗?

    2、用组播的时候,端点号用哪个?

  • cong lin 

    可否加QQ交流,123131936.

    • 我做了组播实验,发送数据是目的地址端点号20,21,组内的成员都可以收到数据,不是应该是注册了相应端点的组内成员才能收到数据吗?