Gateway data processing method, electronic equipment and readable storage medium

By receiving and processing IoT device data in the gateway, combining command sources and configuration files, data queue management is optimized, and the gateway's data processing efficiency is solved in complex environments, achieving efficient and stable data transmission and device compatibility.

CN120378444APending Publication Date: 2025-07-25QINGDAO HAIER AIR CONDITIONING ELECTRONICS CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510051264.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing gateway data processing methods are difficult to cope with the increasingly complex network environment and changing data traffic patterns, resulting in low processing efficiency, low accuracy, high maintenance costs, and unable to meet the data processing needs in large-scale and complex scenarios.

Method used

The preset gateway receives commands, combined with IoT device parameters and server configuration files, and sends commands to the command queue according to the command source and preset processing rules, achieving a standardized and orderly processing process, and optimizing data packaging through data query cycles and number of reporting times to ensure accurate issuance and execution of instructions.

Benefits of technology

It improves data transmission efficiency, enhances network stability and system compatibility, reduces energy consumption, ensures system stability and predictability, and extends the service life of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378444A_ABST
    Figure CN120378444A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of industrial Internet of Things, and provides a gateway data processing method, electronic equipment and a readable storage medium, and the method comprises the steps: receiving a command through employing a preset gateway; wherein the preset gateway is obtained by configuration based on the collected Internet of Things equipment parameters and a configuration file obtained from the server, and the command is generated by the server based on Internet of Things equipment data reported by the preset gateway; and according to the source of the command, in combination with a preset command processing rule, sending the command to a command queue, and taking out the corresponding command from the command queue for execution. According to the method, the defect that the processing efficiency is low as gateway data processing is difficult to deal with increasingly complex network environments and variable data flow modes is overcome, the method can better adapt to the complex environments, the reliability and continuity of data transmission are ensured, and the data transmission efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial Internet of Things, and in particular to a method for processing gateway data, an electronic device, and a readable storage medium. Background Art

[0002] With the rapid development of Internet of Things technology, the gateway, as a bridge connecting different devices and networks, undertakes functions such as data transmission and protocol conversion. The existing gateway data processing mainly relies on the gateway to transmit the data of Internet of Things devices (such as sensors, actuators, etc.) collected to the cloud or other data processing centers, and receive the instructions returned from the cloud or other data processing centers to control the devices according to the instructions.

[0003] However, the Internet of Things gateway faces many challenges in processing data from a large number of Internet of Things devices, such as diverse data types, large format differences, high real-time requirements, large data processing volume, high security guarantee requirements, etc. In addition, the above gateway data processing method mainly relies on WiFi modules or cellular communication modules, etc. The energy consumption of the WiFi module is relatively high and is not suitable for scenarios powered by batteries for a long time. The cost and power consumption of the cellular communication module are relatively high and are not suitable for low-cost scenarios with a large number of nodes deployed. Therefore, it is difficult to cope with the increasingly complex network environment and changing data traffic patterns, and there are often problems such as slow processing speed, low accuracy, and high maintenance costs, which cannot meet the data processing requirements in large-scale and complex scenarios. Summary of the Invention

[0004] The present invention provides a method for processing gateway data, an electronic device, and a readable storage medium, which are used to solve the defect that it is difficult for the existing gateway data processing to cope with the increasingly complex network environment and changing data traffic patterns, resulting in low processing efficiency, and can better adapt to complex environments, ensure the reliability and continuity of data transmission, and improve data transmission efficiency.

[0005] The present invention provides a method for processing gateway data, including: receiving a command by using a preset gateway; wherein, the preset gateway is previously configured based on the parameters of the Internet of Things devices collected and the configuration file obtained from the server, and the command is generated by the server based on the data of the Internet of Things devices reported by the preset gateway; according to the source of the command, combining with the preset command processing rules, sending the command to the command queue, and taking out the corresponding command from the command queue to execute.

[0006] It should be noted that by using the preset gateway to receive commands, according to the source of the commands, combined with the preset command processing rules, the commands are sent to the command queue, so that the entire command processing process is clear and well-regulated, enabling commands from different sources to enter the corresponding command queues for processing according to the established rules, avoiding the chaos of command processing, and to a certain extent alleviating the system processing pressure that may be caused by sudden commands, ensuring that each command is executed in the most appropriate way, improving the accuracy of command execution, and meeting the various different operation requirements of the system to the greatest extent. In addition, since different Internet of Things devices often have differences in functions, communication protocols, data formats, etc., by collecting the parameters of the Internet of Things devices and configuring the preset gateway in combination with the configuration files obtained from the server, the gateway is closely adapted to the characteristics of specific Internet of Things devices, and can adapt to the changes of the system at any time, realizing accurate data interaction and control, enhancing the compatibility of the entire system with various devices, improving the data transmission efficiency, reducing the energy consumption, and enhancing the network stability.

[0007] According to the gateway data processing method provided by the present invention, according to the source of the commands, combined with the preset command processing rules, the commands are sent to the command queue, and the corresponding commands are taken out from the command queue for execution, including: based on the commands coming from the preset server, according to the preset command processing rules, the commands are sent to the command queue, and the corresponding commands are taken out from the command queue for execution, and the process restart is triggered; based on the commands coming from the preset service platform, according to the preset command processing rules, the commands are sent to the command queue, and the corresponding commands are taken out from the command queue for execution.

[0008] It should be noted that by clearly operating according to the source of the commands and the preset command processing rules, the entire command processing process forms a set of standardized and orderly processes. Whether the commands come from the preset server or the preset service platform, they enter the command queue according to the established path, avoiding the randomness of command processing, and helping to maintain the stability and predictability of system operation; by setting corresponding rules for different sources, it can better adapt to the characteristics of their respective application scenarios to accurately meet the command execution requirements in different business scenarios.

[0009] According to the gateway data processing method provided by the present invention, taking out the corresponding commands from the command queue for execution includes: checking whether there are updated commands in the command queue according to the preset data query period; determining the updated commands in the checked command queue, obtaining the corresponding updated commands and parsing them to obtain the distribution address; and sending the update instructions for execution according to the distribution address.

[0010] It should be noted that by presetting the data query period to check whether there are updated commands in the command queue, it is possible to avoid monitoring the command queue too frequently, thereby reasonably allocating system resources. After discovering that there are updated commands in the command queue, obtain and parse them to get the distribution address, so as to ensure that the instructions can be accurately conveyed to the target location, and issue corresponding instructions according to the distribution address, thereby realizing the accurate issuance and execution of the instructions.

