Cloud-based collaborative multi-protocol adaptive compatibility method, system, terminal and storage medium

CN122933494APending Publication Date: 2026-10-16SHENZHEN CHUANGREN TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611147277.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0006]本申请要解决的技术问题在于,针对现有技术的上述缺陷,提供基于云端协同的多协议自适应兼容方法、系统、终端及存储介质,旨在解决现有水表设备存在协议固化、兼容性差、无法灵活适配不同水务平台及不同老旧设备对接的问题

Benefits of technology

[0017] The beneficial effects of this application are as follows: In this embodiment, the control board of the target instrument collects interaction message samples with the target platform to obtain a message sample set, which is then uploaded to a cloud server. The cloud server calls a protocol feature library in the cloud to perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the library, outputting a matching degree ranking result. The target protocol type and version number are determined based on the matching degree ranking result. A target protocol firmware package is generated for the target instrument based on the target protocol type and version number. The target protocol firmware package is securely distributed to the control board of the target instrument. The control board of the target instrument registers the protocol parsing plugin corresponding to the target protocol firmware package with the protocol parsing engine, enabling the protocol parsing engine to process the uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package. This application is applicable to the automatic identification and adaptation process of communication protocols between smart water meters, smart electricity meters, and other terminal metering devices and different management platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933494A_ABST
    Figure CN122933494A_ABST
Patent Text Reader

Abstract

The application discloses a cloud-based collaborative multi-protocol adaptive compatibility method, system, terminal and storage medium. The method comprises the following steps: collecting interaction message samples of a target platform through a control board of a target meter device, obtaining a message sample set and uploading the message sample set to a cloud server; calling a protocol feature library of the cloud through the cloud server, performing multi-dimensional weighted matching between multi-dimensional protocol features extracted from the message sample set and protocol feature templates in the protocol feature library, outputting a matching degree sorting result, and determining a target protocol type and a version number; generating a target protocol firmware package for the target meter device according to the target protocol type and the version number, and safely distributing the target protocol firmware package to the control board; and registering a protocol analysis plug-in corresponding to the target protocol firmware package to a protocol analysis engine through the control board. The application is suitable for the communication protocol automatic identification and adaptation process between terminal metering devices such as intelligent water meters and intelligent electric meters and different management platforms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet of Things (IoT) communication technology, and in particular to a cloud-based collaborative multi-protocol adaptive compatibility method, system, terminal, and storage medium. Background Technology

[0002] Smart meters are the product of the deep integration of traditional mechanical instruments with modern electronic and information technologies. They not only possess the basic function of accurate metering but also, with the help of sensors and communication modules, can achieve real-time collection, transmission, and remote monitoring of water usage data. Taking smart water meters as an example, with the in-depth advancement of smart water management construction, connecting a large number of smart water meter devices to different water management platforms and achieving unified data collection and control has become a core requirement for the digital transformation of the water industry.

[0003] Currently, in the water industry, communication between terminal devices such as smart water meters and water management platforms generally adopts wired communication protocols such as Modbus, DL / T645, and CJ / T188, as well as IoT transmission protocols such as MQTT and HTTP. When the equipment leaves the factory, its communication protocol is usually fixed in the form of firmware in the control board, and the equipment is configured to support one or more specific protocols before leaving the factory.

[0004] However, there are currently more than 10 mainstream communication protocols in the water industry, and different manufacturers' equipment uses different protocols, making them incompatible with each other. Industry standards are insufficient to meet diverse business needs and hinder interoperability.

[0005] Therefore, existing technologies still need improvement and development. Summary of the Invention

[0006] The technical problem to be solved by this application is to provide a cloud-based collaborative multi-protocol adaptive compatibility method, system, terminal and storage medium to address the above-mentioned defects of the existing technology, aiming to solve the problems of fixed protocols, poor compatibility and inability to flexibly adapt to different water affairs platforms and different old equipment in existing water meter devices.

[0007] The technical solution adopted in this application to solve the problem is as follows: In a first aspect, embodiments of this application provide a multi-protocol adaptive compatibility method based on cloud collaboration, the method comprising: The message sample set is obtained by collecting interaction message samples between the target instrument and the target platform through the control board of the target instrument and the target platform, and then the message sample set is uploaded to the cloud server. The cloud server calls the protocol feature library in the cloud to perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputs the matching degree ranking result; the target protocol type and version number are determined according to the matching degree ranking result; a target protocol firmware package is generated for the target instrument device according to the target protocol type and the version number; and the target protocol firmware package is securely distributed to the control board of the target instrument device. The control board of the target instrument device registers the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine, so that the protocol parsing engine processes the uplink and downlink data between the target instrument device and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

