WO2023226277A1 - Internet of things gateway data transmission method and device, server, client and storage medium - Google Patents

Internet of things gateway data transmission method and device, server, client and storage medium Download PDF

Info

Publication number
WO2023226277A1
WO2023226277A1 PCT/CN2022/124712 CN2022124712W WO2023226277A1 WO 2023226277 A1 WO2023226277 A1 WO 2023226277A1 CN 2022124712 W CN2022124712 W CN 2022124712W WO 2023226277 A1 WO2023226277 A1 WO 2023226277A1
Authority
WO
WIPO (PCT)
Prior art keywords
sensor node
message
node data
data
buffer
Prior art date
Application number
PCT/CN2022/124712
Other languages
French (fr)
Chinese (zh)
Inventor
宁磊
洪启俊
梅逢城
陈勇
曹建民
Original Assignee
深圳技术大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳技术大学 filed Critical 深圳技术大学
Publication of WO2023226277A1 publication Critical patent/WO2023226277A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/0278Traffic management, e.g. flow control or congestion control using buffer status reports
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/16Gateway arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the present invention relates to the technical field of Internet of Things data transmission, and in particular to a method, device, server, client and storage medium for Internet of Things gateway data transmission.
  • the IoT gateway is a bridge that connects IoT devices and the IoT cloud platform, and enables two-way communication with the IoT cloud platform.
  • the NB-IoT gateway has become another choice for the wireless communication technology of the Internet of Things due to its low cost, large connection, low power consumption, and wide coverage.
  • the embedded software of NB-IoT gateway usually adopts a bare-metal single-cycle execution scheme, that is, performing data collection, data processing, and data reporting in one cycle.
  • the reliability of this scheme is easily affected by the network environment. For example, during data transmission Data may be lost due to network delays during the process, which is unacceptable for sensor nodes that require accurate reporting of data at regular intervals.
  • the sensor cannot perform collection or the gateway cannot receive and process data from the sensor node, which will also lead to data loss and reduce the integrity of the data transmission process.
  • this solution cannot guarantee the accessibility or real-time performance of data transmission at the application layer. A failure may occur on the link from when the gateway receives sensor node data to when it is transmitted to the cloud platform, resulting in permanent data loss and short-term consequences. or prolonged transmission failure.
  • Embodiments of the present invention provide a data transmission method, device, server, client and storage medium for an Internet of Things gateway, which can improve the reliability of data transmission and the continuity and stability of gateway services.
  • an embodiment of the present invention provides a method for data transmission by an Internet of Things gateway, including:
  • Collect sensor node data store the sensor node data in a buffer, and initialize a retransmission timer and a message identifier, where the retransmission timer and the message identifier correspond to the sensor node , the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
  • the retransmission timer and the message identifier are reset according to the search result, and the sensor node data in the buffer is cleared; in one embodiment, if the message confirmation bitmap contains the message identifier, reset the retransmission timer and the message identifier, and clear the sensor node data in the buffer.
  • an embodiment of the present invention provides a device for data transmission by an Internet of Things gateway, including:
  • the first processing module is used to collect sensor node data, store the sensor node data in a buffer, and initialize a retransmission timer and a message identifier, where the retransmission timer and the message identifier are both consistent with Corresponding to the sensor node, the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to process the sensor node data stored in the buffer. logo;
  • the second processing module is used to scan the buffer to find sensor node data that meets the sending conditions, and store the sensor node data that meets the sending conditions in the message queue;
  • a third processing module configured to read the sensor node data from the message queue and send the sensor node data
  • the fourth processing module is used to receive the message confirmation bitmap and search for the message identifier in the message confirmation bitmap;
  • a fifth processing module configured to reset the retransmission timer and the message identifier according to the search result, and clear the sensor node data in the buffer.
  • an embodiment of the present invention provides an electronic device, including a memory and a processor.
  • the memory stores a computer program.
  • the processor executes the computer program, the above-mentioned Internet of Things gateway data transmission in the first aspect is implemented.
  • embodiments of the present invention provide a computer-readable storage medium, the storage medium stores a program, and the program is executed by a processor to implement the above-mentioned first aspect of the Internet of Things gateway data transmission method.
  • Embodiments of the present invention at least include the following beneficial effects: by introducing an embedded real-time operating system and adopting shared buffer memory and message queue, in addition to realizing the traditional collection-processing-reporting model, it also realizes based on the multi-task scheduling mechanism
  • the decoupling of data collection and data reporting can improve the reliability of data transmission; while using buffers and queues to achieve data decoupling, a retransmission mechanism is introduced, and the cloud platform notifies the gateway of data transmission through message bitmaps. Retransmission of unconfirmed messages can further improve the reliability of data transmission; by introducing health checks and hierarchical recovery mechanisms, the continuity and stability of NB-IoT gateway services can also be improved.
  • Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.
  • Figure 2 is a schematic diagram of the NB-IoT gateway data transmission process in the method according to the embodiment of the present invention
  • Figure 3 is a schematic flow chart of the data collection task in the method according to the embodiment of the present invention.
  • Figure 4 is a schematic flow chart of the buffer scanning task in the method according to the embodiment of the present invention.
  • Figure 5 is a schematic flow chart of the data reporting task in the method according to the embodiment of the present invention.
  • Figure 6 is a schematic flowchart of the health check task in the method according to the embodiment of the present invention.
  • Figure 7 is a schematic flow chart of cloud platform message confirmation in the method according to the embodiment of the present invention.
  • Figure 8 is a schematic flow chart of data sending and confirmation in the method according to the embodiment of the present invention.
  • Figure 9 is a schematic diagram of the device according to the embodiment of the present invention.
  • Figure 10 is a schematic diagram of an electronic device according to an embodiment of the present invention.
  • At least one means one or more, plural means two or more, greater than, less than, exceeding, etc. are understood to exclude the original number, and above, below, within, etc. are understood to include the original number. If there is a description of first and second, it is only for the purpose of distinguishing technical features and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the order of indicated technical features. relation.
  • NB-IoT The full name is Narrow Band Internet of Things. It is a cellular-based narrowband Internet of Things technology and the best connection technology for Low Power Wide Area Internet of Things (LPWA), carrying smart homes, smart travel, smart cities, etc.
  • LPWA Low Power Wide Area Internet of Things
  • the basic connection tasks of the smart world are widely used in many aspects such as smart meters, smart parking, smart street lights, smart agriculture, white home appliances, etc. It is one of the basic connection technologies in the 5G era.
  • NB-IoT gateway An intelligent gateway based on NB-IoT technology.
  • the Internet of Things network is usually not a simple IP network. It often involves the integration of multiple networks.
  • IP network as the core, multiple heterogeneous networks are connected for communication and data exchange.
  • Many industrial devices support RS-485 serial network connections and use the MODBUS protocol for data reporting and control.
  • the IoT server in the IP network communicates with these industrial devices through an intelligent gateway.
  • the intelligent gateway implements the MODBUS and MQTT protocols.
  • NB-IoT module refers to the wireless communication module of the NB-IoT gateway.
  • the wireless communication module is a modular component that integrates chips, memory, power amplifier devices, antenna interfaces, functional interfaces, etc. on the circuit board to realize wireless communication. Wave transceiver, channel noise filtering and conversion between analog signals and digital signals. IoT terminals access the network through wireless communication modules to meet data wireless transmission requirements. Wireless communication modules are key equipment for realizing the intelligent connection of all things.
  • Cloud platform also called cloud computing platform, refers to services based on hardware resources and software resources, providing computing, network and storage capabilities.
  • Figure 1 is a schematic flowchart of a method according to an embodiment of the present invention, including but not limited to the following steps:
  • Step S100 Collect sensor node data, store the sensor node data in the buffer, and initialize the retransmission timer and message identifier.
  • the retransmission timer and message identifier correspond to the sensor node, and the retransmission timer is To trigger the retransmission of sensor node data through timing, the message identifier is used to identify the sensor node data stored in the buffer.
  • Step S200 Scan the buffer to find sensor node data that satisfies the sending condition, and store the sensor node data that satisfies the sending condition in the message queue.
  • Step S300 Read sensor node data from the message queue and send the sensor node data.
  • Step S400 Receive the message confirmation bitmap, and search the message identifier in the message confirmation bitmap.
  • Step S500 Reset the retransmission timer and message identifier according to the search result, and clear the sensor node data in the buffer.
  • the NB-IoT gateway collects data from IoT devices that need to be uploaded to the cloud platform by mounting sensor nodes, that is, sensor node data.
  • IoT devices refer to terminal devices in IoT application scenarios, such as street lights, water meters, shared bicycles, logistics containers, air monitors, etc., which have the characteristics of low power consumption, wide area range, small amount of data transmitted, and low update frequency.
  • IoT terminal equipment The sensor node data written into the buffer is bound to a retransmission timer and message ID (message identifier). When the retransmission timer meets the preset conditions, the corresponding data will be retransmitted and a message will be assigned to the data.
  • the ID is used to sort them in the order they are stored in the buffer.
  • the message confirmation bitmap is a message confirmation response packet sent by the cloud platform.
  • the NB-IoT gateway performs message confirmation by receiving the feedback message confirmation bitmap and checking whether the message ID of the sent data is recorded in the message confirmation bitmap. That is, it is judged whether the reported data is reachable and whether data retransmission needs to be performed.
  • the technical solution of the embodiment of the present invention can divide the data transmission tasks responsible for the NB-IoT gateway into three parts: data collection tasks, buffer scanning tasks and data reporting tasks.
  • a health check task which is an independent task and does not participate in the transmission of data flows.
  • the embodiment of the present invention introduces an embedded real-time operating system and adopts the method of shared buffer memory and message queue. In addition to realizing the traditional collection-processing-reporting model, it also realizes data collection and data reporting based on the multi-task scheduling mechanism. Decoupling can improve the reliability of data transmission.
  • step S100 may include but is not limited to the following steps:
  • Step S101 Collect sensor node data based on the first time interval.
  • Step S102 Write the sensor node data into the buffer data block.
  • Step S103 Initialize the retransmission timer of the buffer data block to zero.
  • Step S104 Increase the value of the message identifier of the buffer data block.
  • FIG. 3 it is a schematic flow chart of the data collection task in the method of the embodiment of the present invention, in which the first time interval is the collection frequency of sensor node data, that is, the delay period at the end of the task. , here it is set to wake up the data collection task after a delay of ten seconds; after collection, the sensor node data is written into the buffer data block, and the retransmission timing bound to the buffer data block is also written together with the data content.
  • the first time interval is the collection frequency of sensor node data, that is, the delay period at the end of the task.
  • the device and message identifier initialize the retransmission timer of the buffer data block, and set the flag bit of the retransmission timer to zero, which means that the data block is to be sent; at the beginning of the NB-IoT gateway starting the data collection task, The initial message identifier is zero.
  • the message ID of the buffer data block is gradually increased, representing the order in which the sensor node data is stored in the buffer.
  • step S200 may include but is not limited to the following steps:
  • Step S201 Scan the buffer based on the second time interval to find sensor node data that meets the sending conditions.
  • Step S202 If the retransmission timer is zero or the retransmission timer reaches the retransmission time limit, confirm that the sensor node data meets the sending conditions.
  • Step S203 Write the sensor node data that meets the sending conditions into the message queue.
  • FIG. 4 it is a schematic flowchart of a buffer scanning task in the method of an embodiment of the present invention.
  • the buffer scanning task is a periodic scanning task, and the second time interval is between two scanning tasks.
  • the time interval can be set according to the needs of the Internet of Things application scenario and the performance of the device; during the scan period, the sensor node data that meets the sending conditions is found by traversing the buffer; the current buffer data block is determined Whether the corresponding retransmission timer meets the conditions.
  • One condition is that the flag bit of the retransmission timer is zero, and the other condition is that the flag bit of the retransmission timer reaches the retransmission time limit.
  • step S300 may include but is not limited to the following steps:
  • Step S301 Scan the message queue based on the third time interval. If the message queue is not empty, read the sensor node data.
  • Step S302 Parse, encapsulate and send sensor node data.
  • the message queue is checked and read in a short period of time.
  • the third time interval is the time interval between two scans of the message queue.
  • the data block information in the message queue is read.
  • Perform data analysis on the read data block information to parse out the message ID and data content, then format and encapsulate the message ID, data content, device ID and other information according to the json format, and finally control the NB-IoT module through AT commands.
  • the group executes data reporting, that is, sends the data package to the cloud platform.
  • step S400 may include but is not limited to the following steps:
  • Step S401 Receive message confirmation bitmap.
  • Step S402 Calculate the bitmap subscript of the message identifier based on the message identifier.
  • Step S403 Determine whether there is a bitmap subscript in the message acknowledgment bitmap. If so, confirm that the message acknowledgment bitmap contains the message identifier.
  • the NB-IoT module is controlled through AT commands to receive the message confirmation bitmap from the cloud platform; by calculating the bitmap subscript of the message identifier, it is determined whether the message ID of the sent buffer data block to be confirmed is in the message confirmation In the bitmap, if it exists, it means that the data block has been confirmed to be delivered to the cloud platform.
  • the method for calculating the bitmap subscript of the message identifier is: perform a modulo operation on the message ID in the buffer, convert the modulo message ID into binary, and right-shift the binary message ID by 3 bits to obtain Array subscript, use the array subscript to find the corresponding 8-bit data in the message confirmation bitmap.
  • the message ID is modulated by 8 and ANDed with the 8-bit data just fetched. If the result of the AND is not 0, it means that the message ID exists in the message confirmation bitmap, and the data corresponding to the message ID is confirmed to be delivered. If it is 0, it means that the message ID does not exist in the message confirmation bitmap, which means that the data corresponding to the message ID has not been sent to the cloud platform.
  • step S500 may include but is not limited to the following steps:
  • Step S501 If the message confirmation bitmap contains a message identifier, set both the retransmission timer and the message identifier to negative one.
  • Step S502 Clear the sensor node data in the buffer.
  • the flag bit and message ID of the retransmission timer of the buffer data block are reset. In this embodiment, respectively Set it to negative one; and clear the buffer data block, that is, release the buffer and clear the sensor node data in the buffer.
  • FIG. 5 it is a schematic flow chart of the data reporting task in the method of the embodiment of the present invention.
  • the message queue is not empty. If so, the message queue is consumed, that is, the message queue is read. data block, then process the message ID and device ID in the data header, re-encapsulate the sensor node data and send the data packet to the cloud platform; then, receive the response data, and if the response data is received, perform the next step. If not received, return to continue traversing the message queue; save the message confirmation bitmap sent by the cloud platform; traverse the message ID of the sent data block in the buffer and determine the bitmap subscript of the current message ID to be confirmed.
  • the retransmission timer in the embodiment of the present invention has both timing and flag functions.
  • the variable of this retransmission timer is used to represent a sending status of the data of the buffer block, and only when the variable is greater than Or when it is equal to one, the timer will automatically increment (equivalent to timing). Specifically, there are the following situations:
  • each scanning task will increase the retransmission timer by one, but will not put it into the sending queue (that is, the data will not be sent);
  • the retransmission timer will be set to negative one (indicating that the data block has been sent and the data block is empty).
  • the technical solution of the present invention not only uses buffers and queues to achieve data decoupling, but also introduces a retransmission mechanism.
  • the cloud platform notifies the gateway of data transmission through message bitmaps, and retransmits unconfirmed messages, which can further improve data transmission. Transmission reliability.
  • Step S600 When the serial port communicates normally, detect the network attachment status; when the serial port communicates abnormally, perform a soft reset operation.
  • Step S700 When the network attachment is abnormal, perform an initial network access operation.
  • FIG. 6 it is a schematic flow chart of the health check task in the method of the embodiment of the present invention.
  • it is checked whether the micro control unit MCU program is working normally. If the scheduled dog feeding operation cannot be performed normally, the MCU is reset. operate.
  • Collect the information of the NB-IoT module analyze and judge the health status of the NB-IoT module, and perform the following operations according to the situation of the NB-IoT module:
  • the NB-IoT module is unresponsive as a whole or the serial port communication is abnormal, perform NB -IoT module soft reset operation; the NB-IoT module responds to commands normally, but cannot send data or the network attachment is abnormal, and the network access operation is re-executed.
  • FIG. 7 it is a schematic flow chart of the cloud platform message confirmation in the method of the embodiment of the present invention.
  • the cloud platform uses the bitmap cumulative confirmation method to send the message confirmation bitmap to the NB-IoT gateway.
  • the timing of the cloud platform The schedule will wake up the message confirmation task at regular intervals.
  • the task will group the device ID and device IP port to read the message IDs of the recently received N pieces of data from the data collection log table, and store the N pieces of data.
  • the message ID is modulo 2N and stored in a 2N-sized bitmap.
  • the corresponding message confirmation bitmap is sent to the gateway based on the device IP.
  • the range of the message ID is infinite, but when the logic confirms the message, it is modulo 128, and the confirmation ID that the bitmap can carry must also be 0-127.
  • the message ID reaches 127, it is incremented to 128.
  • the bitmap has overflowed and needs to be modulo 128 to get 0.
  • the data with message ID 0 is still in the buffer of the gateway and needs to be confirmed, it will be compared with 128.
  • the message ID of the message ID collides. So not only the range of confirmation ID is limited to 0-127, but when pulling the received message ID from the database and confirming, the number of message IDs pulled should be less than half of 128, for example, set to 64.
  • the 2N bitmap only stores N pieces of data (or less).
  • infinite message IDs can be processed under this condition.
  • FIG. 8 it is a schematic flow chart of data sending and confirmation in the method according to the embodiment of the present invention, wherein:
  • Step 1 The data collection task writes the collected sensor node data into the buffer, sets the message ID of the buffer data block, and sets the retransmission timer to zero;
  • Step 2 The buffer scanning task traverses the buffer.
  • the retransmission timer of the buffer data block is zero (to be sent) or the retransmission time limit is reached, the data block information is put into the message queue.
  • the retransmission timer of the buffer data block is greater than zero, increase the retransmission timer by one;
  • Step 3 The data reporting task checks and reads the message queue data, and sends the read data blocks. And check the data reception immediately after sending. If the message confirmation bitmap is received from the cloud platform, scan the buffer to send the message ID to be confirmed, calculate the bitmap subscript where the message ID is located, and use bit operations and Confirm with the operation confirmation message bitmap whether there is confirmation information for the message ID. If there is, the retransmission timer of the data block information in the buffer is reset to negative one, the message ID is reset to negative one, and the data content is cleared. .
  • an embodiment of the present invention provides a schematic diagram of a system for data transmission by an Internet of Things gateway, including but not limited to:
  • the first processing module 901 is used to collect sensor node data, store the sensor node data in the buffer, and initialize the retransmission timer and message identifier, where the retransmission timer and message identifier correspond to the sensor node. , the retransmission timer is used to trigger the retransmission of sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
  • the second processing module 902 is used to scan the buffer to find sensor node data that meets the sending conditions, and store the sensor node data that meets the sending conditions in the message queue;
  • the third processing module 903 is used to read sensor node data from the message queue and send sensor node data;
  • the fourth processing module 904 is used to receive the message confirmation bitmap and search for the message identifier in the message confirmation bitmap;
  • the fifth processing module 905 is configured to reset the retransmission timer and the message identifier according to the search result, and clear the sensor node data in the buffer.
  • an embodiment of the present invention provides an electronic device, including a memory 1001 and a processor 1002; the memory 1001 is used to store computer programs; the processor 1002 is used to implement the program when executing the program stored in the memory 1001.
  • the embodiment of the invention provides a data transmission method for an Internet of Things gateway.
  • Embodiments of the present invention also provide a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When run on a computer, the computer is caused to execute the method for data transmission of an Internet of Things gateway provided by embodiments of the present invention. .
  • the memory may include random access memory (Random Access Memory, RAM for short) or non-volatile memory (Non-Volatile Memory, NVM for short), such as at least one disk memory.
  • RAM Random Access Memory
  • NVM Non-Volatile Memory
  • the memory may also be at least one storage device located far away from the aforementioned processor.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; it can also be a digital signal processor (Digital Signal Processing, referred to as DSP) , Application Specific Integrated Circuit (ASIC for short), Field-Programmable Gate Array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
  • CPU Central Processing Unit
  • NP Network Processor
  • DSP Digital Signal Processing
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the above embodiments it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer program instructions When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center via wired means, such as coaxial cable, optical fiber, digital SSL (DSL), or wireless means, such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more available media integrated therein.
  • the available media may be magnetic media, such as floppy disks, hard disks, magnetic tapes, optical media, such as DVDs, or semiconductor media, such as solid state disks (SSD), etc.

