Internet of Things equipment dynamic adaptation system, method, equipment and storage medium
By designing the dynamic adaptation system of the Internet of Things equipment, the combination of business modules and adaptation modules is used to provide a unified interface for equipment interaction, solving the problem of bloated and poor maintenance of existing system code, and realizing the differences in the equipment. The convenient update and upgrade of the system.
Patent Information
- Application Number
- CN202411561497.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-11-04
AI Technical Summary
Due to the wide variety of equipment and different communication protocols of the existing IoT device, the code is bloated and poor maintainability, and the docking of new devices or modified protocols requires re-release and deployment, affecting the availability and stability of the system.
Design a dynamic adaptation system of IoT equipment, providing a unified interface for equipment interaction through the combination of business modules and adaptation modules. The adaptation module contains information storage and query units, parameter mapping units, and communication template execution units. The communication templates and dynamic loading characteristics written by Groovy language can be used to realize the equipment without differences.
Improve the maintenance and scalability of the system, reduce the development workload and labor cost, solve the problem of incomparable code, realize the convenience of device dynamic adaptation and system update and upgrade, improve the availability and stability of the system sex.
Smart Images

Figure CN119363824A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer software application technology, and in particular to a dynamic adaptation system, method, device and storage medium for Internet of Things devices. Background Art
[0002] With the rapid development of the Internet of Things, more and more applications need to interact with IoT devices. Java, as a widely used programming language, has become an ideal choice for connecting with IoT devices due to its cross-platform nature, high efficiency, and rich library support. The most mainstream IoT device adaptation and interaction solution is to use the Java language to connect to various types of IoT devices and write logic codes for interacting with IoT devices.
[0003] However, due to the wide variety of IoT devices, each type of device has a different docking method, and docking code needs to be written for each type of device, and the code cannot be shared. In addition, the manufacturers of the same type of device are different, and the communication protocols of the devices are also different. Each type of device needs to develop a set of docking code for each manufacturer, resulting in bloated system code and poor maintainability of the adaptation system. In addition, docking new devices or modifying the communication protocol of the original device requires re-releasing the version and redeploying the adaptation system, which has poor availability and stability. Summary of the invention
[0004] Based on this, it is necessary to provide a dynamic adaptation system, method, device and storage medium for Internet of Things devices to address the above technical problems.
[0005] A dynamic adaptation system for IoT devices, the system consisting of a business module and an adaptation module; The business module includes several submodules, which are used to send the operation instructions and related parameters corresponding to the IoT devices to the adapter module by calling the unified interface of the adapter module when interacting with various types of IoT devices from various manufacturers, and receive the return results of the IoT devices forwarded by the adapter module, so as to realize the non-differential adaptation interaction between the business module and various types of IoT devices from various manufacturers based on the adapter module; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT devices; The adaptation module includes an information storage and query unit, a parameter mapping unit and a communication template execution unit; Among them, the information storage and query unit is used to configure and maintain the corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input parameter templates and output parameter templates corresponding to the operation instructions for each type of IoT device of each manufacturer before interaction, and send all operation instructions to the business module; when interacting, query the communication template, communication information, and input parameter template and output parameter template corresponding to the IoT device according to the operation instructions and related parameters sent by the business module; The parameter mapping unit is used to map the business parameters sent by the business module to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call the IoT devices of various types from various manufacturers without distinction; and after receiving the return result of the IoT device, the return result is mapped to the output parameter template corresponding to the operation instruction of the IoT device, and based on the mapped output parameter template, the business module can receive the return result of the IoT devices of various types from various manufacturers without distinction; The communication template execution unit is used to realize interaction with the IoT device by dynamically executing the communication method in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, feed back the returned result to the parameter mapping unit.
[0006] Furthermore, the operation instruction is defined as a dictionary value, and the communication template, communication information, and the input and output templates corresponding to the operation instruction are maintained in the dictionary table, and are permanently used after maintenance. When modification is required, the dynamic loading feature of the groovy language can be used to modify and update.
[0007] Furthermore, the communication template is used to configure the communication method used when interacting with IoT devices, including HTTP communication template, SOCKET communication template and MQTT communication template; among them, the HTTP communication template uses HTTP protocol to interact with IoT devices, the SOCKET communication template uses SOCKET method to interact with IoT devices, and the MQTT communication template uses message publishing and subscription method to interact with IoT devices.
[0008] Furthermore, the communication information includes a communication address and a port, which are used to bind the communication mode in the communication template to various operation instructions of the IoT device.
[0009] Furthermore, the mapping principles of the input parameter template and the output parameter template include: Use the JAVA regular matching mechanism to replace the parameter placeholder mapping of the input template with the business parameters sent by the business module; Utilize the JAVA regular matching mechanism to replace the parameter placeholder mapping of the output template with the return result of the IoT device.
[0010] Furthermore, the adaptation module also includes a state conversion unit, which converts the multi-field return results of various types of IoT devices from various manufacturers into fixed-field status codes by maintaining a state conversion template based on an array format, and feeds the fixed-field status codes back to the business module, so as to keep the status codes received by the business module consistent with the status codes of various types of IoT devices from various manufacturers.
[0011] A method for dynamic adaptation of an Internet of Things device, the method being applied to the above-mentioned dynamic adaptation system for an Internet of Things device, the method comprising the following steps: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the business parameters sent by the business module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0012] In one embodiment, before the business module receives the returned result, the method further includes: According to the state conversion unit in the adaptation module, a state conversion template based on the array format is maintained, and the multi-field return results of various types of IoT devices from various manufacturers are converted into status codes of fixed fields using the state conversion template. The status codes of fixed fields are fed back to the business module to keep the status codes received by the business module consistent with the status codes of various types of IoT devices from various manufacturers.
[0013] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the business parameters sent by the business module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0014] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the business parameters sent by the business module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0015] Compared with the prior art, the above-mentioned IoT device dynamic adaptation system, method, device and storage medium have the following technical effects: 1. The adapter module provides a unified interface. By calling the unified interface, the business module can efficiently send operation instructions and related parameters to the adapter module for dynamic adaptation of IoT devices, and receive device feedback forwarded by the adapter module. The adapter module can shield the details of the interaction between the business module and various types of IoT devices from various manufacturers, greatly improving the maintainability and scalability of the system.
[0016] 2. Based on the information storage and query unit in the adaptation module, the operation instructions, communication templates, communication information and input and output templates corresponding to the operation instructions of various types of IoT of various manufacturers are configured and maintained, which can greatly reduce the development workload and solve the problem that the docking code cannot be shared when docking various IoT devices, greatly improving the development efficiency and reducing the labor cost and system maintenance cost.
[0017] 3. The communication template is written in Groovy language. By taking advantage of the dynamic language features of Groovy, the system can be updated and upgraded without the user's awareness, solving the problem of poor system availability and stability caused by the need to redeploy after code modification. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a structural schematic diagram of a dynamic adaptation system for an Internet of Things device in one embodiment; Figure 2 It is a schematic diagram of the principle of realizing the indifferent adaptation and interaction between the service module and various types of IoT devices of various manufacturers based on the adaptation module in one embodiment; Figure 3 A schematic diagram of a flow chart of a method for dynamic adaptation of an Internet of Things device in one embodiment; Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0020] In one embodiment, a dynamic adaptation system for IoT devices is provided. The usage scenario of the system is an IoT platform or a platform that needs to connect to various IoT devices (such as access control, parking, cameras, etc.). Based on the dynamic adaptation system for IoT devices, unified management of various types of IoT devices from various manufacturers can be achieved, and relevant remote control of the devices can be performed, and the operating status of the devices can also be monitored.
[0021] like Figure 1 As shown, the IoT device dynamic adaptation system consists of a business module and an adaptation module; The business module includes several submodules, which are used to send the operation instructions and related parameters corresponding to the IoT devices to the adapter module by calling the unified interface process of the adapter module when interacting with various types of IoT devices from various manufacturers, and receive the return results of the IoT devices forwarded by the adapter module, so as to realize the non-differential adaptation interaction between the business module and various types of IoT devices from various manufacturers based on the adapter module; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT devices; The adaptation module includes an information storage and query unit, a parameter mapping unit, and a communication template execution unit. The principle of implementing the indiscriminate adaptation and interaction between the business module and various types of IoT devices from various manufacturers based on the adaptation module is as follows: Figure 2 shown.
[0022] Among them, the information storage and query unit is used to configure and maintain the corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input parameter templates and output parameter templates corresponding to the operation instructions for various types of IoT devices of various manufacturers before interaction, and send all operation instructions to the business module; when interacting, the communication templates, communication information, and input parameter templates and output parameter templates corresponding to the operation instructions of the IoT device are queried according to the operation instructions and related parameters sent by the business module.
[0023] Specifically, the operation instructions are defined as dictionary values, which are used to provide the business module with the adapter module. Based on the operation instructions, the business module does not need to pay attention to which manufacturer the IoT device is from and what the interaction protocol is, thereby improving the interaction efficiency between the business module and the IoT device. Specifically, the operation commands defined for access control type devices are: remote door opening, face delivery, and communication record query. The operation commands defined for parking type devices are: channel information query, lifting the bar, whitelist delivery, and communication record query. The operation commands defined for camera type devices are: obtain real-time playback stream, playback directory query, obtain playback playback stream, and pan / tilt control.
[0024] Specifically, the communication template, communication information, and input and output templates corresponding to the operation instructions are maintained in the dictionary table, and are permanently used after one maintenance. When modifications are required, they can be modified and updated using the dynamic loading feature of the groovy language. The above information can be configured on the page without writing code, which is convenient and quick.
[0025] Specifically, the communication template is used to configure the communication method used when interacting with IoT devices, including HTTP (Hypertext Transfer Protocol) communication template, SOCKET (socket) communication template and MQTT (Message Queuing Telemetry Transport) communication template.
[0026] Among them, the HTTP communication template uses the HTTP protocol to interact with IoT devices, and specifically defines HTTP communication methods such as GET, POST, PUT, and DELETE; among them, the GET method is used to obtain resources from the server, the POST method is used to submit data to the server, the PUT method is used to upload or update resources to the server, and DELETE is used to delete resources on the server. The OCKET communication template uses the SOCKET method to interact with IoT devices, and the MQTT communication template uses the message publishing and subscription method to interact with IoT devices.
[0027] The communication template written in Groovy is maintained on the page, which takes advantage of the dynamic language characteristics of Groovy to complete system updates and upgrades without the user's awareness, solving the problem of poor system availability and stability caused by the need to redeploy after code modification.
[0028] Specifically, the communication information includes the communication address and port, which are used to bind the communication mode in the communication template to various operation instructions of the IoT device. For example, the access control device of manufacturer 1 uses the HTTP protocol for interaction, and the HTTP communication address and port of manufacturer 1 are set, and the POST method of the HTTP communication template is bound to the door opening operation command of the access control device, and the GET method of the HTTP model template is bound to the communication record query operation command of the access control device.
[0029] Specifically, the format of the input parameter template corresponding to the operation instruction depends on the specific situation of the IoT device. The front-end page only needs to provide an input box, and no specific format verification is required. Because the interaction parameter formats of various types of IoT devices from different manufacturers are different, in order to allow the business module to use the same business parameters to call various IoT devices without difference, it is necessary to format the business parameters passed by the business module into the real parameter format of each device according to the input parameter module. For example, for the "remote door opening" operation command, the business parameters passed by the business module to the adapter module are (JSON format): { "deviceId": "xxxx", / / device ID "tagId": "xxxx" / / device tag } The business parameters of the "remote door opening" operation command of manufacturer 1 only require the device identifier (parameter name is DeviceNo) in the JSON format. Then the parameter input template is defined as: { "deviceNo":"${deviceId}" } The "remote door opening" operation command of manufacturer 2 requires the device identifier (parameter name is deviceNum) and device tag (tagId) in XML format, so the input parameter template is defined as: <root> <devicenum> ${deviceId}< / devicenum> <tagid> ${tagId}< / tagid> < / root> In the input parameter template, ${} is a parameter placeholder. When mapping, it will be replaced by the business parameter value passed by the business module. In this way, you only need to define the input parameter template for each operation command of each manufacturer's device, and the business module can interact with the IoT device without difference. The business module does not need to pass parameters in different formats according to different types of IoT devices from different manufacturers, which greatly improves the maintainability of the business module.
[0030] Specifically, since the return results of each type of IoT device from each manufacturer are different, in order to enable the business module to receive the return results of each type of IoT device from each manufacturer without difference, an output parameter template is defined for each operation instruction of each type of IoT device from each manufacturer. For example, for the "remote door opening" operation command, the return result format received by the business module is: { "code":"", "msg":"" } The return result format of the "remote door opening" operation command of manufacturer 1 is: { "result":"0", "msg":"Operation successful"} The return result format of the "remote door opening" operation command of manufacturer 2 is: { "code":"0", "message":"success" } The parameter template needs to be defined for the "remote door opening" operation command of manufacturer 1 as follows: { "code":"${result}", "msg":"${msg}" } The parameter template needs to be defined for the "remote door opening" operation command of manufacturer 2 as follows: { "code":"${code}", "msg":"${message}" } In the output parameter template, ${} is a parameter placeholder, which will be replaced by the specific corresponding value of the return result of the IoT device during mapping. In this way, the return result format of various types of IoT devices from different manufacturers is the same for the business module. There is no need to write a set of parsing codes for the return results of various types of IoT devices from different manufacturers, which greatly improves the maintainability of the system.
[0031] The parameter mapping unit is used to map the business parameters sent by the business module to the input parameter template corresponding to the operation instruction of the Internet of Things device, and based on the mapped input parameter template, the business module can make indiscriminate calls to various types of Internet of Things devices from various manufacturers; and after receiving the return result of the Internet of Things device, map the return result to the output parameter template corresponding to the operation instruction of the Internet of Things device, and based on the mapped output parameter template, the business module can receive the return result of various types of Internet of Things devices from various manufacturers indiscriminately.
[0032] Specifically, the mapping principles of the input parameter template and the output parameter template include: The JAVA regular matching mechanism is used to map and replace the parameter placeholders of the input parameter template with the business parameters sent by the business module; specifically, for business parameters in JSON format, the string in the parameter placeholder of the input parameter template corresponds to the key in the business parameter in JSON format. The JAVA regular matching method is used to extract the value corresponding to the key in the business parameter and replace it with the parameter placeholder of the input parameter template to obtain the mapped input parameter template.
[0033] Utilize the JAVA regular matching mechanism to replace the parameter placeholder mapping of the output template with the return result of the IoT device.
[0034] The communication template execution unit is used to realize the interaction with the IoT device by dynamically executing the communication method in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit. Specifically, the communication template execution unit first uses the Java reflection mechanism to instantiate the groovy object defined by the communication template, and then interacts with the IoT device by executing the corresponding communication method in the communication template through grooy.
[0035] Furthermore, the adaptation module also includes a state conversion unit, which converts the multi-field return results of various types of IoT devices from various manufacturers into fixed-field status codes by maintaining a state conversion template based on an array format, and feeds the fixed-field status codes back to the business module, so as to keep the status codes received by the business module consistent with the status codes of various types of IoT devices from various manufacturers. The state conversion template is stored in the information storage and query unit. Specifically, if the IoT device returns 100 to represent success, it can be converted to 1 through the state conversion template and then returned to the business module through the unified interface of the adaptation module. The state conversion template is defined as follows: [{ "sourceKey":"code" "sourceValue":"100" "targetValue":"1" }] Among them, the state conversion template can define dynamic conversion of multiple fields, sourceKey is the name of the field to be converted, sourceValue is the original field value, and targetValue is the converted value.
[0036] In one embodiment, Figure 3 As shown, a method for dynamic adaptation of an Internet of Things device is provided, which is applied to the above-mentioned dynamic adaptation system for an Internet of Things device, and the method comprises the following steps: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; When the communication information exists, the service parameters sent by the service module are mapped to the input parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit in the adaptation module, and the service module is enabled to call various types of IoT devices of various manufacturers without differentiation based on the mapped input parameter template; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0037] In one embodiment, before the business module receives the returned result, the method further includes: According to the state conversion unit in the adaptation module, a state conversion template based on the array format is maintained, and the multi-field return results of various types of IoT devices from various manufacturers are converted into status codes of fixed fields using the state conversion template. The status codes of fixed fields are fed back to the business module to keep the status codes received by the business module consistent with the status codes of various types of IoT devices from various manufacturers.
[0038] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a dynamic adaptation method for an Internet of Things device is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0039] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0040] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the business parameters sent by the business module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0041] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; When interacting, according to several sub-modules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return results of the IoT device forwarded by the adapter module are received. Based on the adapter module, the business module and various types of IoT devices of various manufacturers are adapted and interacted in the same way; Among them, based on the adaptation module, the business module can be adapted and interacted with various types of IoT devices from various manufacturers without any difference, including: According to the information storage and query unit in the adaptation module, the operation instructions and related parameters sent by the business module are obtained, and according to the operation instructions and related parameters, the communication template, communication information and input parameter template and output parameter template corresponding to the IoT device are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the business parameters sent by the business module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the business module can call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; The return result is further mapped to the output parameter template corresponding to the operation instruction of the IoT device according to the parameter mapping unit. Based on the mapped output parameter template, the business module is enabled to receive the return results of various types of IoT devices from various manufacturers without distinction. After receiving the return result, the business module implements the non-differential adaptation and interaction between the business module and various types of IoT devices from various manufacturers according to the response processing logic of the return result.
[0042] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0043] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0044] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A dynamic adaptation system for Internet of Things devices, characterized in that: The system consists of a business module and an adaptation module; The business module includes several submodules, which are used to send the operation instructions and related parameters corresponding to the IoT device to the adaptation module by calling the unified interface of the adaptation module when interacting with various types of IoT devices from various manufacturers, and receive the return result of the IoT device forwarded by the adaptation module, so as to realize the non-differential adaptation interaction between the business module and various types of IoT devices from various manufacturers based on the adaptation module; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; The adaptation module includes an information storage and query unit, a parameter mapping unit and a communication template execution unit; The information storage and query unit is used to configure and maintain corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input parameter templates and output parameter templates corresponding to the operation instructions for each type of IoT device of each manufacturer before interaction, and send all operation instructions to the business module; when interacting, query the communication template, communication information, and input parameter template and output parameter template corresponding to the IoT device according to the operation instructions and related parameters sent by the business module; The parameter mapping unit is used to map the business parameters sent by the business module to the input parameter template corresponding to the operation instruction of the Internet of Things device, and based on the mapped input parameter template, the business module can call various types of Internet of Things devices from various manufacturers without distinction; and after receiving the return result of the Internet of Things device, map the return result to the output parameter template corresponding to the operation instruction of the Internet of Things device, and based on the mapped output parameter template, the business module can receive the return results of various types of Internet of Things devices from various manufacturers without distinction; The communication template execution unit is used to achieve interaction with the Internet of Things device by dynamically executing the communication method in the communication template corresponding to the Internet of Things device, and after receiving the result returned by the Internet of Things device, feed back the returned result to the parameter mapping unit.
2. The Internet of Things device dynamic adaptation system according to claim 1, characterized in that: The operation instruction is defined as a dictionary value, and the communication template, communication information, and the input parameter template and output parameter template corresponding to the operation instruction are maintained in a dictionary table, and are permanently used after maintenance once. When modification is required, the dynamic loading feature of the groovy language can be used to perform modification and update.
3. The Internet of Things device dynamic adaptation system according to claim 2, characterized in that: The communication template is used to configure the communication method used when interacting with the Internet of Things device, including an HTTP communication template, a SOCKET communication template and an MQTT communication template; wherein the HTTP communication template uses the HTTP protocol to interact with the Internet of Things device, the SOCKET communication template uses the SOCKET method to interact with the Internet of Things device, and the MQTT communication template uses the message publishing and subscription method to interact with the Internet of Things device.
4. The Internet of Things device dynamic adaptation system according to claim 2, characterized in that: The communication information includes a communication address and a port, which are used to bind the communication mode in the communication template to various operation instructions of the IoT device.
5. The Internet of Things device dynamic adaptation system according to claim 2, characterized in that: The mapping principle of the input parameter template and the output parameter template includes: Using the JAVA regular matching mechanism, the parameter placeholder mapping of the input parameter template is replaced with the business parameters sent by the business module; Utilize the JAVA regular matching mechanism to replace the parameter placeholder mapping of the output parameter template with the return result of the IoT device.
6. The Internet of Things device dynamic adaptation system according to claim 1, characterized in that: The adaptation module also includes a state conversion unit, which converts the multi-field return results of various types of IoT devices from various manufacturers into status codes of fixed fields by maintaining a state conversion template based on an array format, and feeds the status codes of the fixed fields back to the business module, so as to keep the status codes received by the business module consistent with the status codes of various types of IoT devices from various manufacturers.
7. A method for dynamic adaptation of an Internet of Things device, the method being applied to the dynamic adaptation system for an Internet of Things device according to any one of claims 1 to 6, characterized in that: The method comprises the following steps: Before interaction, the information storage and query unit in the adaptation module configures and maintains corresponding operation instructions, communication templates written in groovy language, communication information of each manufacturer, and input and output templates corresponding to the operation instructions for each type of IoT device of each manufacturer, and sends all operation instructions to the business module; During the interaction, according to several submodules in the business module, the unified interface of the adapter module is called, the operation instructions and related parameters corresponding to the IoT device are sent to the adapter module, and the return result of the IoT device forwarded by the adapter module is received, and the business module and various types of IoT devices of various manufacturers are realized based on the adapter module. Non-differential adaptation interaction; Among them, based on the adaptation module, the business module and various types of IoT devices of various manufacturers are adapted and interacted indiscriminately, including: According to the information storage and query unit in the adaptation module, the operation instruction and related parameters sent by the business module are obtained, and according to the operation instruction and related parameters, the communication template and communication information corresponding to the IoT device and the input parameter template and output parameter template corresponding to the operation instruction are queried; wherein the related parameters include the manufacturer code, device type and business parameters of the IoT device; According to the parameter mapping unit in the adaptation module, the service parameters sent by the service module are mapped to the input parameter template corresponding to the operation instruction of the IoT device, and based on the mapped input parameter template, the service module is enabled to call various types of IoT devices of various manufacturers without distinction; Then, according to the communication template execution unit in the adaptation module, the interaction with the IoT device is realized by dynamically executing the communication mode in the communication template corresponding to the IoT device, and after receiving the result returned by the IoT device, the returned result is fed back to the parameter mapping unit; Further, according to the parameter mapping unit, the returned result is mapped to the output parameter template corresponding to the operation instruction of the Internet of Things device, and based on the mapped output parameter template, the business module is enabled to receive the returned results of various types of Internet of Things devices from various manufacturers without distinction. After receiving the returned result, the business module implements the non-differential adaptation interaction between the business module and various types of Internet of Things devices from various manufacturers according to the response processing logic of the returned result.
8. The method for dynamic adaptation of IoT devices according to claim 7, characterized in that: Before the business module receives the returned result, the method further includes: According to the state conversion unit in the adaptation module, a state conversion template based on an array format is maintained, and the state conversion template is used to convert the multi-field return results of various types of IoT devices of various manufacturers into status codes of fixed fields, and the status codes of the fixed fields are fed back to the business module to keep the status codes received by the business module consistent with the status codes of various types of IoT devices of various manufacturers.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 7 to 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 7 to 8 are implemented.
Citation Information
Patent Citations
Internet of Things equipment integration system based on mapping file
CN114281787A
Object model adaptation method and device
CN115514656A
Internet of Things equipment data conversion method, system and equipment based on hot deployment plug-in, and storage medium
CN117997962A
Visual editing generation and dynamic analysis system for internet-of-things equipment model
CN118034673A
Authentication and authorization system, method and apparatus for internet of things system, and storage medium
WO2024140697A1