[0008] In one implementation, the multidimensional protocol features include: frame header features, checksum features, data bit format features, and response logic features.

[0009] In one implementation, the elements of the protocol feature template in the protocol feature library include: frame header identifier field, checksum algorithm type, data bit length rule, and response timeout threshold.

[0010] In one implementation, the step of performing multidimensional weighted matching between the multidimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputting the matching degree ranking result includes: For each message sample in the message sample set, the similarity of the frame header features, checksum features, data bit format features, and response logic features corresponding to the message sample with the elements corresponding to each protocol feature template in the protocol feature library is calculated, and the similarity of each element is weighted and summed to obtain the comprehensive matching degree of each protocol feature template. The matching degree ranking result is output based on the comprehensive matching degree of each protocol feature template.

[0011] In one implementation, the steps of determining the target protocol type and version number based on the matching degree ranking result include: If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the first matching degree threshold, then the target protocol type and the version number are determined according to the protocol feature template corresponding to the highest overall matching degree value; If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the second matching degree threshold and less than the first matching degree threshold, a secondary verification process is triggered, causing the control board of the target instrument device to upload several new message samples and obtain a new matching degree ranking result. The steps of determining the target protocol type and version number based on the matching degree ranking result are then executed. If the number of times the secondary verification process is triggered reaches a preset number threshold, the target protocol type and version number are determined based on the highest overall matching degree value in the latest matching degree ranking result. Wherein, the second matching degree threshold is less than the first matching degree threshold. If all the overall matching scores in the matching score ranking results are lower than the second matching score threshold, a downgrade process is triggered. A new protocol feature template corresponding to the current message sample is generated through manual parsing and field annotation and stored in the protocol feature library.

[0012] In one implementation, the step of generating a target protocol firmware package for the target instrument device based on the target protocol type and the version number includes: Retrieve the corresponding protocol parsing code framework based on the target protocol type and the version number; The target protocol firmware package is generated based on the hardware model parameters of the target instrument and the protocol parsing code framework.

[0013] In one implementation, the step of securely sending the target protocol firmware package to the control board of the target instrument device includes: The target protocol firmware package is securely delivered to the control board of the target instrument device via encrypted OTA remote upgrade.

[0014] Secondly, embodiments of this application also provide a cloud-based collaborative multi-protocol adaptive compatibility system, the system comprising: The control board of the target instrument is used to collect interaction message samples with the target platform, obtain a message sample set, and upload the message sample set to the cloud server; The cloud server is used to call the protocol feature library in the cloud, perform multi-dimensional weighted matching of the multi-dimensional protocol features extracted from the message sample set with the protocol feature templates in the protocol feature library, and output the matching degree ranking result; determine the target protocol type and version number based on the matching degree ranking result; generate a target protocol firmware package for the target instrument device based on the target protocol type and version number; and securely distribute the target protocol firmware package to the control board of the target instrument device. The control board of the target instrument is also used to register the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine, so that the protocol parsing engine processes the uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

[0015] Thirdly, embodiments of this application also provide a terminal, the terminal including a memory and one or more processors; the memory stores one or more programs; the programs include instructions for executing the cloud-based collaborative multi-protocol adaptive compatibility method as described above; the processor is used to execute the programs.

[0016] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions, characterized in that the instructions are adapted to be loaded and executed by a processor to implement the steps of the cloud-based collaborative multi-protocol adaptive compatibility method as described above.

[0017] The beneficial effects of this application are as follows: In this embodiment, the control board of the target instrument collects interaction message samples with the target platform to obtain a message sample set, which is then uploaded to a cloud server. The cloud server calls a protocol feature library in the cloud to perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the library, outputting a matching degree ranking result. The target protocol type and version number are determined based on the matching degree ranking result. A target protocol firmware package is generated for the target instrument based on the target protocol type and version number. The target protocol firmware package is securely distributed to the control board of the target instrument. The control board of the target instrument registers the protocol parsing plugin corresponding to the target protocol firmware package with the protocol parsing engine, enabling the protocol parsing engine to process the uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package. This application is applicable to the automatic identification and adaptation process of communication protocols between smart water meters, smart electricity meters, and other terminal metering devices and different management platforms. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1This is a flowchart illustrating the cloud-based collaborative multi-protocol adaptive compatibility method provided in the embodiments of this application.