Abstract

Embodiments of the present invention provide an Internet of things gateway data transmission method and device, a server, a client and a storage medium. The method comprises: acquiring sensing node data, storing the sensing node data in a buffer area, and initializing a retransmission timer and a message identifier, wherein the retransmission timer and the message identifier both correspond to sensing nodes; scanning the buffer area to find out the sensing node data satisfying a sending condition, and storing the sensing node data satisfying the sending condition in a message queue; reading the sensing node data from the message queue, and sending the sensing node data; receiving a message confirmation bitmap, and searching the message confirmation bitmap for the message identifier; and resetting the retransmission timer and the message identifier according to the search result, and emptying the sensing node data in the buffer area. The method can improve the reliability of data transmission and improve the stability of a gateway service.

Description

物联网网关数据传输的方法、装置、服务器、客户端及存储介质Internet of Things gateway data transmission method, device, server, client and storage medium 技术领域Technical field
本发明涉及物联网数据传输技术领域,特别是涉及一种物联网网关数据传输的方法、装置、服务器、客户端及存储介质。The present invention relates to the technical field of Internet of Things data transmission, and in particular to a method, device, server, client and storage medium for Internet of Things gateway data transmission.
背景技术Background technique
物联网网关是连接物联网设备和物联网云平台的桥梁,并实现与物联网云平台的双向通信。但随着新兴物联网场景的产生,对物联网网关的传输能力与技术提出了更高的要求。而NB-IoT网关因其低成本、大连接、低功耗、广覆盖的特点,使其成为了物联网无线通信技术的又一种选择。The IoT gateway is a bridge that connects IoT devices and the IoT cloud platform, and enables two-way communication with the IoT cloud platform. However, with the emergence of emerging IoT scenarios, higher requirements have been placed on the transmission capabilities and technology of IoT gateways. The NB-IoT gateway has become another choice for the wireless communication technology of the Internet of Things due to its low cost, large connection, low power consumption, and wide coverage.
目前,NB-IoT网关的嵌入式软件通常采用裸机单循环的执行方案,即循环一次执行数据采集,数据处理,数据上报,但是该方案的可靠性容易受到网络环境的影响,例如,在数据传输过程中可能会因网络延迟而导致数据丢失,这对于要求定时精确上报数据的传感节点来而言不可接受的。另外,在网关服务中断期间,传感器无法执行采集或网关无法接收并处理来自传感节点的数据,也会导致数据丢失,以至于降低数据传输过程的完整性。除此之外,该方案无法保证数据在应用层传输的可达性或实时性,在网关接收传感节点数据到传输至云平台这条链路上可能发生故障而导致数据永久丢失,造成短暂或长时间的传输故障。At present, the embedded software of NB-IoT gateway usually adopts a bare-metal single-cycle execution scheme, that is, performing data collection, data processing, and data reporting in one cycle. However, the reliability of this scheme is easily affected by the network environment. For example, during data transmission Data may be lost due to network delays during the process, which is unacceptable for sensor nodes that require accurate reporting of data at regular intervals. In addition, during the interruption of gateway service, the sensor cannot perform collection or the gateway cannot receive and process data from the sensor node, which will also lead to data loss and reduce the integrity of the data transmission process. In addition, this solution cannot guarantee the accessibility or real-time performance of data transmission at the application layer. A failure may occur on the link from when the gateway receives sensor node data to when it is transmitted to the cloud platform, resulting in permanent data loss and short-term consequences. or prolonged transmission failure.
发明内容Contents of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics described in detail in this article. This summary is not intended to limit the scope of the claims.
本发明实施例提供了一种物联网网关数据传输的方法、装置、服务器、客户端及存储介质,能够提高数据传输的可靠性以及网关服务的持续性与稳定性。Embodiments of the present invention provide a data transmission method, device, server, client and storage medium for an Internet of Things gateway, which can improve the reliability of data transmission and the continuity and stability of gateway services.
第一方面,本发明实施例提供了一种物联网网关数据传输的方法,包括:In a first aspect, an embodiment of the present invention provides a method for data transmission by an Internet of Things gateway, including:
采集传感节点数据,存储所述传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,所述重传计时器、所述消息标识符均与所述传感节点相对应,所述重传计时器用于通过计时触发所述传感节点数据的重传,所述消息标识符用于对存入所述缓冲区的所述传感节点数据进行标识;Collect sensor node data, store the sensor node data in a buffer, and initialize a retransmission timer and a message identifier, where the retransmission timer and the message identifier correspond to the sensor node , the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列;在一实施例中,若所述传感节点数据满足发送条件,存储所述传感节点数据于消息队列;Scan the buffer to find sensor node data that satisfies the sending condition, and store the sensor node data that satisfies the sending condition in the message queue; in one embodiment, if the sensor node data satisfies the sending condition, store all the sensor node data that satisfies the sending condition. Describe sensor node data in the message queue;
从所述消息队列中读取所述传感节点数据,并发送所述传感节点数据;Read the sensor node data from the message queue and send the sensor node data;
接收消息确认位图,并于所述消息确认位图中查找所述消息标识符;Receive the message confirmation bitmap and search the message identifier in the message confirmation bitmap;
根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据;在一实施例中,若所述消息确认位图包含所述消息标识符,则重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据。The retransmission timer and the message identifier are reset according to the search result, and the sensor node data in the buffer is cleared; in one embodiment, if the message confirmation bitmap contains the message identifier, reset the retransmission timer and the message identifier, and clear the sensor node data in the buffer.
第二方面,本发明实施例提供了一种物联网网关数据传输的装置,包括:In a second aspect, an embodiment of the present invention provides a device for data transmission by an Internet of Things gateway, including:
第一处理模块,用于采集传感节点数据,存储所述传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,所述重传计时器、所述消息标识符均与所述传感节点相对应,所述重传计时器用于通过计时触发所述传感节点数据的重传,所述消息标识符用于对存入所述缓冲区的所述传感节点数据进行标识;The first processing module is used to collect sensor node data, store the sensor node data in a buffer, and initialize a retransmission timer and a message identifier, where the retransmission timer and the message identifier are both consistent with Corresponding to the sensor node, the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to process the sensor node data stored in the buffer. logo;
第二处理模块,用于扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列;The second processing module is used to scan the buffer to find sensor node data that meets the sending conditions, and store the sensor node data that meets the sending conditions in the message queue;
第三处理模块,用于从所述消息队列中读取所述传感节点数据,并发送所述传感节点数据;A third processing module, configured to read the sensor node data from the message queue and send the sensor node data;
第四处理模块,用于接收消息确认位图,并于所述消息确认位图中查找所述 消息标识符;The fourth processing module is used to receive the message confirmation bitmap and search for the message identifier in the message confirmation bitmap;
第五处理模块,用于根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据。A fifth processing module, configured to reset the retransmission timer and the message identifier according to the search result, and clear the sensor node data in the buffer.
第三方面,本发明实施例提供了一种电子设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述第一方面的物联网网关数据传输的方法。In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the above-mentioned Internet of Things gateway data transmission in the first aspect is implemented. Methods.
第四方面,本发明实施例提供了一种计算机可读存储介质,所述存储介质存储有程序,所述程序被处理器执行实现上述第一方面的物联网网关数据传输的方法。In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium, the storage medium stores a program, and the program is executed by a processor to implement the above-mentioned first aspect of the Internet of Things gateway data transmission method.
本发明实施例至少包括以下有益效果:通过引入嵌入式实时操作系统,采用共享缓冲区内存以及消息队列的方式,在实现传统的采集-处理-上报模型之外,还基于多任务调度机制实现了数据采集和数据上报的解耦,能够提高数据传输的可靠性;在利用缓冲区与队列实现数据解耦的同时,引入重传机制,云平台通过消息位图的方式通知网关数据的传达,将没有进行确认的消息进行重传,能够进一步提高数据传输的可靠性;通过引入健康检查以及分级恢复机制,还可以提高NB-IoT网关服务的持续性与稳定性。Embodiments of the present invention at least include the following beneficial effects: by introducing an embedded real-time operating system and adopting shared buffer memory and message queue, in addition to realizing the traditional collection-processing-reporting model, it also realizes based on the multi-task scheduling mechanism The decoupling of data collection and data reporting can improve the reliability of data transmission; while using buffers and queues to achieve data decoupling, a retransmission mechanism is introduced, and the cloud platform notifies the gateway of data transmission through message bitmaps. Retransmission of unconfirmed messages can further improve the reliability of data transmission; by introducing health checks and hierarchical recovery mechanisms, the continuity and stability of NB-IoT gateway services can also be improved.
附图说明Description of the drawings
图1为本发明实施例的方法的流程示意图;Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention;
图2为本发明实施例的方法中的NB-IoT网关数据传输过程示意图;Figure 2 is a schematic diagram of the NB-IoT gateway data transmission process in the method according to the embodiment of the present invention;
图3为本发明实施例的方法中的数据采集任务的流程示意图;Figure 3 is a schematic flow chart of the data collection task in the method according to the embodiment of the present invention;
图4为本发明实施例的方法中的缓冲区扫描任务的流程示意图;Figure 4 is a schematic flow chart of the buffer scanning task in the method according to the embodiment of the present invention;
图5为本发明实施例的方法中的数据上报任务的流程示意图;Figure 5 is a schematic flow chart of the data reporting task in the method according to the embodiment of the present invention;
图6为本发明实施例的方法中的健康检查任务的流程示意图;Figure 6 is a schematic flowchart of the health check task in the method according to the embodiment of the present invention;
图7为本发明实施例的方法中的云平台消息确认的流程示意图;Figure 7 is a schematic flow chart of cloud platform message confirmation in the method according to the embodiment of the present invention;
图8为本发明实施例的方法中的数据发送与确认的流程示意图;Figure 8 is a schematic flow chart of data sending and confirmation in the method according to the embodiment of the present invention;
图9为本发明实施例的装置示意图;Figure 9 is a schematic diagram of the device according to the embodiment of the present invention;
图10为本发明实施例的电子设备示意图。Figure 10 is a schematic diagram of an electronic device according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
需要理解的是,如果在说明书和权利要求书及上述附图中涉及到方位描述,例如上、下、前、后、左、右等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。It should be understood that if the description, claims and the above-mentioned drawings involve orientation descriptions, such as up, down, front, back, left, right, etc., the orientation or positional relationship is based on the orientation or position shown in the drawings. The positional relationship is only for the convenience of describing the present invention and simplifying the description. It does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention.
需要说明的是,至少一个的含义是一个或者多个,多个的含义是两个以上,大于、小于、超过等理解为不包括本数,以上、以下、以内等理解为包括本数。如果有描述道第一、第二只是用于区分技术特征为目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量或者隐含指明所指示的技术特征的先后关系。It should be noted that at least one means one or more, plural means two or more, greater than, less than, exceeding, etc. are understood to exclude the original number, and above, below, within, etc. are understood to include the original number. If there is a description of first and second, it is only for the purpose of distinguishing technical features and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the order of indicated technical features. relation.
术语解释:Terminology explanation:
NB-IoT:全称Narrow Band Internet of Things,是一种基于蜂窝的窄带物联网技术,也是低功耗广域物联(LPWA)的最佳联接技术,承载着智慧家庭、智慧出行、智慧城市等智能世界的基础联接任务,广泛应用于如智能表计、智慧停车、智慧路灯、智慧农业、白色家电等多个方面,是5G时代下的基础联接技术之一。NB-IoT: The full name is Narrow Band Internet of Things. It is a cellular-based narrowband Internet of Things technology and the best connection technology for Low Power Wide Area Internet of Things (LPWA), carrying smart homes, smart travel, smart cities, etc. The basic connection tasks of the smart world are widely used in many aspects such as smart meters, smart parking, smart street lights, smart agriculture, white home appliances, etc. It is one of the basic connection technologies in the 5G era.
NB-IoT网关:一种基于NB-IoT技术的智能网关。物联网络通常不是一个单纯的IP网络,它往往涉及多个网络的集成,最终以IP网络为核心,将多个异种网络连接起来进行通信和数据交换。很多工业设备支持RS-485串行网络连接,并使用MODBUS协议进行数据上报和接受控制,IP网络中的物联网服务器通 过一个智能网关与这些工业设备进行通信,智能网关实现了MODBUS和MQTT协议的对接,能够让RS-485总线连接的这些设备加入到物联网操作系统或者物联网平台中,因而这些设备可以向IoT服务器上报信息,并且,若IoT服务器需要控制这些设备,可以通过MODBUS协议向这些设备写入控制数据。NB-IoT gateway: An intelligent gateway based on NB-IoT technology. The Internet of Things network is usually not a simple IP network. It often involves the integration of multiple networks. Finally, with the IP network as the core, multiple heterogeneous networks are connected for communication and data exchange. Many industrial devices support RS-485 serial network connections and use the MODBUS protocol for data reporting and control. The IoT server in the IP network communicates with these industrial devices through an intelligent gateway. The intelligent gateway implements the MODBUS and MQTT protocols. Docking allows these devices connected to the RS-485 bus to be added to the IoT operating system or IoT platform, so these devices can report information to the IoT server, and if the IoT server needs to control these devices, it can send these messages to these devices through the MODBUS protocol. The device writes control data.
NB-IoT模组:指NB-IoT网关的无线通信模组,无线通信模组是一种将芯片、存储器、功放器件、天线接口、功能接口等集成于电路板上的模块化组件,实现无线电波收发、信道噪声过滤及模拟信号与数字信号之间相互转换等功能。物联网终端通过无线通信模组接入网络,满足数据无线传输需求,无线通信模组是实现万物智联的关键设备。NB-IoT module: refers to the wireless communication module of the NB-IoT gateway. The wireless communication module is a modular component that integrates chips, memory, power amplifier devices, antenna interfaces, functional interfaces, etc. on the circuit board to realize wireless communication. Wave transceiver, channel noise filtering and conversion between analog signals and digital signals. IoT terminals access the network through wireless communication modules to meet data wireless transmission requirements. Wireless communication modules are key equipment for realizing the intelligent connection of all things.
云平台:也称云计算平台,是指基于硬件资源和软件资源的服务,提供计算、网络和存储能力。Cloud platform: also called cloud computing platform, refers to services based on hardware resources and software resources, providing computing, network and storage capabilities.
参照图1,图1为本发明实施例的方法的流程示意图,包括但不限于以下步骤:Referring to Figure 1, Figure 1 is a schematic flowchart of a method according to an embodiment of the present invention, including but not limited to the following steps:
步骤S100:采集传感节点数据,存储传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,重传计时器、消息标识符均与传感节点相对应,重传计时器用于通过计时触发传感节点数据的重传,消息标识符用于对存入缓冲区的传感节点数据进行标识。Step S100: Collect sensor node data, store the sensor node data in the buffer, and initialize the retransmission timer and message identifier. The retransmission timer and message identifier correspond to the sensor node, and the retransmission timer is To trigger the retransmission of sensor node data through timing, the message identifier is used to identify the sensor node data stored in the buffer.
步骤S200:扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列。Step S200: Scan the buffer to find sensor node data that satisfies the sending condition, and store the sensor node data that satisfies the sending condition in the message queue.
步骤S300:从消息队列中读取传感节点数据,并发送传感节点数据。Step S300: Read sensor node data from the message queue and send the sensor node data.
步骤S400:接收消息确认位图,并于消息确认位图中查找消息标识符。Step S400: Receive the message confirmation bitmap, and search the message identifier in the message confirmation bitmap.
步骤S500:根据查找结果重置重传计时器和消息标识符,并清空所述缓冲区内的传感节点数据。Step S500: Reset the retransmission timer and message identifier according to the search result, and clear the sensor node data in the buffer.
其中,NB-IoT网关通过挂载传感器节点,采集来自物联网设备需要上传至云平台的数据,即传感节点数据。物联网设备是指物联网应用场景中的终端设备,例如,路灯、水表、共享单车、物流集装箱、空气监测仪等,具有低功耗、广域 范围、传输数据量小且更新频率低等特点的物联网终端设备。被写入缓冲区的传感节点数据绑定了重传计时器和消息ID(消息标识符),在重传计时器满足预设条件时将对其对应的数据进行重传,给数据分配消息ID用于将其按照存入缓冲区的先后顺序排序。消息确认位图是由云平台发送的消息确认响应包,NB-IoT网关通过接收反馈的消息确认位图,以及检查消息确认位图中是否记录有已发送数据的消息ID,来进行消息确认,即判断上报的数据是否可达以及是否需要执行数据重传。Among them, the NB-IoT gateway collects data from IoT devices that need to be uploaded to the cloud platform by mounting sensor nodes, that is, sensor node data. IoT devices refer to terminal devices in IoT application scenarios, such as street lights, water meters, shared bicycles, logistics containers, air monitors, etc., which have the characteristics of low power consumption, wide area range, small amount of data transmitted, and low update frequency. IoT terminal equipment. The sensor node data written into the buffer is bound to a retransmission timer and message ID (message identifier). When the retransmission timer meets the preset conditions, the corresponding data will be retransmitted and a message will be assigned to the data. The ID is used to sort them in the order they are stored in the buffer. The message confirmation bitmap is a message confirmation response packet sent by the cloud platform. The NB-IoT gateway performs message confirmation by receiving the feedback message confirmation bitmap and checking whether the message ID of the sent data is recorded in the message confirmation bitmap. That is, it is judged whether the reported data is reachable and whether data retransmission needs to be performed.
具体的,如图2所示,本发明实施例的技术方案可以将NB-IoT网关负责的数据传输任务分为三部分:数据采集任务、缓冲区扫描任务和数据上报任务,除此之外,还有健康检查任务,该任务为独立任务不参与数据流的传输。本发明实施例通过引入嵌入式实时操作系统,采用共享缓冲区内存以及消息队列的方式,在实现传统的采集-处理-上报模型之外,还基于多任务调度机制实现了数据采集和数据上报的解耦,能够提高数据传输的可靠性。Specifically, as shown in Figure 2, the technical solution of the embodiment of the present invention can divide the data transmission tasks responsible for the NB-IoT gateway into three parts: data collection tasks, buffer scanning tasks and data reporting tasks. In addition, There is also a health check task, which is an independent task and does not participate in the transmission of data flows. The embodiment of the present invention introduces an embedded real-time operating system and adopts the method of shared buffer memory and message queue. In addition to realizing the traditional collection-processing-reporting model, it also realizes data collection and data reporting based on the multi-task scheduling mechanism. Decoupling can improve the reliability of data transmission.
在一些实施例中,步骤S100可以包括但不限于以下步骤:In some embodiments, step S100 may include but is not limited to the following steps:
步骤S101:基于第一时间间隔采集传感节点数据。Step S101: Collect sensor node data based on the first time interval.
步骤S102:将传感节点数据写入缓冲区数据块。Step S102: Write the sensor node data into the buffer data block.
步骤S103:初始化缓冲区数据块的重传计时器为零。Step S103: Initialize the retransmission timer of the buffer data block to zero.
步骤S104:增加缓冲区数据块的消息标识符的数值。Step S104: Increase the value of the message identifier of the buffer data block.
作为一种示例,如图3所示,为本发明实施例的方法中数据采集任务的流程示意图,其中,第一时间间隔为传感节点数据的采集频率,即任务结束时的延时时间段,此处设置为延时十秒后唤醒数据采集任务;采集之后将传感节点数据写入缓冲区数据块,与数据内容一起写入的还有与该缓冲区数据块绑定的重传计时器和消息标识符;初始化该缓冲区数据块的重传计时器,将重传计时器的标志位设为零,意味着该数据块待发送;在NB-IoT网关开启数据采集任务之初,初始化消息标识符为零,随着缓冲区数据块的增加,逐次递增缓冲区数据块的消息ID,代表传感节点数据被存入缓冲区的先后顺序。As an example, as shown in Figure 3, it is a schematic flow chart of the data collection task in the method of the embodiment of the present invention, in which the first time interval is the collection frequency of sensor node data, that is, the delay period at the end of the task. , here it is set to wake up the data collection task after a delay of ten seconds; after collection, the sensor node data is written into the buffer data block, and the retransmission timing bound to the buffer data block is also written together with the data content. device and message identifier; initialize the retransmission timer of the buffer data block, and set the flag bit of the retransmission timer to zero, which means that the data block is to be sent; at the beginning of the NB-IoT gateway starting the data collection task, The initial message identifier is zero. As the buffer data block increases, the message ID of the buffer data block is gradually increased, representing the order in which the sensor node data is stored in the buffer.
在一些实施例中,步骤S200可以包括但不限于以下步骤:In some embodiments, step S200 may include but is not limited to the following steps:
步骤S201:基于第二时间间隔扫描缓冲区,查找满足发送条件的传感节点数据。Step S201: Scan the buffer based on the second time interval to find sensor node data that meets the sending conditions.
步骤S202:若重传计时器为零或重传计时器达到重传时限,则确认传感节点数据满足发送条件。Step S202: If the retransmission timer is zero or the retransmission timer reaches the retransmission time limit, confirm that the sensor node data meets the sending conditions.
步骤S203:将满足发送条件的传感节点数据写入消息队列。Step S203: Write the sensor node data that meets the sending conditions into the message queue.
作为一种示例,如图4所示,为本发明实施例的方法中缓冲区扫描任务的流程示意图,其中,缓冲区扫描任务为周期性扫描任务,第二时间间隔即两次扫描任务之间的时间间隔,可以根据物联网应用场景的需求和设备的性能来设定合适的周期时长;在扫描周期内,通过遍历缓冲区来查找满足发送条件的传感节点数据;判断当前缓冲区数据块对应的重传计时器是否满足条件,其中一种条件为重传计时器的标志位为零,另一种条件为重传计时器的标志位达到重传时限,满足任一种即代表当前缓冲区数据块为待发送状态;如果当前缓冲区数据块满足发送条件,则将其插入消息队列,如果不满足,则继续遍历缓冲区,直至遍历结束;另外,如果当前缓冲区数据块的重传计时器的标志位大于零,则将该标志位加一,需要说明的是,无论是否满足发送条件,每次间隔性扫描缓冲区的操作都会使重传计时器数值增加。As an example, as shown in Figure 4, it is a schematic flowchart of a buffer scanning task in the method of an embodiment of the present invention. The buffer scanning task is a periodic scanning task, and the second time interval is between two scanning tasks. The time interval can be set according to the needs of the Internet of Things application scenario and the performance of the device; during the scan period, the sensor node data that meets the sending conditions is found by traversing the buffer; the current buffer data block is determined Whether the corresponding retransmission timer meets the conditions. One condition is that the flag bit of the retransmission timer is zero, and the other condition is that the flag bit of the retransmission timer reaches the retransmission time limit. If either condition is met, it means the current buffer The area data block is in the state of waiting to be sent; if the current buffer data block meets the sending conditions, it will be inserted into the message queue. If it does not meet the requirements, it will continue to traverse the buffer until the end of the traversal; in addition, if the current buffer data block is retransmitted If the flag bit of the timer is greater than zero, the flag bit is incremented by one. It should be noted that regardless of whether the sending conditions are met, each interval scan operation of the buffer will increase the retransmission timer value.
在一些实施例中,步骤S300可以包括但不限于以下步骤:In some embodiments, step S300 may include but is not limited to the following steps:
步骤S301:基于第三时间间隔扫描消息队列,若消息队列非空,读取传感节点数据。Step S301: Scan the message queue based on the third time interval. If the message queue is not empty, read the sensor node data.
步骤S302:对传感节点数据执行解析、封装和发送。Step S302: Parse, encapsulate and send sensor node data.
具体的,短周期性检查并读取消息队列的消息,第三时间间隔即两次扫描消息队列之间的时间间隔;在检测到消息队列非空后,读取消息队列中的数据块信息,将读取到的数据块信息进行数据解析,解析出消息ID和数据内容,然后依据json格式将消息ID、数据内容、设备ID以及其他信息进行格式化封装,最后通过AT指令控制NB-IoT模组执行数据的上报,即向云平台发送该数据包。Specifically, the message queue is checked and read in a short period of time. The third time interval is the time interval between two scans of the message queue. After detecting that the message queue is not empty, the data block information in the message queue is read. Perform data analysis on the read data block information to parse out the message ID and data content, then format and encapsulate the message ID, data content, device ID and other information according to the json format, and finally control the NB-IoT module through AT commands. The group executes data reporting, that is, sends the data package to the cloud platform.
在一些实施例中,步骤S400可以包括但不限于以下步骤:In some embodiments, step S400 may include but is not limited to the following steps:
步骤S401:接收消息确认位图。Step S401: Receive message confirmation bitmap.
步骤S402:根据消息标识符,计算消息标识符的位图下标。Step S402: Calculate the bitmap subscript of the message identifier based on the message identifier.
步骤S403:判断消息确认位图中是否存在位图下标,若是,则确认消息确认位图包含消息标识符。Step S403: Determine whether there is a bitmap subscript in the message acknowledgment bitmap. If so, confirm that the message acknowledgment bitmap contains the message identifier.
具体的,通过AT指令控制NB-IoT模组接收来自云平台的消息确认位图;通过计算消息标识符的位图下标,来判断已发送缓冲区数据块的待确认消息ID是否在消息确认位图中,如果存在,则表示该数据块已确认送达云平台。具体的,计算消息标识符的位图下标的方法为:将缓冲区中的消息ID进行取模操作,将取模后的消息ID进行转换为二进制,对二进制的消息ID进行右移3位得到数组下标,利用数组下标找到消息确认位图中对应的8比特数据。对消息ID进行取余8并且与刚取出的8比特数据进行与操作。如果与的结果不为0则表示该消息ID存在与消息确认位图之中,该消息ID对应的数据被确认送达。如果为0则表示该消息ID并不存在于消息确认位图中,表示该消息ID对应的数据并未送达云平台。Specifically, the NB-IoT module is controlled through AT commands to receive the message confirmation bitmap from the cloud platform; by calculating the bitmap subscript of the message identifier, it is determined whether the message ID of the sent buffer data block to be confirmed is in the message confirmation In the bitmap, if it exists, it means that the data block has been confirmed to be delivered to the cloud platform. Specifically, the method for calculating the bitmap subscript of the message identifier is: perform a modulo operation on the message ID in the buffer, convert the modulo message ID into binary, and right-shift the binary message ID by 3 bits to obtain Array subscript, use the array subscript to find the corresponding 8-bit data in the message confirmation bitmap. The message ID is modulated by 8 and ANDed with the 8-bit data just fetched. If the result of the AND is not 0, it means that the message ID exists in the message confirmation bitmap, and the data corresponding to the message ID is confirmed to be delivered. If it is 0, it means that the message ID does not exist in the message confirmation bitmap, which means that the data corresponding to the message ID has not been sent to the cloud platform.
在一些实施例中,步骤S500可以包括但不限于以下步骤:In some embodiments, step S500 may include but is not limited to the following steps:
步骤S501:若消息确认位图包含消息标识符,则将重传计时器与消息标识符均设置为负一。Step S501: If the message confirmation bitmap contains a message identifier, set both the retransmission timer and the message identifier to negative one.
步骤S502:清空缓冲区内的传感节点数据。Step S502: Clear the sensor node data in the buffer.
具体的,如果已发送缓冲区数据块的待确认消息ID在消息确认位图内,则将该缓冲区数据块的重传定时器的标志位和消息ID重置,在本实施例中,分别将其设置为负一;并清空该缓冲区数据块,即释放缓冲区,清空缓冲区内的传感节点数据。Specifically, if the message ID of the sent buffer data block to be confirmed is in the message confirmation bitmap, the flag bit and message ID of the retransmission timer of the buffer data block are reset. In this embodiment, respectively Set it to negative one; and clear the buffer data block, that is, release the buffer and clear the sensor node data in the buffer.
作为一种示例,如图5所示,为本发明实施例的方法中数据上报任务的流程示意图,其中,首先,检测消息队列是否非空,若是,则消费消息队列即读取消息队列中的数据块,然后处理数据头部分的消息ID和设备ID,将传感节点数 据重新封装完成后向云平台发送该数据包;接着,接收响应数据,若接收到响应数据则执行下一步骤,若未接收到,则返回继续遍历消息队列;保存由云平台发送的消息确认位图;遍历缓冲区已发送数据块的待确认消息ID,通过计算当前待确认消息ID的位图下标,判断该消息ID是否存在于消息确认位图中,若存在则继续执行下一步骤,若不存在,则返回继续遍历消息队列;重置当前缓冲区数据块的重传计数器的标志位和消息ID均为负一,并清空数据内容;接着,返回继续遍历消息队列,直至消息队列为空,等待零点二秒后被唤醒继续执行数据上报任务。As an example, as shown in Figure 5, it is a schematic flow chart of the data reporting task in the method of the embodiment of the present invention. First, it is detected whether the message queue is not empty. If so, the message queue is consumed, that is, the message queue is read. data block, then process the message ID and device ID in the data header, re-encapsulate the sensor node data and send the data packet to the cloud platform; then, receive the response data, and if the response data is received, perform the next step. If not received, return to continue traversing the message queue; save the message confirmation bitmap sent by the cloud platform; traverse the message ID of the sent data block in the buffer and determine the bitmap subscript of the current message ID to be confirmed. Whether the message ID exists in the message confirmation bitmap, if it exists, continue to the next step, if not, return to continue traversing the message queue; reset the flag bit of the retransmission counter of the current buffer data block and the message ID. minus one, and clear the data content; then, return and continue traversing the message queue until the message queue is empty, wait for 0.2 seconds, and then be awakened to continue performing the data reporting task.
需要说明的是,本发明实施例中的重传计时器兼顾记时与标志的作用,使用这个重传计时器的变量来表示该缓冲区块的数据的一个发送状态,并且只有当该变量大于或等于一的时候计时器才会自增(相当于计时),具体有以下几种情况:It should be noted that the retransmission timer in the embodiment of the present invention has both timing and flag functions. The variable of this retransmission timer is used to represent a sending status of the data of the buffer block, and only when the variable is greater than Or when it is equal to one, the timer will automatically increment (equivalent to timing). Specifically, there are the following situations:
1)如果该数据块为空,则默认重传计时器为负一(表示为空);1) If the data block is empty, the default retransmission timer is negative one (meaning it is empty);
2)当有数据插入到该数据块时,则重传计时器为零(表示该数据块待发送);2) When data is inserted into the data block, the retransmission timer is zero (indicating that the data block is to be sent);
3)此后会被缓冲区扫描任务识别,并将其放入消息队列,并将这个重传计时器加一(表示已经发送一次);3) Afterwards, it will be recognized by the buffer scanning task, put into the message queue, and the retransmission timer will be increased by one (indicating that it has been sent once);
4)在这之后每次扫描任务都会将该重传计时器加一,但是不会放入发送队列(也就是该数据不执行发送);4) After this, each scanning task will increase the retransmission timer by one, but will not put it into the sending queue (that is, the data will not be sent);
5)直到重传计时器的计时次数达到一个阈值(通常为云平台确认周期的2倍以上),则将重传计时器加一,并将该缓冲区的数据块再次放入消息队列,相当于执行了重传;5) Until the number of retransmission timers reaches a threshold (usually more than 2 times the cloud platform confirmation cycle), the retransmission timer will be increased by one, and the data block in the buffer will be put into the message queue again, which is equivalent to Yu performed a retransmission;
6)如果在数据上报任务中得到了该数据块的确认消息,那就会将该重传计时器设置为负一(表示已发送,该数据块为空)。6) If the confirmation message of the data block is obtained in the data reporting task, the retransmission timer will be set to negative one (indicating that the data block has been sent and the data block is empty).
本发明技术方案在利用缓冲区与队列实现数据解耦的同时,引入重传机制,云平台通过消息位图的方式通知网关数据的传达,将没有进行确认的消息进行重传,能够进一步提高数据传输的可靠性。The technical solution of the present invention not only uses buffers and queues to achieve data decoupling, but also introduces a retransmission mechanism. The cloud platform notifies the gateway of data transmission through message bitmaps, and retransmits unconfirmed messages, which can further improve data transmission. Transmission reliability.
本发明实施例的方法还包括但不限于以下步骤:The method of the embodiment of the present invention also includes but is not limited to the following steps:
步骤S600:当串口正常通信,检测网络附着状态,当串口通信异常,执行软复位操作。Step S600: When the serial port communicates normally, detect the network attachment status; when the serial port communicates abnormally, perform a soft reset operation.
步骤S700:当网络附着异常,执行初始化入网操作。Step S700: When the network attachment is abnormal, perform an initial network access operation.
具体的,如图6所示,为本发明实施例的方法中的健康检查任务的流程示意图,其中,检查微控制单元MCU程序是否正常工作,若有无法正常执行定时喂狗操作时执行MCU复位操作。采集NB-IoT模组的信息,分析并判断NB-IoT模组的健康状况,根据NB-IoT模组的情况执行以下操作:NB-IoT模组整体无响应或者是串口通信异常时,执行NB-IoT模组软复位操作;NB-IoT模组正常响应指令,但是无法发送数据或网络附着异常时,重新执行入网操作。通过引入健康检查以及分级恢复机制,可以提高NB-IoT网关服务的持续性与稳定性。Specifically, as shown in Figure 6, it is a schematic flow chart of the health check task in the method of the embodiment of the present invention. In it, it is checked whether the micro control unit MCU program is working normally. If the scheduled dog feeding operation cannot be performed normally, the MCU is reset. operate. Collect the information of the NB-IoT module, analyze and judge the health status of the NB-IoT module, and perform the following operations according to the situation of the NB-IoT module: When the NB-IoT module is unresponsive as a whole or the serial port communication is abnormal, perform NB -IoT module soft reset operation; the NB-IoT module responds to commands normally, but cannot send data or the network attachment is abnormal, and the network access operation is re-executed. By introducing health checks and hierarchical recovery mechanisms, the continuity and stability of NB-IoT gateway services can be improved.
如图7所示,为本发明实施例的方法中的云平台消息确认的流程示意图,其中,云平台采用位图累计确认的方式下发消息确认位图至NB-IoT网关,云平台的定时调度会每隔一段时间唤醒消息确认任务,该任务会以设备ID以及设备IP端口为分组从数据采集日志表中,读取最近已接收到的N条数据的消息ID,并将该N条数据的消息ID取模2N后存入2N大小的位图之中,处理完成后,根据设备IP发送对应的消息确认位图至网关。As shown in Figure 7, it is a schematic flow chart of the cloud platform message confirmation in the method of the embodiment of the present invention. The cloud platform uses the bitmap cumulative confirmation method to send the message confirmation bitmap to the NB-IoT gateway. The timing of the cloud platform The schedule will wake up the message confirmation task at regular intervals. The task will group the device ID and device IP port to read the message IDs of the recently received N pieces of data from the data collection log table, and store the N pieces of data. The message ID is modulo 2N and stored in a 2N-sized bitmap. After the processing is completed, the corresponding message confirmation bitmap is sent to the gateway based on the device IP.
作为一种示例,消息ID的范围是无限大的,但是在逻辑进行消息确认时,均取模128,位图能够承载的确认ID亦需为0-127。当消息ID到达127,自增后为128,此时位图已溢出,需取模128得到0,此时若消息ID为0的数据依然还在网关的缓冲区中待确认,就会与128的消息ID发生碰撞冲突。所以不仅仅是确认ID的范围限制在0-127,在执行从数据库中拉取已接收的消息ID并进行确认时,所拉取的消息ID数量要小于128的一半,比如设置成64个。这样的话,可以在一定程度上避免碰撞导致的误确认,所以才有2N的位图只存放N条数据(或是更少),通过取模操作使得无限大的消息ID能够在这种条件下一一映射到有限大小的位图中。需要说明的是,上述示例中N的值可以根据具体 的网络条件以及网关硬件配置进行适应性调整。As an example, the range of the message ID is infinite, but when the logic confirms the message, it is modulo 128, and the confirmation ID that the bitmap can carry must also be 0-127. When the message ID reaches 127, it is incremented to 128. At this time, the bitmap has overflowed and needs to be modulo 128 to get 0. At this time, if the data with message ID 0 is still in the buffer of the gateway and needs to be confirmed, it will be compared with 128. The message ID of the message ID collides. So not only the range of confirmation ID is limited to 0-127, but when pulling the received message ID from the database and confirming, the number of message IDs pulled should be less than half of 128, for example, set to 64. In this way, false confirmations caused by collisions can be avoided to a certain extent, so the 2N bitmap only stores N pieces of data (or less). Through the modulo operation, infinite message IDs can be processed under this condition. One-to-one mapping into a limited-size bitmap. It should be noted that the value of N in the above example can be adjusted adaptively according to specific network conditions and gateway hardware configuration.
作为一种示例,如图8所示,为本发明实施例的方法中的数据发送与确认的流程示意图,其中,As an example, as shown in Figure 8, it is a schematic flow chart of data sending and confirmation in the method according to the embodiment of the present invention, wherein:
第一步:数据采集任务将采集的传感节点数据写入缓冲区,并设置该缓冲区数据块的消息ID,重传计时器设为零;Step 1: The data collection task writes the collected sensor node data into the buffer, sets the message ID of the buffer data block, and sets the retransmission timer to zero;
第二步:缓冲区扫描任务遍历缓冲区,当缓冲区数据块的重传计时器为零(待发送)或达到重传时限时,将数据块信息放入消息队列。当缓冲区数据块的重传计时器大于零时,将重传计时器加一;Step 2: The buffer scanning task traverses the buffer. When the retransmission timer of the buffer data block is zero (to be sent) or the retransmission time limit is reached, the data block information is put into the message queue. When the retransmission timer of the buffer data block is greater than zero, increase the retransmission timer by one;
第三步:数据上报任务检查并读取消息队列数据,将读取到的数据块进行发送。并于发送后立刻进行数据接收的检查,若接收到来自云平台的消息确认位图,则扫描缓冲区已发送待确认的消息ID,计算出消息ID所在的位图下标,通过位操作和与操作确认消息确认位图是否存在该消息ID的确认信息,若存在则将此缓冲区中该数据块信息的重传计时器重置为负一,消息ID重置为负一,清空数据内容。Step 3: The data reporting task checks and reads the message queue data, and sends the read data blocks. And check the data reception immediately after sending. If the message confirmation bitmap is received from the cloud platform, scan the buffer to send the message ID to be confirmed, calculate the bitmap subscript where the message ID is located, and use bit operations and Confirm with the operation confirmation message bitmap whether there is confirmation information for the message ID. If there is, the retransmission timer of the data block information in the buffer is reset to negative one, the message ID is reset to negative one, and the data content is cleared. .
参照图9,本发明实施例提供了一种物联网网关数据传输的系统示意图,包括但不限于:Referring to Figure 9, an embodiment of the present invention provides a schematic diagram of a system for data transmission by an Internet of Things gateway, including but not limited to:
第一处理模块901,用于采集传感节点数据,存储传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,重传计时器、消息标识符均与传感节点相对应,重传计时器用于通过计时触发传感节点数据的重传,消息标识符用于对存入缓冲区的传感节点数据进行标识;The first processing module 901 is used to collect sensor node data, store the sensor node data in the buffer, and initialize the retransmission timer and message identifier, where the retransmission timer and message identifier correspond to the sensor node. , the retransmission timer is used to trigger the retransmission of sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
第二处理模块902,用于扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的传感节点数据存储于消息队列;The second processing module 902 is used to scan the buffer to find sensor node data that meets the sending conditions, and store the sensor node data that meets the sending conditions in the message queue;
第三处理模块903,用于从消息队列中读取传感节点数据,并发送传感节点数据;The third processing module 903 is used to read sensor node data from the message queue and send sensor node data;
第四处理模块904,用于接收消息确认位图,并于消息确认位图中查找消息标识符;The fourth processing module 904 is used to receive the message confirmation bitmap and search for the message identifier in the message confirmation bitmap;
第五处理模块905,用于根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据。The fifth processing module 905 is configured to reset the retransmission timer and the message identifier according to the search result, and clear the sensor node data in the buffer.
参照图10,本发明实施例提供了一种电子设备,包括存储器1001和处理器1002;存储器1001,用于存放计算机程序;处理器1002,用于执行存储器1001上所存放的程序时,实现本发明实施例提供的物联网网关数据传输的方法。Referring to Figure 10, an embodiment of the present invention provides an electronic device, including a memory 1001 and a processor 1002; the memory 1001 is used to store computer programs; the processor 1002 is used to implement the program when executing the program stored in the memory 1001. The embodiment of the invention provides a data transmission method for an Internet of Things gateway.
本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行本发明实施例提供的物联网网关数据传输的方法。Embodiments of the present invention also provide a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When run on a computer, the computer is caused to execute the method for data transmission of an Internet of Things gateway provided by embodiments of the present invention. .
存储器可以包括随机存取存储器(Random Access Memory,简称RAM),也可以包括非易失性存储器(Non-Volatile Memory,简称NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM for short) or non-volatile memory (Non-Volatile Memory, NVM for short), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far away from the aforementioned processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processing,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; it can also be a digital signal processor (Digital Signal Processing, referred to as DSP) , Application Specific Integrated Circuit (ASIC for short), Field-Programmable Gate Array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线,例如同轴电缆、光纤、数字调节人员线(DSL)或无线,例如红外、无线、微波等方式向另一个网站站点、计算机、 服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,例如,软盘、硬盘、磁带、光介质,例如,DVD、或者半导体介质,例如固态硬盘Solid State Disk(SSD)等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center via wired means, such as coaxial cable, optical fiber, digital SSL (DSL), or wireless means, such as infrared, wireless, microwave, etc. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more available media integrated therein. The available media may be magnetic media, such as floppy disks, hard disks, magnetic tapes, optical media, such as DVDs, or semiconductor media, such as solid state disks (SSD), etc.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, as used herein, the terms "include", "comprises" or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device that includes a series of elements not only includes those elements, It also includes other elements not expressly listed or inherent in the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、服务器、客户端、计算机可读存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner. The same and similar parts between the various embodiments can be referred to each other. Each embodiment focuses on its differences from other embodiments. In particular, for the device, server, client, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the descriptions are relatively simple. For relevant details, please refer to the partial description of the method embodiments.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.

