增加事件驱动和业务回滚处理方式

This commit is contained in:
冯佳
2026-03-04 08:50:04 +08:00
parent cc4c361df6
commit 47a9dff6ef
25 changed files with 2626 additions and 1780 deletions

36
app/tcp_server.h Normal file
View File

@ -0,0 +1,36 @@
/*
* tcp_server.h
*
* Created on: 2026-03-03
* Author: RT-Thread
*
* 功能: TCP服务器模块
* 依赖: lwIP网络栈、SHT40传感器
* 跨平台适配: 基于RT-Thread Nano使用标准lwIP API
*/
#ifndef TCP_SERVER_H
#define TCP_SERVER_H
#include "lwip/sockets.h"
/* TCP Server Configuration */
#define TCP_SERVER_PORT 5588
#define TCP_SERVER_MAX_CLIENTS 2
#define TCP_SERVER_HEARTBEAT_INTERVAL 500 // 心跳间隔 500ms
#define TCP_SERVER_RECEIVE_TIMEOUT 5000 // 接收超时 5 秒
/* 客户端连接结构 */
typedef struct {
int sock; /* 客户端socket */
struct sockaddr_in addr; /* 客户端地址 */
int connected; /* 连接状态 */
} client_conn_t;
/* 全局标志 */
extern volatile int data_upload_success;
/* 函数声明 */
void tcp_server_entry(void *parameter);
#endif /* TCP_SERVER_H */