[0020] Figure 2 This is a schematic diagram of a cloud-based collaborative multi-protocol adaptive compatibility system provided in an embodiment of this application.

[0021] Figure 3 This is a schematic block diagram of the terminal provided in the embodiments of this application. Detailed Implementation

[0022] This application discloses a multi-protocol adaptive compatibility method, system, terminal, and storage medium based on cloud collaboration. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.

[0023] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0024] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0025] To address the aforementioned deficiencies in existing technologies, this application provides a cloud-based collaborative multi-protocol adaptive compatibility method. The method includes: collecting interaction message samples between the target instrument's control board and the target platform to obtain a message sample set, and uploading the message sample set to a cloud server; calling a protocol feature library on the cloud server to perform multi-dimensional weighted matching of multi-dimensional protocol features extracted from the message sample set with protocol feature templates in the protocol feature library, and outputting a matching degree ranking result; determining the target protocol type and version number based on the matching degree ranking result; generating a target protocol firmware package for the target instrument based on the target protocol type and version number; securely distributing the target protocol firmware package to the target instrument's control board; and registering the protocol parsing plugin corresponding to the target protocol firmware package to a protocol parsing engine through the target instrument's control board, enabling the protocol parsing engine to process uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package. This application is applicable to the automatic identification and adaptation of communication protocols between smart water meters, smart electricity meters, and other terminal metering devices and different management platforms.

[0026] like Figure 1 As shown, the method includes: Step S100: Collect interaction message samples between the target instrument and the target platform through the control board of the target instrument, obtain a message sample set, and upload the message sample set to the cloud server.

[0027] Specifically, the control board of the target instrument device has a built-in universal protocol parsing base. This universal protocol parsing base adopts a modular plug-in architecture and can natively integrate parsing engines for various mainstream industry communication protocols corresponding to the target instrument device.

[0028] When the target instrument establishes a physical communication link with the target platform for the first time or connects to an old device with an unknown protocol type, the control board does not directly use a certain protocol plug-in in the base for communication. Instead, it first uses the general protocol to parse the base and call the underlying data capture interface to continuously collect the original interactive messages on the communication bus in a passive listening manner, or actively sends standard probe frames to induce the target platform or old device to return response messages, thereby obtaining interactive message samples including request frames and response frames.

[0029] Interaction message samples can be temporarily stored in the control board's buffer as hexadecimal byte streams. Each message sample contains at least a complete frame structure, including a frame header start identifier, function code or command word, data fields, checksum, and frame tail identifier. To ensure the representativeness and accuracy of the samples, the control board collects a sufficient number of samples according to a preset acquisition strategy (e.g., continuously acquiring no fewer than 10 complete request-response pairs, or acquiring no fewer than 50 valid messages within a preset time window). Then, it performs preprocessing operations such as timestamp alignment and frame boundary marking on the interaction message samples, and packages them into a message sample set.

[0030] Subsequently, the control board uploads the message sample set to the cloud server via an encrypted transmission channel through its onboard cellular communication module, Wi-Fi module, or Ethernet interface, so that the cloud can perform subsequent protocol feature extraction and intelligent recognition.

[0031] For example, taking a smart water meter as the target instrument device, its corresponding target platform can be a water affairs platform. Its corresponding general protocol parsing base can natively integrate parsing engines for various mainstream communication protocols in the water affairs industry, such as Modbus, DL / T645, CJ / T188, MQTT and HTTP, and has reserved a custom protocol parsing interface, possessing the basic capability for future protocol expansion.

[0032] Step S200: The cloud server calls the protocol feature library in the cloud to perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputs the matching degree ranking result; the target protocol type and version number are determined according to the matching degree ranking result; a target protocol firmware package is generated for the target instrument device according to the target protocol type and the version number; the target protocol firmware package is securely sent to the control board of the target instrument device.

[0033] Furthermore, the multidimensional protocol features include: frame header features, checksum features, data bit format features, and response logic features.

