Device linkage program design method and system, electronic device and storage medium

By obtaining and parsing the configuration files for device linkage requirements, and using the thermal update mechanism and builder/parser to map it into executable code, the problems of inefficient device linkage and difficult to meet the diversified requirements in the existing technology are solved, and efficient device linkage programming and dynamic rule updates are achieved.

CN119520590APending Publication Date: 2025-02-25E-SURFING DIGITAL LIFE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411616198.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing technology is inefficient when realizing device linkage, which cannot meet the diverse linkage needs of users, and the equipment manufacturer's standards are not unified, resulting in the Internet of Things platform that needs to be compatible with multiple device linkage logic.

Method used

A device linkage programming method is proposed. By obtaining the first linkage configuration file that represents the device linkage requirements, using the form of combined metadata to characterize the device linkage requirements, loading the configuration file into memory using the thermal update mechanism, mapping the configuration file into executable program code through the builder and parser, and dynamically writing update linkage rules.

Benefits of technology

It improves the efficiency of device linkage program design, simplifies the difficulty of linkage program writing, meets the diversified needs of device linkage, and realizes dynamic writing and update linkage rules without restarting the system services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520590A_ABST
    Figure CN119520590A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an equipment linkage program design method and system, electronic equipment and a storage medium, and belongs to the technical field of computers. According to the method, the first linkage configuration file representing the equipment linkage requirement is obtained, the first linkage configuration file represents the equipment linkage requirement in a metadata combination mode, the metadata are equipment components, logic statements or script languages, the linkage requirement is configured in the metadata combination mode, the linkage program writing difficulty can be simplified, and the linkage program writing efficiency is improved. The method comprises the following steps of: loading a first linkage configuration file into a memory by adopting a hot update mechanism, and mapping the first linkage configuration file in the memory into a file format which can be analyzed by a program by a builder to obtain a second linkage configuration file, the parser parses the second linkage configuration file into executable program codes to obtain the equipment linkage program, then the program is executed, the linkage rule is dynamically written and updated, system service does not need to be restarted, and the design efficiency of the equipment linkage program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a device linkage programming method, system, electronic device and storage medium. Background Art

[0002] With the development of Internet of Things technology, more and more devices are connected to the Internet. Through the linkage between different devices, application scenarios such as digital villages, smart communities, smart homes, smart transportation, smart medical care, industrial automation, etc. are realized, so as to improve production efficiency, reduce costs and improve the quality of life.

[0003] Currently, there are many types of IoT devices, the standards of IoT device manufacturers are not unified, and the functions of a single device are not enough to meet the customer's scenario requirements. Different devices need to be linked through the IoT platform. The IoT platform needs to be compatible with different device linkage logics according to the different scenario requirements of different customers. Generally, professional developers develop programs after collecting customer linkage requirements, and then update the system program version. Customers implement new device linkage functions based on the new program version, but this method is inefficient and cannot meet the diverse linkage needs of users. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose a device linkage program design method, system, electronic device and storage medium, aiming to improve the efficiency of device linkage program design and meet the diverse linkage needs of users.

[0005] To achieve the above purpose, one aspect of an embodiment of the present application proposes a device linkage program design method, comprising the following steps:

[0006] Acquire a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement, or a scripting language;

[0007] Using a hot update mechanism to load the first linkage configuration file into the memory;

[0008] Mapping the first linkage configuration file in the memory into a file format parseable by a program through a builder to obtain a second linkage configuration file;

[0009] The second linkage configuration file is parsed into executable program code by a parser to obtain a device linkage program.

[0010] In some embodiments, before the step of using a hot update mechanism to load the first linkage configuration file into the memory, the device linkage program design method further includes the following steps:

[0011] Testing and verifying the first linkage configuration file to obtain a file test result;

[0012] When the file test result is passed, the step of using the hot update mechanism to load the first linkage configuration file into the memory is continued;

[0013] When the file test result is failed, error data is displayed.

[0014] In some embodiments, before the step of loading the first linkage configuration file into the memory using the hot update mechanism, the device linkage program design method further includes the following steps:

[0015] Uploading the first linkage configuration file to a server for storage;

[0016] The first linkage configuration file is loaded from the server into the memory.

[0017] In some embodiments, uploading the first linkage configuration file to a server for storage includes the following steps:

