A method and device for intelligent adaptation of intelligent terminal equipment

By combining scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering with AI large language models to automatically write adaptation code, the problems of low efficiency, poor compatibility, difficult maintenance, and high threshold in the adaptation process of smart terminal devices are solved, realizing automated, accurate adaptation and multi-protocol compatibility of smart terminal devices.

CN121764843BActive Publication Date: 2026-07-10REDSTONE SUN BEIJING TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511938412.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-07-10
Estimated Expiration
2045-12-22

AI Technical Summary

Technical Problem

The adaptation process for existing smart terminal devices suffers from low efficiency, poor compatibility, difficult maintenance, and high operational barriers. In particular, it is difficult to achieve full-process automation in terms of compatibility with multiple devices, protocols, and interfaces, and ordinary users cannot complete the adaptation process independently.

Method used

The system employs scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering for automatic discovery of smart terminals. It combines pre-built API library matching and AI reverse parsing, utilizes AI large language models to automatically write adaptation code, and generates a visual control interface through automatic testing, thus constructing an automated closed loop of testing, debugging, and iteration.

Benefits of technology

It enables automated and precise discovery and adaptation of smart terminal devices, supports compatibility with multiple protocols and interface types, reduces the need for manual intervention, improves adaptation efficiency and compatibility, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121764843B_ABST
    Figure CN121764843B_ABST
Patent Text Reader

Abstract

This invention provides a method and apparatus for intelligent adaptation of smart terminal devices. It automatically discovers smart terminals by using scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering to identify access devices, achieving automated and accurate discovery of smart terminal devices. Standardized scanning frequency and filtering rules improve the efficiency and accuracy of device discovery. By matching the access devices with pre-built API libraries and performing AI reverse parsing, the interface information of the access devices is obtained. Multi-dimensional parsing technology based on an AI large language model enables automatic parsing of standard and private interfaces. By utilizing the AI ​​large language model and combining it with built-in multi-language programming templates, adaptation code matching interface information is automatically written. Adaptation code is automatically generated based on AI technology, supporting compatibility with devices of multiple protocols and interface types. Ultimately, this solves the core problems of low efficiency, poor compatibility, difficult maintenance, and high barriers to entry in existing smart terminal adaptation processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart terminal adaptation and Internet of Things communication technology, and in particular to a method and apparatus for smart terminal device intelligent adaptation. Background Technology

[0002] With the popularization of IoT technology, various smart terminal devices, such as high-definition cameras, temperature and humidity sensors, infrared detectors, and smart switches, are becoming increasingly diverse in brand and model. Devices from different manufacturers exhibit significant differences in communication protocols (such as TCP / IP, MQTT, and ZigBee), interface standards (such as REST API and private SDKs), and data formats, making interoperability between devices a major pain point in the industry. Currently, the core requirement for smart terminal adaptation is to solve the compatibility issues of multiple devices, protocols, and interfaces. In existing technologies, terminal adaptation mainly relies on manual intervention. Technicians must first manually check the smart terminals in the network to obtain the device's interface documentation and communication parameters; then, they must write adaptation code specifically for each device model to implement functions such as device connection and data interaction; finally, they must manually design test cases to verify the adaptation effect. If the test fails, the problem must be manually located and the code modified until adaptation is successful.

[0003] Currently, the closest adaptation solution in the industry is the IoT device adaptation platform. These platforms provide users with semi-automated adaptation tools by integrating standard APIs and adaptation templates from mainstream manufacturers. Users need to manually input information such as device model and interface address. The platform generates a basic adaptation code framework based on the template, but subsequent manual addition of code logic and parameter debugging are still required. For niche devices or devices with proprietary interfaces that lack standard templates, completely manual development of adaptation programs is still necessary. The core limitation of this solution is that it does not achieve full automation of the adaptation process. Key steps such as device discovery, interface parsing, code completion, and testing and debugging still rely on professional programmers. Adaptation efficiency and compatibility are significantly affected by human experience, resulting in the following drawbacks:

[0004] The adaptation efficiency is extremely low: the cycle of manually checking equipment, writing code, and debugging and testing is long, and the adaptation of a single device takes an average of several hours to several days, which is difficult to meet the needs of batch adaptation of multiple devices.

[0005] Poor compatibility: The interfaces of devices from different manufacturers are very different, and it is easy to miss exception handling logic when writing code manually, resulting in a low success rate of adaptation and problems such as data loss and connection interruption when interconnecting devices.

[0006] High maintenance costs: When the device firmware is updated, the interface is upgraded, or a new device model is added, the adaptation code needs to be manually modified again, which involves a lot of repetitive work and high long-term maintenance costs.

[0007] High operational threshold: It relies on professional programming and IoT technology knowledge. Ordinary users or non-technical enterprises cannot complete the device adaptation on their own and need to rely on third-party technical services.

[0008] Incomplete test coverage: Manually designed test cases are difficult to cover all abnormal scenarios, such as network fluctuations and device offline restarts. As a result, the adapted devices are prone to stability issues in actual use. Summary of the Invention

[0009] This invention provides a method and apparatus for intelligent adaptation of smart terminal devices to solve the problems mentioned in the background art.

[0010] A method for intelligent adaptation of smart terminal devices includes:

[0011] S1: Automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering;

[0012] S2: Perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device;

[0013] S3: Utilizes AI large language models and combines multi-language programming templates to automatically write adaptation code that matches interface information;

[0014] S4: Run tests on the adaptation code. If the test is successful, a visual control interface will be automatically generated. If the test fails, the cause will be analyzed and the adaptation code will be modified.

[0015] Preferably, in step S1, the automatic discovery of smart terminals based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering to obtain access devices includes:

[0016] An initial multi-dimensional scene feature library is constructed from three dimensions: environment, equipment, and scanning constraints. Scene tags are extracted from gateway logs and communication characteristics of historically connected devices, and network topology feedback information is obtained by sending power consumption probe packets into the network. Based on the scene tags and network topology feedback information, the initial multi-dimensional scene feature library is supplemented with scene features to obtain the target multi-dimensional scene feature library.

[0017] Acquire current scene perception information, match the current scene perception information with the target multi-dimensional scene feature library to obtain scene matching results, and determine the scanning network from the scene matching results;

[0018] The dynamic scanning frequency for ARP scanning is established based on three factors: network load factor, device change factor, and device online stability factor.

[0019] Based on the scanning network and dynamic scanning frequency, the smart terminal is scanned using scenario-based adaptive ARP scanning to obtain the devices to be connected;

[0020] A three-layer UPnP fingerprint database is constructed based on basic fingerprints, communication fingerprints, and behavioral fingerprints. Basic information and communication characteristics of the devices to be accessed are obtained. The basic information is matched with the first-layer basic fingerprint in the three-layer UPnP fingerprint database to select smart devices as first-level access devices.

[0021] The communication characteristics of the first-level passing device are matched with the second-level communication fingerprint in the three-layer UPnP fingerprint database, and the second-level passing device with a matching degree greater than the preset matching degree is selected.

[0022] Based on the third-layer behavioral fingerprint in the three-layer UPnP fingerprint database, the MAC address of the secondary device that has passed through the ARP scan is verified to be consistent with the MAC address in the UPnP response message. If the consistency verification is successful, it is allowed to be accessed; otherwise, the secondary device is filtered out.

[0023] Preferably, after obtaining the access device, it also includes:

[0024] The system uses a lightweight function package to verify the intelligent interaction function of access devices, retains the access devices that pass the verification, and issues warnings based on the access devices.

[0025] Store the device information of the verified access devices and set up an information update mechanism.

[0026] Preferably, in step S2, the access device undergoes pre-built API library matching and AI reverse parsing to obtain the access device's interface information, including:

[0027] The system matches access devices based on a pre-built API library and selects the corresponding interface information that meets the matching requirements.

[0028] If the matching requirements are not met, the interface information is obtained by extracting the semantic features of protocol data packets from the access device based on AI reverse parsing, performing knowledge fusion based on RAG, and active detection and verification.

[0029] Preferably, it also includes configuring the following update mechanism for the pre-built API library, specifically:

[0030] By establishing a Webhooks channel with the partner vendor's server, the system automatically receives change notifications and hot-loads the new SDK when the vendor releases new firmware or changes the API.

[0031] Deploy a distributed crawler timed scanning mechanism, use NLP models to perform difference analysis on new and old documents, identify specific semantics, and automatically generate patches to update the pre-built API library.

[0032] Preferably, in step S3, the AI ​​large language model, combined with multi-language programming templates, is used to automatically write adaptation code that matches the interface information, including:

[0033] The interface information is structurally decomposed according to the protocol dimension, function dimension, and constraint dimension to obtain the interface information map;

[0034] Based on the protocol type, a protocol connection template matching the protocol type is established; based on the interface function type, a data interaction template is established by combining the built-in parameter encapsulation, data parsing, and instruction assembly logic; and based on the built-in standardized fault tolerance logic, an exception handling template is established.

[0035] Using the protocol connection template as the core layer, the data interaction template as the business layer, and the exception handling template as the fault tolerance layer, a three-layer multi-language programming template is established.

[0036] A dynamic template adaptation mechanism is established for three-layer multilingual programming templates based on scenario features, protocol features, and language features.

[0037] A dataset was constructed based on IoT device API documentation, private protocol data packets, manually written adaptation code, and device adaptation failure cases, and prompt words corresponding to the interface information were constructed.

[0038] Based on the dataset and prompt words, the initial language model is trained to obtain the AI ​​large language model;

[0039] Based on the template dynamic adaptation mechanism, the interface information graph is matched with the three-layer multilingual programming template, and the initial built-in code is obtained according to the matching result;

[0040] Based on the AI ​​large language model, code that meets the interface information is generated. Using the initial built-in code as a benchmark and the written code as an optimization feature, the initial built-in code and the written code are merged to obtain the adapted code that matches the interface information.

[0041] Preferably, after obtaining the adaptation code that matches the interface information, it also includes:

[0042] Associate the interface information with the adaptation code to generate a unique number;

[0043] The generated adaptation code is recorded and fed back to the AI ​​large language model.

[0044] Preferably, in step S4, the adaptation code is run for testing. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified, including:

[0045] Functional tests, 30-minute stability tests, and network outage simulation tests were performed on the adaptation code to obtain the test results.