[0034] Furthermore, the elements of the protocol feature template in the protocol feature library include: frame header identifier field, checksum algorithm type, data bit length rule, and response timeout threshold.

[0035] Specifically, after the cloud server receives the message sample set uploaded by the control board of the target instrument device, it starts the cloud protocol intelligent identification mechanism: First, it calls the cloud-preset protocol feature library, which stores protocol feature templates of various mainstream and non-standard communication protocols in the relevant industry. Each protocol feature template includes at least a frame header identification field, a check bit algorithm type, a data bit length rule, and a response timeout threshold.

[0036] During the identification process, the cloud server sequentially extracts multi-dimensional protocol features from the message sample set. Specifically, it performs pattern recognition on the message start byte sequence to obtain the value and length of the frame start identifier, thereby extracting frame header features; it performs reverse verification on the check field using multiple check algorithms to identify the type of check algorithm used and the check coverage, thereby extracting check bit features; it analyzes the organization structure of the data fields to determine whether they belong to fixed length, length field indication, or end-of-line indicator type, and extracts the offset address and width of each data field, thereby extracting data bit format features; and it parses the timing correspondence between request and response messages, transaction identifier mapping rules, and the format specifications of abnormal response codes, thereby extracting response logic features.

[0037] After extraction, the cloud server performs multi-dimensional weighted matching between the aforementioned four-dimensional features and the corresponding four-dimensional fields of each protocol feature template in the protocol feature library. It calculates the similarity for each dimension, multiplies it by a preset weight, and then sums the results to obtain the comprehensive matching degree of each candidate protocol template. Finally, it outputs the matching degree ranking of all candidate protocols, sorted from highest to lowest comprehensive matching degree. In practical applications, the weights of each dimension can be dynamically adjusted according to the protocol type.

[0038] Based on the matching ranking results, the cloud server determines key information such as the communication protocol type and version number required for the current docking scenario, and triggers an automatic protocol firmware compilation process to generate a dedicated target protocol firmware package that matches the hardware environment and protocol requirements of the target instrument device. Finally, the target protocol firmware package is distributed to the control board of the target instrument device. The entire process requires no manual programming configuration, achieving adaptive remote adaptation of the protocol between the device and the platform.

[0039] In one implementation, the step of performing multidimensional weighted matching between the multidimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputting the matching degree ranking result includes: For each message sample in the message sample set, the similarity of the frame header features, checksum features, data bit format features, and response logic features corresponding to the message sample with the elements corresponding to each protocol feature template in the protocol feature library is calculated, and the similarity of each element is weighted and summed to obtain the comprehensive matching degree of each protocol feature template. The matching degree ranking result is output based on the comprehensive matching degree of each protocol feature template.

[0040] Specifically, after the cloud server extracts frame header features, checksum features, data bit format features, and response logic features from the message sample set, it enters the multi-dimensional weighted matching calculation stage. For each message sample in the message sample set, the cloud server compares the frame header features corresponding to the message sample one by one with the frame header identifier field of each protocol feature template in the protocol feature library to calculate the similarity in the frame header dimension; it compares the checksum features corresponding to the message sample one by one with the checksum algorithm type of each protocol feature template to calculate the similarity in the checksum dimension; it compares the data bit format features corresponding to the message sample one by one with the data bit length rule of each protocol feature template to calculate the similarity in the data format dimension; and it compares the response logic features corresponding to the message sample one by one with the response timeout threshold of each protocol feature template to calculate the similarity in the response logic dimension.

[0041] After calculating the similarity across all dimensions, the cloud server multiplies the similarity of the frame header features, checksum features, data bit format features, and response logic features by their respective preset weights, then sums them to obtain the overall matching degree of the protocol feature template. Dimensions that are more critical in distinguishing different protocols are assigned higher weights, while dimensions that are relatively auxiliary in distinguishing different protocols are assigned lower weights, with the sum of the weights for all dimensions being 1.

[0042] After performing the comprehensive matching degree calculation on each protocol feature template in the protocol feature library, the cloud server obtains the comprehensive matching degree value for each protocol feature template. Then, it sorts all candidate protocol feature templates in descending order of comprehensive matching degree and outputs the matching degree ranking result. The protocol type corresponding to the protocol feature template with the highest comprehensive matching degree in the matching degree ranking result is the most likely communication protocol in the current docking scenario.

