Browse Source

隔开网关备份

xhj 3 weeks ago
parent
commit
a6bce0a4d0

+ 159 - 0
.cmake/api/v1/reply/codemodel-v2-f10e6914066e1b1ea646.json

@@ -0,0 +1,159 @@
+{
+	"configurations" : 
+	[
+		{
+			"directories" : 
+			[
+				{
+					"build" : ".",
+					"childIndexes" : 
+					[
+						1,
+						2,
+						3
+					],
+					"jsonFile" : "directory-.-d0094a50bb2071803777.json",
+					"minimumCMakeVersion" : 
+					{
+						"string" : "3.13"
+					},
+					"projectIndex" : 0,
+					"source" : "."
+				},
+				{
+					"build" : "modules/gateway-basic",
+					"jsonFile" : "directory-modules.gateway-basic-0cd18c0b274ae7603186.json",
+					"minimumCMakeVersion" : 
+					{
+						"string" : "3.13"
+					},
+					"parentIndex" : 0,
+					"projectIndex" : 1,
+					"source" : "modules/gateway-basic",
+					"targetIndexes" : 
+					[
+						0
+					]
+				},
+				{
+					"build" : "modules/gateway-scheduler",
+					"jsonFile" : "directory-modules.gateway-scheduler-d719f3c53bdee7fd76b3.json",
+					"minimumCMakeVersion" : 
+					{
+						"string" : "3.13"
+					},
+					"parentIndex" : 0,
+					"projectIndex" : 2,
+					"source" : "modules/gateway-scheduler",
+					"targetIndexes" : 
+					[
+						1
+					]
+				},
+				{
+					"build" : "modules/gateway-server",
+					"jsonFile" : "directory-modules.gateway-server-ff8eb450b6b9e59ddd8a.json",
+					"minimumCMakeVersion" : 
+					{
+						"string" : "3.13"
+					},
+					"parentIndex" : 0,
+					"projectIndex" : 3,
+					"source" : "modules/gateway-server",
+					"targetIndexes" : 
+					[
+						2
+					]
+				}
+			],
+			"name" : "",
+			"projects" : 
+			[
+				{
+					"childIndexes" : 
+					[
+						1,
+						2,
+						3
+					],
+					"directoryIndexes" : 
+					[
+						0
+					],
+					"name" : "embedded-gateway"
+				},
+				{
+					"directoryIndexes" : 
+					[
+						1
+					],
+					"name" : "gateway-basic",
+					"parentIndex" : 0,
+					"targetIndexes" : 
+					[
+						0
+					]
+				},
+				{
+					"directoryIndexes" : 
+					[
+						2
+					],
+					"name" : "gateway-scheduler",
+					"parentIndex" : 0,
+					"targetIndexes" : 
+					[
+						1
+					]
+				},
+				{
+					"directoryIndexes" : 
+					[
+						3
+					],
+					"name" : "gateway-server",
+					"parentIndex" : 0,
+					"targetIndexes" : 
+					[
+						2
+					]
+				}
+			],
+			"targets" : 
+			[
+				{
+					"directoryIndex" : 1,
+					"id" : "gateway-basic::@26444984b35057cfdfd9",
+					"jsonFile" : "target-gateway-basic-5afc96412c78d600d60f.json",
+					"name" : "gateway-basic",
+					"projectIndex" : 1
+				},
+				{
+					"directoryIndex" : 2,
+					"id" : "gateway-scheduler::@b14a20826b83cb04503c",
+					"jsonFile" : "target-gateway-scheduler-5b35df5f4d24c232017e.json",
+					"name" : "gateway-scheduler",
+					"projectIndex" : 2
+				},
+				{
+					"directoryIndex" : 3,
+					"id" : "gateway-server::@91cbd3ecfdd0686d89cc",
+					"jsonFile" : "target-gateway-server-5db9632f23c1e77089e5.json",
+					"name" : "gateway-server",
+					"projectIndex" : 3
+				}
+			]
+		}
+	],
+	"kind" : "codemodel",
+	"paths" : 
+	{
+		"build" : "E:/embedded-gateway",
+		"source" : "E:/embedded-gateway"
+	},
+	"version" : 
+	{
+		"major" : 2,
+		"minor" : 7
+	}
+}

+ 108 - 0
.cmake/api/v1/reply/index-2025-05-19T05-11-31-0090.json