[0011] According to a gateway data processing method provided by the present invention, after issuing an update instruction according to the distribution address for execution, or after determining that there are no updated commands in the checked command queue, it further includes: traversing the configuration file based on a preset query method, reading data and caching it; wherein, the preset query method is configured based on the previously obtained data query requirements.

[0012] It should be noted that the preset query method is configured based on the previously obtained data query requirements. The data query requirements are configured according to the key information such as the parameters and operating status of each Internet of Things device that the preset service platform needs to understand, providing a data basis for the accurate monitoring, analysis and decision-making of the subsequent preset service platform; in addition, selectively reading and caching data according to the preset query method, storing the currently useful data in the cache, saving the cache space, avoiding problems such as cache overflow caused by caching too much useless data, improving the utilization rate and effectiveness of the cache. At the same time, reducing unnecessary data reading operations also reduces the read and write frequency of storage devices (such as hard disks, etc.), extends the service life of the storage devices, and saves the energy consumption of the devices to a certain extent, which has a positive impact on the long-term stable operation of the entire system and the sustainable utilization of resources.

[0013] According to a gateway data processing method provided by the present invention, after traversing the configuration file and reading data based on the preset query method, it includes: based on the reporting times being 0, packing the read data into full-volume data, sending the full-volume packed data to the data queue, and incrementing the reporting times by 1; based on the reporting times being non-zero, comparing the data read this time with the previously cached data, packing the change values exceeding the dead zone range set by the configuration file and the values read corresponding to the preset reporting fields into variable data, sending the variable-packed data to the data queue, and incrementing the reporting times by 1; using the MQTT thread to report the packed data in the data queue.

[0014] It should be noted that different data packaging methods are configured according to the reporting times to improve the accuracy of the reported data. When the reporting times is 0, full - volume data is packaged and sent to the data queue to ensure that the preset service platform receives a complete data set for the first time, facilitating the preset service platform to comprehensively understand key information such as the basic parameters and initial operating status of each Internet of Things device, providing a complete data basis for subsequent precise monitoring, analysis, and decision - making, and avoiding problems such as inaccurate device status judgment or unreasonable control instructions caused by missing initial data. When the reporting times is non - zero, only the change values exceeding the dead - zone range set in the configuration file and the values read corresponding to the preset reporting fields are packaged and reported as variable data to avoid repeated transmission of a large amount of data that has not actually changed, reducing the processing burden of a large amount of repeated and unchanged data, enabling the preset service platform to focus more computing resources on analyzing the system dynamics reflected by these change values, and helping to improve the overall data processing efficiency of the preset service platform.

[0015] According to a gateway data processing method provided by the present invention, after issuing an update instruction according to the issued address and executing it, it further includes: based on a first preset time interval, reading the data of the issued address, packaging the read data, and reporting it.

[0016] It should be noted that by reading the data of the issued address at a first preset time interval and packaging and reporting it to the preset service platform, the preset service platform can timely obtain the latest operating conditions of the target device. Based on the continuously updated latest data, the preset service platform can quickly adjust the subsequent command - issuing content or strategy, enabling the entire system to flexibly change according to the actual situation, better cope with various internal and external factor changes, such as environmental changes and device failures, and improving the survival ability and working efficiency of the system in a complex and changeable environment.

[0017] According to a gateway data processing method provided by the present invention, after issuing an update instruction according to the issued address, it includes: if the update command is a software upgrade instruction, determining whether to upgrade using the software upgrade package in the software upgrade instruction according to the software upgrade parameters in the software upgrade instruction, and based on the software upgrade parameters being characterized as upgrade parameters, using the software upgrade package to perform software upgrade on the motherboard of the preset gateway; wherein, the software upgrade parameters are used to characterize whether to upgrade according to the software upgrade package. If the update command is a configuration file upgrade instruction, determining whether to upgrade using the file upgrade package in the configuration file upgrade instruction according to the file upgrade parameters in the configuration file upgrade instruction, and based on the file upgrade parameters being characterized as upgrade parameters, using the file upgrade package to perform software upgrade on the configuration file; wherein, the file upgrade parameters are used to characterize whether to upgrade according to the file upgrade package.

[0018] It should be noted that since not every software upgrade package is applicable to the actual situation of the current gateway motherboard, due to reasons such as network fluctuations and temporary device failures, the software upgrade instructions previously sent by the preset server may not have been successfully executed. Therefore, by determining the software version based on the reported data through the preset service platform to determine whether an upgrade is needed, and thus determining the software upgrade parameters, it is possible to avoid blindly updating the software of the preset gateway motherboard, enabling reasonable allocation of resources and concentrating them on situations where upgrades are truly required. Similarly, by upgrading the configuration file in a similar upgrade method, it is possible to avoid blindly upgrading the configuration file, reduce the operating burden of the device, and extend the service life of the device.

[0019] According to a gateway data processing method provided by the present invention, using a software upgrade package to perform software upgrade on the motherboard of a preset gateway, including: reading the motherboard machine code, the software identifier of the motherboard, and reading the software upgrade package data; comparing the machine code of the read software upgrade package with the motherboard machine code, and based on the consistency of the machine codes, controlling to enter the boot mode, or, based on the inconsistency of the machine codes, comparing the software identifier of the read software upgrade package with the software identifier of the motherboard, and based on the consistency of the software identifiers, controlling to enter the boot mode; based on the successful entry into the boot mode, obtaining the message start address and length from the motherboard, and based on the message start address and length, sending the software upgrade package data to the motherboard.

[0020] It should be noted that during the upgrade process, first read the motherboard machine code, software identifier, and software upgrade package data, and perform corresponding comparisons to ensure that it is possible to accurately determine whether the software upgrade package matches the motherboard of the preset gateway; when the machine codes are inconsistent, further compare the software identifiers, and based on the consistency of the software identifiers, control to enter the boot mode to reconfirm the compatibility between the upgrade package and the motherboard at the software level; after entering the boot mode, according to the process of obtaining the message start address and length from the motherboard and sending the software upgrade package data based on this, the specific operation steps during the upgrade process are further refined, enabling the software upgrade package data to be accurately and completely transmitted to the motherboard for updating, ensuring the correct writing of the upgrade data, avoiding problems such as data loss and misalignment, guaranteeing the integrity and accuracy of the software upgrade at the underlying data level, contributing to achieving a smooth and stable software upgrade effect, enabling the motherboard to be successfully updated to the new software version, and maintaining or improving its functional performance.