[0043] In one implementation, the steps of determining the target protocol type and version number based on the matching degree ranking result include: If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the first matching degree threshold, then the target protocol type and the version number are determined according to the protocol feature template corresponding to the highest overall matching degree value; If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the second matching degree threshold and less than the first matching degree threshold, a secondary verification process is triggered, causing the control board of the target instrument device to upload several new message samples and obtain a new matching degree ranking result. The steps of determining the target protocol type and version number based on the matching degree ranking result are then executed. If the number of times the secondary verification process is triggered reaches a preset number threshold, the target protocol type and version number are determined based on the highest overall matching degree value in the latest matching degree ranking result. Wherein, the second matching degree threshold is less than the first matching degree threshold. If all the overall matching scores in the matching score ranking results are lower than the second matching score threshold, a downgrade process is triggered. A new protocol feature template corresponding to the current message sample is generated through manual parsing and field annotation and stored in the protocol feature library.

[0044] Specifically, after the cloud server outputs the matching score ranking results, it executes the following branch processing based on the highest comprehensive matching score value in the matching score ranking results, combined with the multi-level confidence judgment strategy: First branch: If the highest overall matching score in the matching score ranking results is greater than or equal to the first matching score threshold, the cloud server determines that the confidence level of the current recognition result meets the direct confirmation condition. It then directly determines the target protocol type and version number based on the protocol feature template corresponding to the highest overall matching score and proceeds to the subsequent protocol firmware package compilation and distribution process. For example, the first matching score threshold can be set to 0.75, and this value can be dynamically adjusted based on the size of the protocol feature library and the actual recognition accuracy on-site. The second branch: If the highest overall matching degree in the matching degree ranking results is greater than or equal to the second matching degree threshold and less than the first matching degree threshold, the cloud server determines that the confidence level of the current recognition result is insufficient for direct confirmation but has not yet reached the level of complete failure, triggering the secondary verification process: The cloud server sends a supplementary acquisition command to the control board of the target instrument device, instructing the control board to re-acquire and upload several new message samples on the communication link. Based on the newly received message samples, the cloud server re-executes multi-dimensional feature extraction, multi-dimensional weighted matching, and matching degree ranking to obtain a new matching degree ranking result, and continues to execute the step of determining the target protocol type and version number based on the matching degree ranking result, that is, re-entering the confidence judgment process for branch judgment. If the number of times the secondary verification process is triggered reaches the preset threshold, even if the current matching degree still does not reach the first matching degree threshold, the cloud server will not continue to loop the verification, but will determine the target protocol type and version number based on the highest overall matching degree in the latest matching degree ranking result, in order to avoid the recognition process from falling into an infinite loop due to continuously poor sample quality. In this case, the cloud server can mark the low confidence level of the identification result in the logs for subsequent verification by operations and maintenance personnel. For example, the second matching degree threshold can be set to 0.5; it can instruct the collection of no less than 5 new request-response interaction pairs, or extend the collection time window to capture richer message types; the preset number of times threshold can be set to 3 times.

[0045] The third branch: If all overall matching scores in the matching score ranking results are lower than the second matching score threshold, the cloud server determines that there is no existing protocol template in the protocol feature library that can effectively match the current message sample, triggering a downgrade process. In the downgrade process, the cloud server marks the current message sample as an unrecognized protocol and stores it in the cloud's pending review queue, while simultaneously sending a manual intervention notification to the operations personnel's terminal. The operations personnel use the analysis tools on the cloud management platform to manually parse and annotate the message sample's fields. The parsing includes, but is not limited to, the position and value of the frame start identifier, the specific type and coverage of the verification algorithm, the boundaries of the data fields and the business meaning of each field, and the definition of the mapping relationship between requests and responses. After manual annotation, the cloud server automatically generates a new protocol feature template corresponding to the current message sample based on the annotation results. This template includes necessary elements such as the frame header identifier field, the verification bit algorithm type, the data bit length rules, and the response timeout threshold, and stores the new protocol feature template in the protocol feature library. Subsequently, when other devices upload samples with the same message characteristics, the cloud server can automatically complete the identification based on the newly entered protocol feature template without the need for manual intervention again.

[0046] In one implementation, the step of generating a target protocol firmware package for the target instrument device based on the target protocol type and the version number includes: Retrieve the corresponding protocol parsing code framework based on the target protocol type and the version number; The target protocol firmware package is generated based on the hardware model parameters of the target instrument and the protocol parsing code framework.