@@ -0,0 +1,108 @@
+{
+	"cmake" : 
+	{
+		"generator" : 
+		{
+			"multiConfig" : false,
+			"name" : "Ninja"
+		},
+		"paths" : 
+		{
+			"cmake" : "D:/xhj/CLion 2024.3/bin/cmake/win/x64/bin/cmake.exe",
+			"cpack" : "D:/xhj/CLion 2024.3/bin/cmake/win/x64/bin/cpack.exe",
+			"ctest" : "D:/xhj/CLion 2024.3/bin/cmake/win/x64/bin/ctest.exe",
+			"root" : "D:/xhj/CLion 2024.3/bin/cmake/win/x64/share/cmake-3.30"
+		},
+		"version" : 
+		{
+			"isDirty" : false,
+			"major" : 3,
+			"minor" : 30,
+			"patch" : 5,
+			"string" : "3.30.5",
+			"suffix" : ""
+		}
+	},
+	"objects" : 
+	[
+		{
+			"jsonFile" : "codemodel-v2-f10e6914066e1b1ea646.json",
+			"kind" : "codemodel",
+			"version" : 
+			{
+				"major" : 2,
+				"minor" : 7
+			}
+		},
+		{
+			"jsonFile" : "cache-v2-6518418f9a2e812db9fa.json",
+			"kind" : "cache",
+			"version" : 
+			{
+				"major" : 2,
+				"minor" : 0
+			}
+		},
+		{
+			"jsonFile" : "cmakeFiles-v1-ac00f54fecb9c1c3ff53.json",
+			"kind" : "cmakeFiles",
+			"version" : 
+			{
+				"major" : 1,
+				"minor" : 1
+			}
+		},
+		{
+			"jsonFile" : "toolchains-v1-7c002d93335aea0b8309.json",
+			"kind" : "toolchains",
+			"version" : 
+			{
+				"major" : 1,
+				"minor" : 0
+			}
+		}
+	],
+	"reply" : 
+	{
+		"cache-v2" : 
+		{
+			"jsonFile" : "cache-v2-6518418f9a2e812db9fa.json",
+			"kind" : "cache",
+			"version" : 
+			{
+				"major" : 2,
+				"minor" : 0
+			}
+		},
+		"cmakeFiles-v1" : 
+		{
+			"jsonFile" : "cmakeFiles-v1-ac00f54fecb9c1c3ff53.json",
+			"kind" : "cmakeFiles",
+			"version" : 
+			{
+				"major" : 1,
+				"minor" : 1
+			}
+		},
+		"codemodel-v2" : 
+		{
+			"jsonFile" : "codemodel-v2-f10e6914066e1b1ea646.json",
+			"kind" : "codemodel",
+			"version" : 
+			{
+				"major" : 2,
+				"minor" : 7
+			}
+		},
+		"toolchains-v1" : 
+		{
+			"jsonFile" : "toolchains-v1-7c002d93335aea0b8309.json",
+			"kind" : "toolchains",
+			"version" : 
+			{
+				"major" : 1,
+				"minor" : 0
+			}
+		}
+	}
+}

+ 501 - 0
.cmake/api/v1/reply/target-gateway-scheduler-5b35df5f4d24c232017e.json