[0046] Once the test result indicates that the test was successful, a visual control interface for the accessed device will be automatically generated.

[0047] When a test fails, the system uses AI to analyze logs to pinpoint the cause, automatically modifies the code, and resubmits the test until it succeeds.

[0048] Preferably, the step of matching access devices based on a pre-built API library and selecting interface information that meets the matching requirements includes:

[0049] Based on the device type of the access device, a first-level match is performed with the pre-built API library to obtain the initial interface information;

[0050] Based on the protocol type of the access device, a secondary matching is performed with the initial interface information to obtain intermediate interface information;

[0051] Based on the functional type and parameter specifications of the access device, the information is matched with the intermediate interface information to obtain the interface information that finally meets the matching requirements.

[0052] A device for intelligent adaptation of smart terminal devices, comprising:

[0053] The scanning and filtering module is used to automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering.

[0054] The interface parsing module is used to perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device.

[0055] The code writing module is used to automatically write adaptation code that matches interface information by leveraging AI large language models and combining multi-language programming templates.

[0056] The automated testing module is used to run tests on the adaptation code. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified.

[0057] Compared with the prior art, the present invention has achieved the following beneficial effects:

[0058] By employing scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering for automatic smart terminal discovery, access devices are identified, achieving automated and precise discovery of smart terminal devices. Standardized scanning frequency and filtering rules improve the efficiency and accuracy of device discovery. Interface information of the access devices is obtained through pre-built API library matching and AI reverse parsing. Multi-dimensional parsing technology based on AI large language models enables automatic parsing of standard and private interfaces, overcoming the technical bottleneck of private interface adaptation. By utilizing AI large language models combined with built-in multi-language programming templates, adaptation code matching interface information is automatically written. Adaptation code is automatically generated based on AI technology, supporting compatibility with devices of multiple protocols and interface types. The adaptation code is tested; upon successful testing, a visual control interface is automatically generated; upon failure, root cause analysis and adaptation code modification are performed, constructing an automated closed loop of testing, debugging, and iteration. Adaptation optimization can be completed without manual intervention, ultimately solving the core problems of low efficiency, poor compatibility, difficult maintenance, and high barriers to entry in the current smart terminal adaptation process.

[0059] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in this application.

[0060] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0061] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0062] Figure 1 This is a flowchart of a method for intelligent adaptation of a smart terminal device according to an embodiment of the present invention;

[0063] Figure 2 This is a step sequence diagram of the adaptation process in an embodiment of the present invention;

[0064] Figure 3 This is a structural diagram of a device for intelligent adaptation of a smart terminal device according to an embodiment of the present invention. Detailed Implementation

[0065] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0066] Example 1: This embodiment of the invention provides a method for intelligent adaptation of smart terminal devices, such as... Figure 1 As shown, it includes:

[0067] S1: Automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering;

[0068] S2: Perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device;

[0069] S3: Utilizes AI large language models and combines multi-language programming templates to automatically write adaptation code that matches interface information;

[0070] S4: Run tests on the adaptation code. If the test is successful, a visual control interface will be automatically generated. If the test fails, the cause will be analyzed and the adaptation code will be modified.

[0071] In this embodiment, Context-Adaptive ARP, or Context-Adaptive Address Resolution Protocol, is responsible for resolving IP addresses into their corresponding MAC addresses.

[0072] In this embodiment, multi-fingerprint UPnP filtering, also known as multi-fingerprint plug-and-play filtering, is an architecture for enabling peer-to-peer network connections between computers and intelligent electrical devices.

[0073] In this embodiment, such as Figure 2 As shown, the steps to initiate the adaptation process are executed in the following order. Figure 2 conduct.

[0074] In this embodiment, the cause analysis is based on log analysis.

[0075] In this embodiment, the adaptation code writing process is based on connection logic: TCP / MQTT / HTTP connection establishment; data interaction: command issuance and status polling code; exception handling: automatic injection of fault-tolerant code such as disconnection reconnection and data verification failure retry.

[0076] The beneficial effects of the above design scheme are as follows: By automatically discovering smart terminals based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering, access devices are obtained, achieving automated and accurate discovery of smart terminal devices. Standardized scanning frequency and filtering rules improve the efficiency and accuracy of device discovery. Pre-built API library matching and AI reverse parsing are used to obtain the interface information of the access devices. Multi-dimensional parsing technology based on AI large language models enables automatic parsing of standard and private interfaces, overcoming the technical bottleneck of private interface adaptation. By utilizing AI large language models and built-in multi-language programming templates, adaptation code matching interface information is automatically written. Adaptation code is automatically generated based on AI technology, supporting compatibility with devices of multiple protocols and interface types. The adaptation code is tested; upon successful testing, a visual control interface is automatically generated; upon failure, cause analysis and adaptation code modification are performed, constructing an automated closed loop of testing-debugging-iteration. Adaptation optimization can be completed without manual intervention, ultimately solving the core problems of low efficiency, poor compatibility, difficult maintenance, and high barriers to entry in the existing smart terminal adaptation process.

[0077] Example 2: Based on Example 1, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. In step S1, intelligent terminal automatic discovery is performed based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering to obtain access devices, including:

[0078] An initial multi-dimensional scene feature library is constructed from three dimensions: environment, equipment, and scanning constraints. Scene tags are extracted from gateway logs and communication characteristics of historically connected devices, and network topology feedback information is obtained by sending power consumption probe packets into the network. Based on the scene tags and network topology feedback information, the initial multi-dimensional scene feature library is supplemented with scene features to obtain the target multi-dimensional scene feature library.

[0079] Acquire current scene perception information, match the current scene perception information with the target multi-dimensional scene feature library to obtain scene matching results, and determine the scanning network from the scene matching results;

[0080] The dynamic scanning frequency for ARP scanning is established based on three factors: network load factor, device change factor, and device online stability factor.

[0081] Based on the scanning network and dynamic scanning frequency, the smart terminal is scanned using scenario-based adaptive ARP scanning to obtain the devices to be connected;

[0082] A three-layer UPnP fingerprint database is constructed based on basic fingerprints, communication fingerprints, and behavioral fingerprints. Basic information and communication characteristics of the devices to be accessed are obtained. The basic information is matched with the first-layer basic fingerprint in the three-layer UPnP fingerprint database to select smart devices as first-level access devices.

[0083] The communication characteristics of the first-level passing device are matched with the second-level communication fingerprint in the three-layer UPnP fingerprint database, and the second-level passing device with a matching degree greater than the preset matching degree is selected.

[0084] Based on the third-layer behavioral fingerprint in the three-layer UPnP fingerprint database, the MAC address of the secondary device that has passed through the ARP scan is verified to be consistent with the MAC address in the UPnP response message. If the consistency verification is successful, it is allowed to be accessed; otherwise, the secondary device is filtered out.

[0085] In this embodiment, environmental scene characteristics include, for example, network topology (home, office, industry), network bandwidth (low, medium, high), device density (sparse, dense), and network stability (fluctuating, stable); device scene characteristics include, for example, terminal type (smart home, industrial control, consumer electronics), communication protocol preference (UPnP, DLNA, Bluetooth gateway), and online patterns (24 / 7, time-of-day online); scanning constraint characteristics include, for example, network occupancy threshold (e.g., ≤10% bandwidth occupancy in home scenarios), scanning latency tolerance (≤50ms in industrial scenarios), and lower limit of repeated scanning interval (to avoid device interference). An initial multi-dimensional scene feature library is as follows:

[0086]

[0087] In this embodiment, network topology feedback information includes, for example, the number of subnets and device response latency.

[0088] In this embodiment, the scanning network may be configured to scan only the main subnet in a home scenario, or scan both the main subnet and the subordinate subnet in an industrial scenario.

[0089] In this embodiment, the network load factor is used to monitor network bandwidth utilization in real time. If the utilization exceeds the scenario threshold, the scanning frequency is reduced by 50%. The device change factor is used to temporarily increase the scanning frequency by 2 times if a new device MAC address is found in 3 consecutive scans to ensure that the new device is quickly discovered. The device online stability factor is used to statistically analyze the online status of the discovered devices. If the online rate is ≥95%, the scanning frequency is reduced by 30% to reduce resource consumption.

[0090] In this embodiment, the basic fingerprint includes device type, service type, etc., the communication fingerprint includes the port number, data frame length, and field format of the UPnP request or response packet, and the behavioral fingerprint includes the service discovery frequency, status reporting period, and response latency range of the UPnP device.

[0091] In this embodiment, the first-level screening excludes non-smart devices such as printers and ordinary routers, while the second-level screening determines the matching degree based on the edit distance algorithm.

[0092] The beneficial effects of the above design scheme are as follows: An initial multi-dimensional scene feature library is constructed from three dimensions: environment, equipment, and scanning constraints. Scene tags are extracted from gateway logs and communication characteristics of historically connected devices. Network topology feedback information is obtained by sending power consumption probe packets into the network. Based on the scene tags and network topology feedback information, the initial multi-dimensional scene feature library is supplemented with scene features to obtain the target multi-dimensional scene feature library. This solves the core pain point of traditional scanning lacking a scene-based benchmark, improves the comprehensiveness and accuracy of scene features, and achieves the basic capability of dynamic scene adaptation. By acquiring current scene perception information, the current scene perception information is compared with the target multi-dimensional scene feature library. The process involves matching data to obtain scenario-matching results, determining the scanning network from these results, and transitioning from full scanning to precise scanning. This reduces unnecessary resource consumption and prevents smart terminals from missing or over-scanning. A dynamic scanning frequency for ARP scanning is established based on three factors: network load factor, device change factor, and device online stability factor. This ensures the stability of existing network communication, resolves the latency issue in discovering new devices under traditional fixed frequencies, and improves the utilization efficiency of scanning resources. Ultimately, it achieves intelligent self-adjustment of the scanning frequency without manual intervention. By scanning smart terminals according to the scanning network and dynamic scanning frequency using scenario-based adaptive ARP scanning, the system obtains the network to be accessed. The system eliminates non-target subnets and invalid IPs, significantly reducing the number of devices to be processed and saving computing power for subsequent UPnP filtering, thus improving overall discovery efficiency. A three-layer UPnP fingerprint database is constructed based on basic fingerprints, communication fingerprints, and behavioral fingerprints to obtain basic information and communication characteristics of devices to be accessed. The basic information is matched with the first-layer basic fingerprint in the three-layer UPnP fingerprint database to filter out intelligent devices as first-level pass devices. This allows for the direct elimination of devices without intelligent services, such as printers and ordinary routers, through basic fingerprint matching, quickly narrowing down the device range and avoiding wasted resources on non-target devices during subsequent high-dimensional matching. Furthermore, by matching the communication characteristics of first-level pass devices with the three-layer... The second-layer communication fingerprint in the UPnP fingerprint database is used for matching, and secondary access devices with a matching degree greater than the preset matching degree are selected. Dumb terminals that only support the basic UPnP protocol but have no intelligent interaction capabilities are identified, further improving the accuracy of device screening. Based on the third-layer behavioral fingerprint in the three-layer UPnP fingerprint database, the consistency verification between the MAC address of the secondary access device after ARP scanning and the MAC address in the UPnP response message is performed. If the consistency verification is successful, it is allowed as an access device; otherwise, the secondary access device is filtered out. This closed-loop filtering eliminates unqualified devices, ensuring the quality of access devices. Ultimately, the automated and accurate discovery of intelligent terminal devices is achieved.