[0018] Obtaining a file storage configuration, wherein the file storage configuration includes a storage type and a target object, and the storage type is one of local storage or middleware storage;

[0019] A target server and a storage location of a target object in the target server are determined according to the file storage configuration, and the first linkage configuration file is uploaded to the storage location of the target server for storage.

[0020] In some embodiments, the step of using a hot update mechanism to load the first linkage configuration file into the memory includes the following steps:

[0021] Determine the loading method according to the type of the target server;

[0022] The loading method is adopted to load the first linkage configuration file from the target server into the memory, wherein, when the target server is a server stored by the middleware, the loading method is to reuse the hot update mechanism of the middleware itself; when the target server is a server stored locally or on a disk, the loading method is to call a memory synchronization function.

[0023] In some embodiments, mapping the first linkage configuration file in the memory into a file format parseable by a program through a builder to obtain a second linkage configuration file includes the following steps:

[0024] Determine a configuration type of the first linkage configuration file, wherein the configuration type is one of a logic configuration file or a script configuration file, wherein the logic configuration file is described using metadata of device components and logic statements, and the script configuration file is described using a scripting language and metadata of device components;

[0025] Performing first rule parsing, component registration and metadata assembly operations on the logic class configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program;

[0026] The second rule parsing, component registration and metadata assembly operations are performed on the script-type configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program.

[0027] In some embodiments, obtaining a first linkage configuration file representing a device linkage requirement includes the following steps:

[0028] In response to the configuration mode, displaying a corresponding programming page;

[0029] In response to the configuration instructions on the programming page, a first linkage configuration file is generated.

[0030] To achieve the above purpose, another aspect of the embodiment of the present application provides a device linkage programming system, including:

[0031] A first module is used to obtain a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement or a scripting language;

[0032] A second module is used to load the first linkage configuration file into a memory by adopting a hot update mechanism;

[0033] A third module is used to map the first linkage configuration file in the memory into a file format parseable by a program through a builder to obtain a second linkage configuration file;

[0034] The fourth module is used to parse the second linkage configuration file into executable program code through a parser to obtain a device linkage program.

[0035] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the device linkage program design method described in the above embodiment is realized.

[0036] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium used for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the device linkage program design method described in the above embodiment.

[0037] The device linkage program design method, system, electronic device and storage medium proposed in the present application obtain a first linkage configuration file representing the device linkage demand, wherein the first linkage configuration file uses a combination of metadata to represent the device linkage demand, and the metadata is a device component, a logical statement or a scripting language. The linkage demand is configured in the form of a metadata combination, which can simplify the difficulty of linkage program writing and meet the diverse needs of device linkage. The first linkage configuration file is loaded into the memory by a hot update mechanism, and the first linkage configuration file in the memory is mapped into a file format that can be parsed by the program to obtain a second linkage configuration file through a builder. The second linkage configuration file is parsed into an executable program code through a parser to obtain a device linkage program, and then the program is executed. The linkage rules can be dynamically written and updated without restarting the system service, thereby improving the efficiency of device linkage program design. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 is a flow chart of a device linkage program design method provided in an embodiment of the present application;

[0039] Figure 2 yes Figure 1 Flow chart of step S101 in FIG.

[0040] Figure 3 is a flow chart of a device linkage program design method provided by another embodiment of the present application;

[0041] Figure 4 is a flow chart of a device linkage program design method provided by another embodiment of the present application;

[0042] Figure 5 yes Figure 4 Flow chart of step S401 in FIG.

[0043] Figure 6 yes Figure 4 Flow chart of step S502 in FIG.

[0044] Figure 7 yes Figure 1 Flow chart of step S103 in FIG.

[0045] Figure 8 It is a schematic diagram of a device linkage programming system provided in an embodiment of the present application;

[0046] Fig. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0047] Fig.10 It is a schematic diagram of the system architecture of the application device linkage program design method provided in the embodiment of the present application;

[0048] Fig.11 It is a schematic diagram of the device component packaging code of the network speaker device provided in an embodiment of the present application;

[0049] Fig.12 This is a schematic diagram of the script configuration file writing code provided in the embodiment of the present application;

[0050] Fig.13 This is a schematic diagram of writing code for a logic class configuration file provided in an embodiment of the present application;

