675
社区成员
发帖
与我相关
我的任务
分享终端:
ZStatus_t status = AF_DataRequest(
&dstAddr, // 目标地址
&zclSampleSwEpDesc, // 源端点
ZCL_CLUSTER_ID_CUSTOM_DATA_TRANSFER, // Cluster ID(用于绑定匹配)
frameLen, // 数据长度
sendBuf, // 数据指针(你的 AABB...CCDD 帧)
&transId, // 事务 ID(输出)
options, // 发送选项
radius // 跳数半径
);
协调器:
void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;
// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 0;
// Register the Simple Descriptor for this application
bdb_RegisterSimpleDescriptor( &zclSampleSw_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
// zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );
zclSampleSw_ResetAttributesToDefaultValues();
// Register the application's attribute list
// zcl_registerAttrList( SAMPLESW_ENDPOINT, zclSampleSw_NumAttributes, zclSampleSw_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );
// Register for all key events - This app will handle all key events
// RegisterForKeys( zclSampleSw_TaskID );
bdb_RegisterCommissioningStatusCB( zclSampleSw_ProcessCommissioningStatus );
// Register for a test endpoint
// afRegister( &sampleSw_TestEp);
#ifdef ZCL_DIAGNOSTIC
// Register the application's callback function to read/write attribute data.
// This is only required when the attribute data format is unknown to ZCL.
zcl_registerReadWriteCB( SAMPLESW_ENDPOINT, zclDiagnostic_ReadWriteAttrCB, NULL );
if ( zclDiagnostic_InitStats() == ZSuccess )
{
// Here the user could start the timer to save Diagnostics to NV
}
#endif
#if defined (OTA_CLIENT) && (OTA_CLIENT == TRUE)
// Register for callback events from the ZCL OTA
zclOTA_Register(zclSampleSw_TaskID);
#endif
zdpExternalStateTaskID = zclSampleSw_TaskID;
#ifdef ZDO_COORDINATOR
// Init Uart
zclSampleSw_InitUart();
ZDO_RegisterForZDOMsg ( zclSampleSw_TaskID, Device_annce );
bdb_StartCommissioning( BDB_COMMISSIONING_MODE_NWK_FORMATION |
BDB_COMMISSIONING_MODE_FINDING_BINDING );
NLME_PermitJoiningRequest(255);
//change 注册自定义集群的接收回调函数
// zcl_registerPlugin( 0xFC10, 0xFC10, zclSampleSw_HdlIncomingCustomCluster );
#else
bdb_StartCommissioning( BDB_COMMISSIONING_MODE_NWK_STEERING |
BDB_COMMISSIONING_MODE_FINDING_BINDING );
osal_start_timerEx(zclSampleSw_TaskID,
SAMPLEAPP_REPORT_EVT,
SAMPLEAPP_REPORT_PERIOD);
#endif
}
if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case AF_INCOMING_MSG_CMD:
uint8 *rawData = MSGpkt->cmd.Data;
uint16 dataLen = MSGpkt->cmd.DataLength;
HalUARTWrite(HAL_UART_PORT_0, rawData, dataLen);
break;
亲,由于论坛系统除了问题,很抱歉延迟回复