@@ -0,0 +1,501 @@
+{
+	"artifacts" : 
+	[
+		{
+			"path" : "deploy/bin/gateway-scheduler"
+		}
+	],
+	"backtrace" : 1,
+	"backtraceGraph" : 
+	{
+		"commands" : 
+		[
+			"add_executable",
+			"link_directories",
+			"add_library",
+			"add_definitions",
+			"include_directories"
+		],
+		"files" : 
+		[
+			"modules/gateway-scheduler/CMakeLists.txt",
+			"modules/gateway-basic/CMakeLists.txt",
+			"CMakeLists.txt"
+		],
+		"nodes" : 
+		[
+			{
+				"file" : 0
+			},
+			{
+				"command" : 0,
+				"file" : 0,
+				"line" : 41,
+				"parent" : 0
+			},
+			{
+				"command" : 1,
+				"file" : 0,
+				"line" : 24,
+				"parent" : 0
+			},
+			{
+				"file" : 1
+			},
+			{
+				"command" : 2,
+				"file" : 1,
+				"line" : 37,
+				"parent" : 3
+			},
+			{
+				"file" : 2
+			},
+			{
+				"command" : 3,
+				"file" : 2,
+				"line" : 44,
+				"parent" : 5
+			},
+			{
+				"command" : 3,
+				"file" : 2,
+				"line" : 43,
+				"parent" : 5
+			},
+			{
+				"command" : 3,
+				"file" : 2,
+				"line" : 41,
+				"parent" : 5
+			},
+			{
+				"command" : 4,
+				"file" : 0,
+				"line" : 18,
+				"parent" : 0
+			}
+		]
+	},
+	"compileGroups" : 
+	[
+		{
+			"compileCommandFragments" : 
+			[
+				{
+					"fragment" : "-std=gnu++1z -fdiagnostics-color=always"
+				}
+			],
+			"defines" : 
+			[
+				{
+					"backtrace" : 6,
+					"define" : "DATABASE_JSON_DIR=\"/usr/local/bin/database/json\""
+				},
+				{
+					"backtrace" : 7,
+					"define" : "DATABASE_SQLITE_DIR=\"/usr/local/bin/database/sqlite\""
+				},
+				{
+					"backtrace" : 8,
+					"define" : "DEBUG"
+				}
+			],
+			"includes" : 
+			[
+				{
+					"backtrace" : 9,
+					"path" : "E:/embedded-gateway/include"
+				},
+				{
+					"backtrace" : 9,
+					"path" : "E:/embedded-gateway/library/include"
+				},
+				{
+					"backtrace" : 9,
+					"path" : "E:/embedded-gateway/modules"
+				},
+				{
+					"backtrace" : 9,
+					"path" : "E:/embedded-gateway/deploy/library"
+				}
+			],
+			"language" : "CXX",
+			"languageStandard" : 
+			{
+				"backtraces" : 
+				[
+					1
+				],
+				"standard" : "17"
+			},
+			"sourceIndexes" : 
+			[
+				0,
+				1,
+				2,
+				3,
+				4,
+				5,
+				6,
+				7,
+				8,
+				9,
+				10,
+				11,
+				12,
+				13,
+				14,
+				15,
+				16,
+				17,
+				18,
+				19,
+				20,
+				21,
+				22,
+				23,
+				24,
+				25,
+				26,
+				27,
+				28,
+				29,
+				30
+			]
+		}
+	],
+	"dependencies" : 
+	[
+		{
+			"backtrace" : 1,
+			"id" : "gateway-basic::@26444984b35057cfdfd9"
+		}
+	],
+	"id" : "gateway-scheduler::@b14a20826b83cb04503c",
+	"link" : 
+	{
+		"commandFragments" : 
+		[
+			{
+				"fragment" : "",
+				"role" : "flags"
+			},
+			{
+				"backtrace" : 2,
+				"fragment" : "-LE:\\embedded-gateway\\library\\lib",
+				"role" : "libraryPath"
+			},
+			{
+				"fragment" : "-Wl,-rpath,E:/embedded-gateway/library/lib:E:/embedded-gateway/deploy/library",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lsqlite3",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lboost_filesystem",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lmodbus",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lpthread",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lpaho-mqttpp3",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lpaho-mqtt3as",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-liec61850",
+				"role" : "libraries"
+			},
+			{
+				"fragment" : "-Wl,-Bstatic",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lloragw",
+				"role" : "libraries"
+			},
+			{
+				"fragment" : "-Wl,-Bdynamic",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "deploy\\library\\libgateway-basic.so",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lsqlite3",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lboost_filesystem",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 4,
+				"fragment" : "-lhiredis",
+				"role" : "libraries"
+			}
+		],
+		"language" : "CXX"
+	},
+	"name" : "gateway-scheduler",
+	"nameOnDisk" : "gateway-scheduler",
+	"paths" : 
+	{
+		"build" : "modules/gateway-scheduler",
+		"source" : "modules/gateway-scheduler"
+	},
+	"sourceGroups" : 
+	[
+		{
+			"name" : "Source Files",
+			"sourceIndexes" : 
+			[
+				0,
+				1,
+				2,
+				3,
+				4,
+				5,
+				6,
+				7,
+				8,
+				9,
+				10,
+				11,
+				12,
+				13,
+				14,
+				15,
+				16,
+				17,
+				18,
+				19,
+				20,
+				21,
+				22,
+				23,
+				24,
+				25,
+				26,
+				27,
+				28,
+				29,
+				30
+			]
+		}
+	],
+	"sources" : 
+	[
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/executant/BasicExecutant.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/executant/GPIOExecutant.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/executant/ModbusExecutant.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/insulated-switch-server/insulated_switch_server.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/lora_server/LoRaServer.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/main.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/report/MyIec61850Server.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/report/TaskReportService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleCommunicationRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleDeviceCommunicationRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleDeviceProtocolRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleDeviceRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleProtocolRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleTaskFormatterRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/repository/ScheduleTaskRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/BasicExecutorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/CalculateService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/FlowerExecutorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/FormatterExecutorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/QueueService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleCommunicationService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleDeviceCommunicationService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleDeviceProtocolService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleDeviceService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleProtocolService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleTaskFormatterService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/ScheduleTaskService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/service/TaskExecutorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/tcp_server/TcpServer.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-scheduler/src/utils/HashUtils.cpp",
+			"sourceGroupIndex" : 0
+		}
+	],
+	"type" : "EXECUTABLE"
+}