[0051] Fig.14 The embodiment of this application provides Fig.13 A schematic diagram of the code logic relationship of the logic class configuration file;

[0052] Fig.15 This is a schematic diagram of the process of loading a configuration file into a memory provided by an embodiment of the present application;

[0053] Fig.16 It is a business process diagram of the device linkage requirement configuration provided in the embodiment of the present application. DETAILED DESCRIPTION

[0054] 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.

[0055] It should be noted that, although the functional modules are divided in the system and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0057] First, some nouns involved in this application are analyzed:

[0058] Nacos is an open source dynamic service discovery, configuration management and service management platform of Alibaba, which is mainly used to build cloud native applications. When a service instance is started, it will register its own information (such as IP address, port, service name, etc.) to the Nacos Server. Service consumers query the required service instance information through the Nacos Server to realize the call between services. As a configuration center, Nacos stores various configuration information, such as database connection information, system configuration parameters, etc. Nacos supports dynamic update of configuration and pushes it to the application in real time without restarting the service. The configuration is isolated through dimensions such as Namespace and Group to meet the configuration requirements of different environments (development, testing, and production).

[0059] Zookeeper is a distributed coordination service that provides a complete set of coordination service functions for distributed applications. Zookeeper is essentially a distributed small file storage system that uses a directory tree method similar to the file system to store node data. At the same time, Zookeeper is also designed based on the observer mode and can monitor data changes to perform cluster management, unified naming services, distributed configuration management, distributed message queues, distributed locks, distributed coordination and other functions. Zookeeper's configuration management function stores and manages configuration information in distributed systems, and supports dynamic updates and real-time push of configurations.

[0060] Apollo is a powerful and easy-to-use distributed configuration center that can help developers better manage configuration information in distributed systems and improve the maintainability and scalability of the system. Apollo can centrally manage the configuration of different application environments and clusters. After the configuration is modified, it can be pushed to the application end in real time, and has standardized permissions, process governance and other features, which is suitable for microservice configuration management scenarios. After the user modifies the configuration in Apollo and publishes it, the client can receive the latest configuration in real time (usually within 1 second) and notify the application.

[0061] Java, an object-oriented high-level programming language, has the characteristics of cross-platform, object-oriented, robust, secure, and portable. It is widely used in enterprise application development, mobile application development, big data processing, cloud computing and other fields.

[0062] Groovy is a dynamic language based on JVM and an object-oriented language. It combines many features of Python, Ruby and Smalltalk, and is very similar to Java in syntax.

[0063] Python, a widely used high-level programming language, is known for its concise syntax and powerful functions. It supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural programming.

[0064] Lua is a lightweight, embedded scripting language suitable for embedded systems, game development, Web applications and other scenarios. The table in Lua is a very flexible data structure that can simulate various data structures such as arrays and dictionaries.

[0065] QLExpress is a lightweight Java-based rule engine and expression language that supports dynamic expression parsing and execution.

[0066] JavaScript, a widely used scripting language, is mainly used for web development, including front-end development, back-end development (such as Node.js), and mobile application development (such as React Native). Although JavaScript is not a pure object-oriented language, it supports object-oriented programming paradigms such as classes and inheritance.

[0067] XML (Extensible Markup Language), XML is a subset of Standard Generalized Markup Language (SGML), which is a markup language used to mark electronic files to make them structured.

[0068] JSON (JavaScript Object Notation), JSON is a lightweight data exchange format that is based on a subset of JavaScript syntax but is independent of the JavaScript language.

[0069] YAML (YAML Ain't Markup Language), YAML is a human-readable data serialization standard that uses an indentation-like format to represent data structures.

[0070] Both JSON and XML have good compatibility and can be parsed and processed by multiple programming languages. Although YAML also has good compatibility, it may not be as widespread as JSON and XML in some specific scenarios.

[0071] The embodiments of the present application provide a device linkage program design method, system, electronic device and storage medium, aiming to improve the efficiency of device linkage program design and meet the diverse linkage needs of users.

[0072] The device linkage programming method, system, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the device linkage programming method in the embodiments of the present application is described.

[0073] The device linkage programming method provided in the embodiment of the present application relates to the field of computer technology. The device linkage programming method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, or can be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the device linkage programming method, etc., but is not limited to the above forms.

[0074] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0075] Figure 1 is an optional flowchart of the device linkage program design method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S104.