Claims (10)

  1. 一种物联网网关数据传输的方法,其特征在于,包括:A method for transmitting data from an Internet of Things gateway, which is characterized by including:
    采集传感节点数据,存储所述传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,所述重传计时器、所述消息标识符均与所述传感节点相对应,所述重传计时器用于通过计时触发所述传感节点数据的重传,所述消息标识符用于对存入所述缓冲区的所述传感节点数据进行标识;Collect sensor node data, store the sensor node data in a buffer, and initialize a retransmission timer and a message identifier, where the retransmission timer and the message identifier correspond to the sensor node , the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
    扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列;Scan the buffer to find sensor node data that satisfies the sending condition, and store the sensor node data that satisfies the sending condition in the message queue;
    从所述消息队列中读取所述传感节点数据,并发送所述传感节点数据;Read the sensor node data from the message queue and send the sensor node data;
    接收消息确认位图,并于所述消息确认位图中查找所述消息标识符;Receive the message confirmation bitmap and search the message identifier in the message confirmation bitmap;
    根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据。The retransmission timer and the message identifier are reset according to the search result, and the sensor node data in the buffer is cleared.
  2. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,所述采集传感节点数据,存储所述传感节点数据于缓冲区,初始化重传计时器和消息标识符,包括:The method for transmitting data from an Internet of Things gateway according to claim 1, wherein collecting sensor node data, storing the sensor node data in a buffer, and initializing a retransmission timer and message identifier include:
    基于第一时间间隔采集传感节点数据;Collect sensor node data based on the first time interval;
    将所述传感节点数据写入所述缓冲区数据块;Write the sensor node data into the buffer data block;
    初始化所述缓冲区数据块的所述重传计时器为零;Initializing the retransmission timer of the buffer data block to zero;
    增加所述缓冲区数据块的所述消息标识符的数值。Increment the value of the message identifier of the buffer data block.
  3. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,所述扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列,包括:The method for transmitting data from an Internet of Things gateway according to claim 1, characterized in that the buffer is scanned to find sensor node data that satisfies the sending condition, and the sensor node data that satisfies the sending condition is stored in the message. Queues, including:
    基于第二时间间隔扫描所述缓冲区,查找满足发送条件的所述传感节 点数据;Scan the buffer based on the second time interval to find the sensor node data that meets the sending conditions;
    若所述重传计时器为零或所述重传计时器达到重传时限,则确认所述传感节点数据满足发送条件;If the retransmission timer is zero or the retransmission timer reaches the retransmission time limit, it is confirmed that the sensor node data meets the sending conditions;
    将满足发送条件的所述传感节点数据写入所述消息队列。Write the sensor node data that meets the sending conditions into the message queue.
  4. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,所述从所述消息队列中读取所述传感节点数据,并发送所述传感节点数据包括:The method of data transmission for an Internet of Things gateway according to claim 1, wherein reading the sensor node data from the message queue and sending the sensor node data includes:
    基于第三时间间隔扫描所述消息队列,若所述消息队列非空,读取所述传感节点数据;Scan the message queue based on the third time interval, and if the message queue is not empty, read the sensor node data;
    对所述传感节点数据执行解析、封装和发送。Perform parsing, encapsulation and sending of the sensor node data.
  5. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,所述接收消息确认位图,并于所述消息确认位图中查找所述消息标识符,包括:The method of data transmission for an Internet of Things gateway according to claim 1, wherein the step of receiving a message confirmation bitmap and searching for the message identifier in the message confirmation bitmap includes:
    接收所述消息确认位图;Receiving the message confirmation bitmap;
    根据所述消息标识符,计算所述消息标识符的位图下标;Calculate a bitmap subscript of the message identifier based on the message identifier;
    判断所述消息确认位图中是否存在所述位图下标,若是,则确认所述消息确认位图包含所述消息标识符。Determine whether the bitmap subscript exists in the message acknowledgment bitmap, and if so, confirm that the message acknowledgment bitmap contains the message identifier.
  6. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,所述根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据,包括:The method for data transmission of an Internet of Things gateway according to claim 1, characterized in that the retransmission timer and the message identifier are reset according to the search result, and the transmission timer in the buffer is cleared. Sensory node data, including:
    若所述消息确认位图包含所述消息标识符,则将所述重传计时器与所述消息标识符均设置为负一;If the message confirmation bitmap contains the message identifier, both the retransmission timer and the message identifier are set to negative one;
    清空所述缓冲区内的所述传感节点数据。Clear the sensor node data in the buffer.
  7. 根据权利要求1所述的物联网网关数据传输的方法,其特征在于,还包括:The method for data transmission of an Internet of Things gateway according to claim 1, further comprising:
    当串口正常通信,检测网络附着状态,当所述串口通信异常,执行软复位操作;When the serial port communicates normally, detect the network attachment status; when the serial port communicates abnormally, perform a soft reset operation;
    当所述网络附着异常,执行初始化入网操作。When the network attachment is abnormal, an initial network access operation is performed.
  8. 一种物联网网关数据传输的装置,其特征在于,包括:An Internet of Things gateway data transmission device, characterized by including:
    第一处理模块,采集传感节点数据,存储所述传感节点数据于缓冲区,初始化重传计时器和消息标识符,其中,所述重传计时器、所述消息标识符均与所述传感节点相对应,所述重传计时器用于通过计时触发所述传感节点数据的重传,所述消息标识符用于对存入所述缓冲区的所述传感节点数据进行标识;The first processing module collects sensor node data, stores the sensor node data in a buffer, and initializes a retransmission timer and a message identifier, where the retransmission timer and the message identifier are both the same as the Corresponding to the sensor node, the retransmission timer is used to trigger the retransmission of the sensor node data through timing, and the message identifier is used to identify the sensor node data stored in the buffer;
    第二处理模块,用于扫描缓冲区,以查找出满足发送条件传感节点数据,将满足发送条件的所述传感节点数据存储于消息队列;The second processing module is used to scan the buffer to find sensor node data that meets the sending conditions, and store the sensor node data that meets the sending conditions in the message queue;
    第三处理模块,用于从所述消息队列中读取所述传感节点数据,并发送所述传感节点数据;A third processing module, configured to read the sensor node data from the message queue and send the sensor node data;
    第四处理模块,用于接收消息确认位图,并于所述消息确认位图中查找所述消息标识符;The fourth processing module is used to receive the message confirmation bitmap and search for the message identifier in the message confirmation bitmap;
    第五处理模块,用于根据查找结果重置所述重传计时器和所述消息标识符,并清空所述缓冲区内的所述传感节点数据。A fifth processing module, configured to reset the retransmission timer and the message identifier according to the search result, and clear the sensor node data in the buffer.
  9. 一种电子设备,所述电子设备包括处理器、存储器,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-7中任一项所述的物联网网关数据传输的方法。An electronic device, the electronic device includes a processor, a memory, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, the program Comprised of a method for performing the Internet of Things gateway data transmission according to any one of claims 1-7.
  10. 一种计算机可读存储介质,其特征在于,存储有处理器可运行的程序指令,所述程序指令用于执行如权利要求1-7中任一项所述的物联网网关数据传输的方法。A computer-readable storage medium, characterized in that it stores program instructions executable by a processor, and the program instructions are used to execute the method for data transmission of an Internet of Things gateway according to any one of claims 1 to 7.
