ZigBee communication data conversion method, device, computer equipment and storage medium

By using XML language to define conversion rules in the ZigBee communication system and combining linked lists and hash table structures, the problem of cumbersome conversion of ZigBee communication data is solved, and the effects of resource conservation, strong scalability and improved stability are achieved.

CN116016705BActive Publication Date: 2024-12-06ZHEJIANG REXENSE IOT TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202211704859.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2024-12-06
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

The ZigBee communication data conversion process is cumbersome, resulting in large resource usage, low system scalability, poor stability and high maintenance costs, making it difficult to quickly respond to new needs.

Method used

Define conversion rules in XML language, and process the data by obtaining the key parameters of the data to be converted, searching and applying the conversion rules to process the data, realizing the mutual conversion between the communication byte stream of ZigBee devices and the JSON data applied by the upper layer. The rules are stored in the file library. , accelerate retrieval and cache using linked list and hash table structure.

Benefits of technology

It improves the system's universality, operation and maintenance simplicity and scalability, reduces resource usage and maintenance costs, can quickly respond to new needs, and reduces the burden of program development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016705B_ABST
    Figure CN116016705B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a ZigBee communication data conversion method, device, computer equipment and storage medium, the method comprising: obtaining key parameters of data to be converted in ZigBee communication; retrieving corresponding conversion rules according to the key parameters, the conversion rules being defined in XML language; converting and processing each digital domain of the data to be converted according to the conversion rules to obtain target data. The present invention adopts XML language to define data conversion rules, and the ZigBee gateway application converts data according to the defined rules, thereby realizing the mutual conversion between the communication byte stream of the ZigBee device and the JSON data of the upper layer application, which can be used to solve the current problems of extremely cumbersome ZigBee communication data conversion, resulting in large resource occupation, low system scalability and poor stability, difficulty in rapid response and high maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart home technology, and in particular to a ZigBee communication data conversion method, device, computer equipment and storage medium. Background Art

[0002] As a sunrise industry, smart home carries people's expectations for a better life. Data shows that smart products have become a hot spot in my country's consumer market, and are growing every year. In the context of consumption upgrading, high-quality and intelligent home products have a strong appeal to the public, making this field have great potential to become a trillion-level consumer market. With the guidance of policies, the expansion of the real estate fine decoration market and the continuous development of smart homes themselves, pre-installed smart homes have become a trend. ZigBee technology has become the darling of pre-installed smart furniture because of its self-organizing network, low power consumption, Mesh network and other characteristics.

[0003] Currently, ZigBee devices are widely used in the Internet of Things, making the ZigBee gateway an extremely important node in the Internet of Things. Among them, the conversion and processing of ZigBee communication data by ZigBee gateway application is one of the most important functions. However, due to the characteristics of ZigBee communication protocol and the wide variety of ZigBee devices, ZigBee communication data conversion is extremely cumbersome, which makes ZigBee gateway application obviously have the following defects and shortcomings: 1. With the increase in the types of access devices, the resources occupied by application programs continue to increase, challenging the limited and precious resources of embedded devices; 2. Data conversion processing based on a large number of rigid numbers such as ClassId, AttriButeId, CommandId, etc. of ZigBee communication protocol leads to a large amount of hard coding in the application, making the system scalability extremely low; 3. With the continuous introduction of new functions and new devices and the iterative upgrade of ZigBee communication protocol, it is difficult to respond quickly, which directly leads to the investment of a large amount of resources in customized development to cope with the emerging new needs; 4. A large amount of customized development makes the application frequently upgraded, resulting in the system always being in an unstable state; 5. Some applications introduce the interpreted scripting language Lua to parse data, which can alleviate the above problems to a certain extent, but the maintenance cost is extremely high, almost equivalent to customized development. In view of the current problems that ZigBee communication data conversion is extremely cumbersome, resulting in large resource occupation, low system scalability and poor stability, difficulty in rapid response and high maintenance cost, it is necessary to carry out further research on ZigBee communication data conversion technology. Summary of the invention

[0004] The embodiments of the present invention provide a ZigBee communication data conversion method, device, computer equipment and storage medium to solve the problems that the current ZigBee communication data conversion is extremely cumbersome, resulting in large resource occupation, low system scalability and poor stability, difficulty in rapid response and high maintenance cost.

[0005] On the one hand, the present invention provides a ZigBee communication data conversion method, comprising:

[0006] Get the key parameters of the data to be converted in ZigBee communication;

[0007] Retrieve the corresponding transformation rules according to the key parameters, and the transformation rules are defined in XML language;

[0008] Each digital field of the data to be converted is converted according to the conversion rules to obtain the target data.

[0009] Furthermore, the step of converting each digital field of the data to be converted according to the conversion rule includes:

[0010] Each digital field of the data to be converted is converted according to the structural definition and tag definition of the conversion rules; the structural definition reflects the structure of the byte stream or JSON data through the XML tree structure, including the structural composition and the sequence and subordinate relationship of the data fields in the structure; the tag definition is used to define the processing behavior of each data field.

[0011] Furthermore, the conversion rules are stored in a rule file library, and the types of rule files in the rule file library include data length rule files, general command rule files, and special command rule files;

[0012] The data length rule file is used to define the mapping relationship between data type and length in the Zigbee cluster library;

[0013] The general command rule file is used to define the data conversion rules for all device general commands;

[0014] The dedicated command rule file is used to define the data conversion rules for a certain Cluster-specific command.

[0015] Furthermore, before the step of retrieving the corresponding conversion rule according to the key parameter, the method further includes:

[0016] All rule files are loaded into the memory for caching; the data length rule file and the general command rule file are directly loaded into the memory according to the linked list data structure; the special command rule file adopts the hash table data structure for caching.

[0017] Furthermore, the dedicated command rule file adopts a hash table data structure to cache the step, including:

[0018] Define an array with a capacity of 200, and each element of the array uses a linked list;

[0019] Add the C l user I d value of the dedicated command rule file to the Command I d value modulo 200 as the hash value, locate the array index through the hash value, and store the rule data into the corresponding array element;

[0020] If the hash values ​​conflict, the rule data is stored at the end of the linked list of the corresponding array element.

[0021] Furthermore, the step of retrieving corresponding conversion rules according to key parameters includes:

[0022] Obtain the relevant data of the specified data length rule and the general command rule by traversing the short linked list; or,

[0023] Relevant data of the specified special command rule is obtained through hash table positioning plus short-link table traversal or hash table positioning alone.

[0024] Further, the step of converting each digital field of the data to be converted according to the conversion rule to obtain the target data includes:

[0025] Get the node name of the numeric domain. If it is converted into JSON data, generate the field name of the JSON data based on the node name.

[0026] Check whether the above defined label exists in the node. If it does, obtain the data from the source data according to its semantics and perform corresponding processing;

[0027] Assemble the converted new data to obtain the target data.

[0028] In order to solve the problems that the current ZigBee communication data conversion is extremely cumbersome, resulting in large resource occupation, low system scalability and poor stability, difficulty in rapid response and high maintenance cost, the purpose of the present invention is to provide a ZigBee communication data conversion method, including: obtaining key parameters of data to be converted in ZigBee communication; retrieving corresponding conversion rules according to the key parameters, the conversion rules are defined in XML language; converting each digital field of the data to be converted according to the conversion rules to obtain target data.

[0029] Compared with the prior art, the present invention has the following advantages:

[0030] By using XML language to define data conversion rules, the ZigBee gateway application converts data according to the defined rules, realizing the mutual conversion between the communication byte stream of the ZigBee device and the JSON data of the upper layer application. First of all, the present invention has strong versatility because the rules are defined in standard XML language, and the parsing and processing of the rules are independent of the specific development language; secondly, the rules exist in XML text files, which are simple and intuitive in structure, and ordinary operation and maintenance personnel can create and update the rules, so the operation and maintenance are simple; thirdly, because the rules are definable, maintainable and upgradeable, it is not necessary to customize the development, recompile and upgrade the application program when introducing new functions and new types of equipment, and it has the characteristics of strong scalability; finally, because a large amount of new demand development work is transferred to the definition and maintenance of simple rules, program development can be avoided or minimized, which will save a lot of resource costs.

[0031] In another aspect, the present invention provides a ZigBee communication data conversion device, comprising:

[0032] The acquisition module is used to obtain the key parameters of the data to be converted in ZigBee communication;

[0033] A retrieval module is used to retrieve corresponding conversion rules according to key parameters, and the conversion rules are defined in XML language;

[0034] The conversion module is used to convert each digital field of the data to be converted according to the conversion rules to obtain the target data.

[0035] On the other hand, the present invention provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0036] In yet another aspect, the present invention provides a computer-readable storage medium storing a computer program, which can implement the above method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0038] Figure 1 The present invention is a flowchart of a ZigBee communication data conversion method according to an embodiment of the present invention.

[0039] Figure 2It is a schematic diagram of a ZigBee communication data conversion device according to another embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] See also Figure 1 A ZigBee communication data conversion method according to an embodiment of the present invention comprises the following steps:

[0042] Step 101, obtaining key parameters of data to be converted in ZigBee communication.

[0043] Step 102: Retrieve corresponding conversion rules according to key parameters, where the conversion rules are defined in XML language.

[0044] In the embodiment of the present invention, XML language is used to define data conversion rules, and the ZigBee gateway application converts data according to the defined rules to achieve the mutual conversion between the communication byte stream of the ZigBee device and the JSON data of the upper layer application. Among them, the rules are described in XML language, and their essence is XML format data, which is permanently stored in text files. The basic elements such as data composition structure and sequence, type, length, dependency, unit conversion, etc. are intuitively and completely defined in the rules.

[0045] Step 103, convert each digital field of the data to be converted according to the conversion rule to obtain target data.

[0046] In the embodiment of the present invention, the corresponding conversion rules are quickly retrieved according to the key parameters of the data to be converted (such as String Id, Command Id, etc.), and then each data field is converted according to the XML nodes, attribute tags and their specified semantics defined in the rules. The embodiment of the present invention can be used to implement the most common data conversion in Internet of Things applications, namely: byte stream to JSON, JSON to byte stream.

[0047] The embodiment of the present invention defines data conversion rules by using XML language, and the ZigBee gateway application converts data according to the defined rules, thereby realizing the mutual conversion between the communication byte stream of the ZigBee device and the JSON data of the upper layer application. The method has the following advantages: 1. Strong versatility: the rules are defined by using the standard XML language, and the parsing and processing of the rules are independent of the specific development language, and can be implemented by using languages ​​such as C, C++, and Java; 2. Simple operation and maintenance: the rules exist in XML text files, and the structure is simple and intuitive. Ordinary operation and maintenance personnel can create and upgrade the rules, so as to quickly respond to various new demands of customers and the market, so that such daily new demand development does not require the intervention of application development team personnel; 3. Strong scalability: This is the most prominent advantage of the method. The definable, maintainable, and upgradeable rules make it unnecessary to customize, develop, recompile, and upgrade the application program when introducing new functions and new types of equipment; 4. Low cost: since a large amount of new demand development work is transferred to the definition and maintenance of simple rules, program development can be avoided or minimized, which will save a lot of resource costs.

[0048] As another implementation of the embodiment of the present invention, based on the further improvement of the above ZigBee communication data conversion method, the following steps are included:

[0049] Step 101', obtaining key parameters of data to be converted in ZigBee communication.

[0050] Step 102', load all rule files into the memory for caching; the data length rule file and the general command rule file are directly loaded into the memory according to the linked list data structure; the special command rule file is cached using the hash table data structure.

[0051] In this embodiment, the conversion rules are stored in a rule file library. The types of rule files in the rule file library include data length rule files, general command rule files and special command rule files; the data length rule file is used to define the mapping relationship between data type and length in the Zigbee cluster library (hereinafter referred to as ZCL); the general command rule file is used to define the data conversion rules for all device general commands; the special command rule file is used to define the data conversion rules for a certain Cluster-specific command.

[0052] In the embodiment of the present invention, all rule files share a version number, which is recorded in the Version.txt file. When the application is started and the latest version number of the rule is obtained from the server at regular check, it is compared with the version number recorded in the Version.txt file. If they are different, the compressed package of the rule file is downloaded from the server to the local and decompressed, and finally replaced and upgraded. Specifically, the data length rule file defines the mapping relationship between data types and lengths in ZCL. The file name is fixed as length.xml, and there is only one file in total. The data length rule file has a simple structure and can be defined without the above-mentioned tags. The data items are defined as Stringer Id, Attribute Id, Type, and Length. The general command rule file defines the data conversion rules for all device general commands. The file name is a fixed prefix "common_" + ZCLCommanon Command Id + ".xml", such as common_01.xml, which represents the data conversion rules for reading attribute response data. The number of files is relatively small. The dedicated command rule file defines the data conversion rules for a certain Cluster-specific command. The file name is a fixed prefix "cluster_" + Cluster ID + Cluster Command ID + ".xml", such as cluster_0008_00.xml, which represents the data conversion rules for the brightness control command. The number of files is uncertain and relatively large.

[0053] The steps of caching the dedicated command rule file using a hash table data structure include:

[0054] Define an array with a capacity of 200, and each element of the array uses a linked list;

[0055] Add the C l user I d value of the dedicated command rule file to the Command I d value modulo 200 as the hash value, locate the array index through the hash value, and store the rule data into the corresponding array element;

[0056] If the hash values ​​conflict, the rule data is stored at the end of the linked list of the corresponding array element.

[0057] In the embodiment of the present invention, all rule files are loaded into the memory for caching after the application is started to avoid frequent and low-speed storage device IO operations. The number of data length rule files and general command rule files is small, and they can be directly loaded into the memory according to the linked list data structure. Since this type of data is small, there is no problem in efficiency in checking related data. The number of special command rule files is large. If they are directly loaded into the memory according to the linked list data structure, efficiency problems may arise in fast retrieval, because frequently traversing the long linked list will cause a large amount of CPU resources to be occupied. Therefore, the special command rule file uses a hash table data structure for caching. The specific implementation method is: define an array with a capacity of 200, and each element of the array uses a linked list. Then the C l user I d value of the special command rule file plus the Command I d value modulo 200 is used as a hash value, and the array subscript is located by the hash value, and the rule data is stored in the corresponding array element. If the hash value conflicts, the rule data is stored at the end of the linked list of the corresponding array element. The hash table can be used to limit the traversal of the linked list to rule files with only a small number of hash value conflicts. The hash table is accessed by calculating the hash value to obtain the array index and then directly accessing it. The time complexity is O(1), so the rule data can be quickly located.

[0058] Step 103', retrieve the corresponding conversion rules according to the key parameters, and the conversion rules are defined in XML language. Specifically, the relevant data of the specified data length rule and the general command rule can be obtained by traversing the short chain table; or the relevant data of the specified special command rule can be obtained by locating the hash table plus traversing the short chain table or only locating the hash table.

[0059] Step 104 ′, convert each digital field of the data to be converted according to the conversion rule to obtain target data.

[0060] In this step, as one of the implementation methods, each digital field of the data to be converted can be converted according to the structure definition and tag definition of the conversion rule; the structure definition reflects the structure of the byte stream or JSON data through the tree structure of XML, including the structure composition and the order and subordinate relationship of the data fields in the structure; the tag definition is used to define the processing behavior of each data field.

[0061] Specifically, step 104' may include:

[0062] Get the node name of the numeric domain. If it is converted into JSON data, generate the field name of the JSON data based on the node name.

[0063] Check whether the above defined label exists in the node. If it does, obtain the data from the source data according to its semantics and perform corresponding processing;

[0064] Assemble the converted new data to obtain the target data.

[0065] That is, the embodiment of the present invention quickly retrieves the relevant rule data through Cluster Id and Command Id, and traverses all XML nodes according to the XML file parsing method. Each XML node is processed as follows: first, the node name is obtained. If it is converted into JSON data, the name is directly used to generate the field name of the JSON data. Secondly, check whether there is a tag defined above in the node. If it exists, the data is obtained from the source data according to its semantics and processed accordingly. Finally, the converted new data is assembled to obtain the final target data.

[0066] In the embodiment of the present invention, the rule definition of the conversion provision is divided into two aspects: structure definition and label definition. The structure definition defines the composition of the data, while the label definition defines the processing behavior of each data field.

[0067] The structure definition reflects the structure of the byte stream or JSON data through the tree structure of XML, including the structure composition and the order and attribute relationship of the data fields in the structure. All XML rules use the Rule keyword as the root node. The name of the node is the field name in JSON.

[0068] Take the simplest example, there is a byte stream with 2 bytes, the first byte byte1 corresponds to the first field Field1 in JSON, and the second byte byte2 corresponds to the second field Field2 in JSON. The regular XML structure definition and the two formats of data are shown in Table 1:

[0069]

[0070] Table 1: Definition of rule XML structure and data in two formats

[0071] Correspondingly, if the first field Field1 in JSON is converted into the first byte byte1 in the byte stream, the second field Field2 in JSON is converted into the second byte byte2 in the byte stream, and the third field Field3 in JSON is converted into the third byte byte3 in the byte stream, then the regular XML structure definition and the data in the two formats are shown in Table 2:

[0072]

[0073] Table 2 Rules XML structure definition and two formats of data diagram 2

[0074] Of course, the above structure is relatively simple, with only one level. If a data field in the byte stream includes several data sub-fields or a field in JSON includes several sub-fields, and so on, there are multiple subordinate levels. In the XML rule structure, it can be directly mapped into nodes and sub-nodes, and this level can be defined according to actual conditions without restriction.

[0075] Regarding tag definition, tags are actually attributes of XML nodes. In the rules, the data domain or field corresponding to each node can have multiple tags for specific definition. Each tag has specific semantics for interpretation and execution. In this method, the tag definition shown in Table 3 can be used for definition.

[0076]

[0077]

[0078] Table 3 Label definitions

[0079] When defining rules, tags should be selected based on actual conditions, and not all tags need to be used. The following takes the definition of parsing rules for the data reported by the ZoneStatus Change Notification command of security equipment as an example to explain the specific definition of rules.

[0080] First, the data byte stream reported by the ZigBee device during communication is shown in Table 4:

[0081]

[0082] Table 4 Device ZigBee communication reported data byte stream

[0083] The data field Zone Status occupies 16 bits and 2 bytes, and the type is map16 (0x19). The specific meaning of each bit is as follows:

[0084] bit0: whether there is alarm 1;

[0085] bit1: whether there is an alarm 2;

[0086] bit2: whether it has been demolished;

[0087] bit3: Whether the battery is low;

[0088] The other bits do not need to be processed.

[0089] The data field Eextended Status occupies 8 bits and 1 byte, and its value is fixed to 0.

[0090] The data field Zone ID occupies 8 bits and 1 byte, and its type is unity8 (0x20).

[0091] The data field Delete occupies 16 bits and 2 bytes, and its type is unity16 (0x21).

[0092] Secondly, the JSON data structure to be generated is as follows:

[0093]

[0094] Finally, the ZigBee communication data reported by the Zone Status Change Notification command of the security device is parsed and JSON data is generated. The rule definition is as follows:

[0095]

[0096] Since ZoneStatus is an intermediate processing result and does not need to be generated in the final data, it is labeled Generate and has a value of 0.

[0097] See also Figure 2 A ZigBee communication data conversion device according to another embodiment of the present invention can be used to implement the corresponding steps of the above method embodiment, including:

[0098] The acquisition module is used to obtain the key parameters of the data to be converted in ZigBee communication;

[0099] A retrieval module is used to retrieve corresponding conversion rules according to key parameters, and the conversion rules are defined in XML language;

[0100] The conversion module is used to convert each digital field of the data to be converted according to the conversion rules to obtain the target data.

