CN112527308A - Interplatform universal protocol parsing method, device and medium based on interpreted language - Google Patents
Interplatform universal protocol parsing method, device and medium based on interpreted language Download PDFInfo
- Publication number
- CN112527308A CN112527308A CN202011365039.5A CN202011365039A CN112527308A CN 112527308 A CN112527308 A CN 112527308A CN 202011365039 A CN202011365039 A CN 202011365039A CN 112527308 A CN112527308 A CN 112527308A
- Authority
- CN
- China
- Prior art keywords
- script
- protocol
- parsing
- analysis
- language
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to a cross-platform universal protocol analysis method based on an interpretation type language, which comprises the following steps: pre-receiving and recording a plurality of standard open protocols, respectively compiling analysis scripts of the standard open protocols based on an interpreted script language, taking source contents of the analysis scripts as input, and outputting a uniform standard protocol; setting a script analysis engine, writing a script library in the script analysis engine, setting calling interfaces of various platforms, and then distributing and setting the script analysis engine on each application node of the Internet of things; when a device is accessed, identifying whether a communication protocol used by the device belongs to a pre-recorded standard open protocol or not; if the script belongs to the standard protocol, outputting a unified standard protocol through a script analysis engine; if not, writing a new analysis script through the interpreted script language, recording the new analysis script into the script library, and then updating the script analysis engine.
Description
Technical Field
The invention relates to a cross-platform universal protocol analysis method, equipment and a medium based on an interpreted language, and belongs to the technical field of Internet of things.
Background
In the related field of application of the internet of things, intelligent sensors are core nodes, various intelligent sensors are various, and the industry or the national level lacks of uniform protocol standards, so that the sensors cannot be compatible and universally processed when being accessed. In the prior art, the access of the sensor device mainly includes the following schemes:
1) in the subdivision field of the Internet of things, the service is relatively concentrated, downstream manufacturers can control the service, and a platform end adopts a limited exhaustion mode and can be adaptive to sensor access;
2) in the field of public internet of things service platforms, because sensors and manufacturers are uncontrollable, a mode of adapting a sensor protocol from top to bottom cannot be realized. The manufacturer with influence customizes a unified protocol standard, and the sensor equipment access platform needs to meet the standard protocol standard;
3) some manufacturers adopt XML mode to configure protocol rules, one kind of protocol, and explain the protocol rules through a set of XML.
For the prior art, the limited exhaustive mode is only suitable for the scenes with fixed sensor types, and the code redundancy is high and cannot be reused under the method; the XML is adopted for protocol description, the method is not generally suitable for complex scenes, and the XML has low loading and reading efficiency and high resource consumption, and is not suitable for light-weight sensor equipment.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a cross-platform universal protocol analysis method, equipment and medium based on an interpreted language, which can realize quick modeling, access and communication one-stop service of various intelligent equipment, increase universality and expansibility design and help to quickly construct various applications of the internet of things.
The technical scheme of the invention is as follows:
the first technical scheme is as follows:
a cross-platform universal protocol parsing method based on an interpreted language comprises the following steps:
constructing a script library, pre-receiving and recording a plurality of standard open protocols, and compiling analysis scripts of the standard open protocols respectively based on an interpreted script language, wherein the analysis scripts take source contents corresponding to the standard open protocols as input and output unified standard protocols; collecting each analysis script into a script library, and establishing an association table for describing the binding relationship between the analysis script and the corresponding standard open protocol;
setting a script analysis engine, writing a script library and an association table in the script analysis engine, setting calling interfaces of various platforms on the script analysis engine, and then distributing and setting the script analysis engine on each application node of the Internet of things;
protocol analysis, when equipment is accessed, identifying whether a communication protocol used by the equipment belongs to a pre-recorded standard open protocol or not; if the protocol belongs to the standard protocol, carrying out protocol analysis through a script analysis engine, and outputting a unified standard protocol; if not, compiling a new analysis script for the communication protocol through the interpreted script language, recording the new analysis script into the script library, updating the binding relationship between the analysis script and the equipment of the type in the association table, and updating the script analysis engine through the updated script library and the updated association table in a hot updating mode.
Further, the interpretive scripting language includes a Lua scripting language and a JavaScript scripting language.
Further, the specific method for setting the calling interfaces of the multiple platforms on the script parsing engine is as follows: designing a multi-platform calling interface comprising Java, C + + and Android, generating a dynamic link library so file by using a gcc and JNI compiler, and writing the dynamic link library so file into the script analysis engine.
The second technical scheme is as follows:
an interpretive language-based cross-platform generic protocol parsing device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method according to the first aspect.
The third technical scheme is as follows:
a cross-platform generic protocol parsing medium based on an interpreted language, having stored thereon a computer program which, when executed by a processor, implements the method according to claim one.
The invention has the following beneficial effects:
1. the invention relates to a cross-platform universal protocol analysis method based on an interpretation language, which is characterized in that when a new type of equipment is accessed, an analysis script is correspondingly compiled, and a script analysis engine is updated in a hot updating mode, so that the access speed of the new equipment and the analysis efficiency of a communication protocol are accelerated; the cross-platform calling is realized by arranging a plurality of calling interfaces on the script parsing engine.
2. The cross-platform universal protocol analysis method based on the interpreted language, provided by the invention, has the advantages that the analysis script is compiled through the interpreted script language, the characteristics of concise grammar, high efficiency, high readability and the like are kept, the coding threshold is reduced, and the operation and maintenance personnel can conveniently learn and operate and maintain.
3. The invention relates to a cross-platform universal protocol analysis method based on an interpreted language, which is based on gcc and JNI compiling technologies, cross-compiles a script analysis engine to generate a dynamic link library so file, realizes cross-platform operation, one-time compilation and everywhere operation, and increases code reusability and reliability.
Drawings
FIG. 1 is a flow chart of a first embodiment of the present invention;
FIG. 2 is a system framework diagram of a script parsing engine in an embodiment of the invention.
Detailed Description
The invention is described in detail below with reference to the figures and the specific embodiments.
The first embodiment is as follows:
referring to fig. 1, a cross-platform universal protocol parsing method based on an interpreted language includes the following steps:
constructing a script library, pre-collecting and recording a plurality of standard public protocols (such as 376.1/698 and other public protocols), and compiling analysis scripts of the standard public protocols respectively based on an interpreted script language, wherein the analysis scripts take source contents corresponding to the standard public protocols as input and output unified standard protocols, and the unified standard protocols can be public protocols or private protocols; collecting each analysis script into a script library, and establishing an association table for describing the binding relationship between the analysis script and the corresponding standard open protocol;
the method comprises the steps of setting a script analysis engine, writing a script library and an association table into the script analysis engine, setting calling interfaces of various platforms on the script analysis engine, and distributing the script analysis engine to internet of things nodes such as a gateway, a sensor and a platform, so that the characteristics of miniaturization, high concurrency, high efficiency, high reliability and the like are supported.
Protocol analysis, when equipment is accessed, identifying whether a communication protocol used by the equipment belongs to a pre-recorded standard open protocol or not; if the script belongs to the standard protocol, matching a corresponding analysis script through an association table in a script analysis engine to perform protocol analysis, and outputting a uniform standard protocol; if not, writing a new analysis script for the communication protocol through the interpreted script language, recording the new analysis script into the script library, updating the binding relationship between the analysis script and the type of equipment in the association table, updating the script analysis engine through the updated script library and association table in a hot update mode, and then analyzing the type of equipment, for example: a gateway is newly connected with a sensor of a brand A, a private communication protocol of a company A is used, the private communication protocol is described through an interpretative script language, a new analysis script is compiled according to description contents, the new analysis script updates a script library, a mapping relation between company A equipment and the private communication protocol is newly added in an association table, the updated script library and the association table update a script analysis engine in a hot updating mode, and then all equipment of the company A can directly call corresponding analysis scripts to analyze when being connected, and a standardized protocol is output.
Referring to fig. 2, in this embodiment, the script parsing engine improves the recognition degree of script natural language and the parsing efficiency by self-defining the built-in object type based on the script parsing type system and the object system design of the service scene of the power internet of things; the output characteristics of the power internet of things equipment are combined, the internal structure storage rules of the closure are optimized, the reference count and the code syntax tree pointer are added, a lazy loading mode is adopted, the engine operation efficiency is improved, the resource consumption is reduced, and the method is suitable for the bottom weak resource type hardware equipment.
Furthermore, the interpretive scripting language comprises a Lua scripting language and a JavaScript scripting language, is used for describing various standard public protocols and proprietary protocols, keeps the characteristics of concise grammar, high efficiency, high readability and the like, reduces the coding threshold, and facilitates learning, operation and maintenance of operation and maintenance personnel.
Further, the specific method for setting the calling interfaces of the multiple platforms on the script parsing engine is as follows: designing a multi-platform calling interface comprising Java, C + + and Android, generating a dynamic link library so file by using a gcc and JNI compiler, and writing the dynamic link library so file into the script analysis engine to realize cross-platform calling.
Example two:
an interpretive language-based cross-platform generic protocol parsing device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method according to the first aspect.
Example three:
a cross-platform generic protocol parsing medium based on an interpreted language, having stored thereon a computer program which, when executed by a processor, implements the method according to claim one.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (5)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011365039.5A CN112527308A (en) | 2020-11-27 | 2020-11-27 | Interplatform universal protocol parsing method, device and medium based on interpreted language |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011365039.5A CN112527308A (en) | 2020-11-27 | 2020-11-27 | Interplatform universal protocol parsing method, device and medium based on interpreted language |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN112527308A true CN112527308A (en) | 2021-03-19 |
Family
ID=74994795
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011365039.5A Pending CN112527308A (en) | 2020-11-27 | 2020-11-27 | Interplatform universal protocol parsing method, device and medium based on interpreted language |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112527308A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114327413A (en) * | 2022-01-06 | 2022-04-12 | 东莞市云雀科技有限公司 | Method for implementing data processing engine for programmable controller |
| CN114691246A (en) * | 2022-03-18 | 2022-07-01 | 杭州涂鸦信息技术有限公司 | Native platform function invocation method, apparatus and computer device |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20050273755A1 (en) * | 2004-06-03 | 2005-12-08 | Lucent Technologies Inc. | Scripting engine for network communication software |
| US20060187849A1 (en) * | 2005-02-22 | 2006-08-24 | Mohamed Hamedi | Interpreter engine |
| CN110275704A (en) * | 2019-05-24 | 2019-09-24 | 北京三快在线科技有限公司 | Page data processing method and device, storage medium and electronic equipment |
| CN111447227A (en) * | 2020-03-27 | 2020-07-24 | 四川虹美智能科技有限公司 | Protocol analysis method and device of Internet of things equipment |
-
2020
- 2020-11-27 CN CN202011365039.5A patent/CN112527308A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20050273755A1 (en) * | 2004-06-03 | 2005-12-08 | Lucent Technologies Inc. | Scripting engine for network communication software |
| US20060187849A1 (en) * | 2005-02-22 | 2006-08-24 | Mohamed Hamedi | Interpreter engine |
| CN110275704A (en) * | 2019-05-24 | 2019-09-24 | 北京三快在线科技有限公司 | Page data processing method and device, storage medium and electronic equipment |
| CN111447227A (en) * | 2020-03-27 | 2020-07-24 | 四川虹美智能科技有限公司 | Protocol analysis method and device of Internet of things equipment |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114327413A (en) * | 2022-01-06 | 2022-04-12 | 东莞市云雀科技有限公司 | Method for implementing data processing engine for programmable controller |
| CN114691246A (en) * | 2022-03-18 | 2022-07-01 | 杭州涂鸦信息技术有限公司 | Native platform function invocation method, apparatus and computer device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108920133B (en) | Cross-language programming method and device, electronic equipment and storage medium | |
| CN108769109B (en) | Unified processing method and system for data of Internet of things heterogeneous equipment | |
| CN100520718C (en) | Script order registration method, method and device for calling source program code | |
| US7739696B2 (en) | Message translation systems and methods | |
| CN114611500B (en) | Expression processing method, device, electronic device and computer-readable storage medium | |
| CN115113850A (en) | A construction and operation method, server, terminal and system of a cross-platform application | |
| CN110633076B (en) | Method for automatically generating identity intelligent contract Java client program | |
| CN110457013B (en) | Program component configuration device and method | |
| CN109298954B (en) | A kind of intelligence calls the method and device of Dubbo remote service | |
| CN108762761A (en) | Generation method, device, server and the storage medium of target channel packet | |
| CN112764718A (en) | Method and device for multi-end use of codes, storage medium and electronic equipment | |
| CN113608748A (en) | Data processing method, device and equipment for converting C language into Java language | |
| CN112363694A (en) | Integration method of FMU file, solver running environment and industrial software | |
| CN112527308A (en) | Interplatform universal protocol parsing method, device and medium based on interpreted language | |
| CN102111160B (en) | Codec systems and their codecs for reactive system testing | |
| CN112083919A (en) | YAML template-based target service code generation method and device | |
| CN102999371A (en) | Lua script-based human-computer interface development method and system | |
| CN118747175A (en) | Method, system, device and medium based on database-driven deep learning model | |
| CN110134380A (en) | A kind of code generating method based on template engine, device and electronic equipment | |
| CN114371851B (en) | A method for realizing network equipment automation based on compilation | |
| CN111309634B (en) | Code detection rule framework establishment and use method based on inheritance and proxy | |
| CN111176657A (en) | Method and system for realizing C language codec based on TTCN-3 test platform | |
| CN101154227A (en) | A Code Generation Method Based on ASN Type Object | |
| CN113703339A (en) | Automatic driving simulation method, device, equipment and storage medium | |
| CN119293073A (en) | A database adaptation method and system based on object relational mapping |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210319 |
|
| RJ01 | Rejection of invention patent application after publication |