[0021] The present invention also provides a gateway data processing device, including: a command receiving module, which uses a preset gateway to receive commands; wherein, the preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the commands are generated by the server based on the Internet of Things device data reported by the preset gateway; a command processing module, which, according to the source of the command, combines the preset command processing rules, sends the command to the command queue, and takes out the corresponding command from the command queue for execution.

[0022] It should be noted that the command receiving module uses the preset gateway to receive commands, so that the command processing module can send the commands to the command queue according to the source of the commands and in combination with the preset command processing rules, making the entire command processing process clear, regular and orderly. Commands from different sources can enter the corresponding command queues for processing according to the established rules, avoiding the chaos of command processing, and alleviating to a certain extent the system processing pressure that may be caused by command bursts, ensuring that each command is executed in the most appropriate way, improving the accuracy of command execution, and meeting the various different operation requirements of the system to the greatest extent. In addition, since different Internet of Things devices often have differences in functions, communication protocols, data formats, etc., by collecting the Internet of Things device parameters and combining the configuration file obtained from the server to configure the preset gateway, the gateway can be closely fitted to the characteristics of specific Internet of Things devices, and can adapt to the changes of the system at any time, realizing accurate data interaction and control, enhancing the compatibility of the entire system with various devices, improving the data transmission efficiency, reducing the energy consumption, and enhancing the network stability.

[0023] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the gateway data processing method as described in any one of the above are implemented.

[0024] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the gateway data processing method as described in any one of the above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without making creative efforts based on the embodiments in the present invention belong to the scope of protection of the present invention.

[0026] Figure 1Flow schematic diagram of a gateway data processing method of the present invention. The method includes: S11. Using a preset gateway to receive a command. The preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server. The command is generated by the server based on the Internet of Things device data reported by the preset gateway. S12. According to the source of the command, combining with the preset command processing rules, sending the command to the command queue and taking out the corresponding command from the command queue for execution.

[0027] It should be noted that the step numbers "S1N" in this specification do not represent the sequence of the gateway data processing method. The following specifically combines Figure 2 to describe the gateway data processing method of the present invention.

[0028] S11. Using a preset gateway to receive a command. The preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server. The command is generated by the server based on the Internet of Things device data reported by the preset gateway.

[0029] In an alternative embodiment, referring to Figure 2 , before using the preset gateway configured previously to receive a command, it includes: through the main process, obtaining the configuration file from the preset service platform. The configuration file is encrypted by the preset service platform based on the preset encryption algorithm; decrypting the configuration file based on the preset decryption algorithm to obtain the decrypted configuration file; embedding the previously obtained Internet of Things device parameters into the corresponding parameter positions in the decrypted configuration file to obtain the target configuration file and loading it.

[0030] It should be noted that the configuration file is configured based on the communication protocol between Internet of Things devices, data format conversion rules, enabling and disabling of functional modules, etc. The preset gateway sends the Internet of Things device data to the preset service platform for the preset service platform to determine the corresponding configuration file based on the Internet of Things device data, so as to return the corresponding configuration file to the preset gateway for precise adaptation of the configuration file according to different Internet of Things device types, operating scenarios and real-time requirements, and combining with the preset gateway to decrypt the configuration file and embedding the Internet of Things device parameters into the decrypted configuration file to obtain a complete configuration file. Through this unified configuration file loading mechanism, it is convenient to update the configuration file in a timely manner when the Internet of Things system needs to be functionally extended, vulnerability repaired or performance optimized, greatly reducing the workload and cost of on-site maintenance.

[0031] It should be added that the preset encryption algorithm and the preset decryption algorithm can be selected based on actual design requirements, and the preset encryption algorithm and the preset decryption algorithm are mutually inverse. The encryption key and the decryption key are related, and the parameter rules and algorithm rules of the algorithms also need to be consistent, so as to encrypt the Internet of Things device data (plaintext) reported by the preset gateway using the encryption key through the preset encryption algorithm, and reverse the encrypted ciphertext back to the original plaintext using the decryption key through the preset decryption algorithm.

[0032] In addition, the Internet of Things device parameters include reported data parsing parameters, control command parsing parameters, serial communication protocol (Modbus protocol, abbreviated as modbus) connection parameters, and device reading addresses; obtaining the configuration file from the preset service platform can be done by calling the corresponding interface.

[0033] It should be noted that obtaining the configuration file from the preset service platform is done in the initialization state. After loading the configuration file, it is also possible to consider whether the configuration file needs to be upgraded. Specifically, the method of upgrading the configuration file can be referred to in the following text. Also, before obtaining the configuration file from the preset service platform, it is necessary to consider whether the software needs to be upgraded. Specifically, the software upgrade method can be referred to in the following text, and it will not be repeated here.

[0034] In addition, in the initialization state, before upgrading the software, the method further includes: creating a data queue and a command queue through the basic data processing module, and initializing the data queue and the command queue. Correspondingly, after obtaining the target configuration file conversion, it further includes: loading the target configuration file into the memory of the basic data processing module.

[0035] Furthermore, before obtaining the configuration file from the preset service platform, it includes: determining whether there is a configuration file in the main process. If there is, directly decrypt the configuration file based on the preset decryption algorithm; otherwise, obtain the configuration file from the preset service platform.

[0036] In an alternative embodiment, in the initialization state, especially after obtaining and loading the target configuration file, or after upgrading the configuration file, it further includes: checking whether there is a local cache database. If not, create a local cache database; otherwise, do not create it. It should be added that the local cache database can be configured according to the hardware capabilities of the local preset gateway, such as the lightweight database SQLite, etc., and will not be further limited here.