[0101] On the other hand, the present invention provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0102] In yet another aspect, the present invention provides a computer-readable storage medium storing a computer program, which can implement the above method when executed by a processor.

[0103] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0105] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A ZigBee communication data conversion method, characterized in that: include: Get the key parameters of the data to be converted in ZigBee communication; Retrieving a corresponding conversion rule according to the key parameter, wherein the conversion rule is defined in XML language; Each digital domain of the data to be converted is converted according to the conversion rule to obtain target data; each digital domain of the data to be converted is converted according to the structure definition and tag definition of the conversion rule; the structure definition reflects the structure of the byte stream or JSON data through the tree structure of XML, including the structure composition and the order and subordinate relationship of the data domains in the structure; the tag definition is used to define the processing behavior of each data domain; The step of converting each digital domain of the data to be converted according to the conversion rule to obtain target data comprises: Obtain the node name of the digital domain, and if it is converted into JSON data, generate the field name of the JSON data based on the node name; Check whether the above defined label exists in the node. If it does, obtain the data from the source data according to its semantics and perform corresponding processing; The converted new data are assembled to obtain the target data.

2. The ZigBee communication data conversion method according to claim 1, characterized in that: The conversion rules are stored in a rule file library, and the types of rule files in the rule file library include data length rule files, general command rule files and special command rule files; The data length rule file is used to define the mapping relationship between data type and length in the Zigbee cluster library; The general command rule file is used to define data conversion rules for all device general commands; The dedicated command rule file is used to define data conversion rules for a certain Cluster-specific command.

3. The ZigBee communication data conversion method according to claim 2, characterized in that: Before the step of retrieving the corresponding conversion rule according to the key parameter, the method further includes: All the rule files are loaded into the memory for caching; the data length rule file and the general command rule file are directly loaded into the memory according to the linked list data structure; the special command rule file is cached using a hash table data structure.

4. The ZigBee communication data conversion method according to claim 3, characterized in that: The step of caching the dedicated command rule file using a hash table data structure includes: Define an array with a capacity of 200, each element of the array adopts a linked list; Add the CluserId value of the dedicated command rule file to the CommandId value modulo 200 as a hash value, locate the array index through the hash value, and store the rule data into the corresponding array element; If the hash values ​​conflict, the rule data is stored at the end of the linked list of the corresponding array element.

5. The ZigBee communication data conversion method according to claim 2, characterized in that: The step of retrieving the corresponding conversion rule according to the key parameter comprises: Acquire the relevant data of the specified data length rule and the general command rule by traversing the short linked list; or, The relevant data of the specified special command rule is obtained through hash table positioning plus short chain table traversal or hash table positioning only.

6. A ZigBee communication data conversion device, characterized in that: include: The acquisition module is used to obtain the key parameters of the data to be converted in ZigBee communication; A retrieval module, used for retrieving corresponding conversion rules according to the key parameters, wherein the conversion rules are defined in XML language; A conversion module is used to convert each digital domain of the data to be converted according to the conversion rules to obtain target data; convert each digital domain of the data to be converted according to the structure definition and label definition of the conversion rules; the structure definition reflects the structure of the byte stream or JSON data through the tree structure of XML, including the structure composition and the order and subordinate relationship of the data domains in the structure; the label definition is used to define the processing behavior of each data domain; The conversion module is further used for: Obtain the node name of the digital domain, and if it is converted into JSON data, generate the field name of the JSON data based on the node name; Check whether the above defined label exists in the node. If it does, obtain the data from the source data according to its semantics and perform corresponding processing; The converted new data are assembled to obtain the target data.

7. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 can be implemented.

Citation Information

Patent Citations

  • XML data structure conversion method and apparatus

    CN108664546A

  • Internet of Things water environment monitoring system based on ZigBee

    CN110401927A

  • Network communication encoding and decoding engine method for satellite receiving system based on XML and JSON

    CN112612535A

  • Rule-based data standardization system

    CN112948637A

  • JSON data dynamic conversion method and device, storage medium and electronic device

    CN114138881A