[0093] Example 3: Based on Example 2, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices, which, after obtaining the access device, further includes:

[0094] The system uses a lightweight function package to verify the intelligent interaction function of access devices, retains the access devices that pass the verification, and issues warnings based on the access devices.

[0095] Store the device information of the verified access devices and set up an information update mechanism.

[0096] In this embodiment, the intelligent interaction function verification of the access device is performed based on a lightweight function package, for example, by sending a command to obtain the device status for a smart home device.

[0097] In this embodiment, the device information includes IP address, MAC address, device type, UPnP service information, scene tag, discovery time, etc.

[0098] In this embodiment, an information update mechanism is set, for example, once every hour for households and once every 10 minutes for industries, to ensure the real-time nature of device information.

[0099] The beneficial effects of the above design scheme are: by verifying the actual intelligent interaction capabilities of the device with low-power commands, invalid devices that only match fingerprints but have no interaction functions are avoided from being connected. At the same time, the early warning mechanism quickly identifies unqualified devices, ensuring the validity of connected devices, and comprehensively storing the core information of the device, providing accurate data support for subsequent API matching and code generation.

[0100] Example 4: Based on Example 1, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. In step S2, the access device undergoes pre-built API library matching and AI reverse parsing to obtain the interface information of the access device, including:

[0101] The system matches access devices based on a pre-built API library and selects the corresponding interface information that meets the matching requirements.

[0102] If the matching requirements are not met, the interface information is obtained by extracting the semantic features of protocol data packets from the access device based on AI reverse parsing, performing knowledge fusion based on RAG, and active detection and verification.

[0103] In this embodiment, the semantic feature extraction of protocol data packets specifically involves capturing interactive data packets during the device network configuration phase and removing header verification redundancy; using byte-pair encoding technology to segment the private protocol data stream, identifying continuously changing byte sequences as parameter fields and fixed sequences as instruction fields; knowledge fusion based on RAG (Retrieval Enhanced Generation) specifically involves AI automatically crawling publicly available PDF manuals and technical blogs from the internet based on the device model; utilizing the cross-attention mechanism of the Transformer architecture to map the instruction fields in the data packets to the functional description text in the manuals, thereby deriving the interface logic; and active detection and verification specifically involves generating hypothetical interfaces based on reasoning, and the system sending predicted instructions to the device. Reinforcement learning mechanisms are used to analyze device feedback, verifying and solidifying the interface logic.

[0104] The beneficial effects of the above design scheme are: by performing pre-made API library matching and AI reverse parsing on the access device, the interface information of the access device is obtained; based on the multi-dimensional parsing technology of AI large language model, the automatic parsing of standard interface and private interface is realized, breaking through the technical bottleneck of private interface adaptation.

[0105] Example 5: Based on Example 4, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices, further comprising: configuring the following update mechanism for the pre-built API library, specifically:

[0106] By establishing a Webhooks channel with the partner vendor's server, the system automatically receives change notifications and hot-loads the new SDK when the vendor releases new firmware or changes the API.

[0107] Deploy a distributed crawler timed scanning mechanism, use NLP models to perform difference analysis on new and old documents, identify specific semantics, and automatically generate patches to update the pre-built API library.

[0108] In this embodiment, SDK stands for Software Development Kit.

[0109] In this embodiment, specific semantics include, for example, Deprecated and New Parameter.

[0110] The beneficial effects of the above design scheme are: by configuring an update mechanism for the prefabricated API library, the real-time effectiveness of the prefabricated API library is achieved, thereby improving the matching accuracy.

[0111] Example 6: Based on Example 1, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. In step S3, an AI large language model is used in conjunction with multi-language programming templates to automatically write adaptation code that matches interface information, including:

[0112] The interface information is structurally decomposed according to the protocol dimension, function dimension, and constraint dimension to obtain the interface information map;

[0113] Based on the protocol type, a protocol connection template matching the protocol type is established; based on the interface function type, a data interaction template is established by combining the built-in parameter encapsulation, data parsing, and instruction assembly logic; and based on the built-in standardized fault tolerance logic, an exception handling template is established.