PCT/CN2022/124712 2022-05-27 2022-10-11 Internet of things gateway data transmission method and device, server, client and storage medium WO2023226277A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210586100.1A CN115102807B (en) 2022-05-27 2022-05-27 Method, device, server, client and storage medium for gateway data transmission of Internet of things
CN202210586100.1 2022-05-27

Publications (1)

Publication Number Publication Date
WO2023226277A1 true WO2023226277A1 (en) 2023-11-30

Family

ID=83288203

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/124712 WO2023226277A1 (en) 2022-05-27 2022-10-11 Internet of things gateway data transmission method and device, server, client and storage medium

Country Status (2)

Country Link
CN (1) CN115102807B (en)
WO (1) WO2023226277A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117479049A (en) * 2023-12-27 2024-01-30 成都秦川物联网科技股份有限公司 Data transmission control method for intelligent fuel gas, internet of things system and medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115102807B (en) * 2022-05-27 2023-11-28 深圳技术大学 Method, device, server, client and storage medium for gateway data transmission of Internet of things

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089328A1 (en) * 2007-10-02 2009-04-02 Miller Douglas R Minimally Buffered Data Transfers Between Nodes in a Data Communications Network
CN103259776A (en) * 2012-11-19 2013-08-21 北京新岸线移动多媒体技术有限公司 Method and device used for transmitting and receiving application layer information acknowledgements
US20170187642A1 (en) * 2015-12-23 2017-06-29 Intel Corporation Managing communication congestion for internet of things devices
CN111949648A (en) * 2019-05-14 2020-11-17 北京沃东天骏信息技术有限公司 Memory cache data system and data indexing method
CN112491842A (en) * 2020-11-17 2021-03-12 国网江苏省电力工程咨询有限公司 Multi-protocol Internet of things gateway for smart construction site
CN115102807A (en) * 2022-05-27 2022-09-23 深圳技术大学 Method, device, server, client and storage medium for data transmission of internet of things gateway

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002281047A (en) * 2001-01-10 2002-09-27 Ntt Docomo Inc Packet communication controller and its method, data communication repeater system and its method, and network system
US7532639B2 (en) * 2003-09-10 2009-05-12 Broadcom Corporation System and method for message queue management in a power-save network
CN100354164C (en) * 2004-03-15 2007-12-12 王家法 Method for implementing instruction execution from anti-theft burglar by through mobile phone
US7584397B2 (en) * 2004-06-10 2009-09-01 Interdigital Technology Corporation Method and apparatus for dynamically adjusting data transmission parameters and controlling H-ARQ processes
US7830901B2 (en) * 2007-03-15 2010-11-09 International Business Machines Corporation Reliable network packet dispatcher with interleaving multi-port circular retry queue
CN104780028A (en) * 2015-04-02 2015-07-15 京信通信技术(广州)有限公司 Method and equipment for retransmitting TCP (transmission control protocol) data messages
CN106712908B (en) * 2015-11-13 2020-01-14 富士通株式会社 Data transmission method, device and system
CN106059950B (en) * 2016-05-25 2019-03-08 四川大学 A kind of adaptive network congestion control method based on SCPS-TP
KR102071955B1 (en) * 2018-06-07 2020-03-02 주식회사 티맥스소프트 Method for processing multicast in distributed cache environment, and distributed cache server using the same
CN111050309A (en) * 2018-10-12 2020-04-21 奇酷互联网络科技(深圳)有限公司 Mobile terminal, network registration method thereof and storage medium
CN113597806B (en) * 2019-08-08 2023-09-05 Oppo广东移动通信有限公司 Method for transmitting data and terminal equipment
CN111064674B (en) * 2019-11-05 2021-02-26 珠海格力电器股份有限公司 Data transmission method, device and system
EP3866365A1 (en) * 2020-02-14 2021-08-18 Robert Bosch GmbH Radio device, method to operate a radio device
CN113676605A (en) * 2020-05-15 2021-11-19 腾讯科技(深圳)有限公司 Data transmission method, device, equipment and computer readable storage medium
CN113541885B (en) * 2021-07-27 2023-10-31 广东电网有限责任公司 Transmission performance protection method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089328A1 (en) * 2007-10-02 2009-04-02 Miller Douglas R Minimally Buffered Data Transfers Between Nodes in a Data Communications Network
CN103259776A (en) * 2012-11-19 2013-08-21 北京新岸线移动多媒体技术有限公司 Method and device used for transmitting and receiving application layer information acknowledgements
US20170187642A1 (en) * 2015-12-23 2017-06-29 Intel Corporation Managing communication congestion for internet of things devices
CN111949648A (en) * 2019-05-14 2020-11-17 北京沃东天骏信息技术有限公司 Memory cache data system and data indexing method
CN112491842A (en) * 2020-11-17 2021-03-12 国网江苏省电力工程咨询有限公司 Multi-protocol Internet of things gateway for smart construction site
CN115102807A (en) * 2022-05-27 2022-09-23 深圳技术大学 Method, device, server, client and storage medium for data transmission of internet of things gateway

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117479049A (en) * 2023-12-27 2024-01-30 成都秦川物联网科技股份有限公司 Data transmission control method for intelligent fuel gas, internet of things system and medium
CN117479049B (en) * 2023-12-27 2024-03-15 成都秦川物联网科技股份有限公司 Data transmission control method for intelligent fuel gas, internet of things system and medium