[0047] Furthermore, the step of securely distributing the target protocol firmware package to the control board of the target instrument device includes: The target protocol firmware package is securely delivered to the control board of the target instrument device via encrypted OTA remote upgrade.

[0048] Specifically, after the cloud server determines the target protocol type and version number, it triggers the automatic compilation process of the protocol firmware. First, the cloud server retrieves the corresponding protocol parsing code framework from the cloud protocol template library based on the target protocol type and version number. The protocol parsing code framework includes a complete frame structure definition, verification algorithm implementation, data field parsing functions, and response processing logic for the protocol. Each of these parts reserves communication parameter interfaces, memory buffer size interfaces, and timeout counter interfaces in placeholder form, allowing the code framework to flexibly adapt to the hardware resources of different devices.

[0049] Meanwhile, the cloud server reads the hardware model parameters of the target meter from the device management file. Taking a smart water meter as an example, the hardware model parameters may include: MCU type, Flash capacity, RAM capacity, and serial port baud rate range. The hardware model parameters are reported by the control board and stored in the cloud during the initial device registration, or are pre-set in the device management file when the device leaves the factory.

[0050] Subsequently, the cloud server injects the read hardware model parameters into the protocol parsing code framework, replacing all placeholders: the MCU type is used to select the corresponding compiler instruction set, the Flash capacity is used to constrain the firmware size optimization target, the RAM capacity is used to set the actual allocation size of the memory buffer, and the serial port baud rate range is used to limit the configurable set of communication parameters, thus obtaining a complete source code that matches the target instrument device's hardware environment. After injection, the cloud server calls a cross-compilation toolchain that matches the MCU type to perform size optimization compilation on the complete source code after the hardware model parameters are injected, generating a binary protocol firmware package adapted to the device's hardware environment. After the binary protocol firmware package is generated, the cloud server encapsulates it together with the protocol type identifier, device model identifier, version number, and compilation timestamp into a dedicated target protocol firmware package for subsequent distribution.

[0051] During the firmware distribution phase, the cloud server can securely distribute the target protocol firmware package to the control board of the target instrument device via encrypted OTA remote upgrade. Specifically, the cloud server first invokes the security module to perform encryption and signing operations on the target protocol firmware package. For example, it uses the national cryptographic standard SM4 or AES-256 symmetric encryption algorithm to encrypt the binary data of the firmware package for transmission. The encryption key is dynamically generated by the cloud key management service based on the device ID and the current timestamp. At the same time, it uses the SM2 or RSA asymmetric signature algorithm to generate a digital signature for the encrypted firmware package and appends it to the end of the package. During the distribution process, the cloud server establishes an OTA transmission channel with the control board of the target instrument device, supporting breakpoint resumption mechanism and abnormal retry mechanism. The entire process does not require disassembly of the device or any manual programming configuration, realizing fully unmanned remote deployment for protocol adaptation.

[0052] Step S300: Register the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine through the control board of the target instrument device, so that the protocol parsing engine processes the uplink and downlink data between the target instrument device and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

[0053] Specifically, after receiving the encrypted target protocol firmware package, the control board first verifies the validity of the digital signature using the device's built-in cloud public key. Once the signature verification is successful, it decrypts the package using the key corresponding to the encryption and verifies its integrity to ensure the firmware package has not been tampered with or damaged during transmission. After successful verification, the control board loads the target protocol firmware package, registers the protocol parsing logic it contains with the protocol parsing engine of the general protocol parsing base, and completes the dynamic loading, configuration overriding, and initialization of the protocol plugin.

[0054] The protocol parsing engine processes uplink and downlink data between the target instrument device and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package. Specifically, for uplink data (data uploaded by the target instrument device to the target platform), the routing and distribution module in the protocol parsing engine first determines the protocol type to be used for this communication based on the target platform identifier corresponding to the data generation source. Then, it calls the plugin instance corresponding to that protocol type to assemble the standardized internal data structure into a protocol frame byte stream that meets the requirements of the target platform according to the frame format specification of that protocol, and sends it to the target platform via the physical communication interface. For downlink data (data sent by the target platform to the target instrument device), the protocol parsing engine first receives the raw byte stream data through the physical communication interface, extracts frame header features to identify its protocol attribution, then routes the data to the plugin instance corresponding to that protocol type, and calls the corresponding interface to unpack the data frame, finally restoring it into a standardized data structure that can be recognized by the internal business logic of the target instrument device, and then handing it over to the business processing layer to perform the corresponding operations.