[0037] In an alternative embodiment, in the initialization state, for example, after obtaining and loading the target configuration file, or after upgrading the configuration file, it further includes: opening the Modbus 485 port, starting the Modbus thread, the lightweight communication protocol (Message Queuing Telemetry Transport, abbreviated as MQTT) thread based on the publish / subscribe mode, the task scheduling thread, and the Socket thread. Among them, the Modbus thread is mainly used to execute data query tasks, which involves the execution of commands sent by the MQTT thread in the command queue. For details, please refer to the following text; the MQTT thread includes a first mqtt sub-thread placed in the watchdog process and a second mqtt sub-thread placed in the main process. The second mqtt sub-thread is mainly used to send commands issued by the preset service platform, such as configuration file upgrade instructions, command issuance instructions, and log switch instructions, to the command queue and monitor the data queue and report the data in the data queue. The first mqtt sub-thread is mainly used to send software upgrade instructions obtained based on the preset service platform to the command queue; the task thread is mainly used to report data read by traversing the configuration file based on a preset query method, delete expired data, check memory and CPU usage. For reporting data read by traversing the configuration file based on a preset query method, please refer to the following text and will not be repeated here; the Socket thread is mainly used to send software upgrade instructions issued by the preset server to the command queue, execute the commands and trigger the process to restart to achieve the software upgrade effect. For details, please refer to the following text.

[0038] S12. According to the source of the command, combined with the preset command processing rules, send the command to the command queue and retrieve the corresponding command from the command queue for execution.

[0039] It should be added that the preset command processing rules are configured in advance based on the command and the corresponding command processing rules.

[0040] Specifically, according to the source of the command, combined with the preset command processing rules, send the command to the command queue and retrieve the corresponding command from the command queue for execution, including: based on the command originating from the preset server, according to the preset command processing rules, send the command to the command queue, retrieve the corresponding command from the command queue for execution, and trigger the process to restart; based on the command originating from the preset service platform, according to the preset command processing rules, send the command to the command queue and retrieve the corresponding command from the command queue for execution.

[0041] It should be noted that by operating in clear accordance with the source of the command and the preset command processing rules, the entire command processing process forms a set of standardized and orderly procedures. Whether the command comes from the preset server or the preset service platform, it enters the command queue along the established path, avoiding the randomness of command processing and contributing to maintaining the stability and predictability of system operation. By setting corresponding rules for different sources, it can better adapt to the characteristics of their respective application scenarios to accurately meet the command execution requirements in different business scenarios.

[0042] It should be added that the preset server can adopt a socket server to receive software update instructions sent by the watchdog process and send commands to the preset gateway. The preset gateway uses a socket thread to push the software upgrade instructions into the command queue and uses a Modbus thread to retrieve and execute the corresponding commands from the command queue. Specifically, it can refer to the following description. The software upgrade method can refer to the following description and will not be repeated here.

[0043] In addition, the preset service platform can adopt a Hypertext Transfer Protocol (HTTP) service platform. The preset gateway uses an MQTT thread to send commands to the command queue and uses a Modbus thread to retrieve and execute the corresponding commands from the command queue. Specifically, it can refer to the following description. The upgrade method of the configuration file can refer to the following description and will not be repeated here.

[0044] Furthermore, the MQTT thread includes a first mqtt sub-thread and a second mqtt sub-thread. Sending the command to the command queue according to the preset command processing rules includes: if the command is a software upgrade instruction, then according to the preset command processing rules, use the first mqtt sub-thread to send the software upgrade instruction to the command queue; otherwise, according to the preset command processing rules, use the second mqtt sub-thread to send the software upgrade instruction to the command queue.

[0045] In addition, retrieving the corresponding command from the command queue for execution includes: checking whether there is an updated command in the command queue according to the preset data query period; determining the updated command in the checked command queue, obtaining the corresponding updated command and parsing it to obtain the distribution address; and sending the update instruction for execution according to the distribution address.

[0046] It should be noted that by using the preset data query period to check whether there is an updated command in the command queue, it is possible to avoid monitoring the command queue situation too frequently, thereby reasonably allocating system resources. When an updated command is found in the command queue, it is obtained and parsed to obtain the distribution address to ensure that the instruction can be accurately conveyed to the target location, and the corresponding instruction is sent according to the distribution address, thus realizing the accurate sending and execution of the instruction.

[0047] Further, after the update instruction is sent according to the sent address, it includes: if the update command is a software upgrade instruction, determine whether to upgrade using the software upgrade package in the software upgrade instruction according to the software upgrade parameters in the software upgrade instruction, and based on the software upgrade parameters characterized as upgrade parameters, use the software upgrade package to perform software upgrade on the motherboard of the preset gateway; wherein, the software upgrade parameters are used to characterize whether it is necessary to upgrade according to the software upgrade package; if the update command is a configuration file upgrade instruction, determine whether to upgrade using the file upgrade package in the configuration file upgrade instruction according to the file upgrade parameters in the configuration file upgrade instruction, and based on the file upgrade parameters characterized as upgrade parameters, use the file upgrade package to perform software upgrade on the configuration file; wherein, the file upgrade parameters are used to characterize whether it is necessary to upgrade according to the file upgrade package.

[0048] It should be noted that since not every software upgrade package is applicable to the actual situation of the current gateway motherboard, the software upgrade instruction sent by the previous preset server may not be successfully executed due to reasons such as network fluctuations and temporary device failures. Therefore, by determining whether to upgrade based on the software version determined by the preset service platform according to the reported data, and thus determining the software upgrade parameters, it is possible to avoid blindly updating the software of the preset gateway motherboard, enabling reasonable allocation of resources and concentrating them on situations that truly require upgrading. Similarly, by upgrading the configuration file in a similar upgrade manner, it is possible to avoid blindly upgrading the configuration file, reduce the operating burden of the device, and extend the service life of the device.

[0049] It is worth noting that the software upgrade instruction can be obtained by the preset gateway calling the platform interface based on the first preset time period. At this time, the command sent by the preset service platform can be sent to the command queue through the second mqtt sub-thread, and the process restart can be triggered by the Modbus thread to achieve software update; the first preset time period can be configured based on the software upgrade requirements, so as to regularly obtain the software upgrade instruction and avoid the situation where the instruction actively sent by the preset service platform fails to be upgraded. No further limitation is made here.

[0050] In addition, the configuration file upgrade instruction can be actively sent by the preset service platform, or the configuration file upgrade instruction can be obtained by the preset gateway calling the server interface from the preset service platform based on the second preset time period, and the command sent by the server is sent to the data queue through the first mqtt sub-thread; the second preset time period can be configured based on the upgrade requirements of the configuration file, so as to regularly obtain the configuration file upgrade instruction and avoid the situation where the configuration file upgrade actively sent by the preset service platform fails. No further limitation is made here.

