Release:5.20灰测

This commit is contained in:
2026-05-21 10:01:28 +08:00
parent 8a5a32b139
commit fd65e9c6a2
68 changed files with 4329 additions and 1489 deletions

View File

@@ -0,0 +1,90 @@
/**
* @file udp_manager.c
* @brief UDP管理模块
* @details 处理充电桩与服务器之间的UDP通信提供数据发送功能。
* 支持向指定充电桩发送数据以及向上位机服务器发送数据。
* @date 2025-01-09 14:32:15
* @version 1.0.0
* @copyright Copyright (c) 2026
*/
/* Includes ------------------------------------------------------------------*/
#include "task_air724.h"
#include "ykc_router.h"
#include "drv_air724.h"
/* typedef --------------------------------------------------------------------*/
/* variables ------------------------------------------------------------------*/
/* code -----------------------------------------------------------------------*/
/**
* @brief tcp_recv_task_function云快充 TCP 消息解析任务
*
* @note none
*
* @param taskID : 任务ID
*
* @retval runtime : 任务周期
*/
void air724_recv_task_function(void const *argument)
{
uint8_t air724_rx_msg[UART1_RX_BUFFER_SIZE];
uint8_t *ykc_downlink_frame = NULL;
/* 等待 datalink_conn 初始化完成 */
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
/**/
while (1)
{
/*---------------------------------------------------获取任务运行状态---------------------------------------------------*/
TaskRunTimeStat.DownLinkTask.threads_runtime = GetTask_RunTime(DownLinkTaskID);
TaskRunTimeStat.DownLinkTask.threads_counter = GetTask_Beatcnt(DownLinkTaskID);
TaskRunTimeStat.DownLinkTask.threads_freestack = Get_Free_Stack(DownLinkTaskID);
if (xQueueReceive(Air724_Message_Queue, &air724_rx_msg, 10) == pdPASS)
{
if (air724_rx_msg[0] == 0x55 && air724_rx_msg[1] == 0xAA)
{
// 主指令解析
switch (air724_rx_msg[2])
{
// 云快充下行解析
case 0x01:
{
uint8_t charger_index = air724_rx_msg[3];
uint8_t ykc_downlink_frame_len = air724_rx_msg[4];
memcpy(ykc_downlink_frame, &air724_rx_msg[5], ykc_downlink_frame_len);
SERVER_PACK frame;
frame.start_flag = ykc_downlink_frame[0];
frame.len = ykc_downlink_frame[1];
frame.serial = (ykc_downlink_frame[2] << 8) | ykc_downlink_frame[3];
frame.encrypt_flag = ykc_downlink_frame[4];
frame.frame_type = ykc_downlink_frame[5];
frame.data = (uint8_t *)pvPortMalloc(frame.len - 4);
memcpy(frame.data, ykc_downlink_frame + HEADER_LENGTH, frame.len - 4);
frame.crc = (ykc_downlink_frame[HEADER_LENGTH + frame.len] << 8) | ykc_downlink_frame[HEADER_LENGTH + frame.len + 1];
ykc_route_dispatch(charger_index, &frame); // 云快充路由分发
vPortFree(frame.data);
}
break;
case 0x83:
case 0x84:
case 0x85:
case 0x86:
case 0x87:
{
drv_air724_parse_response(air724_rx_msg, UART1_RX_BUFFER_SIZE);
}
break;
}
}
}
}
}