[0114] Using the protocol connection template as the core layer, the data interaction template as the business layer, and the exception handling template as the fault tolerance layer, a three-layer multi-language programming template is established.

[0115] A dynamic template adaptation mechanism is established for three-layer multilingual programming templates based on scenario features, protocol features, and language features.

[0116] A dataset was constructed based on IoT device API documentation, private protocol data packets, manually written adaptation code, and device adaptation failure cases, and prompt words corresponding to the interface information were constructed.

[0117] Based on the dataset and prompt words, the initial language model is trained to obtain the AI ​​large language model;

[0118] Based on the template dynamic adaptation mechanism, the interface information graph is matched with the three-layer multilingual programming template, and the initial built-in code is obtained according to the matching result;

[0119] Based on the AI ​​large language model, code that meets the interface information is generated. Using the initial built-in code as a benchmark and the written code as an optimization feature, the initial built-in code and the written code are merged to obtain the adapted code that matches the interface information.

[0120] In this embodiment, the protocol dimension includes the protocol type of the interface and protocol parameters; the function dimension includes the interface function type and input / output parameters; and the constraint dimension includes interface call frequency limits, timeout thresholds, and permission requirements.

[0121] In this embodiment, the protocol connection template is, for example, a TCP template: containing core code snippets such as three-way handshake implementation, connection keep-alive, and port reuse; or an MQTT template: containing snippets such as client initialization, topic subscription / publishing, and will message configuration; the template features reserved protocol parameter placeholders that support dynamic filling.

[0122] In this embodiment, the data interaction template is, for example, an instruction issuance template, which includes parameter verification, instruction encoding, and message sending logic; a status polling template, which includes polling period configuration, return data decoding, and status caching logic; and the template features are associated parameter type verification rules to adapt to parameter differences of different devices.

[0123] In this embodiment, the exception handling template is, for example, a disconnection reconnection template, which includes the number of reconnections, the reconnection interval, and the reconnection triggering conditions; and a data verification failure retry template, which includes the number of retries, the retry delay, and the failure alarm triggering logic; the template features support for scenario-based configuration.

[0124] In this embodiment, the template matching logic is to first execute the protocol connection template to establish a device communication link, then call the business layer template to realize data interaction for instruction issuance or status polling; finally, embed the fault tolerance layer template to add exception handling logic at key nodes.

[0125] The beneficial effects of the above design scheme are as follows: By structurally decomposing interface information according to protocol, function, and constraint dimensions, an interface information graph is obtained, solving the problem of fragmented interface information and reducing the parsing cost of AI models. Based on protocol type, a protocol connection template matching the protocol type is established; based on interface function type, a data interaction template is established by combining built-in parameter encapsulation, data parsing, and instruction assembly logic; and based on built-in standardized fault-tolerance logic, an exception handling template is established. Each template focuses on a single core capability of the adapted code, avoiding the logical redundancy or lack of core capabilities in traditional single templates. By using the protocol connection template as the core layer, the data interaction template as the business layer, and the exception handling template as the fault-tolerance layer, a three-layer multi-language programming template is established, ensuring that the generated code has complete operational logic for connection, interaction, and exception fallback without the need for additional core code. Furthermore, by considering scenario characteristics, protocol characteristics, and language... The system features a three-layer multi-language programming template dynamic adaptation mechanism that accurately matches the optimal template combination, avoiding logical confusion caused by loading irrelevant templates and reducing initial code generation time. It constructs a dataset based on IoT device API documentation, private protocol data packages, manually written adaptation code, and device adaptation failure cases, and generates prompts corresponding to interface information. This ensures the dataset covers all dimensions of adaptation scenarios, and the prompts accurately guide model generation. The initial language model is trained based on the dataset and prompts to obtain an AI-powered large language model. This model overcomes the limitations of general-purpose large models, accurately understanding the specific needs of private protocols, device interaction logic, and other unique scenarios. Based on the AI-powered large language model, it generates code that meets the interface information. Using the initial built-in code as a benchmark and the written code as an optimization feature, the initial built-in code and the written code are merged to obtain adaptation code that matches the interface information. The initial code is then fused with AI code to prevent the AI-generated code from deviating from the core framework, while also compensating for personalized needs that templates cannot cover. The merged code has a higher run rate and combines standardization and adaptability, reducing logic correction and vulnerability fixing work during the testing phase and lowering debugging time for the adaptation code.

[0126] Example 7: Based on Example 6, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. After obtaining the adaptation code that matches the interface information, it further includes:

[0127] Associate the interface information with the adaptation code to generate a unique number;

[0128] The generated adaptation code is recorded and fed back to the AI ​​large language model.

[0129] The beneficial effects of the above design scheme are: by associating interface information with adaptation code to generate a unique number, it is convenient for subsequent testing and modification traceability; by recording the generation effect of adaptation code and feeding it back to the AI ​​large language model, iterative optimization of template logic and fine-tuning of model parameters can be achieved, thereby improving the accuracy of subsequent code generation.

[0130] Example 8: Based on Example 1, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. In step S4, the adaptation code is run for testing. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified, including:

[0131] Functional tests, 30-minute stability tests, and network outage simulation tests were performed on the adaptation code to obtain the test results.

[0132] Once the test result indicates that the test was successful, a visual control interface for the accessed device will be automatically generated.

[0133] When a test fails, the system uses AI to analyze logs to pinpoint the cause, automatically modifies the code, and resubmits the test until it succeeds.

[0134] The beneficial effects of the above design scheme are: by running tests on the adaptation code, a visual control interface is automatically generated after the test is successful, and the cause analysis and adaptation code modification are carried out after the test fails, thus building an automated closed loop of test-debugging-iteration, which can complete the adaptation optimization without human intervention.

[0135] Example 9: Based on Example 4, this embodiment of the invention provides a method for intelligent adaptation of smart terminal devices. The method involves matching access devices based on a pre-built API library and selecting interface information that meets the matching requirements, including:

[0136] Based on the device type of the access device, a first-level match is performed with the pre-built API library to obtain the initial interface information;

[0137] Based on the protocol type of the access device, a secondary matching is performed with the initial interface information to obtain intermediate interface information;

[0138] Based on the functional type and parameter specifications of the access device, the information is matched with the intermediate interface information to obtain the interface information that finally meets the matching requirements.

[0139] The beneficial effects of the above design scheme are: from coarse screening of device type to narrowing down of protocol type, the range of API matching is gradually reduced, avoiding the waste of computing power caused by full database traversal, improving matching efficiency by more than 60%, solving the problem of long time consumption for full matching, the hierarchical and progressive matching link logic is clear, and the problem link can be quickly located when matching fails, reducing the cost of troubleshooting.

[0140] Example 10: This embodiment of the invention provides a device for intelligent adaptation of smart terminal devices, such as... Figure 3 As shown, it includes:

[0141] The scanning and filtering module is used to automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering.

[0142] The interface parsing module is used to perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device.

[0143] The code writing module is used to automatically write adaptation code that matches interface information by leveraging AI large language models and combining multi-language programming templates.

[0144] The automated testing module is used to run tests on the adaptation code. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified.

[0145] In this embodiment, Context-Adaptive ARP, or Context-Adaptive Address Resolution Protocol, is responsible for resolving IP addresses into their corresponding MAC addresses.

[0146] In this embodiment, multi-fingerprint UPnP filtering, also known as multi-fingerprint plug-and-play filtering, is an architecture for enabling peer-to-peer network connections between computers and intelligent electrical devices.

[0147] In this embodiment, the cause analysis is based on log analysis.

[0148] In this embodiment, the adaptation code writing process is based on connection logic: TCP / MQTT / HTTP connection establishment; data interaction: command issuance and status polling code; exception handling: automatic injection of fault-tolerant code such as disconnection reconnection and data verification failure retry.

[0149] The beneficial effects of the above design scheme are as follows: By automatically discovering smart terminals based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering, access devices are obtained, achieving automated and accurate discovery of smart terminal devices. Standardized scanning frequency and filtering rules improve the efficiency and accuracy of device discovery. Pre-built API library matching and AI reverse parsing are used to obtain the interface information of the access devices. Multi-dimensional parsing technology based on AI large language models enables automatic parsing of standard and private interfaces, overcoming the technical bottleneck of private interface adaptation. By utilizing AI large language models and built-in multi-language programming templates, adaptation code matching interface information is automatically written. Adaptation code is automatically generated based on AI technology, supporting compatibility with devices of multiple protocols and interface types. The adaptation code is tested; upon successful testing, a visual control interface is automatically generated; upon failure, cause analysis and adaptation code modification are performed, constructing an automated closed loop of testing-debugging-iteration. Adaptation optimization can be completed without manual intervention, ultimately solving the core problems of low efficiency, poor compatibility, difficult maintenance, and high barriers to entry in the existing smart terminal adaptation process.

[0150] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of this application and its equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for intelligent adaptation of smart terminal devices, characterized in that, include: S1: Automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering; S2: Perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device, including: The system matches access devices based on a pre-built API library and selects the corresponding interface information that meets the matching requirements. If the matching requirements are not met, the interface information is obtained by extracting the semantic features of protocol data packets from the access device based on AI reverse parsing, performing knowledge fusion based on RAG, and active detection and verification. S3: Utilizing an AI-powered large language model and combining multi-language programming templates, automatically writes adaptation code that matches interface information, including: The interface information is structurally decomposed according to the protocol dimension, function dimension, and constraint dimension to obtain the interface information map; Based on the protocol type, a protocol connection template matching the protocol type is established; based on the interface function type, a data interaction template is established by combining the built-in parameter encapsulation, data parsing, and instruction assembly logic; and based on the built-in standardized fault tolerance logic, an exception handling template is established. Using the protocol connection template as the core layer, the data interaction template as the business layer, and the exception handling template as the fault tolerance layer, a three-layer multi-language programming template is established. A dynamic template adaptation mechanism is established for three-layer multilingual programming templates based on scenario features, protocol features, and language features. A dataset was constructed based on IoT device API documentation, private protocol data packets, manually written adaptation code, and device adaptation failure cases, and prompt words corresponding to the interface information were constructed. Based on the dataset and prompt words, the initial language model is trained to obtain the AI ​​large language model; Based on the template dynamic adaptation mechanism, the interface information graph is matched with the three-layer multilingual programming template, and the initial built-in code is obtained according to the matching result; Based on the AI ​​large language model, code that meets the interface information is generated. The initial built-in code is used as the benchmark, and the code is used as the optimization feature. The initial built-in code and the code are merged to obtain the adaptation code that matches the interface information. S4: Run tests on the adaptation code. If the test is successful, a visual control interface will be automatically generated. If the test fails, the cause will be analyzed and the adaptation code will be modified.