+ 601 - 0
.cmake/api/v1/reply/target-gateway-server-5db9632f23c1e77089e5.json

@@ -0,0 +1,601 @@
+{
+	"artifacts" : 
+	[
+		{
+			"path" : "deploy/bin/gateway-server"
+		}
+	],
+	"backtrace" : 1,
+	"backtraceGraph" : 
+	{
+		"commands" : 
+		[
+			"add_executable",
+			"link_directories",
+			"target_link_libraries",
+			"add_library",
+			"add_definitions",
+			"include_directories"
+		],
+		"files" : 
+		[
+			"modules/gateway-server/CMakeLists.txt",
+			"modules/gateway-basic/CMakeLists.txt",
+			"CMakeLists.txt"
+		],
+		"nodes" : 
+		[
+			{
+				"file" : 0
+			},
+			{
+				"command" : 0,
+				"file" : 0,
+				"line" : 34,
+				"parent" : 0
+			},
+			{
+				"command" : 1,
+				"file" : 0,
+				"line" : 22,
+				"parent" : 0
+			},
+			{
+				"command" : 2,
+				"file" : 0,
+				"line" : 37,
+				"parent" : 0
+			},
+			{
+				"file" : 1
+			},
+			{
+				"command" : 3,
+				"file" : 1,
+				"line" : 37,
+				"parent" : 4
+			},
+			{
+				"file" : 2
+			},
+			{
+				"command" : 4,
+				"file" : 2,
+				"line" : 44,
+				"parent" : 6
+			},
+			{
+				"command" : 4,
+				"file" : 2,
+				"line" : 43,
+				"parent" : 6
+			},
+			{
+				"command" : 4,
+				"file" : 2,
+				"line" : 41,
+				"parent" : 6
+			},
+			{
+				"command" : 5,
+				"file" : 0,
+				"line" : 16,
+				"parent" : 0
+			}
+		]
+	},
+	"compileGroups" : 
+	[
+		{
+			"compileCommandFragments" : 
+			[
+				{
+					"fragment" : "-std=gnu++1z -fdiagnostics-color=always"
+				}
+			],
+			"defines" : 
+			[
+				{
+					"backtrace" : 7,
+					"define" : "DATABASE_JSON_DIR=\"/usr/local/bin/database/json\""
+				},
+				{
+					"backtrace" : 8,
+					"define" : "DATABASE_SQLITE_DIR=\"/usr/local/bin/database/sqlite\""
+				},
+				{
+					"backtrace" : 9,
+					"define" : "DEBUG"
+				}
+			],
+			"includes" : 
+			[
+				{
+					"backtrace" : 10,
+					"path" : "E:/embedded-gateway/include"
+				},
+				{
+					"backtrace" : 10,
+					"path" : "E:/embedded-gateway/library/include"
+				},
+				{
+					"backtrace" : 10,
+					"path" : "E:/embedded-gateway/modules"
+				}
+			],
+			"language" : "CXX",
+			"languageStandard" : 
+			{
+				"backtraces" : 
+				[
+					1
+				],
+				"standard" : "17"
+			},
+			"sourceIndexes" : 
+			[
+				0,
+				1,
+				2,
+				3,
+				4,
+				5,
+				6,
+				7,
+				8,
+				9,
+				10,
+				11,
+				12,
+				13,
+				14,
+				15,
+				16,
+				17,
+				18,
+				19,
+				20,
+				21,
+				22,
+				23,
+				24,
+				25,
+				26,
+				27,
+				28,
+				29,
+				30,
+				31,
+				32,
+				33,
+				34,
+				35,
+				36,
+				37,
+				38,
+				39,
+				40,
+				41,
+				42,
+				43,
+				44,
+				45
+			]
+		}
+	],
+	"dependencies" : 
+	[
+		{
+			"backtrace" : 1,
+			"id" : "gateway-basic::@26444984b35057cfdfd9"
+		}
+	],
+	"id" : "gateway-server::@91cbd3ecfdd0686d89cc",
+	"link" : 
+	{
+		"commandFragments" : 
+		[
+			{
+				"fragment" : "",
+				"role" : "flags"
+			},
+			{
+				"backtrace" : 2,
+				"fragment" : "-LE:\\embedded-gateway\\library\\lib",
+				"role" : "libraryPath"
+			},
+			{
+				"backtrace" : 2,
+				"fragment" : "-LE:\\embedded-gateway\\deploy\\library",
+				"role" : "libraryPath"
+			},
+			{
+				"fragment" : "-Wl,-rpath,E:/embedded-gateway/library/lib:E:/embedded-gateway/deploy/library",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lmicrohttpd",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lsqlite3",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lboost_filesystem",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "deploy\\library\\libgateway-basic.so",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 3,
+				"fragment" : "-lstdc++fs",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lsqlite3",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 1,
+				"fragment" : "-lboost_filesystem",
+				"role" : "libraries"
+			},
+			{
+				"backtrace" : 5,
+				"fragment" : "-lhiredis",
+				"role" : "libraries"
+			}
+		],
+		"language" : "CXX"
+	},
+	"name" : "gateway-server",
+	"nameOnDisk" : "gateway-server",
+	"paths" : 
+	{
+		"build" : "modules/gateway-server",
+		"source" : "modules/gateway-server"
+	},
+	"sourceGroups" : 
+	[
+		{
+			"name" : "Source Files",
+			"sourceIndexes" : 
+			[
+				0,
+				1,
+				2,
+				3,
+				4,
+				5,
+				6,
+				7,
+				8,
+				9,
+				10,
+				11,
+				12,
+				13,
+				14,
+				15,
+				16,
+				17,
+				18,
+				19,
+				20,
+				21,
+				22,
+				23,
+				24,
+				25,
+				26,
+				27,
+				28,
+				29,
+				30,
+				31,
+				32,
+				33,
+				34,
+				35,
+				36,
+				37,
+				38,
+				39,
+				40,
+				41,
+				42,
+				43,
+				44,
+				45
+			]
+		}
+	],
+	"sources" : 
+	[
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/CommunicationController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/DashboardDeviceController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/DashboardDeviceHistoryController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/DeviceCommunicationController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/DeviceController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/DeviceProtocolController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/ExecutorController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/FlowerNodeController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/FlowerOperatorController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/ProtocolController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/RedisCacheController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/RedisReportCacheController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/TaskController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/TaskFormatterController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/controller/UserController.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/large_screen_display/devices_info.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/main.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/CommunicationRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/DashboardDeviceHistoryRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/DeviceCommunicationRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/DeviceProtocolRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/DeviceRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/ExecutorRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/FlowerNodeRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/FlowerOperatorRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/ProtocolRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/TaskFormatterRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/TaskRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/repository/UserRepository.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/server/BasicRouter.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/server/BasicServer.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/CommunicationService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/DashboardDeviceHistoryService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/DashboardDeviceService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/DeviceCommunicationService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/DeviceProtocolService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/DeviceService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/ExecutorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/FlowerNodeService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/FlowerOperatorService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/ProtocolService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/RedisCacheService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/RedisReportCacheService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/TaskFormatterService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/TaskService.cpp",
+			"sourceGroupIndex" : 0
+		},
+		{
+			"backtrace" : 1,
+			"compileGroupIndex" : 0,
+			"path" : "modules/gateway-server/src/service/UserService.cpp",
+			"sourceGroupIndex" : 0
+		}
+	],
+	"type" : "EXECUTABLE"
+}

+ 87 - 0
.cmake/api/v1/reply/toolchains-v1-7c002d93335aea0b8309.json

@@ -0,0 +1,87 @@
+{
+	"kind" : "toolchains",
+	"toolchains" : 
+	[
+		{
+			"compiler" : 
+			{
+				"id" : "GNU",
+				"implicit" : 
+				{
+					"includeDirectories" : 
+					[
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.5.0/include",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.5.0/include-fixed",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/include",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/include"
+					],
+					"linkDirectories" : 
+					[
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/7.5.0",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/lib/gcc",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/lib64",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/lib",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/libc/lib",
+						"E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/aarch64-linux-gnu/libc/usr/lib"
+					],
+					"linkFrameworkDirectories" : [],
+					"linkLibraries" : 
+					[
+						"gcc",
+						"gcc_s",
+						"c",
+						"gcc",
+						"gcc_s"
+					]
+				},
+				"path" : "E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc.exe",
+				"version" : "7.5.0"
+			},
+			"language" : "C",
+			"sourceFileExtensions" : 
+			[
+				"c",
+				"m"
+			]
+		},
+		{
+			"compiler" : 
+			{
+				"id" : "GNU",
+				"implicit" : 
+				{
+					"includeDirectories" : [],
+					"linkDirectories" : [],
+					"linkFrameworkDirectories" : [],
+					"linkLibraries" : []
+				},
+				"path" : "E:/xhj/gcc-linaro-7.5.0-2019/gcc-linaro-7.5.0-2019.12-i686-mingw32_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++.exe",
+				"version" : "7.5.0"
+			},
+			"language" : "CXX",
+			"sourceFileExtensions" : 
+			[
+				"C",
+				"M",
+				"c++",
+				"cc",
+				"cpp",
+				"cxx",
+				"mm",
+				"mpp",
+				"CPP",
+				"ixx",
+				"cppm",
+				"ccm",
+				"cxxm",
+				"c++m"
+			]
+		}
+	],
+	"version" : 
+	{
+		"major" : 1,
+		"minor" : 0
+	}
+}

BIN
library/lib/libloragw.a


+ 176 - 0
modules/gateway-scheduler/src/insulated-switch-server/insulated_switch_server.cpp

@@ -0,0 +1,176 @@
+
+#include "insulated_switch_server.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <cstring>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <map>
+#include <nlohmann/json.hpp>
+#include <sstream>
+#include <unordered_set>
+#include <algorithm>
+using json = nlohmann::json;
+
+
+std::unordered_set<std::string> whiteList = {"ABCDEF1234A1", "ABCDEF1234B1", "ABCDEF1234C1"};
+std::map<std::string, std::string> deviceIdToName = {{"ABCDEF1234A1", "1"}, {"ABCDEF1234B1", "2"}, {"ABCDEF1234C1", "3"}};
+
+std::map<int, std::string> insulatedParaIndex = {{332,"压力"}, {30, "电池电压"}, {2054, "温度"}};
+
+
+std::string csvSavePath = "./saver/";
+
+
+std::vector<std::string> splitATCommand(const std::string& data) {
+  std::vector<std::string> tokens;
+  std::stringstream ss(data);
+  std::string token;
+
+  // 跳过开头的 "AT+MDAT="
+  size_t start_pos = data.find('=');
+  if (start_pos == std::string::npos) return tokens;
+
+  // 提取等号后的部分
+  std::string payload = data.substr(start_pos + 1);
+  std::stringstream payload_ss(payload);
+
+  // 按逗号分割
+  while (std::getline(payload_ss, token, ',')) {
+    tokens.push_back(token);
+  }
+
+  return tokens;
+}
+
+
+// 辅助函数:单个16进制字符转数值
+uint8_t hex_digit_to_value(char c) {
+  if (c >= '0' && c <= '9') return c - '0';
+  if (c >= 'A' && c <= 'F') return 10 + (c - 'A');
+  if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
+  throw std::invalid_argument("Invalid hex digit");
+}
+std::vector<uint8_t> hex_string_to_bytes(const std::string& hex_str) {
+  if (hex_str.length() % 2 != 0) {
+    throw std::invalid_argument("Hex string must have even length");
+  }
+
+  std::vector<uint8_t> bytes;
+  bytes.reserve(hex_str.size() / 2);
+
+  for (size_t i = 0; i < hex_str.size(); i += 2) {
+    uint8_t byte = static_cast<uint8_t>(
+        (hex_digit_to_value(hex_str[i]) << 4) |
+        hex_digit_to_value(hex_str[i+1])
+    );
+    bytes.push_back(byte);
+  }
+
+  return bytes;
+}
+
+// 打印字节数组(16进制格式)
+void print_hex_bytes(const std::vector<uint8_t>& bytes) {
+  std::cout << "Converted bytes (hex):\n";
+  for (size_t i = 0; i < bytes.size(); ++i) {
+    std::cout << std::hex << std::setw(2) << std::setfill('0')
+              << static_cast<int>(bytes[i]);
+  }
+  std::cout << std::dec << "\nTotal bytes: " << bytes.size() << std::endl;
+}
+
+
+float decodeInsulatedSwitchPara(std::vector<uint8_t> group){
+  uint16_t paraIndex = ((group[1] << 8) | group[0]) >> 2;
+  uint8_t temp[sizeof(float)];
+
+  float value;
+  std::memcpy(&value, &group[2], sizeof(float));
+  // 将4字节拷贝到float中(避免类型双关的未定义行为)
+//  if(paraIndex == 332) {
+//    std::memcpy(temp, &group[2], sizeof(float));
+//    std::reverse(temp, temp + sizeof(float));
+//
+//    std::memcpy(&value, temp, sizeof(float));
+//  }else{
+//    std::memcpy(&value, &group[2], sizeof(float));
+//  }
+  std::cout << "paraIndex: " << paraIndex << insulatedParaIndex[paraIndex] << " value:" << value << std::endl;
+  return value;
+}
+
+
+
+void saveFloatsToCSV(const std::string& filename,
+                     const std::vector<float>& data) {
+  std::ofstream file(filename);
+  if (!file.is_open()) {
+    throw std::runtime_error("Failed to open file: " + filename);
+  }
+
+  // 直接写入单行数据
+  for (size_t i = 0; i < data.size(); ++i) {
+    file << data[i];
+    if (i != data.size() - 1) file << ","; // 最后一个元素不加逗号
+  }
+}
+
+
+
+std::vector<float> decodeInsulatedSwitchData(const std::string& data){
+  auto bytes = hex_string_to_bytes(&data[0]);
+  print_hex_bytes(bytes);
+  uint16_t DataLen = bytes[6] >> 4;
+  std::cout << "DataLen: " << DataLen << std::endl;
+  std::vector<float> res;
+
+  for(int i = 0; i < DataLen; i++){
+    // 提取当前组的6个字节
+    std::vector<uint8_t> group(
+        bytes.begin() + 7 + i*6,
+        bytes.begin() + 7 + i*6 + 6
+    );
+    res.push_back(decodeInsulatedSwitchPara(group));
+  }
+  return res;
+
+
+}
+
+
+
+std::string get_current_time_str() {
+  auto now = std::chrono::system_clock::now();
+  std::time_t now_time_t = std::chrono::system_clock::to_time_t(now);
+  std::tm local_tm;
+
+#if defined(_WIN32) || defined(_WIN64)
+  localtime_s(&local_tm, &now_time_t);  // Windows 安全版本
+#else
+  localtime_r(&now_time_t, &local_tm);  // Linux / macOS
+#endif
+
+  std::ostringstream oss;
+  oss << std::put_time(&local_tm, "%Y_%m_%d_%H_%M_%S");
+  return oss.str();
+}
+
+
+void SerialPortReader::dataHandler(const std::string& data){
+  if (data.find("AT+MDAT") == 0) {
+
+    std::vector<std::string> fields = splitATCommand(data);
+
+    // 结构化访问示例
+    if(whiteList.find(fields[1]) != whiteList.end()) {
+      std::string path = csvSavePath + deviceIdToName[fields[1]] + "_" + get_current_time_str() + ".csv";
+//      std::cout << path << std::endl;
+      std::vector<float> res= decodeInsulatedSwitchData(fields[2]);
+      saveFloatsToCSV(path, res);
+    }
+  }
+}

+ 127 - 0
modules/gateway-scheduler/src/insulated-switch-server/insulated_switch_server.h

@@ -0,0 +1,127 @@
+//
+// Created by lenovo on 2025/4/10.
+//
+
+#ifndef EMBEDDED_GATEWAY_INSULATED_SWITCH_SERVER_H
+#define EMBEDDED_GATEWAY_INSULATED_SWITCH_SERVER_H
+
+#include <iostream>
+#include <fcntl.h>
+#include <unistd.h>
+#include <thread>
+#include <atomic>
+#include <functional>
+#include <string>
+#include <mutex>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <string>
+#include <stdexcept>
+
+
+class SerialPortReader {
+ public:
+  SerialPortReader(const std::string& port)
+      : port_(port), running_(false) {}
+
+  ~SerialPortReader() {
+    stop();
+  }
+
+  bool start() {
+    fd_ = open(port_.c_str(), O_RDWR | O_NOCTTY);
+    if (fd_ < 0) {
+      perror(("Error opening " + port_).c_str());
+      return false;
+    }
+
+    running_.store(true);
+    thread_ = std::thread(&SerialPortReader::readThreadFunc, this);
+    return true;
+  }
+
+  void stop() {
+    running_.store(false);
+    if (thread_.joinable()) {
+      thread_.join();
+    }
+    if (fd_ >= 0) {
+      close(fd_);
+      fd_ = -1;
+    }
+  }
+
+  void dataHandler(const std::string& data);
+ private:
+  void readThreadFunc() {
+    char buf[256];
+    std::string partial_data; // 处理不完整数据
+
+    std::cout << "begin send to uart!" << std::endl;
+    write_to_serial("/dev/ttyS4", "begin send to uart!");
+    while (running_.load()) {
+      int n = read(fd_, buf, sizeof(buf));
+      if (n > 0) {
+        std::cout << buf << std::endl;
+        std::lock_guard<std::mutex> lock(mutex_);
+
+        write_to_serial("/dev/ttyS4", buf);
+        // 处理数据(支持不完整数据包拼接)
+        partial_data.append(buf, n);
+
+        // 按行分割处理(假设数据以换行符分隔)
+        size_t pos;
+        while ((pos = partial_data.find('\n')) != std::string::npos) {
+          std::string complete_msg = partial_data.substr(0, pos);
+          partial_data.erase(0, pos + 1);
+
+          if (!complete_msg.empty()) {
+            dataHandler(complete_msg);
+          }
+        }
+      } else if (n < 0) {
+        if (errno != EAGAIN && errno != EWOULDBLOCK) {
+          perror("Read error");
+          break;
+        }
+      }
+      // 短暂休眠避免CPU占用过高
+      std::this_thread::sleep_for(std::chrono::milliseconds(10));
+    }
+  }
+
+  void write_to_serial(const std::string& port_name, const std::string& data) {
+    // 1. 打开串口(只写模式 + 非阻塞,避免卡住)
+    int serial_port = open(port_name.c_str(), O_WRONLY | O_NOCTTY | O_NONBLOCK);
+    if (serial_port == -1) {
+      throw std::runtime_error("Failed to open serial port: " + port_name);
+    }
+
+    // 2. 直接写入数据(不配置参数)
+    ssize_t bytes_written = write(serial_port, data.c_str(), data.size());
+    if (bytes_written == -1) {
+      close(serial_port);
+      throw std::runtime_error("Failed to write data to serial port");
+    }
+
+    // 3. 关闭串口
+    close(serial_port);
+  }
+
+
+
+  std::string port_;
+  int fd_ = -1;
+  std::thread thread_;
+  std::atomic<bool> running_;
+  //  DataCallback callback_;
+  std::mutex mutex_;
+};
+
+
+
+
+
+
+#endif  // EMBEDDED_GATEWAY_INSULATED_SWITCH_SERVER_H

+ 65 - 0
modules/gateway-scheduler/src/lora_server/LoRaServer.cpp

@@ -0,0 +1,65 @@
+
+
+#include "LoRaServer.h"
+// Global flag to indicate if the server should keep running
+volatile sig_atomic_t keepRunning = true;
+
+// Signal handler to gracefully stop the server
+void signalHandler(int signal) {
+  if (signal == SIGINT) {
+    std::cout << "\nReceived SIGINT. Stopping LoRa server..." << std::endl;
+    keepRunning = false;
+  }
+}
+
+
+LoRaServer::LoRaServer(const std::string& port, int baudRate) {
+  // Open the serial port
+  serialPort = open(port.c_str(), O_RDWR | O_NOCTTY);
+  if (serialPort < 0) {
+    std::cerr << "Error opening serial port!" << std::endl;
+    return;
+  }
+
+  // Configure the serial port
+  struct termios tty;
+  tcgetattr(serialPort, &tty);
+
+  cfsetospeed(&tty, baudRate); // Set baud rate
+  cfsetispeed(&tty, baudRate);
+
+  tty.c_cflag &= ~PARENB; // No parity
+  tty.c_cflag &= ~CSTOPB; // 1 stop bit
+  tty.c_cflag &= ~CSIZE;
+  tty.c_cflag |= CS8;     // 8 data bits
+  tty.c_cflag &= ~CRTSCTS; // Disable hardware flow control
+  tty.c_cflag |= CREAD | CLOCAL; // Enable receiver
+
+  tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // Raw mode
+  tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Disable software flow control
+  tty.c_oflag &= ~OPOST; // Raw output
+
+  tcsetattr(serialPort, TCSANOW, &tty);
+}
+
+LoRaServer::~LoRaServer() {
+  if (serialPort >= 0) {
+    close(serialPort);
+  }
+}
+
+void LoRaServer::startListening() {
+  std::cout << "LoRa Server: Listening for incoming messages..." << std::endl;
+  char buffer[256];
+  while (keepRunning) {
+    int n = read(serialPort, buffer, sizeof(buffer) - 1);
+    if (n > 0) {
+      buffer[n] = '\0';
+      std::cout << "LoRa Server: Received message -> " << buffer << std::endl;
+    } else {
+      usleep(10000); // Sleep briefly to avoid busy-waiting
+    }
+  }
+  std::cout << "LoRa Server: Stopped listening." << std::endl;
+}
+

+ 39 - 0
modules/gateway-scheduler/src/lora_server/LoRaServer.h

@@ -0,0 +1,39 @@
+//
+// Created by lenovo on 2025/4/7.
+//
+
+#ifndef EMBEDDED_GATEWAY_LORASERVER_H
+#define EMBEDDED_GATEWAY_LORASERVER_H
+
+#include <iostream>
+#include <string>
+#include <unistd.h> // for usleep
+#include <fcntl.h>  // for open
+#include <termios.h> // for serial communication
+#include <signal.h> // for signal handling
+
+class LoRaServer {
+ private:
+  int serialPort; // File descriptor for the serial port
+
+ public:
+  /**
+     * @brief Constructor to initialize the LoRa server.
+     * @param port The serial port device (e.g., "/dev/ttyUSB0").
+     * @param baudRate The baud rate for serial communication (e.g., B9600).
+   */
+  LoRaServer(const std::string& port, int baudRate);
+
+  /**
+     * @brief Destructor to clean up resources.
+   */
+  ~LoRaServer();
+
+  /**
+     * @brief Starts listening for incoming LoRa messages.
+     * This method runs in a loop until the server is stopped.
+   */
+  void startListening();
+};
+
+#endif  // EMBEDDED_GATEWAY_LORASERVER_H