[0076] Step S101, obtaining a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement, or a scripting language;

[0077] Step S102, using a hot update mechanism to load the first linkage configuration file into the memory;

[0078] Step S103, mapping the first linkage configuration file in the memory into a file format parseable by the program through a builder, to obtain a second linkage configuration file;

[0079] Step S104: parsing the second linkage configuration file into executable program code by a parser to obtain a device linkage program.

[0080] In steps S101 to S104 shown in the embodiment of the present application, a first linkage configuration file representing the device linkage demand is obtained. The first linkage configuration file uses a combination of metadata to represent the device linkage demand. The metadata is a device component, a logical statement or a scripting language. The linkage demand is configured in the form of a metadata combination, which can simplify the difficulty of writing a linkage program and meet the diverse needs of device linkage. The first linkage configuration file is loaded into the memory by a hot update mechanism. The first linkage configuration file in the memory is mapped to a file format that can be parsed by the program through a builder to obtain a second linkage configuration file. The second linkage configuration file is parsed into an executable program code through a parser to obtain a device linkage program. The program is then executed, and the linkage rules can be dynamically written and updated without restarting the system service, thereby improving the efficiency of device linkage program design.

[0081] According to some embodiments of the present application, the device linkage program design method of the embodiment of the present application can be applied to the following: Fig.10 In the system architecture shown, the system architecture mainly includes storage, metadata, builder, parser and executor. The storage part can choose relational database (SQL), Nacos, Zookeeper, local file, Apollo and other storage methods to realize the storage of configuration files. Metadata is divided into three types: Condition (logical statement), Component (device component) and script language. Condition includes THEN (serial statement), WHEN (parallel statement), SWITCH (selection statement), IF (conditional statement), FOR (number of loop statements), WHILE (conditional loop statement), etc. Component is a module based on the encapsulation of a single type of device capability. The scripting language includes Java, Groovy, Python, Lua, QLExpress, JavaScript, etc. The metadata is combined to form a linkage configuration file. The builder is used to read the stored linkage configuration file and build a file format that can be parsed by the program. The parser is used to support the parsing of linkage configuration files in formats such as xml, json, and yaml into executable program code. The executor is used to execute the program code of the parsed linkage configuration file.

[0082] In step S101 of some embodiments, a user or developer may describe the device linkage requirement in the form of a metadata combination on a programming page according to the device linkage requirement, wherein the metadata group may be a device component, a logic statement or a scripting language.

[0083] Device components refer to encapsulating device capabilities or device data to form an independent code or module. Device components provide object-oriented interfaces to facilitate user calls. For example, a device component encapsulation code for a network speaker device is as follows: Fig.11 shown.

[0084] Logical statements refer to object-oriented high-level language statements that can describe the logic of device linkage dependence. The logical statements provided during programming include THEN (serial statement), WHEN (parallel statement), SWITCH (selection statement), IF (conditional statement), FOR (number of loop statements), WHILE (conditional loop statement), etc.

[0085] For example, the linkage configuration example using THEN (serial statement) is as follows:

[0086]

[0087] The linkage configuration in this example indicates that the four device components a, b, c, and d are executed in sequence.

[0088] For example, the linkage configuration example using WHEN (parallel statement) is as follows:

[0089]

[0090] The linkage configuration in this example indicates that three device components a, b, and c are executed in parallel.

[0091] For example, the linkage configuration example using SWITCH (select statement) is as follows:

[0092]

[0093] The linkage configuration of this example indicates that one of device components b, c, and d is selected for execution based on device component a.

[0094] For example, the linkage configuration example using IF (conditional statement) is as follows:

[0095]

[0096] The linkage configuration in this example indicates that component x is used as the conditional node. When the condition is true, the link x->a->b is executed, and when the condition is false, the link is x->b.

[0097] For example, the linkage configuration example using FOR (number of loop statements) is as follows:

[0098]

[0099] The linkage configuration in this example indicates that the link from component a->b is executed five times in a loop.

[0100] For example, the linkage configuration example using WHILE (conditional loop statement) is as follows:

[0101]

[0102] The linkage configuration in this example indicates that when the w component is true, the link of component a->b is executed cyclically.

