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

在Home1.2.2a中,在应用层有注册这样一个端口

static endPointDesc_t SampleApp_TestEp =
{
20, // Test endpoint
&zclSampleApp_TaskID,
(SimpleDescriptionFormat_t *)NULL, // No Simple description for this test endpoint
(afNetworkLatencyReq_t)0 // No Network Latency req
};

像这个端口的simpleDesc和latencyReq都是NULL和0,尤其是simpleDesc居然是NULL,这样注册的端口能正常使用吗?我记得在Zstack2.5.1中,它的simpleDesc是有具体内容的,尤其还会在ClusterList中指定CLUSTERID的。

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;
};

像Home1.2.2a的那种用法,还能在接收方做switch(CLUSTERID)吗,因为在注册端口的时候就没有指定CLUSTERID

  • 你用的是Z-Stack Home1.2.2a的哪個例程?
  • 您应该是没有完整理解1.22a的程序。

    以switch为例;

    zclSampleSw_Init()里面有注册

    // This app is part of the Home Automation Profile
    zclHA_Init( &zclSampleSw_SimpleDesc );

    zclSampleSw_SimpleDesc这个定义在zcl_samplesw_data.c

    void zclHA_Init( SimpleDescriptionFormat_t *simpleDesc )
    {
    endPointDesc_t *epDesc;

    // Register the application's endpoint descriptor
    // - This memory is allocated and never freed.
    epDesc = osal_mem_alloc( sizeof ( endPointDesc_t ) );
    if ( epDesc )
    {
    // Fill out the endpoint description.
    epDesc->endPoint = simpleDesc->EndPoint;
    epDesc->task_id = &zcl_TaskID; // all messages get sent to ZCL first
    epDesc->simpleDesc = simpleDesc;
    epDesc->latencyReq = noLatencyReqs;

    // Register the endpoint description with the AF
    afRegister( epDesc );
    }
    }

  • 还有一个问题请教您,是不是SimpleDescriptionFormat_t 中的cId_t *pAppInClusterList和cId_t *pAppOutClusterList分别限定了这个注册的端口只能接收来自pAppInClusterList中CLUSTERID的网络帧,以及只能通过pAppOutClusterList的CLUSTERID发送的网络帧?
  • DoorLock,多谢您的回复。Alvin Chen已经指出问题所在啦
  • Application Cluster

    An application cluster generates persistent functional application transactions between client and server sides of a cluster, and the targets of these transactions are determined when binds are created between matching clusters (client and server).

    Examples of application cluster transactions include: On/Off cluster - Switch (On/Off cluster client) sends commands to Light (On/Off cluster server) Temperature Measurement cluster - Temperature Sensor (Temp Meas. cluster server) sends reports to Thermostat (Temp Meas. cluster client)