Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Giải pháp:
- - Yêu cầu tất cả các bản tin report, bản tin custom phải có APS ACK và không sử dụng Default Response
- - Kiểm tra thông báo trạng thái APS ACK từ ZCL
- - Báo sự kiện gửi không thành công (không nhận được APS ACK) cho Event Handler của thiết bị
- Các bước cập nhật 2, 5 sẽ được cập nhật trên git repository SDK.
- 1. Cấu hình chế độ APS ACK và Default Response cho ZCL
- - #define ZCL_DISABLE_DEFAULT_RESPONSES (TRUE)
- #define ZCL_DISABLE_APS_ACK (FALSE)
- 2. Cấu hình bỏ Default Response cho tất cả các bản tin Report:
- - Trong hàm u16ZCL_WriteCommandHeader ở eZCL_ReportAttribute() bật cờ Disable default response
- +u16Offset = u16ZCL_WriteCommandHeader(
- hAPduInst, eFrameType,
- FALSE, 0, //Not mfr.specific
- TRUE, //From server to client
- TRUE, // TRUE //Disable default response
- u8Seq, E_ZCL_REPORT_ATTRIBUTES);
- 3. Cấu hình gửi report có yêu cầu APS ACK
- - Cấu hình địa chỉ nút đích:
- sDestinationAddress.eAddressMode = E_ZCL_AM_SHORT;
- sDestinationAddress.uAddress.u16DestinationAddress = 0;
- 4. Bỏ điều kiện xử lý ZCL Event đối với ROUTER_APPLICATION_ENDPOINT trong vAppHandleAfEvent() --> Xử lý tất cả các event ZCL của endpoint
- if ((psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_DATA_INDICATION) ||
- (psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_INTERPAN_DATA_INDICATION))
- 5. Xử lý event ZCL Data ACK trong vZCL_HandleDataAcknowledgement() cho tất cả các loại cluster ko phải SE_CLUSTER_ID_KEY_ESTABLISHMENT và SE_CLUSTER_ID_TUNNELING:
- - Chuyển event từ E_ZCL_CBET_UNHANDLED_EVENT sang E_ZCL_CBET_ZIGBEE_EVENT: sZCL_CallBackEvent.eEventType = E_ZCL_CBET_ZIGBEE_EVENT;
- - Thay thế psZCL_Common->pfZCLinternalCallBackFunction(&sZCL_CallBackEvent);
- bằng vZCL_PassEventToUser(&sZCL_CallBackEvent);
- 6. Thêm sự kiện APP_E_EVENT_ZCL_APS_ACK_FAIL vào APP_teEventType
- 7. Xử lý sự kiện E_ZCL_CBET_ZIGBEE_EVENT trong APP_ZCL_cbEndpointCallback();
- - Khai báo: ZPS_tsAfEvent* pZPSevent;
- tsZCL_ClusterInstance* psClusterInstance;
- - Xử lý event:
- pZPSevent = psEvent->pZPSevent;
- if (pZPSevent->eType == ZPS_EVENT_APS_DATA_ACK)
- {
- if (pZPSevent->uEvent.sApsDataAckEvent.u8Status == 0)
- {
- return;
- }
- if(eZCL_SearchForClusterEntry(pZPSevent->uEvent.sApsDataAckEvent.u8DstEndpoint,
- pZPSevent->uEvent.sApsDataAckEvent.u16ClusterId,
- TRUE,
- &psClusterInstance) != E_ZCL_SUCCESS)
- {
- if(eZCL_SearchForClusterEntry(pZPSevent->uEvent.sApsDataAckEvent.u8DstEndpoint,
- pZPSevent->uEvent.sApsDataAckEvent.u16ClusterId,
- TRUE,
- &psClusterInstance) != E_ZCL_SUCCESS)
- {
- DBG_vPrintf(TRACE_ZCL, "\nEP EVT: ZigBee Invalid cluster\n");
- return;
- }
- }
- /* Send event to event handler to signal error on transmit ZCL data with APS ACK */
- APP_tsEvent sEvent;
- sEvent.eType = APP_E_EVENT_ZCL_APS_ACK_FAIL;
- if(ZQ_bQueueSend(&APP_msgAppEvents, &sEvent) == FALSE)
- {
- DBG_vPrintf(TRACE_ZCL, "Failed to post Event %d \n", sEvent.eType);
- }
- DBG_vPrintf(TRACE_ZCL, "\nEP EVT: ZigBee APS ACK Fail Status: %d\n", pZPSevent->uEvent.sApsDataAckEvent.u8Status);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement