CN-121530935-B - Internet of things equipment access method and device, electronic equipment and storage medium
Abstract
The application relates to the technical field of the Internet of things and discloses an access method and device of equipment of the Internet of things, electronic equipment and a storage medium, wherein the method comprises the steps of extracting message characteristics corresponding to message data reported by the equipment to be accessed; the method comprises the steps of calculating confidence coefficient between message features and protocol fingerprints in a protocol fingerprint library, wherein the protocol fingerprint library comprises protocol fingerprints corresponding to a plurality of communication protocols, each communication protocol corresponds to one protocol fingerprint, judging whether the maximum confidence coefficient in the confidence coefficient is larger than a preset threshold value, accessing to-be-accessed equipment according to the communication protocol corresponding to the maximum confidence coefficient if the maximum confidence coefficient is larger than the preset threshold value, creating a corresponding analyzer instance according to the message features if the maximum confidence coefficient is smaller than or equal to the preset threshold value, and accessing to-be-accessed equipment based on the analyzer instance. The application can improve the flexibility and efficiency of the equipment access.
Inventors
- ZHANG YUANNING
- HUANG XUBIN
- DING ZHEN
- WANG JIAN
- WANG BIN
Assignees
- 浙江正泰物联技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260114
Claims (7)
- 1. An internet of things device access method, comprising: extracting message characteristics corresponding to message data reported by equipment to be accessed; Calculating the confidence between the message characteristics and the protocol fingerprints in a protocol fingerprint library, wherein the protocol fingerprint library comprises protocol fingerprints corresponding to a plurality of communication protocols, and each communication protocol corresponds to one protocol fingerprint; Judging whether the maximum confidence in the confidence is greater than a preset threshold value or not; If the maximum confidence coefficient is larger than the preset threshold value, accessing the equipment to be accessed according to a communication protocol corresponding to the maximum confidence coefficient; If the maximum confidence coefficient is smaller than or equal to the preset threshold value, a corresponding analyzer instance is created according to the message characteristics, and the equipment to be accessed is accessed based on the analyzer instance; The creating a corresponding parser instance according to the message characteristics includes: Analyzing the message format of the message data through a dynamic rule generator to obtain an analysis rule description file; storing the analysis rule description file into an analysis rule library, and generating a rule update event; When the rule updating event is detected, triggering a parser factory to actively acquire the parsing rule description file from the parsing rule base, and creating a corresponding parser instance in a memory according to the parsing rule description file; Storing the resolver instance into a resolver cache pool, and updating a resolver mapping table corresponding to the resolver cache pool, wherein the resolver mapping table comprises unique identifiers of communication protocols and resolver instances stored in corresponding relation; And when the rule updating event is detected, determining a corresponding protocol fingerprint according to the message data reported by the equipment to be accessed, and storing the protocol fingerprint into the protocol fingerprint library.
- 2. The method of claim 1, wherein calculating the confidence level between the message feature and a protocol fingerprint in a protocol fingerprint library comprises: determining a corresponding message feature vector according to the message feature; determining corresponding protocol fingerprint vectors and feature weights according to the protocol fingerprints; According to the message feature vector, the protocol fingerprint vector and the feature weight, calculating the similarity between the message feature and the protocol fingerprint respectively through a plurality of similarity calculation modes to obtain the similarity corresponding to each similarity calculation mode; And determining the confidence coefficient according to the similarity corresponding to each similarity calculation mode.
- 3. The method of claim 2, wherein determining the confidence level based on the similarity corresponding to each similarity calculation mode comprises: Obtaining a weight corresponding to each similarity calculation mode; and calculating the sum of products of the similarity corresponding to each similarity calculation mode and the corresponding weight to obtain the confidence coefficient.
- 4. The method according to claim 1, wherein analyzing the message format of the message data to obtain the parsing rule description file includes: Analyzing the message data to obtain an initial message structure, wherein the initial message structure comprises a fixed domain and position information of the fixed domain, a variable domain and position information of the variable domain; Determining key parameters of a key domain in the variable domain based on the initial message structure, wherein the key domain comprises a length domain, a data domain and a checksum domain, and the key parameters comprise offset, length and coding mode; determining field attributes corresponding to each field in the data field according to the key parameters of the key field, wherein the field attributes comprise data types, coding modes, meanings and offsets; and determining the analysis rule description file according to the initial message structure, the key parameters of the key domain and the field attributes corresponding to each field in the data domain.
- 5. An internet of things device access apparatus, the apparatus comprising: the first processing module is used for extracting message characteristics corresponding to message data reported by the equipment to be accessed; The second processing module is used for calculating the confidence between the message characteristics and the protocol fingerprints in the protocol fingerprint library, wherein the protocol fingerprint library comprises protocol fingerprints corresponding to a plurality of communication protocols, and each communication protocol corresponds to one protocol fingerprint; the third processing module is used for judging whether the maximum confidence coefficient in the confidence coefficient is larger than a preset threshold value or not; A fourth processing module, configured to access the device to be accessed according to a communication protocol corresponding to the maximum confidence coefficient if the maximum confidence coefficient is greater than the preset threshold value; a fifth processing module, configured to create a corresponding resolver instance according to the message characteristic if the maximum confidence coefficient is less than or equal to the preset threshold value, and access the device to be accessed based on the resolver instance; The fifth processing module is specifically configured to analyze a message format of the message data through a dynamic rule generator, so as to obtain an analysis rule description file; storing the analysis rule description file into an analysis rule library, and generating a rule update event; When the rule updating event is detected, triggering a parser factory to actively acquire the parsing rule description file from the parsing rule base, and creating a corresponding parser instance in a memory according to the parsing rule description file; Storing the resolver instance into a resolver cache pool, and updating a resolver mapping table corresponding to the resolver cache pool, wherein the resolver mapping table comprises unique identifiers of communication protocols and resolver instances stored in corresponding relation; and the fifth processing module is further configured to determine a corresponding protocol fingerprint according to the message data reported by the device to be accessed when the rule updating event is detected, and store the protocol fingerprint into the protocol fingerprint library.
- 6. An electronic device, comprising: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions that, when executed, perform the steps of the internet of things device access method of any one of claims 1 to 4.
- 7. A computer-readable storage medium, wherein computer instructions for causing a computer to perform the steps of the internet of things device access method of any one of claims 1 to 4 are stored on the computer-readable storage medium.
Description
Internet of things equipment access method and device, electronic equipment and storage medium Technical Field The application relates to the technical field of the Internet of things, in particular to an Internet of things equipment access method and device, electronic equipment and a storage medium. Background With the development of the internet of things technology, internet of things equipment is widely connected to a cloud platform, communication protocols adopted by the equipment are various, and new protocols continue to emerge. In the related art, engineers are required to manually write analysis scripts, configure templates and restart services to access new protocols, so that the access efficiency is low, the service continuity is affected, errors are easy to occur, and the maintenance cost is high. Disclosure of Invention The application provides an access method, an access device, electronic equipment and a storage medium of Internet of things equipment, which are used for solving the problems that an engineer manually writes an analysis script, configures a template and restarts a service to access a new protocol, the access efficiency is low, the service continuity is affected, errors are easy to occur and the maintenance cost is high. In a first aspect, the present application provides an access method for an internet of things device, where the method includes: The method comprises the steps of extracting message characteristics corresponding to message data reported by equipment to be accessed, calculating confidence coefficient between the message characteristics and protocol fingerprints in a protocol fingerprint library, wherein the protocol fingerprint library comprises protocol fingerprints corresponding to a plurality of communication protocols, each communication protocol corresponds to one protocol fingerprint, judging whether the maximum confidence coefficient in the confidence coefficient is larger than a preset threshold value, accessing the equipment to be accessed according to the communication protocol corresponding to the maximum confidence coefficient if the maximum confidence coefficient is larger than the preset threshold value, and creating a corresponding analyzer instance according to the message characteristics if the maximum confidence coefficient is smaller than or equal to the preset threshold value, and accessing the equipment to be accessed based on the analyzer instance. According to the embodiment, the dependence of the traditional Internet of things equipment access on the predefined protocol library is broken through by extracting the message characteristics, performing confidence level matching and layering processing logic of the last layered scene access equipment. The traditional method can support a new protocol only by manually writing an analysis script and restarting service, but the embodiment can directly match and access a known communication protocol through automatic feature extraction and confidence calculation, dynamically create an analyzer instance for an unknown protocol, and complete equipment access without manual intervention. The message feature extraction provides a core basis for protocol identification, the accuracy of protocol identification is ensured by multidimensional matching through confidence calculation, the known communication protocol is quickly adapted and the unknown communication protocol is dynamically compatible through the scene access logic, the pain points of poor expansibility and high labor cost of the traditional method are fundamentally solved, and the flexibility and the efficiency of heterogeneous equipment access are greatly improved. In an alternative implementation, the method for calculating the confidence between the message features and the protocol fingerprints in the protocol fingerprint library comprises the steps of determining corresponding message feature vectors according to the message features, determining corresponding protocol fingerprint vectors and feature weights according to the protocol fingerprints, calculating the similarity between the message features and the protocol fingerprints according to the message feature vectors, the protocol fingerprint vectors and the feature weights through multiple similarity calculation modes to obtain the similarity corresponding to each similarity calculation mode, and determining the confidence according to the similarity corresponding to each similarity calculation mode. According to the embodiment, the message characteristics and the protocol fingerprints are converted into the vector form, and the multi-dimensional similarity calculation is adopted by combining the characteristic weights, so that the accuracy and the reliability of the confidence calculation are remarkably improved. Firstly, abstract message features and protocol fingerprints are converted into numeric vectors, so that quantifiable comparison of features is realized, and one-sided