[0051] Furthermore, before performing a software upgrade on the motherboard of a preset gateway using a software upgrade package based on the software upgrade parameters characterized as upgrade parameters, the following steps are included: Based on the software upgrade parameters characterized as upgrade parameters, call the serial port to read the current program mode of the motherboard in the communication protocol; According to the current program mode of the motherboard, determine whether the motherboard device status needs to be upgraded and whether the current program mode of the motherboard allows for an upgrade, obtaining an upgrade judgment result; Based on the upgrade judgment result being an upgrade, send a wireless communication interface request to a preset service platform; Receive the software upgrade package and software upgrade parameters returned by the preset service platform based on the wireless communication interface request.

[0052] In addition, performing a software upgrade on the motherboard of a preset gateway using a software upgrade package includes: Reading the motherboard machine code, software identifier of the motherboard, and reading the software upgrade package data; Comparing the machine code of the read software upgrade package with the motherboard machine code, and based on the machine codes being the same, control to enter the boot mode, or, based on the machine codes being different, compare the software identifier of the read software upgrade package with the software identifier of the motherboard, and based on the software identifiers being the same, control to enter the boot mode; Based on successfully entering the boot mode, obtain the message start address and length from the motherboard, and based on the message start address and length, send the software upgrade package data to the motherboard.

[0053] It should be added that the software upgrade package data includes the machine code of the software upgrade package, firmware version, number of motherboards supported for upgrade by the firmware package, number of preset binary format files, and software identifier. The preset binary format can be the bin format, and no further limitation is made here.

[0054] In addition, during the upgrade process, first read the motherboard machine code, software identifier, and software upgrade package data, and perform corresponding comparisons to ensure that it can accurately judge whether the software upgrade package matches the motherboard of the preset gateway; When the machine codes are different, further compare the software identifiers, and based on the software identifiers being the same, control to enter the boot mode to reconfirm the compatibility between the upgrade package and the motherboard at the software level; After entering the boot mode, according to the process of obtaining the message start address and length from the motherboard and sending the software upgrade package data based on this, the specific operation steps during the upgrade process are further refined, enabling the software upgrade package data to be accurately and completely transmitted to the motherboard for update, ensuring the correct writing of the upgrade data, avoiding problems such as data loss and misalignment, guaranteeing the integrity and accuracy of the software upgrade at the underlying data level, contributing to achieving a smooth and stable software upgrade effect, allowing the motherboard to be successfully updated to a new software version, and maintaining or enhancing its functional performance.

[0055] Furthermore, controlling entry into the boot mode includes: sending a boot mode entry instruction to the baseboard and receiving a status code returned by the baseboard based on the boot mode instruction; performing corresponding control according to the communication protocol in combination with the status code to enter the boot mode. It should be added that the control method needs to be determined according to the specific communication protocol. For example, when the communication protocol is OTA and the status code is E7, the corresponding control is to switch to the slave station, respond to the instruction baud rate, and enter the boot mode after sending is completed.

[0056] In addition, obtaining the message start address and length from the baseboard and sending the read software upgrade package data to the baseboard based on the message start address and length includes: sending data to the baseboard and receiving the message start address and length returned by the baseboard based on the sent data; obtaining data from the read software upgrade package according to the message start address and length and sending it to the baseboard through the serial port, and continuing this sending action until the baseboard sends an end instruction or an error instruction to end the sending; if the baseboard sends an end instruction, the upgrade is successful and the boot mode is exited, and if the baseboard sends a failure instruction, an attempt is made to resend.

[0057] In addition, after the upgrade is completed, it further includes: receiving the status code data returned after each Internet of Things device is upgraded and packaging and sending it to the data queue for the first mqtt sub-thread to report it to the preset service platform.

[0058] In an alternative embodiment, before executing the command taken out from the command queue, it includes: connecting to the baseboard according to the baseboard connection parameters in the configuration file. It should be added that the baseboard connection parameters include baud rate, data bits, parity mode, stop bits, etc. In addition, the port address is fixed for each model of the module.

[0059] To achieve periodic data query, after executing the update instruction according to the issued address, or after determining that there is no updated command in the command queue to be checked, it further includes: traversing the configuration file based on the preset query method, reading the data and caching it; where the preset query method is configured based on the previously obtained data query requirements.

[0060] It should be noted that the preset query method is configured based on the data query requirements obtained in advance. The data query requirements are configured according to the key information such as the parameters and operating status of each Internet of Things device that the preset service platform needs to understand, providing a data basis for the subsequent precise monitoring, analysis, and decision-making of the preset service platform. Additionally, data is selectively read and cached according to the preset query method, and the useful data at present is stored in the cache, saving cache space and avoiding problems such as cache overflow caused by caching too much useless data, improving the utilization rate and effectiveness of the cache. At the same time, unnecessary data reading operations are reduced, thereby reducing the read and write frequency of storage devices (such as hard disks, etc.), extending the service life of the storage devices, and saving the energy consumption of the devices to a certain extent, which has a positive impact on the long-term stable operation of the entire system and the sustainable utilization of resources.

[0061] Furthermore, based on the preset query method, traverse the configuration file, read the data and cache it, including: based on the preset query method, determine the address bit to be queried; traverse the address bits to be queried in the configuration file, read the corresponding address bits, and write them into the key of the point table that was previously created and stored in the cache database according to the preset point table rules. Additionally, when traversing each address bit to be queried, if the reading time exceeds the time threshold, it is regarded as a reading timeout, and this point may be abnormal and is marked; the preset query method can be determined according to the actual point rules involved and the created point table, and no further limitation is made here.

[0062] In an alternative embodiment, after executing the update instruction according to the issued address, it further includes: based on the first preset time interval, read the data of the issued address, package the read data, and report it.

[0063] It should be noted that by reading the data of the issued address at the first preset time interval and packaging and reporting it to the preset service platform, the preset service platform can timely obtain the latest operating conditions of the target device. The preset service platform can quickly adjust the subsequent command issuance content or strategy based on the continuously updated latest data, enabling the entire system to flexibly change according to the actual situation and better cope with various internal and external factor changes, such as environmental changes and device failures, improving the survival ability and working efficiency of the system in a complex and changeable environment.