[0103] Scripting language refers to an object-oriented high-level language provided to users for configuration programming. Users can choose Java, Groovy, Python, Lua, QLExpress, JavaScript and other languages ​​according to their needs, allowing users to expand personalized device linkage functions based on scripting languages.

[0104] This embodiment designs device capabilities as components, decouples the capabilities between devices, reduces system complexity, and improves system versatility. The device linkage logic is implemented by forming a linkage configuration file through dynamic programming. Different configuration files can be written for different customers to meet the different scenario requirements of different customers and realize device linkage scenarios for thousands of people. Dynamic programming is supported by using conditions such as IF and WHEN and scripting languages ​​to expand personalized functions, and complex linkage requirements can be realized without changing the server code.

[0105] See also Figure 2 In some embodiments, step S101 includes but is not limited to steps S201 to S202:

[0106] Step S201, in response to the configuration mode, displaying a corresponding programming page;

[0107] Step S202: generating a first linkage configuration file in response to a configuration instruction on a programming page.

[0108] In this embodiment, the user can select the configuration type on the front-end visualization page, and the background will display the corresponding programming page in response to the configuration type selected by the user. Exemplarily, the user can select the configuration method of the script language or the configuration method of the logic statement. If the user selects the configuration method of the script language, the programming page includes a script language selection box and a programming instruction input box. The script language selection box provides various script languages ​​for selection. The user can select the script language to be used on the programming page. In response to the script language selected by the user, the background will call the corresponding script language program (such as Java programming software) to display the front-end programming interface in the programming instruction input box, so that the user can enter the configuration instructions of the corresponding script language on the programming page. The configuration instructions can use the device component calling method to obtain the first linkage configuration file of the corresponding script language. The first linkage configuration file obtained by this configuration method is a script class configuration file. Exemplarily, the script class configuration file is such as Fig.12 shown.

[0109] If the user selects the configuration method of logic statements, the programming page includes a logic statement selection box and a programming instruction input box. The logic statement selection box provides various logic statement templates for selection. The user can select the logic statement to be used on the programming page. In response to the logic statement selected by the user, the background writes the logic statement template into the programming instruction input box. The user can write device components into the logic statement template in the input box to form a complete configuration instruction, thereby obtaining a first linkage configuration file formed by multiple configuration instructions. The first linkage configuration file obtained by this configuration method is a logic configuration file. For example, the logic configuration file is as follows: Fig.13 As shown, Fig.13 The logical relationship corresponding to the configuration file is as follows Fig.14 In another exemplary embodiment, the user can also directly form multiple configuration instructions with logic statements and device components in the programming instruction input box, thereby obtaining the first linkage configuration text.

[0110] See also Figure 3 In some embodiments, before step S102, the device linkage program design method of the embodiment of the present application further includes but is not limited to steps S301 to S303:

[0111] Step S301, testing and verifying the first linkage configuration file to obtain a file test result;

[0112] Step S302: when the file test result is passed, the step of loading the first linkage configuration file into the memory using the hot update mechanism is continued;

[0113] Step S303: when the file test result is failed, error data is displayed.

[0114] In this embodiment, after obtaining the first linkage configuration file, the first linkage configuration file can be tested and verified to check whether the device component called in the file exists and whether there are spelling errors in the sentences, thereby obtaining the file test result, wherein the file test result is used to determine whether the test passes and the error data in the case of failure. When the file test result is passed, the above step S102 is continued to be executed, that is, the hot update mechanism loads the first linkage configuration file into the memory; if the file test result is failed, the error data is displayed, wherein the error data is used to indicate the location of the error in the first linkage configuration file.

[0115] See also Figure 4 In some embodiments, before step S102, the device linkage program design method of the embodiment of the present application further includes but is not limited to steps S401 to S402:

[0116] Step S401, uploading the first linkage configuration file to the server for storage;

[0117] Step S402: Load the first linkage configuration file from the server into the memory.

[0118] In this embodiment, after the first linkage configuration file is obtained and the first linkage configuration file passes the test verification, the first linkage configuration file can be uploaded to the server for storage, so that the first configuration file can be subsequently read from the server and loaded into the memory to implement the update of the device linkage program. The server of this embodiment can refer to a server that supports storage forms such as relational databases, Nacos, Zookeeper, local files, or Apollo.

[0119] See also Figure 5 In some embodiments, step S401 may include but is not limited to steps S501 to S502:

[0120] Step S501, obtaining a file storage configuration, wherein the file storage configuration includes a storage type and a target object, and the storage type is one of local storage or middleware storage;

[0121] Step S502: determine the target server and the storage location of the target object in the target server according to the file storage configuration, and upload the first linkage configuration file to the storage location of the target server for storage.

[0122] In this embodiment, when the user uploads the first configuration file to the server, the user can enter the file storage configuration, and the file storage configuration includes a storage type and a target object. The storage type is divided into two types: local storage and middleware storage. Local storage refers to a server that stores files on a local disk or database, and middleware storage refers to a server that stores files on a third-party storage system such as Nacos, Zookeeper or Apollo. The target object is a software program that needs to configure the corresponding device linkage requirements. After obtaining the file storage configuration, the background determines the corresponding target server (for example, stored on a local disk) according to the storage type in the file storage configuration. Since the local disk may store different folders of multiple software or different software versions, it may include folders of computer system programs, device linkage software, and social software. Therefore, it is necessary to determine the corresponding storage location in the local disk according to the target object indicated in the file storage configuration (for example, the device linkage software with version number 003), so as to upload the first linkage configuration file to the correct location on the server, so as to update the new device linkage function for the device linkage program.

[0123] In step S102 of some embodiments, the hot update mechanism refers to a mechanism that can update part or all of the content of an application without restarting or reinstalling the application during the operation of the software or application. The implementation of hot updates usually relies on dynamic loading technology. For example, the hot update mechanism checks whether there is a new resource version on the remote server. If so, the new resources are downloaded and the old resource files are replaced to update the application interface or function. In order to reduce the size of the update file and increase the update speed, hot updates usually use differential code technology to send only the changed part of the code, which is then merged with the local code by the client to generate a new version of the code. The hot update mechanism is usually implemented through scripting languages ​​(such as Lua, JavaScript, etc.), which can be easily embedded in native code and executed at runtime.

[0124] In this embodiment, when the program is started or when it is regularly checked that the device linkage program in the server has a configuration file updated, the first configuration file can be dynamically loaded into the memory for operation. The linkage configuration file supports hot update without restarting the platform service, and can quickly support customer needs.

[0125] See also Figure 6 In some embodiments, step S402 may also include but is not limited to steps S601 to S602:

[0126] Step S601, determining a loading method according to the type of the target server;

[0127] Step S602, load the first linkage configuration file from the target server into the memory by loading, wherein, when the target server is a server stored by the middleware, the loading method is to reuse the hot update mechanism of the middleware itself; when the target server is a server stored locally or on a disk, the loading method is to call a memory synchronization function.

[0128] In this embodiment, when the program is started, the first device linkage configuration file such as the rule file and the script file will be loaded into the memory for execution. For example, please refer to Fig.15 , stored in the form of Key-Value, the configuration file is stored in the local disk or database, that is, the target server is the local disk or database, the update of the configuration file in the memory is realized by calling the function, for example, to update a single configuration file to the program instance in the memory, it can be realized by the function Flows.reloadRuleAndScript(activityId,scriptId), and to update all configuration files to the memory, it can be realized by the function Flows.reloadAll(). The configuration file is stored in middleware such as Apollo, Nacos, and Zokeeper, that is, the target server is a storage system of the middleware type, and the hot update mechanism of the middleware itself can be reused.

[0129] In step S103 of some embodiments, since the first device linkage configuration file uses an object-oriented interpreted language, and different users may use different scripting languages, after loading the configuration file, the embodiment maps the first linkage configuration file to a unified computer-parseable language, such as an assembly language such as C language, through a builder, and uses a suitable file format to represent it, thereby obtaining a second linkage configuration file in a program-parseable file format. The file format may be xml, json, yaml, etc.

[0130] See also Figure 7 In some embodiments, step S103 may include but is not limited to steps S701 to S703:

[0131] Step S701, determining a configuration type of a first linkage configuration file, wherein the configuration type is one of a logic configuration file and a script configuration file, wherein the logic configuration file is described by metadata of device components and logic statements, and the script configuration file is described by metadata of scripting language and device components;

[0132] Step S702, performing first rule parsing, component registration and metadata assembly operations on the logic class configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program;

[0133] Step S703: performing second rule parsing, component registration and metadata assembly operations on the script configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program.

[0134] In this embodiment, the configuration type of the first linkage configuration file is divided into a logic configuration file or a script configuration file. The logic configuration file is described by metadata of device components and logic statements, and the script configuration file is described by script language and metadata of device components.

[0135] A first rule parsing, component registration and metadata assembly operation is performed on the logic class configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program. Exemplarily, the first rule parsing is specifically to use a preset first semantic mapping table to map the logic statements in the configuration file into an intermediate language, such as mapping them into C language representation, and then registering the component code to the memory according to the call of the device component in the configuration file, and then assembling the converted logical semantics and the corresponding device component code to obtain the second linkage configuration file in a file format that can be parsed by the program.

[0136] The second rule parsing, component registration and metadata assembly operations are performed on the script class configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program. Exemplarily, the second rule parsing is specifically to use a suitable second semantic mapping table (such as a semantic mapping of JAVA and C language) to map the script language in the configuration file to an intermediate language, such as mapping it to a C language representation, and then registering the component code to the memory according to the call of the device component in the configuration file, and then assembling the converted logical semantics and the corresponding device component code to obtain the second linkage configuration file in a file format that can be parsed by the program.

[0137] In this embodiment, the program adopts a startup loading design, and most of the work is completed at startup, including parsing rules, registering components, assembling meta information, and there is almost no additional consumption on the system when executing the link.

[0138] In step S104 of some embodiments, the parser can support parsing the second linkage configuration file in the format of xml, json, yaml, etc. into executable program code. For example, the second linkage configuration file is C language code, and the parser can compile the C language into binary machine code to obtain executable program code, that is, the device linkage program, and then execute the parsed program code through the executor to realize the operation of the device linkage configuration.

[0139] According to some embodiments of this application, the program meets the needs of customer linkage broadcasting based on the capabilities of cloud broadcasting, video AI monitoring, smoke sensors, smart watches and bracelets, etc. Please refer to Fig.16The specific business process of equipment linkage requirement configuration is as follows:

[0140] Customers have equipment linkage requirements where smoke sensor alarms trigger cloud broadcast equipment alarms;

[0141] Dynamically program and form equipment linkage configuration files based on the customer's equipment linkage requirements;

[0142] Test and verify the written device linkage configuration files;

[0143] If the device linkage configuration file fails the test verification, it returns to modify the device linkage configuration file;

[0144] When the device linkage configuration file passes the test verification, the file is uploaded to the server, and then the customer's device linkage program is dynamically refreshed to realize the device linkage requirements.

[0145] This embodiment uses a dynamically programmable method to encapsulate the capabilities of each device into a Component. According to customer needs, a linkage configuration file is formed in a programming manner. By dynamically building, parsing, and executing the linkage rules of the configuration file, different device components are connected in series to achieve dynamic modification of device linkage logic without the need for platform upgrades.

[0146] See also Figure 8 The present application also provides a device linkage programming system, including:

[0147] A first module is used to obtain a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement or a script language;

[0148] The second module is used to load the first linkage configuration file into the memory by adopting a hot update mechanism;

[0149] The third module is used to map the first linkage configuration file in the memory into a file format that can be parsed by the program through a builder to obtain a second linkage configuration file;

[0150] The fourth module is used to parse the second linkage configuration file into executable program code through a parser to obtain a device linkage program.

[0151] It can be understood that the contents of the above-mentioned device linkage programming method embodiment are applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above-mentioned device linkage programming method embodiment, and the beneficial effects achieved are also the same as those achieved by the above-mentioned device linkage programming method embodiment.

[0152] The embodiment of the present application also provides an electronic device, the electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program is executed by the processor to realize the above-mentioned device linkage program design method. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0153] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0154] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0155] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the device linkage programming method of the embodiment of this application;

[0156] Input / output interface 903, used to implement information input and output;

[0157] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0158] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0159] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0160] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned device linkage program design method.

