void tcp_client_appcall_user(void) { uint8 buffer[ELEMENT_SIZE]; if (uip_aborted() || uip_timedout() || uip_closed()) { tcp_client_reconnect(); return; } if (uip_rexmit()) { _uip_send_rexmit_http(); return; } if (QueueLength(&queue) != 0) { FreeQueuePop(&queue, buffer); _uip_send_http(buffer); } else { if (nv_read_msg(buffer)) { _uip_send_http(buffer); } } if (uip_newdata()) { process_ip_command(uip_datalen(), (uint8*)uip_appdata); } }
void CurrentDetectionT1_RecoverHeartBeatMessage(uint8* sendToG1Buf) { if (!inNetwork) { return; } if (nv_number()) { if (nv_read_msg(sendToG1Buf + SN_LEN)) { SET_HEART_BIT_STATUS(sendToG1Buf , HEART_BIT_STATUS_REALTIME_MASK, 0); if (AF_DataRequest( &CurrentDetectionT1_Periodic_DstAddr, &CurrentDetectionT1_epDesc, DTCT_PERIODIC_CLUSTERID, HEART_BIT_MSG_LEN, sendToG1Buf, &CurrentDetectionT1_TransID, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS) { nv_next(); if (nv_number() == 0) { nv_write_config(); } PrintRecover(sendToG1Buf, true); HalLedBlink(HAL_LED_2, 2, 20, 50); } else { PrintRecover(sendToG1Buf, false); } } } else if (nv_mem_number()) { memcpy(sendToG1Buf + SN_LEN, nv_mem_read(), NV_LEN); SET_HEART_BIT_STATUS(sendToG1Buf , HEART_BIT_STATUS_REALTIME_MASK, 0); if (AF_DataRequest( &CurrentDetectionT1_Periodic_DstAddr, &CurrentDetectionT1_epDesc, DTCT_PERIODIC_CLUSTERID, HEART_BIT_MSG_LEN, sendToG1Buf, &CurrentDetectionT1_TransID, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS) { nv_mem_next(); PrintRecover(sendToG1Buf, true); HalLedBlink(HAL_LED_2, 2, 20, 50); } else { PrintRecover(sendToG1Buf, false); } } }