[0064] It should be added that the first preset time interval can be configured based on the actual time required for instruction issuance. For example, it can be 20 ms, etc., and no further limitation is made here. After the instruction issuance is completed, the data at the issued address is read to ensure that the changed data after the execution of the instruction is packaged and uploaded. In addition, the read data is packaged and reported to the preset service platform, including: sending the packaged data to the data queue through the Modbus thread; using mqtt in the main process to report the packaged data in the data queue to the server side.

[0065] In an alternative embodiment, after traversing the configuration file and reading data based on a preset query method, it includes: based on the reporting count being 0, performing full-volume data packaging on the read data, sending the fully packaged data to the data queue, and incrementing the reporting count by 1; based on the reporting count being non-zero, comparing the data read this time with the data cached previously, performing variable data packaging on the change values exceeding the dead zone range set in the configuration file and the values read corresponding to the preset reporting fields, sending the variably packaged data to the data queue, and incrementing the reporting count by 1; using the MQTT thread to report the packaged data in the data queue.

[0066] It should be noted that by configuring different data packaging methods for the reporting count, the accuracy of the reported data is improved. When the reporting count is 0, full-volume data packaging is performed and sent to the data queue to ensure that the preset service platform receives a complete dataset for the first time, facilitating the preset service platform to comprehensively understand key information such as the basic parameters and initial operating status of each Internet of Things device, providing a complete data basis for subsequent precise monitoring, analysis, and decision-making, and avoiding problems such as inaccurate device status judgment or unreasonable control instructions caused by missing initial data; when the reporting count is non-zero, only the change values exceeding the dead zone range set in the configuration file and the values read corresponding to the preset reporting fields are packaged and reported as variable data to avoid repeated transmission of a large amount of data that has not actually changed, reducing the processing burden of a large amount of repeated and unchanged data, enabling the preset service platform to focus more computing resources on analyzing the system dynamics reflected by these change values, and helping to improve the overall data processing efficiency of the preset service platform.

[0067] In addition, the above-mentioned packaging of data and sending the packaged data to the data queue can be achieved through the task thread, and reporting the packaged data in the data queue to the preset service platform can be achieved through mqtt in the main process. In addition, data packaging can be performed based on a preset period. For example, data reporting is performed every once in a while, and the preset period can be set according to actual design requirements. For example, it can be 30 seconds, and no further limitation is made here.

[0068] Further, when performing full - volume data packaging or variable data packaging, the data to be packaged is parsed according to the reported data parsing parameters in the configuration file, and is packaged separately by device to obtain the packaged data.

[0069] In addition, the task thread is also used to reset the reporting count to 0 when the number of reporting times reaches the target number.

[0070] In an optional embodiment, when sending the packaged data to the data queue, the packaged data is also synchronized to the local cache database.

[0071] In summary, the embodiment of the present invention uses a preset gateway to receive commands, and according to the source of the commands, combines the preset command processing rules to send the commands to the command queue, so that the entire command processing process is clear and well - regulated, enabling commands from different sources to enter the corresponding command queue for processing according to the established rules, avoiding the chaos of command processing, and alleviating to a certain extent the system processing pressure that may be caused by sudden commands, ensuring that each command is executed in the most appropriate way, improving the accuracy of command execution, and meeting the various different operation requirements of the system to the greatest extent. In addition, since different Internet of Things devices often have differences in functions, communication protocols, data formats, etc., by collecting Internet of Things device parameters and configuring the preset gateway in combination with the configuration file obtained from the server, the gateway is closely fitted to the characteristics of specific Internet of Things devices, and can adapt to system changes at any time, realizing accurate data interaction and control, enhancing the compatibility of the entire system with various devices, improving data transmission efficiency, reducing energy consumption, and enhancing network stability.

[0072] Next, the gateway data processing device provided by the present invention will be described. The gateway data processing device described below can be correspondingly referred to the gateway data processing method described above.

[0073] Figure 3 The structure diagram of a gateway data processing device is shown. The device includes: A command receiving module 31, which uses a preset gateway to receive commands; wherein, the preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the commands are generated by the server based on the Internet of Things device data reported by the preset gateway; A command processing module 32, which according to the source of the commands, combines the preset command processing rules, sends the commands to the command queue, and takes out the corresponding commands from the command queue for execution.

[0074] In an alternative embodiment, the device further includes: a file acquisition module that, before receiving a command using a pre-configured preset gateway, obtains a configuration file from a preset service platform through a main process, where the configuration file is encrypted by the preset service platform based on a preset encryption algorithm; a file decryption module that decrypts the configuration file based on a preset decryption algorithm to obtain a decrypted configuration file; and a file loading module that embeds the previously obtained Internet of Things device parameters into the corresponding parameter positions in the decrypted configuration file to obtain a target configuration file and loads it.

[0075] It should be added that in the initialization state, the device further includes: a basic data processing module that creates a data queue and a command queue and initializes the data queue and the command queue. Correspondingly, the file loading module is further configured to: after obtaining the converted target configuration file, load the target configuration file into the memory of the basic data processing module.

[0076] Furthermore, the device further includes: a file judgment module that, before obtaining a configuration file from a preset service platform, determines whether a configuration file exists in the main process. If it exists, the configuration file is directly decrypted based on a preset decryption algorithm; otherwise, the configuration file is obtained from the preset service platform.

[0077] In an alternative embodiment, in the initialization state, especially after obtaining and loading the target configuration file, or after upgrading the configuration file, the device further includes: a database creation module that checks whether a cache database exists locally. If not, it creates a local cache database; otherwise, it does not create one.

[0078] In an alternative embodiment, in the initialization state, for example, after obtaining and loading the target configuration file, or after upgrading the configuration file, the device further includes: a thread startup module that opens the Modbus 485 port and starts the Modbus thread, the lightweight communication protocol (Message Queuing Telemetry Transport, abbreviated as MQTT) thread based on the publish / subscribe mode, the timed task management (task) thread, and the socket thread. Among them, the Modbus thread is mainly used to execute data query tasks, which involves the execution of commands sent by the MQTT thread in the command queue. For details, please refer to the following text; the MQTT thread includes a first mqtt sub-thread placed in the watchdog process and a second mqtt sub-thread placed in the main process. The second mqtt sub-thread is mainly used to send commands issued by the preset service platform, such as configuration file upgrade instructions, command issuance instructions, and log switch instructions, to the command queue and monitor the data queue and report the data in the data queue. The first mqtt sub-thread is mainly used to send software upgrade instructions obtained from the preset service platform to the command queue; the task thread is mainly used to report data read by traversing the configuration file based on a preset query method, delete expired data, view memory and CPU usage. For details on reporting data read by traversing the configuration file based on a preset query method, please refer to the following text and will not be repeated here; the socket thread is mainly used to send software upgrade instructions issued by the preset server to the command queue, execute commands and trigger process restart to achieve the software upgrade effect. For details, please refer to the following text.

