Internet of Things equipment access protocol component development method, equipment and storage medium
By building a protocol analysis and processing common framework, using AI large models and multi-agent generation interface to implement code, the Internet of Things protocol analysis and processing problems such as diversity and heterogeneity in component development are solved, and efficient and compatible The highly capable protocol component development improves development efficiency and product quality.
Patent Information
- Application Number
- CN202411502131.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-07
AI Technical Summary
The existing technology faces problems such as protocol diversity, data heterogeneity, real-time and reliability, security, scalability and maintainability when developing IoT protocol analysis and processing components, which leads to difficult development, time-consuming and testing. There are many problems and low product quality.
Using an IoT device access protocol component development method, it is implemented by building a general framework for protocol analysis and processing, the abstract protocol-specific logical processing part is a function interface, building a protocol expert AI knowledge base, and using AI big model and multi-agent generation interface to achieve it. Code and integrate the generated code with a common framework for compilation, correction, testing and tuning.
This method greatly improves the development efficiency of IoT platform equipment access protocol analysis and processing components, reduces development technology thresholds, and reduces human errors. The resulting access protocol analysis and processing components are highly compatible with existing systems and are easy to adjust Testing and maintenance improves system stability and maintainability.
Smart Images

Figure CN119396365A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a method, device and storage medium for developing an Internet of Things device access protocol component. Background Art
[0002] In order for the IoT platform to implement access to specific IoT device access protocols, a series of work needs to be done to ensure that the devices can successfully connect to the platform and interact with data. The most important step is to develop access capabilities that support specific protocols in the IoT platform, which usually includes developing corresponding protocol parsing and processing components to be able to receive and parse the data sent by the device, and send control instructions to the device.
[0003] Using existing technologies and development processes, there are the following difficulties when developing IoT protocol parsing and processing components:
[0004] (1) Protocol diversity: IoT devices use a variety of communication protocols, and there is no unified protocol standard, which leads to complex protocols and high maintenance difficulties when connecting various devices. Technicians need to be familiar with the characteristics and working principles of multiple protocols in order to accurately parse and process data sent by different devices;
[0005] (2) Data heterogeneity: The data in the IoT perception layer is heterogeneous and comes from multiple sources. Different devices generate data in different formats and contents. Technicians need to design flexible data parsing and processing mechanisms to cope with various types of data input;
[0006] (3) Real-time and reliability requirements: IoT applications usually have high requirements for the real-time and reliability of data transmission. Technical personnel need to optimize protocol parsing and processing processes to ensure that data can be transmitted and processed in a timely and accurate manner;
[0007] (4) Security: IoT devices usually involve the transmission and processing of a large amount of sensitive data, such as user privacy, device status, etc. Technical personnel need to have a strong sense of security and be able to add necessary security measures during protocol parsing and processing, such as data encryption and identity authentication;
[0008] (5) Scalability and maintainability: With the continuous increase and update of IoT devices, protocol parsing and processing components need to have good scalability and maintainability. Technicians need to design a reasonable module architecture and interface so that functional expansion and maintenance can be easily carried out in the future.
[0009] These difficulties encountered in developing IoT protocol parsing and processing components, based on the high requirements for technical personnel, often lead to problems such as high difficulty, long time consumption, many testing problems, and low product quality in developing new IoT protocol parsing and processing components.
[0010] To this end, this application specifically proposes a method and system for developing an IoT device access protocol component to solve the above technical problems. Summary of the invention
[0011] The main purpose of the present invention is to provide a method, system, device and storage medium for developing an Internet of Things device access protocol component to solve the technical problems raised in the background technology.
[0012] The present invention adopts the following technical solutions to solve the above technical problems:
[0013] A method for developing an IoT device access protocol component is provided for rapidly developing an IoT device access protocol parsing and processing component on an IoT platform side, comprising the following steps:
[0014] S1. Build a general framework for protocol parsing and processing. According to the protocol parsing and processing components that have been implemented in the IoT platform, extract the common logical parts of the protocol to form a general framework for protocol parsing and processing;
[0015] S2. Abstract the protocol-specific logic processing part in the general framework into a function interface. According to the parts that are strongly related to the specific protocol and are not implemented in the general framework, define the input and output parameters and their properties of the relevant processing, and abstract the method / function interface;
[0016] S3. Build a protocol expert AI knowledge base for data learning;
[0017] S4. Generate interface implementation code using AI big model and multi-agent, build AI big model and multi-agent processing flow using AI knowledge base, select and specify big model and configure relevant parameters, identify key terms, definitions, flow charts, tables in original protocol documents, understand the logical relationship between them, extract parameter extraction / encoding logic required in the interface defined by the general framework of protocol parsing and processing, and generate interface implementation code;
[0018] S5. Generate code and integrate it with the general framework, integrate the generated interface implementation codes with the general framework, and compile, modify and test them;
[0019] S6. Test and tune: test and tune the integrated access protocol parsing and processing components, and input the tuned code into the protocol expert knowledge base.
[0020] Preferably, the framework in step S1 is used to fully implement the common functions necessary for the protocol parsing and processing components, including but not limited to:
[0021] Configuration management, which is used to read and parse configuration files and provide a unified configuration information access interface;
[0022] The module startup and shutdown process performs operations such as loading configuration, starting thread pool, and initializing network communication in the initialization phase, and closing all network connections, releasing thread pool resources, and closing logging in the cleanup phase;
[0023] TCP / UDP port monitoring, encapsulates the implementation of TCP and UDP servers, and supports dynamic configuration of monitoring ports;
[0024] Socket message sending and receiving, realizing the message sending and receiving mechanism based on Socket;
[0025] Device session management, used to manage the session state between the device and the platform;
[0026] Thread pool management and scheduling for handling concurrent tasks;
[0027] The calling interface of other modules / middleware of the IoT platform is adapted to the interfaces of other modules of the existing platform to ensure that the framework can be seamlessly integrated with other modules.
[0028] Preferably, the method / function interface in step S2 includes:
[0029] The message type determination interface is used to classify the messages received on the socket. The input parameters include the message byte stream, and the output parameters include the message type.
[0030] Login message parsing interface, used to parse the login request message sent by the device to the IoT platform;
[0031] Data reporting message parsing interface, used to parse the data reporting message sent by the device to the IoT platform;
[0032] The command response message parsing interface is used to parse the command response message sent by the device to the IoT platform;
[0033] Heartbeat message parsing interface, used to parse the message sent by the device to the IoT platform to maintain the session;
[0034] Login response message encoding interface, used to generate a login response sent by the IoT platform to the device;
[0035] Data reporting response message encoding interface, used to generate data reporting response sent by the IoT platform to the device;
[0036] The command sending message encoding interface is used to generate commands sent by the IoT platform to the device;
[0037] Heartbeat response message encoding interface, used to generate messages sent by the IoT platform to the device to maintain the session.
[0038] Preferably, in the interface, when there is no relevant message in the protocol specification, the corresponding message parsing interface is not defined, and the corresponding message encoding interface can be defined as outputting an empty byte stream; when there is no relevant parameter description of a message / interface in the protocol specification, the corresponding parameter is empty.
[0039] Preferably, the AI large model and multi-agent processing flow in step S4 includes:
[0040] S41. Document preprocessing: Use the NLP technology of the AI big model to parse and understand the IoT device access protocol document, identify the logical relationships between key terms, definitions, flow charts, and tables in the document, and use the retrieval enhancement generation technology. The document preprocessing big model combines the protocol expert knowledge base to analyze the content in the document, and output the corresponding content required by the interface to the corresponding code generation big model;
[0041] S42. Generate interface implementation code. According to each interface definition, configure a corresponding code generation model for each interface, and make a specific description of the interface metadata model of the target implementation. Combined with the protocol expert knowledge base, parse the text content output by the document preprocessing, understand the message format and parsing rules, and automatically generate the corresponding code;
[0042] S43. Code tuning, configure the code tuning big model, standardize and optimize the code format of the interface implementation code output by the code generation big model according to the programming specifications of the target code language, the programming specifications of the product system or organization and other requirements, or trigger the generation big model to regenerate the code.
[0043] Preferably, in the step S42, in the state of code generation large model, the test message of the interface is simultaneously generated to improve the development efficiency of automated test cases, and in each state of code generation large model, the programming language used by the generated target code is determined by reading the global configuration item.
[0044] Preferably, the step S43 further includes the following specific process before configuring the code to tune the large model:
[0045] S431 specifies the value of the relevant input parameter of the generated test message, so that the generated test message is encoded according to the specified parameter value;
[0046] S432. Then use the test message as an input parameter to verify the interface implementation code, and compare the return value of the interface implementation code with the value of the relevant input parameter of the test message:
[0047] If the results are consistent, the interface code and test message are retained;
[0048] If the results are inconsistent, you can manually determine whether the test results are correct or not, and remove the incorrect test messages or incorrect interface implementations, or simply repeat the previous step to regenerate the interface implementation code until the test passes.
[0049] Preferably, in the step S6, when the preset conditions allow, a private large model is deployed locally, and a feedback loop process is set at this time, including the following specific processes:
[0050] S61. Feedback the results of the generated code test to the large model for supervised fine-tuning;
[0051] S62. During the development of new protocols, save the inputs and outputs of each step of the multi-agent process in log files;
[0052] S63. After the new protocol is developed, the log files are fed back to the large model for incremental training;
[0053] S64.Through two types of secondary training of the big model, the big model’s ability to understand the protocol and the accuracy of code generation are improved.
[0054] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the above method.
[0055] On the other hand, the present invention further discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0056] It can be seen from the above technical solution that the present invention provides a method for developing an IoT device access protocol component. Compared with the prior art, the present invention has the following advantages:
[0057] 1. The present invention can provide a unified development template by setting up a general framework for protocol parsing and processing and its interface modeling during the development process of the protocol parsing and processing components for the IoT platform device access, thereby achieving the effect of lowering the development technology threshold, greatly improving development efficiency and reducing human errors.
[0058] 2. The present invention can enhance compatibility with existing systems by supporting the generation of access protocol parsing and processing components in different programming languages, thereby facilitating further integration and ensuring that new components are seamlessly integrated into the existing platform environment.
[0059] 3. The present invention can simplify the debugging and maintenance process by forming a unified access protocol parsing and processing component framework, thereby achieving the effect of improving system stability and maintainability, and can lay a solid foundation for subsequent development work.
[0060] 4. The present invention sets a feedback loop process to continuously optimize the locally deployed big model, which can continuously improve the big model's ability to understand the protocol and generate code, thereby achieving the effect of improving the quality of automatically generated code, and further facilitating the gradual optimization of the entire development process as usage increases.
[0061] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become easy to understand through the following description. Of course, it is not necessary to achieve all of the advantages described above simultaneously for any product implementing the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The drawings constituting a part of the present application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0063] Figure 1 It is a schematic diagram of the overall process of the method of the present invention;
[0064] Figure 2 It is a schematic diagram of the AI big model and multi-agent processing flow of the present invention. DETAILED DESCRIPTION
[0065] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. In the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0066] In the embodiment, see Figure 1 to Figure 2 .
[0067] Because various IoT devices that use IoT standard protocols, proprietary protocols, and private protocols need to implement the parsing and processing components of the corresponding protocols before they are connected to the IoT platform, Figure 1 As shown, an embodiment of the present invention proposes a method for developing an IoT device access protocol component, which is used to quickly develop an IoT device access protocol parsing and processing component on an IoT platform side, and its main steps include:
[0068] L1. Based on the already implemented protocol parsing and processing components, extract the common logic parts when processing different protocols, such as port monitoring, message sending and receiving, login authentication, session maintenance, message flow, etc., and integrate these common parts to form a general framework for protocol parsing and processing;
[0069] L2. Extract the unique parts of IoT protocol parsing and processing components when processing different protocols, mainly the parsing and encoding methods of specific messages, define the input and output of the unique processing logic based on the above general framework, and standardize and interface the unique processing logic;
[0070] L3. Determine the IoT device access protocol document that needs to be developed;
[0071] L4. Use AI big models and multi-agent technology to identify key terms, definitions, flow charts, tables, etc. in protocol documents, understand the logical relationship between them, extract key information such as device access process, message format, field description, etc., output standardized device access process documents, and implement parsing and encoding codes for each message according to the interface defined by the general framework of protocol parsing and processing;
[0072] L5. Embed the automatically generated code into the general framework of protocol parsing and processing, compile, modify, test and verify it, and complete the development of new protocol parsing and processing components.
[0073] Furthermore, for the development method of the IoT device access protocol component, the present invention disassembles the development process of the IoT protocol parsing and processing components, solidifies the general processes applicable to most protocols into a general framework, and achieves compatibility with the general framework by defining interfaces for the processing of differentiated message parsing and encoding of different protocols, interaction sequence of specific processes, and other parts.
[0074] At the same time, for the development method of IoT device access protocol components, the present invention also uses AI big models and multi-agent technology to replace manual understanding of protocol documents, generate codes for message parsing and encoding that meet the definition of the general framework interface, and realize protocol access.
[0075] In a specific implementation process, for the IoT device access protocol component development method, the detailed operation steps include:
[0076] S1. Build a general framework for protocol parsing and processing: Based on the protocol parsing and processing components that have been implemented on the IoT platform, extract the common logic parts of most protocols to form a general framework for protocol parsing and processing. The framework should have a file structure similar to that of other protocol parsing and processing components, such as project configuration files, header files, dependency libraries, source files, etc., and use version control;
[0077] The framework should fully implement the common functions necessary for protocol parsing and processing components, including but not limited to:
[0078] (1) Configuration management: Implement a configuration manager class that is responsible for reading and parsing configuration files and providing a unified configuration information access interface. For port configuration, the framework will support reading the listening ports required for each protocol from the configuration file and dynamically applying these configurations in the network communication module.
[0079] (2) Module startup and shutdown process: In the initialization phase, the framework will load the configuration, start the thread pool, initialize network communication, etc.; in the cleanup phase, it is responsible for closing all network connections, releasing thread pool resources, closing logging, etc.;
[0080] (3) TCP / UDP port monitoring: Encapsulates the implementation of TCP and UDP servers and supports dynamic configuration of monitoring ports. The framework will provide an interface that allows users to start the corresponding TCP or UDP server according to the protocol configuration and monitor the traffic on the specified port.
[0081] (4) Socket message sending and receiving: Implement the Socket-based message sending and receiving mechanism; the framework will provide an asynchronous or synchronous message processing interface, allowing users to define message processing logic and automatically call it when a message is received;
[0082] (5) Device session management: Maintain a device session manager to manage the session status between the device and the platform; including session creation (based on device connection), update (such as heartbeat processing), query (such as online detection) and destruction (such as device disconnection);
[0083] (6) Thread pool management and scheduling: Implement an efficient thread pool to handle concurrent tasks, such as message parsing and execution of device control commands. The framework will provide a thread pool configuration interface, allowing users to adjust the thread pool size and scheduling strategy according to actual needs.
[0084] (7) Calling interfaces with other modules / middleware of the IoT platform: Adapting interfaces with other modules of the existing platform, including device information query interface, object model interface, session information cache, and message passing, to ensure that the framework can be seamlessly integrated with other modules (such as device management, data analysis, user management, etc.); these interfaces will follow unified calling specifications and error handling mechanisms to improve the overall stability and maintainability of the system;
[0085] In addition, it should be noted that this step does not need to be repeated in the development of access components for different protocols.
[0086] S2. Abstract the protocol-specific logic processing part in the general framework into a function interface: According to the parts that are strongly related to the specific protocol and are not implemented in the general framework, define the input and output parameters and their properties of the relevant processing, and abstract the method / function interface;
[0087] The interfaces and parameters that need to be defined include but are not limited to:
[0088] (1) Message type determination interface: used to classify messages received on the socket. The input parameters include the message byte stream, and the output parameters include the message type, such as login message, data report message, heartbeat message, and command response message. In the general framework, when the socket receives a device message, it calls the message type determination interface and sends the message byte stream to the corresponding interface for processing according to the message type.
[0089] (2) Login message parsing interface: used to parse the login request message sent by the device to the IoT platform. The input parameters include the message byte stream, and the output parameters include the device ID, password, message sequence number, and device information parameter list. When the message is successfully parsed by the login parsing interface, the general framework calls the relevant interface of the device management module to query and authenticate the device information based on the device ID and password, creates session information for the authenticated device, continues the subsequent uplink and downlink interactions, and rejects the connection request of the device that has not passed the authentication.
[0090] (3) Data report message parsing interface: used to parse the data report message sent by the device to the IoT platform. The input parameters include the message byte stream, and the output parameters include the message sequence number, report type, and data content. When the message is successfully parsed by the data report message parsing interface, the general framework sends the data content reported by the device to other IoT business process modules for processing according to the report type.
[0091] (4) Command-sending response message parsing interface: used to parse the command response message sent by the device to the IoT platform. The input parameters include the message byte stream, and the output parameters include the message sequence number, command status, and response content. When the message is successfully parsed by the command-sending response message parsing interface, the general framework matches the message sequence number with the previously issued command, updates its command status, and records the response content.
[0092] (5) Heartbeat message parsing interface: used to parse the message sent by the device to the IoT platform to maintain the session. The input parameter includes the message byte stream, and the output parameter includes whether it is a heartbeat message. When the message is successfully determined as a heartbeat by the heartbeat message parsing interface, the general framework updates the device session and extends its online time.
[0093] (6) Login response message encoding interface: used to generate a login response sent by the IoT platform to the device. The input parameters include the device identifier, message sequence number, and other parameter lists. The output parameters include the message byte stream. After the device sends a login message and it is successfully parsed and processed by the login message parsing interface, the general framework calls the login response message encoding interface to generate a login response message and sends it to the device through the Socket.
[0094] (7) Data report response message encoding interface: used to generate the data report response sent by the IoT platform to the device. The input parameters include the device identifier, message sequence number, and other parameter lists. The output parameters include the message byte stream. After the device sends the data report and is successfully parsed and processed by the data report message parsing interface, the general framework calls the data report response message encoding interface to generate a data report response message. If the generated message is not empty, it is sent to the device through the Socket.
[0095] (8) Command sending message encoding interface: used to generate commands sent by the IoT platform to the device. The input parameters include the device identifier, message sequence number, and command parameter list. The output parameters include the message byte stream. When the user calls the platform command sending interface, the platform calls the command sending interface of the general framework, and then calls the message encoding interface to generate a command message and send it to the device through the Socket.
[0096] (9) Heartbeat response message encoding interface: used to generate a message sent by the IoT platform to the device to maintain the session. The input parameters include the message sequence number, and the output parameters include the heartbeat message. When the device requires the platform to send a heartbeat response message, the general framework calls the heartbeat response message encoding interface to generate a heartbeat response message after receiving the device's heartbeat message, and sends it to the device through the Socket.
[0097] At this point, it can be explained that by setting up a general framework for protocol parsing and processing and its interface modeling during the development of the protocol parsing and processing components for IoT platform device access, a unified development template can be provided, thereby achieving the effect of lowering the development technology threshold, greatly improving development efficiency and reducing human errors;
[0098] In addition, it is necessary to add that in the above interfaces, when the relevant message does not exist in the protocol specification, the corresponding message parsing interface is not defined, and the corresponding message encoding interface can be defined to output an empty byte stream; when the relevant parameter description of a message / interface does not exist in the protocol specification, the corresponding parameter is empty;
[0099] At the same time, a detailed metadata model is established for each interface, which includes not only the interface name, input and output parameter lists, but also detailed information such as parameter data type, mandatory or not, default value, validation rules, and the relationship between parameters.
[0100] In addition, the S2 step also refers to the above S1 step. In the development of access components of different protocols, this step does not need to be repeated;
[0101] S3. Build a protocol expert AI knowledge base for data learning: Create a protocol expert AI knowledge base, and the learning content includes: standard IoT protocol documents (such as MQTT, Modbus, OPC UA, LwM2M, JT / T808, etc.), metadata models of each interface, standard protocol interface implementation code that has been implemented according to the interface definition, and corresponding message samples of each interface of the standard protocol. Optional learning content also includes programming specifications of the target code, especially the company's internal programming specifications, example codes, etc.
[0102] S4. Generate interface implementation code using AI big model and multi-agent: Use AI knowledge base to build AI big model and multi-agent processing flow, select and specify big model and configure relevant parameters, identify key terms, definitions, flow charts, tables, etc. in original protocol documents, understand the logical relationship between them, extract parameter extraction / encoding logic required in the interface defined by the general framework of protocol parsing and processing, and generate interface implementation code;
[0103] At this time, the AI large model and multi-agent processing flow are as follows Figure 2 As shown in the figure, by building a protocol expert AI knowledge base and using a large model to understand specific device access protocol documents, it is possible to automatically generate adaptation framework interface code, thereby reducing the need for developers to conduct in-depth research on the device side and platform architecture, allowing developers to focus more on business logic implementation. The specific operation process includes the following:
[0104] S41. Document preprocessing: Use the NLP technology of the AI big model to parse and understand the IoT device access protocol document, identify key terms, definitions, flow charts, tables, etc. in the document, and understand the logical relationship between them; use the retrieval enhancement generation technology, the document preprocessing big model combines the protocol expert knowledge base to analyze the content in the document, and output the login process and format, reporting process and format, instruction process and format, heartbeat process and format, and the corresponding content required by other defined interfaces to the corresponding code generation big model;
[0105] S42. Generate interface implementation code: According to each interface definition, configure a corresponding code generation model for each interface, such as configuring a login message parsing model for the login message parsing interface; in the code generation model, a specific description of the interface metadata model of the target implementation is required, and the text content output by the document preprocessing is parsed in combination with the protocol expert knowledge base, the message format and parsing rules are understood, and the corresponding code is automatically generated;
[0106] At this time, in the state of code generation big model, the test message of the interface is also generated to improve the development efficiency of automated test cases, and in each state of code generation big model, the programming language used by the generated target code is determined by reading the global configuration item;
[0107] S43. Code tuning: further configure the code tuning model, standardize and optimize the interface implementation code output by the code generation model according to the target code language programming specification, product system or organization programming specification and other requirements, or trigger the generation model to regenerate code;
[0108] By supporting the generation of access protocol parsing and processing components in different programming languages, it can enhance compatibility with existing systems, making it easier to integrate and ensure that new components are seamlessly integrated into the existing platform environment.
[0109] It can be further explained that before configuring the code to tune the large model, the following specific processes are also included:
[0110] S431. Specify the values of the relevant input parameters of the generated test message, such as device identification, data content, message sequence number, etc., so that the generated test message is encoded according to the specified parameter value;
[0111] S432. Then use the test message as an input parameter to verify the interface implementation code, and compare the return value of the interface implementation code with the value of the relevant input parameter of the test message:
[0112] If the results are consistent, the interface code and test message are retained;
[0113] If the results are inconsistent, you can manually determine whether the test message or interface implementation is incorrect, or repeat the previous step to regenerate the interface implementation code until the test passes.
[0114] S5. Integrate the generated code with the general framework: Integrate the generated interface implementation codes with the general framework, compile, modify and test them;
[0115] At this point, it should be noted that, if necessary, the steps of preprocessing or generating a large model of code can be repeated to select the optimal generated code for integration;
[0116] S6. Test and Tuning: Test and tune the integrated access protocol parsing and processing components, and input the tuned code into the protocol expert knowledge base;
[0117] At this time, by forming a unified access protocol parsing and processing component framework, it can simplify the debugging and maintenance process, thereby improving the stability and maintainability of the system and laying a solid foundation for subsequent development work;
[0118] It should also be noted that, if the preset conditions allow, private large models can also be deployed locally to set up a feedback loop process, including the following specific processes:
[0119] S61. Add a feedback loop to the multi-agent processing flow to feed the results of the generated code test back to the big model for supervised fine-tuning;
[0120] S62. During the development of new protocols, save the inputs and outputs of each step of the multi-agent process in log files;
[0121] S63. After the new protocol is developed, the log files are fed back to the large model for incremental training;
[0122] S64. Through two types of secondary training of the big model, the big model's ability to understand the protocol and the accuracy of code generation are improved;
[0123] At this time, by setting up a feedback loop process to continuously optimize the locally deployed large model, it can play a role in continuously improving the large model's understanding of the protocol and code generation capabilities, thereby achieving the effect of improving the quality of automatically generated code, and further facilitating the gradual optimization of the entire development process as usage increases.
[0124] In summary, the protocol expert AI knowledge base formed through accumulation can provide support in multiple fields such as product document generation, user Q&A, automated testing, etc., thereby achieving the effect of expanding application scenarios and significantly improving the overall system's intelligence level and service quality.
[0125] Based on the above development method, the present invention divides the development of the IoT platform device access protocol parsing and processing components into two parts:
[0126] The first is the general framework for protocol parsing and processing and its interface modeling. Based on the implementation of the existing IoT platform and the characteristics of IoT protocol access, a general framework for protocol parsing and processing is formed. This framework is strongly related to the IoT platform system, implements the general process of IoT device access protocol processing and interaction with other components of the IoT platform, provides a general interface for adapting to different protocol processing, and performs metadata modeling on the input and output parameters related to each interface;
[0127] The second is to generate a code generation system that adapts to the framework interface. Build a protocol expert AI knowledge base, use large models to understand specific device access protocol documents, generate implementation code according to the interface defined by the general framework and the definition of the specific protocol, use multi-agents to configure multiple large models and the input-output relationship between large models, and realize the automation process from understanding protocol documents to generating various interface implementation codes. Use automatically generated test cases to test the automatically generated interface code to further improve the quality of the generated code. After integrating the general framework and the generated code, a parsing and processing component for the specific device access protocol is formed.
[0128] Therefore, in summary, the present invention can greatly improve the development efficiency and accuracy of the Internet of Things platform device access protocol parsing and processing components, lower the development technology threshold, reduce human errors, and the formed access protocol parsing and processing components are highly compatible with the existing Internet of Things platform system, easy to debug, automate testing and maintain. The formed protocol expert knowledge base will be further improved as the number of adapted protocols increases, thereby improving the development efficiency of new protocol components. It can also lower the use threshold of the Internet of Things platform and provide assistance to users in scenarios such as device development and docking, application docking, etc.
[0129] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the above method.
[0130] On the other hand, the present invention further discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0131] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the IoT device access protocol component development methods in the above embodiments.
[0132] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the above method.
[0133] The embodiment of the present application also provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus.
[0134] Memory, used to store computer programs;
[0135] The processor is used to implement the above-mentioned IoT device access protocol component development method when executing the program stored in the memory.
[0136] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0137] The communication interface is used for communication between the above electronic device and other devices.
[0138] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0139] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.
[0140] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, an optical medium, or a semiconductor medium, etc.
[0141] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0142] In addition, it should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0143] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the meaning of "and / or" appearing in the full text includes three parallel schemes. Taking "A and / or B" as an example, it includes scheme A, or scheme B, or schemes that A and B meet at the same time. In addition, in the embodiments of the present invention, "multiple" refers to more than two. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
Claims
1. A method for developing an IoT device access protocol component, which is used for rapid development of IoT device access protocol parsing and processing components on the IoT platform side, characterized in that: The following steps are involved: S1. Build a general framework for protocol parsing and processing. According to the protocol parsing and processing components that have been implemented in the IoT platform, extract the common logical parts of the protocol to form a general framework for protocol parsing and processing; S2. Abstract the protocol-specific logic processing part in the general framework into a function interface. According to the parts that are strongly related to the specific protocol and are not implemented in the general framework, define the input and output parameters and their properties of the relevant processing, and abstract the method / function interface; S3. Build a protocol expert AI knowledge base for data learning; S4. Generate interface implementation code using AI big model and multi-agent, build AI big model and multi-agent processing flow using AI knowledge base, select and specify big model and configure relevant parameters, identify key terms, definitions, flow charts, tables in original protocol documents, understand the logical relationship between them, extract parameter extraction / encoding logic required in the interface defined by the general framework of protocol parsing and processing, and generate interface implementation code; S5. Generate code and integrate it with the general framework, integrate the generated interface implementation codes with the general framework, and compile, modify and test them; S6. Test and tune: test and tune the integrated access protocol parsing and processing components, and input the tuned code into the protocol expert knowledge base.
2. The method for developing an IoT device access protocol component according to claim 1, wherein: The framework described in step S1 is used to fully implement the common functions necessary for the protocol parsing and processing components, including but not limited to: Configuration management, which is used to read and parse configuration files and provide a unified configuration information access interface; The module startup and shutdown process performs operations such as loading configuration, starting thread pool, and initializing network communication in the initialization phase, and closing all network connections, releasing thread pool resources, and closing logging in the cleanup phase; TCP / UDP port monitoring, encapsulates the implementation of TCP and UDP servers, and supports dynamic configuration of monitoring ports; Socket message sending and receiving, realizing the message sending and receiving mechanism based on Socket; Device session management, used to manage the session state between the device and the platform; Thread pool management and scheduling for handling concurrent tasks; The calling interface of other modules / middleware of the IoT platform is adapted to the interfaces of other modules of the existing platform to ensure that the framework can be seamlessly integrated with other modules.
3. The method for developing an IoT device access protocol component according to claim 1, wherein: The method / function interface in step S2 includes: The message type determination interface is used to classify the messages received on the socket. The input parameters include the message byte stream, and the output parameters include the message type. Login message parsing interface, used to parse the login request message sent by the device to the IoT platform; Data reporting message parsing interface, used to parse the data reporting message sent by the device to the IoT platform; The command response message parsing interface is used to parse the command response message sent by the device to the IoT platform; Heartbeat message parsing interface, used to parse the message sent by the device to the IoT platform to maintain the session; Login response message encoding interface, used to generate a login response sent by the IoT platform to the device; Data reporting response message encoding interface, used to generate data reporting response sent by the IoT platform to the device; The command sending message encoding interface is used to generate commands sent by the IoT platform to the device; Heartbeat response message encoding interface, used to generate messages sent by the IoT platform to the device to maintain the session.
4. The method for developing an IoT device access protocol component according to claim 3, wherein: In the interface, when there is no relevant message in the protocol specification, the corresponding message parsing interface is not defined, and the corresponding message encoding interface can be defined as outputting an empty byte stream; When the protocol specification does not contain relevant parameter descriptions for a message or interface, the corresponding parameters are empty.
5. The method for developing an IoT device access protocol component according to claim 1, wherein: The AI big model and multi-agent processing flow in step S4 includes: S41. Document preprocessing: Use the NLP technology of the AI big model to parse and understand the IoT device access protocol document, identify the logical relationship between key terms, definitions, flow charts, and tables in the document, and use the retrieval enhancement generation technology. The document preprocessing big model combines the protocol expert knowledge base to analyze the content in the document and output the corresponding content required by the interface to the corresponding code generation big model; S42. Generate interface implementation code: According to each interface definition, configure a corresponding code generation model for each interface, and make a specific description of the interface metadata model of the target implementation. Combined with the protocol expert knowledge base, parse the text content output by the document preprocessing, understand the message format and parsing rules, and automatically generate the corresponding code; S43. Code tuning: Configure the code tuning model, standardize and optimize the interface implementation code output by the code generation model according to the target code language programming specifications, product system or organization programming specifications and other requirements, or trigger the generation model to regenerate code.
6. The method for developing an IoT device access protocol component according to claim 5, wherein: In the step S42, in the state of code generation large model, the test message of the interface is generated at the same time to improve the development efficiency of automated test cases, and in each state of code generation large model, the programming language used by the generated target code is determined by reading the global configuration item.
7. The method for developing an IoT device access protocol component according to claim 5, wherein: The step S43 also includes the following specific processes before configuring the code to tune the large model: S431 specifies the value of the relevant input parameter of the generated test message, so that the generated test message is encoded according to the specified parameter value; S432. Then use the test message as an input parameter to verify the interface implementation code, and compare the return value of the interface implementation code with the value of the relevant input parameter of the test message: If the results are consistent, the interface code and test message are retained; If the results are inconsistent, you can manually determine whether the test results are correct or not, and remove the incorrect test messages or incorrect interface implementations, or simply repeat the previous step to regenerate the interface implementation code until the test passes.
8. The method for developing an IoT device access protocol component according to claim 1, wherein: In the step S6, when the preset conditions allow, a private large model is deployed locally, and a feedback loop process is set at this time, including the following specific processes: S61. Feedback the results of the generated code test to the large model for supervised fine-tuning; S62. During the development of new protocols, save the inputs and outputs of each step of the multi-agent process in log files; S63. After the new protocol is developed, the log files are fed back to the large model for incremental training; S64.Through two types of secondary training of the big model, the big model’s ability to understand the protocol and the accuracy of code generation are improved.
9. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
10. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 8.
Citation Information
Cited By
Intelligent equipment access system and access method based on AI large model
CN119964569A
Internet of Things equipment message data analysis method, system and equipment based on large model, and medium
CN120017738A
Protocol analysis method and device based on multi-agent cooperation and medium
CN120378519A
A protocol analysis method, device and medium based on multi-agent cooperation
CN120378519B
Flight simulator interface code automatic generation method, system and equipment based on large language model and storage medium
CN120872322A