Advertisement
tranthudo

Default.Response

Jul 5th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.69 KB | None | 0 0
  1. Giải pháp:
  2. - 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
  3. - Kiểm tra thông báo trạng thái APS ACK từ ZCL
  4. - 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ị
  5.  
  6. Các bước cập nhật 2, 5 sẽ được cập nhật trên git repository SDK.
  7.  
  8. 1. Cấu hình chế độ APS ACK và Default Response cho ZCL
  9.     - #define ZCL_DISABLE_DEFAULT_RESPONSES       (TRUE)
  10.       #define ZCL_DISABLE_APS_ACK                 (FALSE)
  11.      
  12. 2. Cấu hình bỏ Default Response cho tất cả các bản tin Report:
  13.     - Trong hàm u16ZCL_WriteCommandHeader ở eZCL_ReportAttribute() bật cờ Disable default response
  14.         +u16Offset = u16ZCL_WriteCommandHeader(
  15.                      hAPduInst, eFrameType,
  16.                      FALSE, 0, //Not mfr.specific
  17.                      TRUE, //From server to client
  18.                      TRUE, // TRUE //Disable default response
  19.                      u8Seq, E_ZCL_REPORT_ATTRIBUTES);
  20.  
  21. 3. Cấu hình gửi report có yêu cầu APS ACK
  22.     - Cấu hình địa chỉ nút đích:
  23.             sDestinationAddress.eAddressMode = E_ZCL_AM_SHORT;
  24.             sDestinationAddress.uAddress.u16DestinationAddress = 0;
  25.  
  26. 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
  27.     if ((psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_DATA_INDICATION) ||
  28.         (psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_INTERPAN_DATA_INDICATION))
  29.  
  30. 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:
  31.     - Chuyển event từ E_ZCL_CBET_UNHANDLED_EVENT sang E_ZCL_CBET_ZIGBEE_EVENT: sZCL_CallBackEvent.eEventType = E_ZCL_CBET_ZIGBEE_EVENT;
  32.     - Thay thế psZCL_Common->pfZCLinternalCallBackFunction(&sZCL_CallBackEvent);
  33.       bằng     vZCL_PassEventToUser(&sZCL_CallBackEvent);
  34.  
  35. 6. Thêm sự kiện APP_E_EVENT_ZCL_APS_ACK_FAIL vào APP_teEventType
  36.  
  37. 7. Xử lý sự kiện E_ZCL_CBET_ZIGBEE_EVENT trong APP_ZCL_cbEndpointCallback();
  38.     - Khai báo:    ZPS_tsAfEvent*         pZPSevent;
  39.                     tsZCL_ClusterInstance* psClusterInstance;
  40.     - Xử lý event:
  41.             pZPSevent = psEvent->pZPSevent;
  42.             if (pZPSevent->eType == ZPS_EVENT_APS_DATA_ACK)
  43.             {
  44.                 if (pZPSevent->uEvent.sApsDataAckEvent.u8Status == 0)
  45.                 {
  46.                     return;
  47.                 }
  48.  
  49.                 if(eZCL_SearchForClusterEntry(pZPSevent->uEvent.sApsDataAckEvent.u8DstEndpoint,
  50.                                               pZPSevent->uEvent.sApsDataAckEvent.u16ClusterId,
  51.                                               TRUE,
  52.                                               &psClusterInstance) != E_ZCL_SUCCESS)
  53.                 {
  54.                     if(eZCL_SearchForClusterEntry(pZPSevent->uEvent.sApsDataAckEvent.u8DstEndpoint,
  55.                                                   pZPSevent->uEvent.sApsDataAckEvent.u16ClusterId,
  56.                                                   TRUE,
  57.                                                   &psClusterInstance) != E_ZCL_SUCCESS)
  58.                     {
  59.                         DBG_vPrintf(TRACE_ZCL, "\nEP EVT: ZigBee Invalid cluster\n");
  60.                         return;
  61.                     }
  62.                 }
  63.  
  64.                 /* Send event to event handler to signal error on transmit ZCL data with APS ACK */
  65.                 APP_tsEvent sEvent;
  66.                 sEvent.eType = APP_E_EVENT_ZCL_APS_ACK_FAIL;
  67.  
  68.                 if(ZQ_bQueueSend(&APP_msgAppEvents, &sEvent) == FALSE)
  69.                 {
  70.                     DBG_vPrintf(TRACE_ZCL, "Failed to post Event %d \n", sEvent.eType);
  71.                 }
  72.                 DBG_vPrintf(TRACE_ZCL, "\nEP EVT: ZigBee APS ACK Fail Status: %d\n", pZPSevent->uEvent.sApsDataAckEvent.u8Status);
  73.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement