# protocol **Repository Path**: leo-iot/protocol ## Basic Information - **Project Name**: protocol - **Description**: 设备侧协议框架 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-15 - **Last Updated**: 2025-06-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # XCom Protocol Handler This is a C++ project designed to implement support for the XCom protocol, including functionalities such as parsing XCom files and processing protocol data. The project achieves flexible data description and loading through Lua configuration. ## Features - **XCom Protocol Parsing**: Loads and parses XCom files using the `XComParser` class. - **Lua Integration**: Describes protocol data using Lua configuration, integrated through the `LuaConfig` and `LuaScada` classes. - **Protocol Processing**: Processes protocol data according to node configurations using the `XComProcess` class. - **Modular Design**: `XComNode` and `XComHandler` provide abstraction and implementation of concrete operations for protocol nodes. - **Test Support**: The project includes a test module to verify the correctness of XCom parsing and processing logic. ## Main Components - `xcom_parser.cpp`: Core logic for parsing XCom files. - `xcom_process.cpp`: Processing logic for XCom protocol data. - `xcom_node.cpp`: Defines the interface for protocol nodes. - `xcom_handler.cpp`: Provides common operational interfaces for the XCom protocol. - `lua_config.cpp`: Core logic for integrating Lua configurations. - `lua_scada.cpp`: Implements the integration between Lua and SCADA systems. ## Build and Test ### Dependencies - C++11 or higher - CMake for building - Lua library support - Google Test (for unit testing) ### Build Instructions ```bash mkdir build cd build cmake .. make ``` ### Running Tests Test files are located in the `test/` directory. You can run them using the following commands: ```bash ./test/xcom_parser_test ./test/xcom_process_test ``` ## Usage Examples ### Loading an XCom File ```cpp XComParser parser; parser.LoadXComFile("example.xcom"); ``` ### Creating a Protocol Node ```cpp std::shared_ptr node = std::make_shared(); node->SetName("example_node"); ``` ### Processing Protocol Data ```cpp XComProcess process(node, "127.0.0.1"); process.ProcessData(); ``` ## Contributing and Feedback Issues and Pull Requests are welcome to help improve this project. ## License This project is licensed under the MIT License. For details, please refer to the `LICENSE` file. --- The content above is a general description based on the code structure. For more detailed documentation, it is recommended to refer to the specific source files and test cases.