2. The method for intelligent adaptation of a smart terminal device according to claim 1, characterized in that, In step S1, intelligent terminal automatic discovery is performed based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering to obtain access devices, including: An initial multi-dimensional scene feature library is constructed from three dimensions: environment, equipment, and scanning constraints. Scene tags are extracted from gateway logs and communication characteristics of historically connected devices, and network topology feedback information is obtained by sending power consumption probe packets into the network. Based on the scene tags and network topology feedback information, the initial multi-dimensional scene feature library is supplemented with scene features to obtain the target multi-dimensional scene feature library. Acquire current scene perception information, match the current scene perception information with the target multi-dimensional scene feature library to obtain scene matching results, and determine the scanning network from the scene matching results; The dynamic scanning frequency for ARP scanning is established based on three factors: network load factor, device change factor, and device online stability factor. Based on the scanning network and dynamic scanning frequency, the smart terminal is scanned using scenario-based adaptive ARP scanning to obtain the devices to be connected; A three-layer UPnP fingerprint database is constructed based on basic fingerprints, communication fingerprints, and behavioral fingerprints. Basic information and communication characteristics of the devices to be accessed are obtained. The basic information is matched with the first-layer basic fingerprint in the three-layer UPnP fingerprint database to select smart devices as first-level access devices. The communication characteristics of the first-level passing device are matched with the second-level communication fingerprint in the three-layer UPnP fingerprint database, and the second-level passing device with a matching degree greater than the preset matching degree is selected. Based on the third-layer behavioral fingerprint in the three-layer UPnP fingerprint database, the MAC address of the secondary device that has passed through the ARP scan is verified to be consistent with the MAC address in the UPnP response message. If the consistency verification is successful, it is allowed to be accessed; otherwise, the secondary device is filtered out.

3. The method for intelligent adaptation of a smart terminal device according to claim 2, characterized in that, After obtaining the access device, it also includes: The system uses a lightweight function package to verify the intelligent interaction function of access devices, retains the access devices that pass the verification, and issues warnings based on the access devices. Store the device information of the verified access devices and set up an information update mechanism.

4. The method for intelligent adaptation of a smart terminal device according to claim 1, characterized in that, Also includes: Configure the following update mechanism for the pre-built API library: By establishing a Webhooks channel with the partner vendor's server, the system automatically receives change notifications and hot-loads the new SDK when the vendor releases new firmware or changes the API. Deploy a distributed crawler timed scanning mechanism, use NLP models to perform difference analysis on new and old documents, identify specific semantics, and automatically generate patches to update the pre-built API library.

5. The method for intelligent adaptation of a smart terminal device according to claim 1, characterized in that, After obtaining the adaptation code for the matching interface information, it also includes: Associate the interface information with the adaptation code to generate a unique number; The generated adaptation code is recorded and fed back to the AI ​​large language model.

6. The method for intelligent adaptation of a smart terminal device according to claim 1, characterized in that, In step S4, the adaptation code is run for testing. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified, including: Functional tests, 30-minute stability tests, and network outage simulation tests were performed on the adaptation code to obtain the test results. Once the test result indicates that the test was successful, a visual control interface for the accessed device will be automatically generated. When a test fails, the system uses AI to analyze logs to pinpoint the cause, automatically modifies the code, and resubmits the test until it succeeds.

7. The method for intelligent adaptation of a smart terminal device according to claim 1, characterized in that, The process of matching access devices based on a pre-built API library and selecting interface information that meets the matching requirements includes: Based on the device type of the access device, a first-level match is performed with the pre-built API library to obtain the initial interface information; Based on the protocol type of the access device, a secondary matching is performed with the initial interface information to obtain intermediate interface information; Based on the functional type and parameter specifications of the access device, the information is matched with the intermediate interface information to obtain the interface information that finally meets the matching requirements.

8. An apparatus for intelligent adaptation of a smart terminal device, used to implement the method for intelligent adaptation of a smart terminal device as described in any one of claims 1-7, characterized in that, include: The scanning and filtering module is used to automatically discover smart terminals and obtain access devices based on scenario-based adaptive ARP scanning and multi-fingerprint UPnP filtering. The interface parsing module is used to perform pre-built API library matching and AI reverse parsing on the access device to obtain the interface information of the access device. The code writing module is used to automatically write adaptation code that matches interface information by leveraging AI large language models and combining multi-language programming templates. The automated testing module is used to run tests on the adaptation code. If the test is successful, a visual control interface is automatically generated. If the test fails, the cause is analyzed and the adaptation code is modified.

Citation Information

Patent Citations

  • Butt-joint method for equipment using large language model and Internet of Things platform

    CN118509471A

  • Network device discovery method

    CN119697086A