[0079] In this embodiment, the command processing module 32 is configured to: based on the command originating from the preset server, according to the preset command processing rules, send the command to the command queue, retrieve the corresponding command from the command queue for execution, and trigger process restart; based on the command originating from the preset service platform, according to the preset command processing rules, send the command to the command queue, and retrieve the corresponding command from the command queue for execution.

[0080] Furthermore, the MQTT thread includes a first mqtt sub-thread and a second mqtt sub-thread; the command processing module 32 is further configured to: if the command is a software upgrade instruction, according to the preset command processing rules, use the first mqtt sub-thread to send the software upgrade instruction to the command queue; otherwise, according to the preset command processing rules, use the second mqtt sub-thread to send the software upgrade instruction to the command queue.

[0081] In addition, the command processing module 32 includes: a command checking unit that checks whether there is an updated command in the command queue according to a preset data query period; an address obtaining unit that determines the updated command in the checked command queue, obtains the corresponding updated command and parses it to obtain a sending address; and a command sending unit that sends an update instruction according to the sending address for execution.

[0082] Furthermore, the command processing module 32 further includes: a command execution unit that, after sending an update instruction according to the sending address, if the updated command is a software upgrade instruction, determines whether to upgrade using the software upgrade package in the software upgrade instruction according to the software upgrade parameters in the software upgrade instruction, and based on the software upgrade parameters being characterized as upgrade parameters, uses the software upgrade package to perform software upgrade on the motherboard of the preset gateway; wherein, the software upgrade parameters are used to characterize whether an upgrade is required according to the software upgrade package; if the updated command is a configuration file upgrade instruction, determines whether to upgrade using the file upgrade package in the configuration file upgrade instruction according to the file upgrade parameters in the configuration file upgrade instruction, and based on the file upgrade parameters being characterized as upgrade parameters, uses the file upgrade package to perform software upgrade on the configuration file; wherein, the file upgrade parameters are used to characterize whether an upgrade is required according to the file upgrade package.

[0083] Even further, the command execution unit includes: a mode reading subunit that, before performing software upgrade on the motherboard of the preset gateway using the software upgrade package based on the software upgrade parameters being characterized as upgrade parameters, calls a serial port based on the software upgrade parameters being characterized as upgrade parameters to read the current program mode of the motherboard in the communication protocol; an upgrade judgment subunit that determines whether the motherboard device status needs to be upgraded and whether the current program mode of the motherboard allows an upgrade according to the current program mode of the motherboard to obtain an upgrade judgment result; a request sending subunit that sends a wireless communication interface request to a preset service platform based on the upgrade judgment result being an upgrade; and an instruction receiving subunit that receives the software upgrade package and software upgrade parameters returned by the preset service platform based on the wireless communication interface request.

[0084] In addition, the command execution unit further includes: a data reading subunit that reads the machine number of the motherboard and the software identifier of the motherboard and reads the software upgrade package data; a mode control subunit that compares the machine number of the read software upgrade package with the machine number of the motherboard, and based on the machine numbers being the same, controls entry into the boot mode, or, based on the machine numbers being different, compares the software identifier of the read software upgrade package with the software identifier of the motherboard, and based on the software identifiers being the same, controls entry into the boot mode; an upgrade subunit that, based on successful entry into the boot mode, obtains the message start address and length from the motherboard, and based on the message start address and length, sends the software upgrade package data to the motherboard.

[0085] Furthermore, the mode control subunit includes: an instruction sending sub-subunit that sends a boot mode instruction to the backplane and receives a status code returned by the backplane based on the boot mode instruction; a mode control sub-subunit that executes corresponding control according to the communication protocol and in combination with the status code to enter the boot mode.

[0086] In addition, the upgrade subunit includes: a data acquisition sub-subunit that sends data to the backplane and receives the message start address and length returned by the backplane based on the sent data; a data sending sub-subunit that, according to the message start address and length, obtains data from the read software upgrade package and sends it to the backplane through the serial port, and continues this sending action until the backplane sends an end instruction or an error instruction to end the sending; if the backplane sends an end instruction, the upgrade is successful and the boot mode is exited, if the backplane sends a failure instruction, an attempt is made to resend.

[0087] In addition, the upgrade subunit further includes: a data packaging sub-subunit that, after the upgrade is completed, receives the status code data returned by each Internet of Things device after the upgrade is completed and packages and sends it to the data queue for the first mqtt sub-thread to report it to the preset service platform.

[0088] In an alternative embodiment, the device further includes: a backplane connection module that connects to the backplane according to the backplane connection parameters in the configuration file before executing the command taken out from the command queue.

[0089] In order to implement periodic data query, the command processing module 32 further includes: a data query unit that, after executing the update instruction according to the issued address, or after determining that there is no update command in the checked command queue, traverses the configuration file based on a preset query method, reads the data and caches it; wherein the preset query method is configured based on the previously obtained data query requirements.

[0090] Further, the data query unit includes: a query condition acquisition sub-subunit that determines the address bits to be queried based on the preset query method; a query sub-subunit that traverses the address bits to be queried in the configuration file, reads the corresponding address bits, and writes them into the key of the point table created and stored in the cache database in advance according to the preset point table rules.

[0091] In an alternative embodiment, the command processing module 32 further includes: a data reporting unit that, after executing the update instruction according to the issued address, reads the data of the issued address based on a first preset time interval, packages and reports the read data.

[0092] In an alternative embodiment, the data reporting unit is further configured to: after traversing the configuration file based on a preset query method and reading the data, if the reporting count is 0, perform full-volume data packaging on the read data, send the fully packaged data to the data queue, and increment the reporting count by 1; if the reporting count is non-zero, compare the data read this time with the data cached previously, perform variable data packaging on the change values that exceed the dead zone range set in the configuration file and the values read corresponding to the preset reporting fields, send the variably packaged data to the data queue, and increment the reporting count by 1; use the MQTT thread to report the packaged data in the data queue.

[0093] In an alternative embodiment, the command processing module 32 further includes: synchronize the cache in the same way, and when sending the packaged data to the data queue, also synchronize the packaged data to the local cache database.

