A large model-based internet of things protocol code construction system and method
By using a multi-agent collaborative working system based on a large model, the entire process of IoT protocol code development has been automated, solving the problems of low efficiency, high cost, and unstable quality in existing technologies, improving development efficiency and code quality, and meeting the real-time and reliability requirements of fields such as vehicle networking.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN ZHANLAN MATRIX TECHNOLOGY CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies suffer from low efficiency, high cost, and unstable quality in the development of IoT communication protocol code. They cannot achieve a complete closed loop from protocol requirements analysis to final code testing and delivery, leading to bottlenecks in project implementation. Especially in the field of vehicle networking, where real-time and reliability requirements are stringent, the inefficiency and instability of manual development can easily cause communication failures.
Design an automated system for multi-agent collaborative work based on a large model. Through protocol document cleaning, structured parsing, architecture design, test-driven development, and layered code generation, realize a standardized eight-step process from protocol document input to deployable code output. It includes protocol document processing, structured parsing, code generation, and testing modules, supports multiple protocol document formats, and has task status traceability and exception recovery capabilities.
It has achieved full automation of IoT protocol code development, improving development efficiency by more than 80%, reducing professional manpower costs, generating code of senior engineer quality, and enabling direct application in practical applications. It supports heterogeneous data processing and multi-technology stack adaptation, enhancing the robustness and reliability of the system.
Smart Images

