Răsfoiți Sursa

[Improve][Modularization][Module_OcppBackend]

2021.08.24 / Folus Wen

Actions:
1. Add TX length to TTIA log record.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 ani în urmă
părinte
comite
1726be7ce1
1 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 3 2
      EVSE/Modularization/ocppfiles/MessageHandler.c

+ 3 - 2
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -419,7 +419,7 @@ int sendTTIAInfo(uint8_t gun_index)
 
 
 	uint8_t tx_buf[80] = {0};
 	uint8_t tx_buf[80] = {0};
 	uint8_t logBuf[256]= {0};
 	uint8_t logBuf[256]= {0};
-	uint8_t tempIndex, socStart, socEnd;
+	uint8_t tx_len, tempIndex, socStart, socEnd;
 	uint16_t PresentChargedEnergy;
 	uint16_t PresentChargedEnergy;
 	struct tm tmStart, tmEnd;
 	struct tm tmStart, tmEnd;
 
 
@@ -626,12 +626,13 @@ int sendTTIAInfo(uint8_t gun_index)
 			bcopy((char *)server->h_addr, (char *)&dest_addr.sin_addr.s_addr, server->h_length);
 			bcopy((char *)server->h_addr, (char *)&dest_addr.sin_addr.s_addr, server->h_length);
 			dest_addr.sin_port = htons(ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_port);
 			dest_addr.sin_port = htons(ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_port);
 
 
-			if(sendto(udp_socket_fd, tx_buf, strlen((char*)tx_buf), 0, &dest_addr, sizeof(dest_addr)) >= 0)
+			if((tx_len = sendto(udp_socket_fd, tx_buf, ARRAY_SIZE(tx_buf), 0, &dest_addr, sizeof(dest_addr))) >= 0)
 			{
 			{
 				for(uint8_t idx=0;idx<ARRAY_SIZE(tx_buf);idx++)
 				for(uint8_t idx=0;idx<ARRAY_SIZE(tx_buf);idx++)
 				{
 				{
 					sprintf((char*)logBuf, "%s %02X", logBuf, tx_buf[idx]);
 					sprintf((char*)logBuf, "%s %02X", logBuf, tx_buf[idx]);
 				}
 				}
+				DEBUG_TTIA_INFO("TX raw data length: %d\n", tx_len);
 				DEBUG_TTIA_INFO("Message raw: %s\n", logBuf);
 				DEBUG_TTIA_INFO("Message raw: %s\n", logBuf);
 				DEBUG_TTIA_INFO("OCPP Transaction ID: %d\n", ShmOCPP16Data->StopTransaction[gun_index].TransactionId);
 				DEBUG_TTIA_INFO("OCPP Transaction ID: %d\n", ShmOCPP16Data->StopTransaction[gun_index].TransactionId);
 				DEBUG_TTIA_INFO("TTIA server address: %s\n", ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_addr);
 				DEBUG_TTIA_INFO("TTIA server address: %s\n", ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_addr);