[0161] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0162] The device linkage program design method, device, electronic device and storage medium provided in the embodiments of the present application obtain a first linkage configuration file representing the device linkage demand. The first linkage configuration file uses a combination of metadata to represent the device linkage demand. The metadata is a device component, a logical statement or a scripting language. The linkage demand is configured in the form of a metadata combination, which can simplify the difficulty of linkage program writing and meet the diverse needs of device linkage. The first linkage configuration file is loaded into the memory by a hot update mechanism. The first linkage configuration file in the memory is mapped to a file format that can be parsed by the program through a builder to obtain a second linkage configuration file. The second linkage configuration file is parsed into an executable program code through a parser to obtain a device linkage program. The program is then executed, and linkage rules can be dynamically written and updated without restarting the system service, thereby improving the efficiency of device linkage program design.

[0163] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0164] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0165] The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0166] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0167] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0168] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0169] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0170] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0171] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0173] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A device linkage program design method, characterized in that: The following steps are involved: Acquire a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement, or a scripting language; Using a hot update mechanism to load the first linkage configuration file into the memory; Mapping the first linkage configuration file in the memory into a file format parseable by a program through a builder to obtain a second linkage configuration file; The second linkage configuration file is parsed into executable program code by a parser to obtain a device linkage program.

2. The device linkage program design method according to claim 1, characterized in that: Before the step of loading the first linkage configuration file into the memory by using the hot update mechanism, the device linkage program design method further includes the following steps: Testing and verifying the first linkage configuration file to obtain a file test result; When the file test result is passed, the step of using the hot update mechanism to load the first linkage configuration file into the memory is continued; When the file test result is failed, error data is displayed.

3. The device linkage program design method according to claim 1, characterized in that: Before the step of loading the first linkage configuration file into the memory by using the hot update mechanism, the device linkage program design method further includes the following steps: Uploading the first linkage configuration file to a server for storage; The first linkage configuration file is loaded from the server into the memory.

4. The device linkage program design method according to claim 3, characterized in that: The step of uploading the first linkage configuration file to a server for storage comprises the following steps: Obtaining a file storage configuration, wherein the file storage configuration includes a storage type and a target object, and the storage type is one of local storage or middleware storage; A target server and a storage location of a target object in the target server are determined according to the file storage configuration, and the first linkage configuration file is uploaded to the storage location of the target server for storage.

5. The device linkage program design method according to claim 4, characterized in that: The step of using a hot update mechanism to load the first linkage configuration file into the memory includes the following steps: Determine the loading method according to the type of the target server; The loading method is adopted to load the first linkage configuration file from the target server into the memory, wherein, when the target server is a server stored by the middleware, the loading method is to reuse the hot update mechanism of the middleware itself; when the target server is a server stored locally or on a disk, the loading method is to call a memory synchronization function.

6. The device linkage program design method according to claim 1, characterized in that: The method of mapping the first linkage configuration file in the memory into a file format parseable by a program to obtain a second linkage configuration file includes the following steps: Determine a configuration type of the first linkage configuration file, wherein the configuration type is one of a logic configuration file or a script configuration file, wherein the logic configuration file is described using metadata of device components and logic statements, and the script configuration file is described using a scripting language and metadata of device components; Performing first rule parsing, component registration and metadata assembly operations on the logic class configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program; The second rule parsing, component registration and metadata assembly operations are performed on the script-type configuration file to obtain a second linkage configuration file in a file format that can be parsed by the program.

7. The device linkage program design method according to claim 1, characterized in that: The step of obtaining a first linkage configuration file representing a device linkage requirement includes the following steps: In response to the configuration mode, displaying a corresponding programming page; In response to the configuration instructions on the programming page, a first linkage configuration file is generated.

8. A device linkage programming system, characterized in that: include: A first module is used to obtain a first linkage configuration file representing a device linkage requirement, wherein the first linkage configuration file represents the device linkage requirement in the form of combined metadata, and the metadata is a device component, a logic statement or a scripting language; A second module is used to load the first linkage configuration file into a memory by adopting a hot update mechanism; A third module is used to map the first linkage configuration file in the memory into a file format parseable by a program through a builder to obtain a second linkage configuration file; The fourth module is used to parse the second linkage configuration file into executable program code through a parser to obtain a device linkage program.

9. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the device linkage program design method as described in any one of claims 1 to 7 are realized.

10. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the device linkage program design method described in any one of claims 1 to 7.