Also Published As

Publication number Publication date
CN115102807A (en) 2022-09-23
CN115102807B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
WO2023226277A1 (en) Internet of things gateway data transmission method and device, server, client and storage medium
CN112822276B (en) Substation control layer communication method and system, electronic equipment and storage medium
US6965571B2 (en) Precise error reporting
CN102404170B (en) Detection method, device and system of message loss
CN109217983B (en) Industrial Internet of things operation terminal communication protocol design method
US10560968B2 (en) Broadcast messaging
CN103141050B (en) Data packet retransmission method and node in quick path interconnect system
CN113596017B (en) Protocol analysis method and device, soft gateway and storage medium
WO2011053544A1 (en) Techniques for improved clock offset measuring
CN112994971A (en) Equipment offline monitoring method based on cloud server and related device
CN102685149B (en) Institute of electronic and electrical engineers (IEEE) 1394 and universal plug and play (UPnP) technology-based remote control and access method and device
US20050063326A1 (en) Data collection system and data collection method
WO2017114400A1 (en) Method and device for time sequence data detection
KR20200139059A (en) Controller diagnostic device and method thereof
US20090232123A1 (en) Extended Range Wireless Packetized Data Communication System
JP2009525707A (en) Congestion management and delay prediction in CSMA transmission media
KR101001046B1 (en) Relay apparatus and relay method
CN115865680A (en) Method, system and device for distributed equipment access, control and data transmission
US20210218686A1 (en) Methods and apparatus to facilitate data transmission
CN110099001B (en) Bidirectional forwarding detection time parameter negotiation method and device and electronic equipment
CN114157523A (en) Data reporting method and device, intelligent household equipment and storage medium
KR20140080838A (en) Apparatus for monitoring status of ecu based on can communication in heterogeneous network and method thereof
US9743037B2 (en) Method for transmitting device indicator data in network-based AV system
Bansal et al. A Reliable CoAP Protocol for IoT Communication
CN218941111U (en) Microcontroller, electronic equipment and vehicle

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22943465

Country of ref document: EP

Kind code of ref document: A1