Figure CN122433710A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, specifically to a system and method for constructing Internet of Things (IoT) protocol code based on a large model. Background Technology
[0002] The Internet of Things (IoT) technology, especially in the field of connected vehicles, is experiencing rapid development. Communication protocols are central to enabling reliable and efficient data interaction between devices and the cloud, and between devices themselves. Accurate and efficient protocol parsing code is a crucial foundation for ensuring the functionality and performance of the entire IoT system. Currently, the development of IoT communication protocol parsing code primarily relies on a traditional, manually-led approach.
[0003] Currently, existing technologies generally employ a manual development model. Specifically, development engineers must first manually read and parse the communication protocol document to understand the core content defined in the protocol, such as frame structure, data format, interaction logic, and instruction definitions. Based on this, engineers must use their professional knowledge and experience to manually translate the protocol specification into parsing code in a specific programming language. After the code development is completed, a series of tasks, including unit testing, integration testing, and writing development documentation, are still required to ultimately deliver the entire protocol parsing component. Although code generation assistance technologies based on large models exist, these technologies are usually only used to generate isolated code snippets and fail to build a professional, standardized, and fully automated generation system for IoT communication protocols, thus failing to achieve a complete closed loop from protocol requirements analysis to final code testing and delivery.
[0004] However, existing technical methods have significant flaws and shortcomings. Manually parsing complex communication protocol documents and writing code typically takes days or even weeks. Due to the lack of standardized processes, the development pace varies greatly among different engineers, making it difficult to meet the rapid iteration and deployment requirements of IoT projects, resulting in extremely low development efficiency. The development of protocol parsing code heavily relies on professional engineers with both IoT communication knowledge and software development capabilities. Senior development engineers, in particular, have extremely high labor costs, and the large amount of repetitive parsing and coding work is essentially a waste of high-level human resources. The quality of the code depends entirely on the individual professional level and rigor of the specific development engineer, leading to significant differences in code standardization, readability, and maintainability between different engineers and different projects. Furthermore, manual coding is highly susceptible to introducing code vulnerabilities such as protocol parsing logic errors and missing boundary condition handling, affecting system reliability. Existing large-model-assisted code generation technologies fail to design standardized execution steps tailored to the characteristics of IoT protocol development. These technologies can only generate fragmented code snippets and cannot achieve an end-to-end automated closed loop from unstructured protocol document input to structured protocol analysis, layered code generation, automated testing and verification, and project document integration. Therefore, the generated code cannot be directly applied to actual production environments, and its practical value is limited.
[0005] In summary, existing technologies have made the development of IoT communication protocol code a bottleneck for project implementation, especially in fields such as vehicle networking where real-time performance and reliability requirements are stringent. The inefficiency and instability of manual development can easily lead to communication failures, thus hindering the improvement of the overall system performance. Summary of the Invention
[0006] The purpose of this invention is to provide an IoT protocol code building system based on a large model. This invention designs an automated system for multi-agent collaborative work, utilizing prompt word engineering to precisely guide the large model, and constructs a standardized eight-step process from protocol document input to deployable code output. The system first cleans and structures the protocol document to form a machine-understandable protocol model; then, it designs the architecture and initializes the engineering skeleton; based on this, it incrementally generates and verifies each segment of protocol parsing code through unit testing using a test-driven development approach; subsequently, it generates and integrates and verifies other layered code such as the access layer and business layer; finally, it automatically integrates and outputs a complete, tested protocol processing system project and standardized documentation. This invention aims to automate the entire protocol code development process, greatly improving development efficiency and reducing labor costs, while ensuring the quality of the generated code reaches the level of a senior engineer and is ready for direct practical application.
[0007] To achieve this objective, the present invention provides an IoT protocol code construction system based on a large model, comprising: The protocol document processing module is used to clean the communication protocol documents of the Internet of Things or the Internet of Vehicles to obtain the cleaned protocol text; the protocol parsing agent performs structured parsing on the cleaned protocol text to obtain a structured protocol model; and the structured protocol model is quality audited. Based on the audited structured protocol model, the protocol processing system is modularly designed according to the set requirements to generate an architecture summary file and an output index file. The large model inference module is used to obtain the protocol inference text through prompt word engineering based on the cleaned protocol text, structured protocol model, architecture summary file, product index file and pre-trained language model; The code generation and testing module is used to generate test case lists and message test data based on the structured protocol model; based on the architecture summary file and the artifact index file, the code generation agent creates a standardized protocol project directory structure, protocol build files and common base classes in the preset target working directory, thereby forming the initialization project skeleton of the protocol processing system. Based on the protocol reasoning text, the initialization engineering skeleton, and the message identifiers in the structured protocol model, the entity class code and parser class code corresponding to each message identifier are incrementally generated by the code generation agent; the special unit test corresponding to each message identifier is generated by the test agent, and the corresponding special unit test is executed according to the test case list and message test data. When all special unit tests pass, the protocol parsing layer code of the protocol processing system is generated based on the entity class code and parser class code corresponding to all message identifiers. Based on the protocol reasoning text, structured protocol model, initialization project skeleton, and architecture summary file, a code generation agent generates access layer code, business layer code, and data storage layer code for the protocol processing system. Integration testing is then performed on the access layer code, business layer code, and data storage layer code. When the integration test passes, the protocol processing system code is generated based on the access layer code, business layer code, data storage layer code, and the protocol parsing layer code.
[0008] Preferably, it also includes a document integration module, which is used to summarize and generate project description documents and directly deployable communication protocol parsing code projects based on workflow status files, task handover files, architecture summary files, artifact index files, unit test result files, integration test result files and protocol processing system code through a document integration agent; The workflow status file is a file specified or created by the main control agent in front of the protocol document processing module, used to record the global status and progress of the protocol processing system construction process. The task handover file is a file specified or created by the main control agent in front of the protocol document processing module, used to transmit specific task instructions between the main control agent and various professional sub-agents.
[0009] Preferably, the specific method for obtaining a structured protocol model by performing structured parsing of the cleaned protocol text through a protocol parsing agent is as follows: The protocol parsing agent scans the cleaned protocol text, identifies and locates all protocol definition blocks containing set keywords, and forms a preliminary message list. For each protocol definition block, the protocol parsing agent uses rule matching and the semantic understanding capabilities of a pre-trained language model to parse and extract the protocol's technical specifications. The protocol parsing agent organizes the extracted technical specifications into a machine-readable structured data model and outputs a series of files, including a protocol index file, a single message definition file, an aggregated protocol definition file, and a protocol summary file. Based on the machine-readable structured data model and the series of files, the protocol parsing agent performs consistency checks on field offset continuity, length consistency, bit field closure, message integrity, and duplicate identifiers to obtain a structured protocol model.
[0010] The preferred method for obtaining the protocol reasoning text is as follows: Based on the cleaned protocol text, structured protocol model, architecture summary file, and product index file, task instructions are set. According to the received task instructions, the required structured input file for completing the task is determined. Based on the current task type, the corresponding preset task template is called, and the structured input file is inserted into the specified position of the prompt word template to obtain prompt words that conform to the task instructions. The prompt words are then input into the pre-trained language model, which considers the prompt words based on pre-trained knowledge and outputs protocol reasoning text.
[0011] Preferably, the specific method for obtaining the initialization engineering skeleton of the protocol processing system is as follows: The testing agent, based on a structured protocol model containing detailed definitions of all messages, automatically analyzes and lists various test scenarios that each message in the structured protocol model needs to verify. It then generates a structured test case list based on these test scenarios. Simultaneously, based on the frame structure, field definitions, and validation rules of the cleaned protocol text, it constructs the original message data corresponding to each test scenario in the structured test case list and its expected parsing results. Upon receiving the architecture summary file and artifact index file, the code generation agent, in a preset target working directory, creates a standardized protocol project directory structure according to standard software engineering specifications. It generates and configures protocol build files and writes reusable common base classes, establishing the protocol processing system initialization project skeleton containing standardized directories, component configurations, and infrastructure code.
[0012] Preferably, the specific method for obtaining the protocol parsing layer code of the protocol processing system is as follows: For a specific message identifier that is currently being processed, the code generation agent combines the protocol reasoning text and, based on the protocol definition of the message corresponding to the specific message identifier, generates the entity class code and parser class code corresponding to the message identifier, and writes the source code into the initialization project skeleton; Combined with the test case list, the test agent creates corresponding specialized unit tests for the newly generated parser class code. The pre-constructed message test data is used as input to execute the unit tests. The correctness of field parsing and the consistency of binary loopback are verified based on the test results. If the verification results all meet the set standards, the protocol parsing layer code of the protocol processing system is obtained. When any verification result fails to meet the set standard, the code generation agent writes the unit error information into the workflow status file and test result file in a structured manner, and generates a diagnostic report. Based on the diagnostic report, the master control agent schedules the code generation agent again to analyze the specific reasons for failing to meet the set standard, and performs repairs according to the repair strategy to obtain the repaired entity class code and parser class code. Unit tests are performed on the repaired entity class code and parser class code. If the verification results do not meet the set standards, the repaired entity class code and parser class code are repaired again until all unit tests for the message pass, thus obtaining the protocol parsing layer code of the protocol processing system.
[0013] The preferred method for integration testing is as follows: After the protocol parsing layer code verification is passed, the code generation agent generates access layer code, business layer code, and data storage layer code based on the architecture summary file, the initialization project skeleton, and the protocol inference text, and writes the access layer code, business layer code, and data storage layer code into the corresponding directories of the project skeleton. The test agent executes integration tests based on the architecture design, including access pipeline tests to verify the complete data processing link, data access tests to verify database operations, and assembly tests to verify component dependencies. If the verification results of all tests meet the set standards, the integration test passes. When any verification result fails to meet the set standard, the code generation agent will integrate the error information and write it into the workflow status file and test result file in a structured manner to generate a diagnostic report. Based on the diagnostic report, the master control agent will schedule the code generation agent again to analyze the specific reasons for failing to meet the set standard and repair it according to the repair strategy to obtain the repaired access layer code, business layer code and data storage layer code. Perform integration tests on the repaired access layer code, business layer code, and data storage layer code. If any verification result fails to meet the set standard, repair the repaired access layer code, business layer code, and data storage layer code again until all integration tests for the message pass.
[0014] The preferred repair strategy is as follows: First, determine if it is a local error. If the reason for not meeting the set standard is a local code error, then directly modify the corresponding local source code to obtain the corrected code. If the structural error or partial repair is ineffective, the corresponding code for that message will be completely regenerated, and the regenerated code will replace the original code as the repaired code.
[0015] The beneficial effects of this invention are as follows: This invention proposes an IoT protocol code building system based on a large model. By constructing a system for multi-agent collaborative work, it establishes a standardized eight-step execution process from protocol document input, cleaning, structured parsing, architecture design, project initialization, incremental code generation, layered integration testing, to automatic document integration, forming an end-to-end automated closed loop. This changes the development model that relies on manual line-by-line writing, testing, and debugging. In practical implementation, the code generation cycle for complex vehicle networking protocols is shortened from the traditional manual time of several days to several weeks to several hours, improving development efficiency by more than 80%, and effectively supporting the rapid iteration needs of IoT projects.
[0016] The protocol processing system can replace senior development engineers in a large amount of repetitive and time-consuming work in protocol parsing, coding implementation, testing and verification, allowing them to focus on higher-value system design and architecture decisions. The entire process can be started by ordinary staff simply by completing the input of the protocol document, which greatly reduces the professional human resource cost of protocol code development and achieves optimized allocation of human resources.
[0017] By employing pre-defined prompts, the inference process for large-scale models is precisely guided, embedding protocol knowledge, coding standards, and testing requirements into the workflow. Simultaneously, test-driven development (TDD) is integrated into the AI generation process. Through an automated closed loop of test data-driven generation, incremental TDD at the protocol layer, and layered overall verification, every piece of generated code undergoes rigorous validation upon output. This ensures that the final protocol parsing code achieves a unified standard in terms of standardization, readability, maintainability, and reliability, with quality comparable to that of senior development engineers. This effectively solves the problems of inconsistent code quality and error-proneness caused by manual development.
[0018] Unlike traditional large-scale models that only generate isolated code snippets, the final product of this invention is a complete and standardized software engineering project. This project not only includes protocol parsing code that has undergone thorough unit and integration testing and can be directly compiled and deployed, but also automatically generates standardized project documentation containing system architecture, usage examples, and test reports. This deliverable can be integrated into actual vehicle-to-everything (V2X) or Internet of Things (IoT) systems without requiring manual modification, demonstrating high practical value and commercial viability.
[0019] The protocol processing system supports input of protocol documents in various formats, including PDF, tables, and OCR text. It achieves standardized processing of heterogeneous data through text cleaning and structured extraction modules. Through workflow status files and task handover files, the system enables traceability of task status, precise control of execution progress, and automatic recovery after abnormal interruptions, enhancing the robustness and reliability of the entire construction process. Furthermore, the system architecture is not dependent on specific large models or programming languages; it can be adapted to different technology stacks by adjusting prompt word templates and initialization configurations, demonstrating good versatility and scalability.
[0020] This invention not only solves the pain points of low efficiency, high cost and poor quality in the existing technology, but also creates an efficient, reliable and high-quality automated production system for IoT communication protocol code through innovative full-process automation and intelligent methods, which has significant technological progress and broad application prospects. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the structure of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to represent selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0023] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments: Example 1 A system for building IoT protocol code based on a large model, such as Figure 1 As shown, it includes: The protocol document processing module is used to clean the communication protocol documents of the Internet of Things or the Internet of Vehicles to obtain the cleaned protocol text; the protocol parsing agent performs structured parsing on the cleaned protocol text to obtain a structured protocol model; the protocol analysis agent performs quality audit on the structured protocol model; based on the audited structured protocol model, the protocol processing system is modularly designed according to the set requirements to generate an architecture summary file and an output index file. The large model inference module is used to obtain the protocol inference text through prompt word engineering based on the cleaned protocol text, structured protocol model, architecture summary file, product index file and pre-trained language model; The code generation and testing module is used to generate test case lists and message test data based on the structured protocol model; based on the architecture summary file and the artifact index file, the code generation agent creates a standardized protocol project directory structure, protocol build files and common base classes in the preset target working directory, thereby forming the initialization project skeleton of the protocol processing system. Based on the protocol reasoning text, the initialization engineering skeleton, and the message identifiers in the structured protocol model, the entity class code and parser class code corresponding to each message identifier are incrementally generated by the code generation agent; the special unit test corresponding to each message identifier is generated by the test agent, and the corresponding special unit test is executed according to the test case list and message test data. When all special unit tests pass, the protocol parsing layer code of the protocol processing system is generated based on the entity class code and parser class code corresponding to all message identifiers. Based on the protocol reasoning text, structured protocol model, initialization project skeleton, and architecture summary file, a code generation agent generates access layer code, business layer code, and data storage layer code for the protocol processing system. Integration testing is then performed on the access layer code, business layer code, and data storage layer code. When the integration test passes, the protocol processing system code is generated based on the access layer code, business layer code, data storage layer code, and the protocol parsing layer code.
[0024] In some preferred embodiments, the inputs for integration testing of the access layer code, service layer code, and data storage layer code include protocol inference text, structured protocol model, initialization project skeleton, and architecture summary file; test case list and message test data are mainly used as inputs for the test verification phase.
[0025] In some preferred embodiments, the intelligent agents used in this IoT protocol code building system include a master intelligent agent, which is responsible for starting, advancing and monitoring the status of the entire workflow; maintaining and updating key status files, recording task execution stages, statuses, problems and repair history; scheduling and coordinating the execution of tasks by various professional sub-intelligent agents in sequence or in parallel according to the process logic; and being responsible for passing the error context to the corresponding sub-intelligent agent to start the repair process when the test fails. The text cleaning agent receives the raw text obtained from PDFs through OCR recognition, performs noise reduction on the text, including removing garbled characters, irrelevant formatting information, page breaks, as well as line break repair and table structure restructuring, and outputs cleaned, standardized plain text or Markdown documents, laying a good data foundation for subsequent protocol information extraction. The protocol parsing agent reads the cleaned protocol text and performs structured parsing. It extracts the core definitions of the protocol, including but not limited to: frame structure, message type, message ID, field definitions, field offsets, field lengths, encoding methods, verification rules, bit field information, and nested structures. The extracted information is then used to construct a structured protocol model, with output typically including a protocol index file, message-splittered independent definition files, and aggregated protocol definition files. Consistency checks are performed on the extraction results, such as verifying the continuity of field offsets and the consistency of lengths. The protocol analysis agent is used to read the structured protocol model output by the protocol parsing agent, and perform secondary auditing and in-depth analysis. Based on the data flow, responsibility boundaries and engineering implementation requirements of the protocol, a modular system architecture design is carried out. For example, the system is abstracted into a frame receiving module, a frame parsing module, an instruction execution module, and an error handling module. In specific engineering implementations, it is further refined into an access layer, a protocol parsing layer, a business service layer, a data storage layer, etc. The architecture summary file and the artifact index file are generated to provide a clear design blueprint for code generation. The code generation agent is used to create a standard project skeleton in the target directory based on the architecture design, including the source code directory, test directory, configuration files, and common base classes; based on the artifact index and architecture summary, it generates code incrementally by message granularity and by functional hierarchy, first generating the protocol layer, and then generating the access layer, business layer, data storage layer, etc. in sequence.
[0026] The test agent is used to pre-generate test case lists and message test data based on the structured protocol model before code generation, thus solidifying the test benchmark; generate a comprehensive test suite including unit tests and integration tests, and execute these tests; work closely with the code generation agent to realize an incremental test-driven development cycle of generation, testing, and repair, performing specialized tests immediately after each part of code is generated; when a test fails, detailed error information is written to a status file and fed back to the code generation agent to drive it to perform automatic repair. The document integration agent is used to summarize all information in the entire agent workflow after code generation and testing are completed; it reads status files, handover files, architecture summaries, test results, as well as generated source code and test files; it automatically integrates and generates standardized project delivery documents, which typically include project introduction, features, quick start guide, architecture description, usage examples, project structure, dependency descriptions, and test result reports.
[0027] In some preferred embodiments, the auditing method is as follows: Within the same message, check whether the start and end offset addresses of each field are continuous, non-overlapping, and without gaps; verify whether the length declared in the field definition matches its actual possible value range and encoding method, and whether a consistent length definition is used for fields with the same semantics throughout the protocol; for bit-defined fields, check whether the definitions of all bit fields completely cover the entire byte or word to avoid bit field fragmentation or undefined bits; check whether the definition of each message contains the necessary components, such as message ID, name, length, field list, checksum, etc., to ensure that no critical information is missing; check whether there are duplicate message IDs or message names throughout the protocol to ensure the uniqueness of each identifier.
[0028] For modular architecture design, in some preferred embodiments, based on the structured protocol model generated by the protocol parsing agent and which has undergone quality auditing, and according to the data flow, responsibility boundaries, and engineering implementation requirements in the protocol processing, a modular architecture is designed, which includes at least the following four core functional modules: The access layer, which handles protocol processing, is used to receive raw binary data streams from physical networks or communication buses, handle low-level communication issues such as packet fragmentation and reassembly, and identify and separate complete protocol frames. The protocol processing parsing layer is used to parse the received complete binary protocol frame into a structured data object in memory, according to the frame structure, field offsets, encoding rules, verification rules, etc. defined in the structured protocol model. The business layer, which processes the parsed structured data objects, executes the specific business instructions or logic contained within them. For example, it routes data to different business processing functions based on message IDs to perform business calculations, status updates, etc. The error handling module is used throughout the entire data processing chain. It is responsible for handling any exceptions and errors that may occur at any stage of receiving, parsing, or executing, such as data verification failure, parsing format errors, business logic exceptions, etc., and performing unified error response, logging, or recovery processing. Architecture design is not just about conceptual division; it also generates concrete, machine-readable design documents to guide subsequent code generation, namely, the generated architecture summary file and artifact index file.
[0029] In some preferred embodiments, it also includes a document integration module, which is used to summarize and generate project description documents and directly deployable communication protocol parsing code projects based on workflow status files, task handover files, architecture summary files, artifact index files, unit test result files, integration test result files and protocol processing system code through a document integration agent. The workflow status file is a file specified or created by the main control agent in front of the protocol document processing module, used to record the global status and progress of the protocol processing system construction process. The task handover file is a file specified or created by the main control agent in front of the protocol document processing module, used to transmit specific task instructions between the main control agent and various professional sub-agents.
[0030] In some preferred embodiments, it further includes a workflow initialization module for starting the main control agent and initializing or reading the workflow status file and task handover file, the specific method of which is as follows: The master control agent program first checks if a workflow status file exists in the preset path. If the file does not exist or reading fails, the system automatically creates an initial status file. This initial file contains a series of predefined fields and initial values. These fields are used to record at least basic project information, the status of each stage, the current task, unresolved issues, repair history, and quality gates (i.e., the standards for passing each stage's tests). The system initializes a task handover file, which is temporary and used to transmit specific instructions for this round of tasks between the master control agent and the sub-agents about to execute the task. Its initial content may include the task type, the path to the input file, and output requirements.
[0031] If the file exists, the system successfully reads and parses the existing workflow status file. The master agent obtains the current global status of the workflow from the file, including which stage the workflow is currently in, the execution result and status of the previous task, whether there are any pending exceptions or problems recorded in the unresolved issues field, and the repair history used to provide reference for subsequent repair decisions. At the same time, the system will prepare or regenerate the corresponding task handover file based on the current status to indicate which agent should perform the next task, based on what input, and what task.
[0032] The task handover document serves as a carrier for transmitting specific task instructions between intelligent agents. It is used to ensure that the master intelligent agent's scheduling of sub-intelligent agents is accurate and traceable, and that the sub-intelligent agents can clearly know what their inputs are and what standards their outputs should meet.
[0033] The above technical solution introduces a document integration module and workflow status and task handover files on the basis of the system, which improves the operability and deliverability of the system to the level of engineering management. The workflow status files enable the entire complex, multi-step automated process to have the ability to persist the status and recover from anomalies, avoiding the loss of all previous efforts due to midway failure. The task handover files standardize the instruction transmission between the master intelligent agent and various professional sub-intelligent agents, which is the key to ensuring the orderly collaboration of multiple intelligent agents. The addition of the document integration module means that the system not only produces code, but also automatically generates supporting standardized project documents, thereby completing the improvement from automated coding to automated project delivery, which greatly improves the practicality and maintainability of the results.
[0034] In some preferred embodiments, the specific method for obtaining a structured protocol model by performing structured parsing of the cleaned protocol text using a protocol parsing agent is as follows: The protocol parsing agent scans the cleaned protocol text, identifies and locates all protocol definition blocks containing set keywords, and forms a preliminary message list. For each protocol definition block, the protocol parsing agent uses rule matching and the semantic understanding capabilities of a pre-trained language model to parse and extract the protocol's technical specifications. The protocol parsing agent organizes the extracted technical specifications into a machine-readable structured data model and outputs a series of files, including a protocol index file, a single message definition file, an aggregated protocol definition file, and a protocol summary file. Based on the machine-readable structured data model and the series of files, the protocol parsing agent performs consistency checks on field offset continuity, length consistency, bit field closure, message integrity, and duplicate identifiers, resulting in a structured protocol model that can be directly used for subsequent code generation.
[0035] In some preferred embodiments, the protocol parsing agent employs a phased hybrid intelligent strategy to complete protocol parsing. Rule matching is used to quickly scan and clean the text, identifying paragraphs, tables, and other blocks that may contain protocol definitions through keywords and structural patterns, thus defining the scope for precise location. For non-standard or complex formatted parts, OCR or a pre-trained document understanding model is invoked to accurately reconstruct the text content and table structure. The core semantic understanding task is performed by a large language model, which is guided by designed prompts to extract technical specifications such as message ID, field names, byte offsets, length, data type, encoding rules, and verification rules from the located text, and organizes them into a structured JSON format. To ensure the engineering usability of the extracted results, the agent automatically performs a series of structure rule-based verifications, such as checking the continuity of field offsets, length consistency, bit field closure, and the uniqueness of message identifiers, thereby forming an accurate, consistent, and machine-readable structured protocol model.
[0036] In optional embodiments, the protocol's technical specifications include message structure, field definitions, field offsets, field lengths, data types, encoding methods, byte order, verification rules, bit field definitions, and nested structure relationships.
[0037] In some preferred embodiments, the protocol index file serves as a directory and navigation map for the entire protocol, providing an overview by listing all messages defined in the protocol. It typically includes a unique identifier and message name for each message, allowing the system to quickly understand which messages the protocol contains and locate the detailed definition file for each message.
[0038] In some preferred embodiments, the single message definition file is the core data unit of the structured protocol model, containing a complete and detailed specification of a single message. Each message corresponds to an independent file, ensuring the modularity and independent maintainability of the information. It provides direct and accurate input for the subsequent code generation agent to generate the entity class and parser class corresponding to the message.
[0039] In some preferred embodiments, the aggregated protocol definition file serves as a unified single file containing all message details, facilitating global querying, analysis, or import into third-party tools that require viewing the complete protocol definition, providing one-stop access to the entire protocol data model.
[0040] In some preferred embodiments, the protocol summary file provides high-level, general information about the protocol, rather than details of specific fields. It functions similarly to a protocol overview, providing a quick understanding of the protocol's overall objectives, version, scope, basic features, and key constraints.
[0041] In some preferred embodiments, the specific method by which the protocol parsing agent performs consistency checks on field offset continuity, length consistency, bit field closure, message integrity, and duplicate identifiers is as follows: Field offset continuity: The protocol parsing agent sorts all field definitions within the same message. It calculates the end offset of each field in turn and checks whether the end offset of the current field is equal to the start offset of the next field. If the offsets of all adjacent fields are connected end to end, they are considered continuous; if there is overlap or gap, the check fails.
[0042] Length Consistency: The protocol parsing intelligence cross-validates the reasonableness of field lengths from multiple dimensions. First, it checks whether the declared length of a field matches its data type in a common-sense way; for example, an int32 type should typically occupy 4 bytes. For fields that appear multiple times in the protocol and have the same semantics, it checks whether their length definitions are consistent. It can also be used to verify whether the field length is consistent with the implicit length requirements of encoding rules (such as scaling factors).
[0043] Bit-field closure check: For bit-defined fields, the protocol parsing intelligence performs bit-level analysis to identify all bit-fields belonging to the same parent unit. It then checks whether the bit offsets and bit lengths of these bit-fields completely and without overlap cover all bits of the entire parent unit. For example, for an 8-bit byte, if the defined bit fields are from bit 0 to bit 3 and from bit 5 to bit 7, then bit 4 is undefined, and the check fails.
[0044] Message Integrity Verification: The protocol parsing agent performs an integrity scan on each extracted message definition based on a pre-defined list of required components for protocol messages. This list typically includes: message ID, message name, a list of fields (which cannot be empty), and key management fields such as total message length and checksum fields. It is used to check whether the JSON definition of each message contains all these required keys and their valid values.
[0045] Duplicate identifier verification: The protocol parsing agent traverses all message definitions and collects the unique identifiers for each message, usually the message ID and message name. It checks whether there are duplicate message IDs and message names throughout the protocol. Any duplicates are considered errors. In a protocol, each message ID must uniquely correspond to a message type, and each message name should also be unique for easy identification.
[0046] The above technical solution defines a robust and accurate hybrid intelligent extraction process from unstructured text to a high-quality structured data model. It adopts a series of strategies including rule localization, model enhancement, semantic extraction, and rule verification. This approach leverages rules to quickly locate target blocks to improve efficiency, utilizes the semantic understanding capabilities of large models to handle complex and varied natural language descriptions, and finally uses engineering rules to automatically verify the extraction results. This ensures the accuracy of the structured protocol model, which is the cornerstone of the entire system, from the source, laying a reliable data foundation for all subsequent steps.
[0047] In some preferred embodiments, the specific method for obtaining the protocol inference text is as follows: Based on the cleaned protocol text, structured protocol model, architecture summary file, and product index file, task instructions are set. According to the received task instructions, the required structured input file for completing the task is determined. Based on the current task type, the corresponding preset task template is called, and the structured input file is inserted into the specified position of the prompt word template to obtain prompt words that conform to the task instructions. The prompt words are then input into the pre-trained language model, which considers the prompt words based on pre-trained knowledge and outputs protocol reasoning text.
[0048] In some preferred embodiments, a template framework is selected by task type, and specific data is extracted from upstream structured files through task analysis as fill content, thereby closely combining general model guidance capabilities with specific protocol engineering information to generate high-quality, executable model instructions as prompt words.
[0049] The aforementioned technical solution defines a specific method for the large model's inference module to obtain protocol inference text, constructing a task-driven and data-injected dynamic prompt generation mechanism. This transforms the large model from a general-purpose tool requiring carefully designed questions into a dedicated engine capable of automatically generating precise instructions based on specific engineering tasks and structured input. By inserting cleaned protocol text, structured models, and other specific data into preset task templates, the generated prompts are highly targeted and contextually relevant, thus stably driving the large model to output high-quality code or text that meets the requirements of the current stage.
[0050] In some preferred embodiments, the specific method for obtaining the initialization engineering skeleton of the protocol processing system is as follows: The testing agent, based on a structured protocol model containing detailed definitions of all messages, automatically analyzes and lists various test scenarios that each message in the structured protocol model needs to verify. It then generates a structured test case list based on these test scenarios. Simultaneously, based on the frame structure, field definitions, and validation rules of the cleaned protocol text, it constructs the original message data corresponding to each test scenario in the structured test case list and its expected parsing results. Upon receiving the architecture summary file and artifact index file, the code generation agent, in a preset target working directory, creates a standardized protocol project directory structure according to standard software engineering specifications. It generates and configures protocol build files and writes reusable common base classes, establishing the protocol processing system initialization project skeleton containing standardized directories, component configurations, and infrastructure code.
[0051] In an optional embodiment, the prompt word will define the corresponding language-level project skeleton for creating a standardized protocol project directory structure. For example, if the current output is a Java type project, the final project skeleton structure will be generated according to the current protocol definition and the Java project skeleton preset by the prompt word. Subsequent code generation will generate the code for each module according to this skeleton.
[0052] For reusable common base classes, in an optional embodiment, some utility class descriptions commonly used in the protocol parsing process will be predefined in the prompt words. The large language model will generate utility classes based on these descriptions and the current protocol.
[0053] The aforementioned technical solution refines the construction method of the initialization project skeleton, with a particular emphasis on the principle of test data first, deeply integrating the testing and verification process into the starting point of the construction process. It overturns the traditional "develop first, test later" model, generating test cases and test data based on the protocol definition before writing the first line of business code, essentially setting an objective and precise acceptance standard for code generation. This method not only solidifies and verifies the understanding of the protocol, ensuring that subsequently generated code has a clear correctness benchmark, but also provides the necessary prerequisite for realizing a true test-driven development cycle.
[0054] In some preferred embodiments, the specific method for obtaining the protocol parsing layer code of the protocol processing system is as follows: For a specific message identifier that is currently being processed, the code generation agent combines the protocol reasoning text and, based on the protocol definition of the message corresponding to the specific message identifier, generates the entity class code and parser class code corresponding to the message identifier, and writes the source code into the initialization project skeleton; After the source code is written into the initialization project skeleton, the test agent creates corresponding special unit tests for the newly generated parser class code, based on the test case list. The unit tests are executed with pre-constructed message test data as input. The correctness of field parsing and the consistency of binary loopback are verified based on the test results. If the verification results meet the set standards, the protocol parsing layer code of the protocol processing system is obtained. When any verification result fails to meet the set standard, the code generation agent writes the unit error information into the workflow status file and test result file in a structured manner, and generates a diagnostic report. Based on the diagnostic report, the master control agent schedules the code generation agent again to analyze the specific reasons for failing to meet the set standard, and performs repairs according to the repair strategy to obtain the repaired entity class code and parser class code. Unit tests are performed on the repaired entity class code and parser class code. If the verification results do not meet the set standards, the repaired entity class code and parser class code are repaired again until all unit tests for the message pass, thus obtaining the protocol parsing layer code of the protocol processing system.
[0055] In some preferred embodiments, parsing code is generated sequentially according to message ID or message type based on the parsed and identified protocol message directory. After the parsing code is generated, the code parsing logic is tested. If an error occurs, it is fixed on the spot. If there is no problem, the next message generation process is started. In this way, incremental generation of protocol code is achieved.
[0056] In some preferred embodiments, the specific methods for verifying the correctness of field parsing and the consistency of binary loopbacks based on test results are as follows: Verifying the correctness of field parsing: Before code generation, the test agent has constructed message test data based on the structured protocol model, which includes the original hexadecimal byte sequence for a specific message and the expected parsing result for each field. In the specialized unit test, the parsing method of the newly generated message parser class is called, taking the original hexadecimal byte sequence as input. After the parser runs, it outputs a structured message object. The test cases extract the actual parsed value of each field from this object. The actual parsed value of each field is compared field by field with the predefined expected parsing result. For example, checking whether the parsed value of a uint16 type vehicle speed field is equal to the pre-set value in the test data after considering decoding rules (such as a scaling factor of 0.1). If the actual values of all fields match the expected values exactly, the field parsing correctness verification passes.
[0057] Binary loop consistency verification: The original hexadecimal byte sequence is parsed into a message object in memory using a parser. The encoding method of the same message object is then called to convert the message object back into a binary byte sequence, resulting in a reserialized binary byte sequence. The reserialized binary byte sequence is compared byte-by-byte with the original hexadecimal byte sequence. If the reserialized binary byte sequence is completely identical to the original hexadecimal byte sequence, the verification passes. This verifies that the parsing and encoding logics are completely symmetrical and precise, that no errors were introduced during parsing, and that the encoding rules are entirely correct.
[0058] In some preferred embodiments, the verification methods for the correctness of field parsing and the consistency of binary loopback are verified based on test results. These verification methods also include protocol structure consistency verification, message parsing correctness verification, message round-trip consistency verification, unit test verification, integration test verification, and re-verification based on error feedback after repair.
[0059] The above technical solution describes the incremental generation and verification process of the protocol parsing layer code, establishing a closed-loop micro-loop development unit with messages as the smallest granularity. This decomposes the complex protocol layer development task into a series of independently verifiable and repairable small tasks, greatly reducing the complexity and risk of automated development. By generating code separately for each message identifier and immediately executing specialized tests, errors can be located instantly and accurately. When tests fail, the system can perform targeted repairs based on diagnostic reports, thereby ensuring the correctness of each basic component. This robust, modular approach to building the entire protocol parsing layer is the core mechanism for achieving code quality at the senior engineer level.
[0060] In some preferred embodiments, the specific method for integration testing is as follows: After the protocol parsing layer code verification is passed, the code generation agent generates access layer code, business layer code, and data storage layer code based on the architecture summary file, the initialization project skeleton, and the protocol inference text, and writes the access layer code, business layer code, and data storage layer code into the corresponding directories of the project skeleton. The test agent executes integration tests based on the architecture design, including access pipeline tests to verify the complete data processing link, data access tests to verify database operations, and assembly tests to verify component dependencies. If the verification results of all tests meet the set standards, the integration test passes. When any verification result fails to meet the set standard, the code generation agent will integrate the error information and write it into the workflow status file and test result file in a structured manner to generate a diagnostic report. Based on the diagnostic report, the master control agent will schedule the code generation agent again to analyze the specific reasons for failing to meet the set standard and repair it according to the repair strategy to obtain the repaired access layer code, business layer code and data storage layer code. Perform integration tests on the repaired access layer code, business layer code, and data storage layer code. If any verification result fails to meet the set standard, repair the repaired access layer code, business layer code, and data storage layer code again until all integration tests for the message pass.
[0061] In some preferred embodiments, integration testing is performed on the access layer code, service layer code, and data storage layer code. The inputs include protocol inference text, structured protocol model, initialization project skeleton, and architecture summary file; the test case list and message test data are mainly used as inputs in the test verification phase.
[0062] In some preferred embodiments, the specific methods for generating access layer code, service layer code, and data storage layer code are as follows: Access layer code: Based on the component definitions of the access layer in the architecture summary file, combined with the class names and interfaces specified in the product index file, the code generation agent uses protocol reasoning text (i.e., the logical description of how to implement decoding and distribution generated by the pre-trained language model) to generate the Java source code of the above classes in the access layer package path under src / main / java. This code will call the generated protocol parsing layer code.
[0063] Business layer code: Based on the message types in the structured protocol model and the business layer design in the architecture summary file, the code generation agent generates corresponding service interfaces and implementation classes for key message types. The protocol inference text provides implementation snippets of specific business logic. This code is placed in the business layer's package path and depends on the message objects passed from the access layer.
[0064] Data storage layer code: Based on the data layer definition in the architecture summary file and the data items that need to be persisted in the structured protocol model, the code generation agent generates corresponding entity classes and DAO components. The protocol reasoning text provides the implementation of data mapping relationships and basic query methods. This code is placed in the package path of the data storage layer.
[0065] The aforementioned technical solution, building upon a solid protocol parsing layer, further defines methods for generating and integrating upper-layer business code. This completes the vertical architecture construction and integrated verification from protocol data objects to a full processing system. It ensures that the system can not only correctly parse packets but also achieve a complete functional chain from network access and business processing to data storage. By generating access layer, business layer, and data storage layer code, and conducting integration tests covering the entire data flow, such as access pipeline testing and data access testing, the system verifies the collaborative working capabilities between components at each level. This layered generation and overall verification approach ensures that the final output is not an isolated parsing library, but a fully functional microservice or application module that can be directly integrated and deployed.
[0066] In some preferred embodiments, the specific method of the repair strategy is as follows: First, determine if it is a local error. If the reason for not meeting the set standard is a local code error, then directly modify the corresponding local source code to obtain the corrected code. If the structural error or partial repair is ineffective, the corresponding code for that message will be completely regenerated, and the regenerated code will replace the original code as the repaired code.
[0067] In some preferred embodiments, after a test agent fails to execute a test, it writes failure information to a workflow status file and a test result file, such as error stack traces, failure assertions, and differences between expected and actual values, and generates a diagnostic report. The master agent then schedules the code generation agent to perform repairs based on this report. The code generation agent analyzes the diagnostic report and determines that the error is a localized error, such as missing or incorrect import statements, method signature mismatches, errors in specific expressions in field parsing logic, errors in conditional judgments or calculations in validation logic, or errors in setting specific constant values. Instead of rewriting the entire file, the agent locates the specific line or code block that caused the error and replaces it with the correct code. This modification process strictly adheres to protocol definitions and engineering constraints.
[0068] In some preferred embodiments, for structural errors, such as when entity class code and parser class code fail to pass verification because the variable-length array length field in a real-time information reporting message is misidentified, subsequent fields will be misaligned. In this case, the entity class code, parser class code and test cases corresponding to the message need to be regenerated based on the corrected structured protocol model.
[0069] The aforementioned technical solution introduces a tiered, intelligent fault recovery mechanism, prioritizing repair methods that minimize system disruption. This significantly improves the robustness and efficiency of the automated system. When code verification fails, the system doesn't arbitrarily rewrite the entire file; instead, it first analyzes whether the error is localized and attempts precise local modifications, mimicking the debugging process of a senior engineer—fast and efficient. Only when local repairs are ineffective or the error is structural does a more costly full regeneration occur. This strategy ensures the effectiveness of repairs while minimizing unnecessary calculations and file changes, making the entire automated process more stable and intelligent.
[0070] Example 2 A method for constructing IoT protocol code based on a large model, comprising: Data cleaning is performed on communication protocol documents for the Internet of Things or the Internet of Vehicles to obtain cleaned protocol text; the cleaned protocol text is then structured and parsed by a protocol parsing agent to obtain a structured protocol model; the structured protocol model is then quality audited; based on the audited structured protocol model, a modular architecture design is performed on the protocol processing system according to the set requirements, generating an architecture summary file and an output index file. Based on the cleaned protocol text, structured protocol model, architecture summary file, product index file, and pre-trained language model, the protocol reasoning text is obtained through prompt word engineering. Based on the structured protocol model, a test case list and message test data are generated; based on the architecture summary file and artifact index file, a code generation agent creates a standardized protocol project directory structure, protocol build files and common base classes in the preset target working directory, thereby forming the initialization engineering skeleton of the protocol processing system. Based on the protocol reasoning text, the initialization engineering skeleton, and the message identifiers in the structured protocol model, the entity class code and parser class code corresponding to each message identifier are incrementally generated by the code generation agent; the special unit test corresponding to each message identifier is generated by the test agent, and the corresponding special unit test is executed according to the test case list and message test data. When all special unit tests pass, the protocol parsing layer code of the protocol processing system is generated based on the entity class code and parser class code corresponding to all message identifiers. Based on the protocol reasoning text, the initialization project skeleton, and the architecture summary file, a code generation agent generates access layer code, business layer code, and data storage layer code for the protocol processing system. Integration tests are then performed on the access layer code, business layer code, and data storage layer code. When the integration tests pass, the protocol processing system code is generated based on the access layer code, business layer code, data storage layer code, and the protocol parsing layer code.
[0071] Example 3 A computer program product includes a computer program, characterized in that, when the computer program is executed by a processor, it implements the steps of the method described in Embodiment 2.
[0072] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
Claims
1. A system for constructing IoT protocol code based on a large model, characterized in that, include: The protocol document processing module is used to clean the communication protocol documents of the Internet of Things or the Internet of Vehicles to obtain the cleaned protocol text. The cleaned protocol text is structured and parsed by a protocol parsing agent to obtain a structured protocol model. The structured protocol model is then audited for quality. Based on the audited structured protocol model, the protocol processing system is modularly designed according to the set requirements, generating an architecture summary file and an output index file. The large model inference module is used to obtain the protocol inference text through prompt word engineering based on the cleaned protocol text, structured protocol model, architecture summary file, product index file and pre-trained language model; The code generation and testing module is used to generate test case lists and message test data based on the structured protocol model; based on the architecture summary file and the artifact index file, the code generation agent creates a standardized protocol project directory structure, protocol build files and common base classes in the preset target working directory, thereby forming the initialization project skeleton of the protocol processing system. Based on the protocol reasoning text, the initialization engineering skeleton, and the message identifiers in the structured protocol model, the entity class code and parser class code corresponding to each message identifier are incrementally generated by the code generation agent. The test agent generates specialized unit tests for each message identifier and executes the corresponding specialized unit tests based on the test case list and message test data. When all specialized unit tests pass, the protocol parsing layer code of the protocol processing system is generated based on the entity class code and parser class code corresponding to all message identifiers. Based on the protocol reasoning text, structured protocol model, initialization project skeleton, and architecture summary file, a code generation agent generates access layer code, business layer code, and data storage layer code for the protocol processing system. Integration testing is then performed on the access layer code, business layer code, and data storage layer code. When the integration test passes, the protocol processing system code is generated based on the access layer code, business layer code, data storage layer code, and the protocol parsing layer code.
2. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: It also includes a document integration module, which uses a document integration agent to summarize and generate project description documents and directly deployable communication protocol parsing code projects based on workflow status files, task handover files, architecture summary files, artifact index files, unit test result files, integration test result files, and protocol processing system code. The workflow status file is a file specified or created by the main control agent in front of the protocol document processing module, used to record the global status and progress of the protocol processing system construction process. The task handover file is a file specified or created by the main control agent in front of the protocol document processing module, used to transmit specific task instructions between the main control agent and various professional sub-agents.
3. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: The specific method for obtaining a structured protocol model by performing structured parsing of the cleaned protocol text using a protocol parsing agent is as follows: The protocol parsing agent scans the cleaned protocol text, identifies and locates all protocol definition blocks containing set keywords, and forms a preliminary message list. For each protocol definition block, the protocol parsing agent uses rule matching and the semantic understanding capabilities of a pre-trained language model to parse and extract the protocol's technical specifications. The protocol parsing agent organizes the extracted technical specifications into a machine-readable structured data model and outputs a series of files, including a protocol index file, a single message definition file, an aggregated protocol definition file, and a protocol summary file. Based on a machine-readable structured data model and a series of documents, the protocol parsing agent performs consistency checks on field offset continuity, length consistency, bit field closure, message integrity, and duplicate identifiers to obtain a structured protocol model.
4. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: The specific method for obtaining the protocol reasoning text is as follows: Based on the cleaned protocol text, structured protocol model, architecture summary file, and product index file, task instructions are set. According to the received task instructions, the required structured input file for completing the task is determined. Based on the current task type, the corresponding preset task template is called, and the structured input file is inserted into the specified position of the prompt word template to obtain prompt words that conform to the task instructions. The prompt words are then input into the pre-trained language model, which considers the prompt words based on pre-trained knowledge and outputs protocol reasoning text.
5. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: The specific method for obtaining the initialization project skeleton of the protocol processing system is as follows: The testing agent, based on a structured protocol model containing detailed definitions of all messages, automatically analyzes and lists various test scenarios that each message in the structured protocol model needs to verify. It then generates a structured test case list based on these test scenarios. Simultaneously, based on the frame structure, field definitions, and validation rules of the cleaned protocol text, it constructs the original message data corresponding to each test scenario in the structured test case list and its expected parsing results. Upon receiving the architecture summary file and artifact index file, the code generation agent, in a preset target working directory, creates a standardized protocol project directory structure according to standard software engineering specifications. It generates and configures protocol build files and writes reusable common base classes, establishing the protocol processing system initialization project skeleton containing standardized directories, component configurations, and infrastructure code.
6. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: The specific method for obtaining the protocol parsing layer code of the protocol processing system is as follows: For a specific message identifier that is currently being processed, the code generation agent combines the protocol reasoning text and, based on the protocol definition of the message corresponding to the specific message identifier, generates the entity class code and parser class code corresponding to the message identifier, and writes the source code into the initialization project skeleton; Combined with the test case list, the test agent creates corresponding specialized unit tests for the newly generated parser class code. The pre-constructed message test data is used as input to execute the unit tests. The correctness of field parsing and the consistency of binary loopback are verified based on the test results. If the verification results all meet the set standards, the protocol parsing layer code of the protocol processing system is obtained. When any verification result fails to meet the set standard, the code generation agent writes the unit error information into the workflow status file and test result file in a structured manner, and generates a diagnostic report. Based on the diagnostic report, the master control agent re-schedules the code generation agent to analyze the specific reasons why the set standards were not met, and performs repairs according to the repair strategy to obtain the repaired entity class code and parser class code; Unit tests are performed on the repaired entity class code and parser class code. If the verification results do not meet the set standards, the repaired entity class code and parser class code are repaired again until all unit tests for the message pass, thus obtaining the protocol parsing layer code of the protocol processing system.
7. The IoT protocol code construction system based on a large model according to claim 1, characterized in that: The specific methods for integration testing are as follows: After the protocol parsing layer code verification is passed, the code generation agent generates access layer code, business layer code, and data storage layer code based on the architecture summary file, the initialization project skeleton, and the protocol inference text, and writes the access layer code, business layer code, and data storage layer code into the corresponding directories of the project skeleton. The test agent executes integration tests based on the architecture design, including access pipeline tests to verify the complete data processing link, data access tests to verify database operations, and assembly tests to verify component dependencies. If the verification results of all tests meet the set standards, the integration test passes. When any verification result fails to meet the set standard, the code generation agent will integrate the error information and write it into the workflow status file and test result file in a structured manner to generate a diagnostic report. Based on the diagnostic report, the master control agent again dispatches the code generation agent to analyze the specific reasons why the set standards were not met, and performs repairs according to the repair strategy to obtain the repaired access layer code, business layer code, and data storage layer code. Perform integration tests on the repaired access layer code, business layer code, and data storage layer code. If any verification result fails to meet the set standard, repair the repaired access layer code, business layer code, and data storage layer code again until all integration tests for the message pass.
8. A large-model-based IoT protocol code construction system according to claim 6 or 7, characterized in that: The specific methods of the repair strategy are as follows: First, determine if it is a local error. If the reason for not meeting the set standard is a local code error, then directly modify the corresponding local source code to obtain the corrected code. If the structural error or partial repair is ineffective, the corresponding code for that message will be completely regenerated, and the regenerated code will replace the original code as the repaired code.
9. A method for constructing IoT protocol code based on a large model, characterized in that, It includes: Data cleaning is performed on communication protocol documents for the Internet of Things (IoT) or the Internet of Vehicles (IoV) to obtain cleaned protocol text. The cleaned protocol text is structured and parsed by a protocol parsing agent to obtain a structured protocol model. The structured protocol model is then audited for quality. Based on the audited structured protocol model, the protocol processing system is modularly designed according to the set requirements, generating an architecture summary file and an output index file. Based on the cleaned protocol text, structured protocol model, architecture summary file, product index file, and pre-trained language model, the protocol reasoning text is obtained through prompt word engineering. Based on the structured protocol model, a test case list and message test data are generated; based on the architecture summary file and artifact index file, a code generation agent creates a standardized protocol project directory structure, protocol build files and common base classes in the preset target working directory, thereby forming the initialization engineering skeleton of the protocol processing system. Based on the protocol reasoning text, the initialization engineering skeleton, and the message identifiers in the structured protocol model, the entity class code and parser class code corresponding to each message identifier are incrementally generated by the code generation agent. The test agent generates specialized unit tests for each message identifier and executes the corresponding specialized unit tests based on the test case list and message test data. When all specialized unit tests pass, the protocol parsing layer code of the protocol processing system is generated based on the entity class code and parser class code corresponding to all message identifiers. Based on the protocol reasoning text, the initialization project skeleton, and the architecture summary file, a code generation agent generates access layer code, business layer code, and data storage layer code for the protocol processing system. Integration tests are then performed on the access layer code, business layer code, and data storage layer code. When the integration tests pass, the protocol processing system code is generated based on the access layer code, business layer code, data storage layer code, and the protocol parsing layer code.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 9.