[0094] In summary, in the embodiment of the present invention, the command receiving module uses a preset gateway to receive commands, and the command processing module sends the commands to the command queue according to the source of the commands in combination with the preset command processing rules, so that the entire command processing process is clear, standardized and orderly, enabling commands from different sources to enter the corresponding command queues for processing according to the established rules, avoiding the chaos of command processing, and to a certain extent alleviating the system processing pressure that may be caused by sudden commands, ensuring that each command is executed in the most appropriate way, improving the accuracy of command execution, and meeting the various different operation requirements of the system to the greatest extent. In addition, since different Internet of Things devices often have differences in functions, communication protocols, data formats, etc., by collecting the parameters of the Internet of Things devices and configuring the preset gateway in combination with the configuration file obtained from the server, the gateway is closely adapted to the characteristics of specific Internet of Things devices, can adapt to the changes of the system at any time, realizes accurate data interaction and control, enhances the compatibility of the entire system with various devices, improves the data transmission efficiency, reduces the energy consumption, and enhances the network stability.

[0095] Figure 4 Illustrates a schematic physical structure diagram of an electronic device, such as Figure 4As shown in the figure, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communications interface 420, and the memory 430 complete their mutual communication through the communication bus 440. The processor 410 can call the logical instructions in the memory 430 to execute the gateway data processing method, which includes: receiving a command using a preset gateway; where the preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the command is generated by the server based on the Internet of Things device data reported by the preset gateway; according to the source of the command, combining the preset command processing rules, sending the command to the command queue, and taking out the corresponding command from the command queue for execution.

[0096] In addition, when the logical instructions in the above-mentioned memory 430 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0097] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the gateway data processing method provided by the above-mentioned various methods. The method includes: receiving a command using a preset gateway; where the preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the command is generated by the server based on the Internet of Things device data reported by the preset gateway; according to the source of the command, combining the preset command processing rules, sending the command to the command queue, and taking out the corresponding command from the command queue for execution.

[0098] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the gateway data processing method provided above. The method includes: receiving a command by using a preset gateway; wherein the preset gateway is configured in advance based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the command is generated by the server based on the Internet of Things device data reported by the preset gateway; according to the source of the command, combining with the preset command processing rules, sending the command to the command queue, and taking out the corresponding command from the command queue to execute.

[0099] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0100] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or equivalently replace some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A gateway data processing method, characterized in that, Including: Receiving a command by using a preset gateway; wherein, the preset gateway is previously configured based on the collected Internet of Things device parameters and the configuration file obtained from the server, and the command is generated by the server based on the Internet of Things device data reported by the preset gateway; According to the source of the command, combining with a preset command processing rule, sending the command to a command queue, and taking out the corresponding command from the command queue for execution.

2. The gateway data processing method according to claim 1, wherein According to the source of the command, combining with a preset command processing rule, sending the command to a command queue, and taking out the corresponding command from the command queue for execution, including: Based on the command originating from a preset server, according to the preset command processing rule, sending the command to the command queue, taking out the corresponding command from the command queue for execution, and triggering a process restart; Based on the command originating from a preset service platform, according to the preset command processing rule, sending the command to the command queue, and taking out the corresponding command from the command queue for execution.

3. The gateway data processing method according to claim 2, wherein Taking out the corresponding command from the command queue for execution, including: Checking whether there is an updated command in the command queue according to a preset data query period; Determining the updated command in the checked command queue, obtaining the corresponding updated command and parsing it to obtain a sending address; Sending the updated instruction to the corresponding address for execution according to the sending address.

4. The gateway data processing method according to claim 3, wherein, After sending the updated instruction to the corresponding address for execution according to the sending address, or after determining that there is no updated command in the checked command queue, further including: Traversing the configuration file based on a preset query method, reading data and caching it; wherein, the preset query method is configured based on the previously obtained data query requirements.

5. The gateway data processing method according to claim 4, wherein After traversing the configuration file and reading data based on a preset query method, including: Based on the reporting times being 0, packing the read data into full-volume data, sending the full-volume packed data to the data queue, and incrementing the reporting times by 1; Based on the reporting times being non-zero, comparing the data read this time with the previously cached data, packing the change values exceeding the dead zone range set by the configuration file and the values read from the preset reporting fields into variable data, sending the variable-packed data to the data queue, and incrementing the reporting times by 1; Using an MQTT thread to report the packed data in the data queue.

6. The gateway data processing method according to claim 3, wherein After sending the updated instruction to the corresponding address for execution according to the sending address, further including: Reading the data at the sending address based on a first preset time interval, packing the read data and reporting it.

7. The gateway data processing method according to claim 3, wherein After sending the updated instruction to the corresponding address according to the sending address, including: If the updated command is a software upgrade instruction, determining whether to upgrade by using the software upgrade package according to the software upgrade parameters in the software upgrade instruction, and based on the software upgrade parameters being characterized as upgrade parameters, using the software upgrade package to perform software upgrade on the motherboard of the preset gateway; wherein, the software upgrade parameters are used to characterize whether to upgrade according to the software upgrade package. If the update command is a configuration file upgrade instruction, determine whether to upgrade using the file upgrade package in the configuration file upgrade instruction according to the file upgrade parameters in the configuration file upgrade instruction, and based on the file upgrade parameters being characterized as upgrade parameters, use the file upgrade package to perform software upgrade on the configuration file; wherein, the file upgrade parameters are used to characterize whether it is necessary to upgrade according to the file upgrade package.

8. The gateway data processing method according to claim 7, characterized in that Using the software upgrade package to perform software upgrade on the motherboard of the preset gateway includes: Reading the motherboard serial number and the software identifier of the motherboard and reading the software upgrade package data; Comparing the serial number of the read software upgrade package with the motherboard serial number, and based on the serial numbers being the same, controlling to enter the boot mode, or, based on the serial numbers being different, comparing the software identifier of the read software upgrade package with the software identifier of the motherboard, and based on the software identifiers being the same, controlling to enter the boot mode; Based on the successful entry into the boot mode, obtaining the message start address and length from the motherboard, and based on the message start address and length, sending the software upgrade package data to the motherboard.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that When the processor executes the computer program, it implements the steps of the gateway data processing method according to any one of claims 1 to 8.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the gateway data processing method according to any one of claims 1 to 8.