[go: up one dir, main page]

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 PDF

Info

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
Application number
CN202011365039.5A
Other languages
Chinese (zh)
Inventor
罗义钊
詹超
柳玉銮
蔡竞仪
俞煌
谭阿峰
李榕桂
林志文
范体顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Wangneng Technology Development Co ltd
State Grid Information and Telecommunication Group Co Ltd
Great Power Science and Technology Co of State Grid Information and Telecommunication Co Ltd
State Grid Corp of China SGCC
Original Assignee
Fujian Wangneng Technology Development Co ltd
State Grid Information and Telecommunication Group Co Ltd
Great Power Science and Technology Co of State Grid Information and Telecommunication Co Ltd
State Grid Corp of China SGCC
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fujian Wangneng Technology Development Co ltd, State Grid Information and Telecommunication Group Co Ltd, Great Power Science and Technology Co of State Grid Information and Telecommunication Co Ltd, State Grid Corp of China SGCC filed Critical Fujian Wangneng Technology Development Co ltd
Priority to CN202011365039.5A priority Critical patent/CN112527308A/en
Publication of CN112527308A publication Critical patent/CN112527308A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

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

Interplatform universal protocol parsing method, device and medium based on interpreted language
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)

1.一种基于解释型语言的跨平台通用协议解析方法,其特征在于,包括以下步骤:1. a cross-platform general protocol analysis method based on interpreted language, is characterized in that, comprises the following steps: 构建脚本库,预收录多种标准公开协议,基于解释型脚本语言分别编写各标准公开协议的解析脚本,所述解析脚本以对应标准公开协议的源内容为输入,输出统一的标准协议;各解析脚本汇集入脚本库中,同时建立描述解析脚本与对应标准公开协议之间的绑定关系的关联表;Build a script library, pre-record a variety of standard open protocols, and write parsing scripts for each standard open protocol based on an interpreted script language. The parsing script takes the source content of the corresponding standard open protocol as input, and outputs a unified standard protocol; The scripts are collected into the script library, and an association table describing the binding relationship between the parsing script and the corresponding standard public protocol is established at the same time; 设置脚本解析引擎,在所述脚本解析引擎中写入脚本库和关联表,同时在脚本解析引擎上设置多种平台的调用接口,再将所述脚本解析引擎分布设置在物联网的各个应用节点上;Setting up a script parsing engine, writing a script library and an association table in the script parsing engine, and setting the calling interfaces of various platforms on the script parsing engine, and then distributing the script parsing engine on each application node of the Internet of Things superior; 协议解析,当有设备接入时,识别该种类设备使用的通讯协议是否属于预收录的标准公开协议;若属于,则通过脚本解析引擎进行协议解析,输出统一的标准协议;若不属于,则通过解释型脚本语言对该通讯协议编写一新的解析脚本,将新的解析脚本收录至所述脚本库中,同时在所述关联表中更新该解析脚本与该种类设备之间的绑定关系,再将更新后的脚本库和关联表通过热更新的方式对所述脚本解析引擎进行更新。Protocol analysis, when a device is connected, identify whether the communication protocol used by this type of device belongs to the pre-recorded standard open protocol; if it is, the script analysis engine is used for protocol analysis, and a unified standard protocol is output; if not, then Write a new parsing script for the communication protocol through an interpreted script language, record the new parsing script into the script library, and update the binding relationship between the parsing script and the type of device in the association table at the same time , and then update the script parsing engine by means of hot update with the updated script library and association table. 2.根据权利要求1所述的一种基于解释型语言的跨平台通用协议解析方法,其特征在于:所述解释性脚本语言包括Lua脚本语言和JavaScript脚本语言。2 . The cross-platform universal protocol parsing method based on an interpreted language according to claim 1 , wherein the interpreted scripting language includes Lua scripting language and JavaScript scripting language. 3 . 3.根据权利要求1所述的一种基于解释型语言的跨平台通用协议解析方法,其特征在于,所述在脚本解析引擎上设置多种平台的调用接口的具体方法为:设计包括Java、C++和Android的多平台调用接口,使用gcc以及JNI编译器,生成动态链接库so文件,并将动态链接库so文件写入所述脚本解析引擎中。3. a kind of cross-platform general protocol analysis method based on interpreted language according to claim 1, is characterized in that, the described concrete method that the calling interface of multiple platforms is set on script analysis engine is: design comprises Java, The multi-platform calling interface of C++ and Android uses gcc and JNI compilers to generate a dynamic link library so file, and write the dynamic link library so file into the script parsing engine. 4.一种基于解释型语言的跨平台通用协议解析设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至3任一项所述的方法。4. A cross-platform general protocol parsing device based on an interpreted language, comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor executes the program when the processor executes the program. A method as claimed in any one of claims 1 to 3 is carried out. 5.一种基于解释型语言的跨平台通用协议解析介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1至3任一项所述的方法。5 . A cross-platform universal protocol parsing medium based on an interpreted language, on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
CN202011365039.5A 2020-11-27 2020-11-27 Interplatform universal protocol parsing method, device and medium based on interpreted language Pending CN112527308A (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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