[0055] Furthermore, the general protocol parsing platform also supports a multi-protocol coexistence switching mechanism. When a target instrument needs to communicate with multiple target platforms simultaneously, the platform can load multiple protocol parsing plugin instances at the same time, with each plugin independently maintaining its own protocol stack state. The protocol parsing engine assigns a priority level to each plugin, with the priority determined by a combination of real-time data transmission requirements and business importance. When multiple protocols have data to process simultaneously, the protocol parsing engine schedules them according to priority. The platform maintains multiple logical communication channels simultaneously, with each channel independently configured with the currently active protocol type. When switching between different protocols is required, the platform executes a channel switching process, sequentially suspending the context of the current protocol plugin, releasing communication resources, loading the target protocol plugin, and restoring its context. The entire switching process is transparent to upper-layer services, ensuring that business data is not lost due to protocol switching.

[0056] Furthermore, for the protocol versions already distributed to field devices, the cloud server also supports remote iterative updates: when the protocol standard changes or protocol parsing defects need to be fixed, the cloud version management module compares the differences between the old and new versions. If the difference in data volume is less than a preset proportion (e.g., 30%) of the full package data volume, a differential upgrade package is automatically generated and distributed to save bandwidth and power consumption; otherwise, a full upgrade package is distributed. Batch updates of field device protocols can be completed by triggering the above OTA remote upgrade process again, without requiring on-site disassembly or manual intervention.

[0057] Based on the above embodiments, this application also provides a cloud-based collaborative multi-protocol adaptive compatibility system, such as... Figure 2 As shown, the system includes: The control board 01 of the target instrument equipment is used to collect interaction message samples with the target platform, obtain a message sample set, and upload the message sample set to the cloud server; The cloud server 02 is used to call the protocol feature library in the cloud, perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and output the matching degree ranking result; determine the target protocol type and version number based on the matching degree ranking result; generate a target protocol firmware package for the target instrument device based on the target protocol type and the version number; and securely distribute the target protocol firmware package to the control board of the target instrument device. The control board 01 of the target instrument is also used to register the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine, so that the protocol parsing engine processes the uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

[0058] Based on the above embodiments, this application also provides a terminal, the principle block diagram of which can be as follows: Figure 3 As shown, the terminal includes a processor, memory, network interface, and display screen connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a cloud-based collaborative multi-protocol adaptive compatibility method. The display screen can be an LCD screen or an e-ink screen.

[0059] Those skilled in the art will understand that Figure 3 The block diagram shown is only a partial structural diagram related to the solution of this application and does not constitute a limitation on the terminal on which the solution of this application is applied. The specific terminal may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0060] In one implementation, the terminal's memory stores one or more programs, and these programs are configured to be executed by one or more processors, and the programs include instructions for performing a cloud-based collaborative multi-protocol adaptive compatibility method.

[0061] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0062] In summary, this application discloses a multi-protocol adaptive compatibility method, system, terminal, and storage medium based on cloud collaboration. The method includes: collecting interaction message samples between the target meter device's control board and the target platform to obtain a message sample set, and uploading the message sample set to a cloud server; calling a protocol feature library in the cloud through the cloud server, performing multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputting a matching degree ranking result; determining the target protocol type and version number based on the matching degree ranking result; generating a target protocol firmware package for the target meter device based on the target protocol type and version number; securely distributing the target protocol firmware package to the control board of the target meter device; registering the protocol parsing plugin corresponding to the target protocol firmware package to a protocol parsing engine through the control board of the target meter device, enabling the protocol parsing engine to process the uplink and downlink data between the target meter device and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package. This application is applicable to the automatic identification and adaptation process of communication protocols between terminal metering devices such as smart water meters and smart electricity meters and different management platforms.

[0063] It should be understood that the application of this application is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.

Claims

1. A cloud-based collaborative multi-protocol adaptive compatibility method, characterized in that, The method includes: The message sample set is obtained by collecting interaction message samples between the target instrument and the target platform through the control board of the target instrument and the target platform, and then the message sample set is uploaded to the cloud server. The cloud server calls the protocol feature library in the cloud to perform multi-dimensional weighted matching between the multi-dimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputs the matching degree ranking result; the target protocol type and version number are determined according to the matching degree ranking result; a target protocol firmware package is generated for the target instrument device according to the target protocol type and the version number; and the target protocol firmware package is securely distributed to the control board of the target instrument device. The control board of the target instrument device registers the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine, so that the protocol parsing engine processes the uplink and downlink data between the target instrument device and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

2. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 1, characterized in that, The multidimensional protocol features include: frame header features, checksum features, data bit format features, and response logic features.

3. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 2, characterized in that, The elements of the protocol feature template in the protocol feature library include: frame header identifier field, checksum algorithm type, data bit length rule, and response timeout threshold.

4. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 3, characterized in that, The steps of performing multidimensional weighted matching between the multidimensional protocol features extracted from the message sample set and the protocol feature templates in the protocol feature library, and outputting the matching degree ranking results, include: For each message sample in the message sample set, the similarity of the frame header features, checksum features, data bit format features, and response logic features corresponding to the message sample with the elements corresponding to each protocol feature template in the protocol feature library is calculated, and the similarity of each element is weighted and summed to obtain the comprehensive matching degree of each protocol feature template. The matching degree ranking result is output based on the comprehensive matching degree of each protocol feature template.

5. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 1, characterized in that, The steps for determining the target protocol type and version number based on the matching degree ranking results include: If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the first matching degree threshold, then the target protocol type and the version number are determined according to the protocol feature template corresponding to the highest overall matching degree value; If the highest overall matching degree value in the matching degree ranking result is greater than or equal to the second matching degree threshold and less than the first matching degree threshold, a secondary verification process is triggered, causing the control board of the target instrument device to upload several new message samples and obtain a new matching degree ranking result. The steps of determining the target protocol type and version number based on the matching degree ranking result are then executed. If the number of times the secondary verification process is triggered reaches a preset number threshold, the target protocol type and version number are determined based on the highest overall matching degree value in the latest matching degree ranking result. Wherein, the second matching degree threshold is less than the first matching degree threshold. If all the overall matching scores in the matching score ranking results are lower than the second matching score threshold, a downgrade process is triggered. A new protocol feature template corresponding to the current message sample is generated through manual parsing and field annotation and stored in the protocol feature library.

6. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 1, characterized in that, The steps of generating a target protocol firmware package for the target instrument device according to the target protocol type and the version number include: Retrieve the corresponding protocol parsing code framework based on the target protocol type and the version number; The target protocol firmware package is generated based on the hardware model parameters of the target instrument and the protocol parsing code framework.

7. The cloud-based collaborative multi-protocol adaptive compatibility method according to claim 1, characterized in that, The steps of securely sending the target protocol firmware package to the control board of the target instrument device include: The target protocol firmware package is securely delivered to the control board of the target instrument device via encrypted OTA remote upgrade.

8. A cloud-based collaborative multi-protocol adaptive compatibility system, characterized in that, The system includes: The control board of the target instrument is used to collect interaction message samples with the target platform, obtain a message sample set, and upload the message sample set to the cloud server; The cloud server is used to call the protocol feature library in the cloud, perform multi-dimensional weighted matching of the multi-dimensional protocol features extracted from the message sample set with the protocol feature templates in the protocol feature library, and output the matching degree ranking result; determine the target protocol type and version number based on the matching degree ranking result; generate a target protocol firmware package for the target instrument device based on the target protocol type and version number; and securely distribute the target protocol firmware package to the control board of the target instrument device. The control board of the target instrument is also used to register the protocol parsing plugin corresponding to the target protocol firmware package to the protocol parsing engine, so that the protocol parsing engine processes the uplink and downlink data between the target instrument and the target platform based on the protocol parsing plugin corresponding to the target protocol firmware package.

9. A terminal, characterized in that, The terminal includes a memory and one or more processors; the memory stores one or more programs; the programs contain instructions for executing the cloud-based collaborative multi-protocol adaptive compatibility method as described in any one of claims 1 to 7; the processors are used to execute the programs.

10. A computer-readable storage medium storing a plurality of instructions thereon, characterized in that, The instructions are applicable to be loaded and executed by a processor to implement the steps of the cloud-based collaborative multi-protocol adaptive compatibility method as described in any one of claims 1 to 7.