技术领域technical field
本发明涉及物联网领域,特别涉及一种数据传输方法、装置及系统。The present invention relates to the field of the Internet of Things, in particular to a data transmission method, device and system.
背景技术Background technique
在物联网领域中,局域网包括中心网关以及与该中心网关连接的多个终端,终端通常处于睡眠状态,每个终端可以每隔一定时长从睡眠状态进入唤醒状态,并向中心网关发送心跳信号。该中心网关在接收到终端发送的心跳信号后,若确定需要进行数据更新,则可以向该终端发送更新数据。若确定不需要进行数据更新,则可以向该终端发送心跳响应,以使终端在接收到该心跳响应后从唤醒状态进入睡眠状态。In the field of the Internet of Things, the local area network includes a central gateway and multiple terminals connected to the central gateway. The terminal is usually in a sleep state, and each terminal can wake up from the sleep state at regular intervals and send a heartbeat signal to the central gateway. After receiving the heartbeat signal sent by the terminal, the central gateway can send update data to the terminal if it determines that data update is required. If it is determined that no data update is required, a heartbeat response may be sent to the terminal, so that the terminal enters a sleep state from the wake-up state after receiving the heartbeat response.
但是,在上述方案中,中心网关需要逐个向多个终端发送更新数据,因此数据传输的灵活性较差。However, in the above solution, the central gateway needs to send update data to multiple terminals one by one, so the flexibility of data transmission is poor.
发明内容Contents of the invention
本发明实施例提供了一种数据传输方法、装置及系统。所述技术方案如下:Embodiments of the present invention provide a data transmission method, device and system. Described technical scheme is as follows:
一方面,提供了一种数据传输方法,应用于中心网关,所述方法包括:On the one hand, a data transmission method is provided, which is applied to a central gateway, and the method includes:
接收第一终端发送的携带有所述第一终端的标识的第一心跳信号,所述第一终端为与所述中心网关连接的任一终端;receiving a first heartbeat signal carrying the identity of the first terminal sent by a first terminal, where the first terminal is any terminal connected to the central gateway;
当确定需要进行数据更新时,记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第二心跳信号是所述第二终端向所述中心网关发送的,所述第一时长的起始时刻为接收到所述第一心跳信号的时刻;When it is determined that data update is required, record the identity of the second terminal carried by the second heartbeat signal received within the first duration, the second terminal being the terminals connected to the central gateway except the first For a terminal other than a terminal, the second heartbeat signal is sent by the second terminal to the central gateway, and the starting moment of the first duration is the moment when the first heartbeat signal is received;
基于所述第一终端的标识和所述第二终端的标识,将所述更新数据同步传输至所述第一终端和所述第二终端。Based on the identifier of the first terminal and the identifier of the second terminal, synchronously transmit the update data to the first terminal and the second terminal.
可选的,所述更新数据包括:多个数据包以及数据包总数;Optionally, the update data includes: multiple data packets and the total number of data packets;
所述将更新数据同步传输至所述第一终端和所述第二终端,包括:The synchronously transmitting the update data to the first terminal and the second terminal includes:
将所述数据包总数同步传输至所述第一终端和所述第二终端;synchronously transmitting the total number of data packets to the first terminal and the second terminal;
将所述多个数据包分多次同步传输至所述第一终端和所述第二终端。and synchronously transmitting the multiple data packets to the first terminal and the second terminal multiple times.
可选的,所述更新数据还包括:每个所述数据包的传输次序号;Optionally, the update data also includes: a transmission sequence number of each of the data packets;
所述将所述多个数据包分多次同步传输至所述第一终端和所述第二终端,包括:The synchronously transmitting the plurality of data packets to the first terminal and the second terminal multiple times includes:
对于所述多个数据包中的目标数据包,在每次向所述第一终端和所述第二终端同步传输所述目标数据包时,向所述第一终端和所述第二终端同步传输所述目标数据包和所述目标数据包的传输次序号,所述目标数据包为所述多个数据包中的任一数据包,所述传输次序号不大于次数阈值。For a target data packet among the plurality of data packets, synchronizing to the first terminal and the second terminal each time the target data packet is synchronously transmitted to the first terminal and the second terminal transmitting the target data packet and the transmission sequence number of the target data packet, the target data packet is any data packet in the plurality of data packets, and the transmission sequence number is not greater than a times threshold.
可选的,当确定需要进行数据更新之后,所述方法还包括:Optionally, after it is determined that data update is required, the method further includes:
将所述第一时长以及所述更新数据的标识发送至所述第一终端,以使所述第一终端基于所述更新数据的标识确定未存储所述更新数据时,保持所述第一时长的睡眠状态;Sending the first duration and the identifier of the update data to the first terminal, so that the first terminal keeps the first duration when determining that the update data is not stored based on the identifier of the update data sleep state;
所述记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,包括:The recording of the identity of the second terminal carried by the second heartbeat signal received within the first duration includes:
接收在所述第一时长内所述第二终端发送的所述第二心跳信号;receiving the second heartbeat signal sent by the second terminal within the first duration;
将第二时长以及所述更新数据的标识发送至所述第二终端,并记录所述第二终端的标识,以使所述第二终端基于所述更新数据的标识确定未存储所述更新数据时,保持所述第二时长的睡眠状态,其中,所述第二时长小于所述第一时长,且所述第二时长的起始时刻为接收到所述第二心跳信号的时刻,所述第二时长的终止时刻与所述第一时长的终止时刻相同。sending the second duration and the identifier of the update data to the second terminal, and recording the identifier of the second terminal, so that the second terminal determines that the update data is not stored based on the identifier of the update data , keep the sleep state of the second duration, wherein the second duration is less than the first duration, and the start moment of the second duration is the moment when the second heartbeat signal is received, the The end moment of the second duration is the same as the end moment of the first duration.
另一方面,提供了一种数据传输方法,应用于第一终端,所述方法包括:In another aspect, a data transmission method is provided, which is applied to a first terminal, and the method includes:
向中心网关发送携带所述第一终端的标识的第一心跳信号;sending a first heartbeat signal carrying the identity of the first terminal to the central gateway;
接收所述中心网关传输的更新数据,所述更新数据是所述中心网关确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于所述第一终端的标识和所述第二终端的标识同步传输的;receiving the update data transmitted by the central gateway, the update data is that the central gateway determines that data update is required, and after recording the identity of the second terminal carried by the second heartbeat signal received within the first duration, based on The identity of the first terminal and the identity of the second terminal are transmitted synchronously;
其中,所述第二心跳信号是所述第二终端向所述中心网关发送的,所述第一终端为与所述中心网关连接的终端中的任一终端,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第一时长的起始时刻为所述中心网关接收到所述第一心跳信号的时刻。Wherein, the second heartbeat signal is sent by the second terminal to the central gateway, the first terminal is any one of the terminals connected to the central gateway, and the second terminal is connected to the central gateway. For terminals other than the first terminal among the terminals connected to the central gateway, the starting moment of the first duration is the moment when the central gateway receives the first heartbeat signal.
可选的,所述更新数据包括:多个数据包和数据包总数;Optionally, the update data includes: multiple data packets and the total number of data packets;
所述接收所述中心网关传输的更新数据,包括:The receiving the update data transmitted by the central gateway includes:
接收所述中心网关传输的所述数据包总数;receiving the total number of data packets transmitted by the central gateway;
分多次接收所述中心网关传输的所述多个数据包。The plurality of data packets transmitted by the central gateway are received in multiple times.
可选的,所述更新数据还包括:每个所述数据包的传输次序号;Optionally, the update data also includes: a transmission sequence number of each of the data packets;
所述分多次接收所述中心网关传输的所述多个数据包,包括:The multiple receiving of the multiple data packets transmitted by the central gateway includes:
对于所述多个数据包中的目标数据包,接收所述中心网关传输的所述目标数据包以及所述目标数据包的传输次序号,所述目标数据包为所述多个数据包中的任一数据包,所述传输次序号不大于次数阈值;For the target data packet in the multiple data packets, receive the target data packet transmitted by the central gateway and the transmission sequence number of the target data packet, the target data packet is the target data packet in the multiple data packets For any data packet, the transmission sequence number is not greater than the number of times threshold;
若接收到的数据包的个数不大于所述数据包总数,且所述目标数据包的传输次序号小于次数阈值,保持第三时长的睡眠状态后接收所述中心网关传输的所述目标数据包的下一个数据包,所述第三时长为所述目标数据包的传输时长与差值阈值的乘积,所述差值阈值为所述次数阈值与所述目标数据包的传输次序号的差值;If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is less than the number of times threshold, the target data transmitted by the central gateway is received after maintaining a sleep state for a third length of time The next data packet of the packet, the third duration is the product of the transmission duration of the target data packet and the difference threshold, and the difference threshold is the difference between the number of times threshold and the transmission sequence number of the target data packet value;
若接收到的数据包的个数不大于所述数据包总数,且所述目标数据包的传输次序号等于次数阈值,接收所述中心网关传输的所述目标数据包的下一个数据包。If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is equal to the number of times threshold, receive the next data packet of the target data packet transmitted by the central gateway.
又一方面,提供了一种数据传输方法,应用于第二终端,所述方法包括:In yet another aspect, a data transmission method is provided, which is applied to a second terminal, and the method includes:
向中心网关发送携带所述第二终端的标识的第二心跳信号;sending a second heartbeat signal carrying the identity of the second terminal to the central gateway;
接收所述中心网关传输的更新数据,所述更新数据是所述中心网关接收到第一终端发送的携带有所述第一终端的标识的第一心跳信号,确定需要进行数据更新,并记录在第一时长内接收到的所述第二心跳信号所携带的第二终端的标识后,基于所述第一终端的标识和所述第二终端的标识同步传输的;Receive the update data transmitted by the central gateway, the update data is that the central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, determines that data update is required, and records it in After receiving the identity of the second terminal carried by the second heartbeat signal within the first duration, synchronously transmitting based on the identity of the first terminal and the identity of the second terminal;
其中,所述第一终端为与所述中心网关连接的终端中的任一终端,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第一时长的起始时刻为所述中心网关接收到所述第一心跳信号的时刻。Wherein, the first terminal is any one of the terminals connected to the central gateway, the second terminal is a terminal other than the first terminal among the terminals connected to the central gateway, and the second The starting moment of a duration is the moment when the central gateway receives the first heartbeat signal.
又一方面,提供了一种数据传输装置,应用于中心网关,所述装置包括:In yet another aspect, a data transmission device is provided, which is applied to a central gateway, and the device includes:
接收模块,用于接收第一终端发送的携带有所述第一终端的标识的第一心跳信号,所述第一终端为与所述中心网关连接的任一终端;A receiving module, configured to receive a first heartbeat signal carrying an identifier of the first terminal sent by a first terminal, where the first terminal is any terminal connected to the central gateway;
记录模块,用于当确定需要进行数据更新时,记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第二心跳信号是所述第二终端向所述中心网关发送的,所述第一时长的起始时刻为接收到所述第一心跳信号的时刻;A recording module, configured to record the identity of the second terminal carried by the second heartbeat signal received within the first duration when it is determined that data update is required, the second terminal being one of the terminals connected to the central gateway For terminals other than the first terminal, the second heartbeat signal is sent by the second terminal to the central gateway, and the starting moment of the first duration is the moment when the first heartbeat signal is received ;
传输模块,用于基于所述第一终端的标识和所述第二终端的标识,将所述更新数据同步传输至所述第一终端和所述第二终端。A transmission module, configured to synchronously transmit the update data to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal.
可选的,所述更新数据包括:多个数据包以及数据包总数;Optionally, the update data includes: multiple data packets and the total number of data packets;
所述传输模块,包括:The transmission module includes:
第一传输子模块,用于将所述数据包总数同步传输至所述第一终端和所述第二终端;A first transmission submodule, configured to synchronously transmit the total number of data packets to the first terminal and the second terminal;
第二传输子模块,用于将所述多个数据包分多次同步传输至所述第一终端和所述第二终端。The second transmission sub-module is configured to synchronously transmit the plurality of data packets to the first terminal and the second terminal multiple times.
可选的,所述更新数据还包括:每个所述数据包的传输次序号;Optionally, the update data also includes: a transmission sequence number of each of the data packets;
所述第二传输子模块,用于:The second transmission submodule is used for:
对于所述多个数据包中的目标数据包,在每次向所述第一终端和所述第二终端同步传输所述目标数据包时,向所述第一终端和所述第二终端同步传输所述目标数据包和所述目标数据包的传输次序号,所述目标数据包为所述多个数据包中的任一数据包,所述传输次序号不大于次数阈值。For a target data packet among the plurality of data packets, synchronizing to the first terminal and the second terminal each time the target data packet is synchronously transmitted to the first terminal and the second terminal transmitting the target data packet and the transmission sequence number of the target data packet, the target data packet is any data packet in the plurality of data packets, and the transmission sequence number is not greater than a times threshold.
可选的,当确定需要进行数据更新之后,所述装置还包括:Optionally, after it is determined that data update is required, the device further includes:
发送模块,用于将所述第一时长以及所述更新数据的标识发送至所述第一终端,以使所述第一终端基于所述更新数据的标识确定未存储所述更新数据时,保持所述第一时长的睡眠状态;A sending module, configured to send the first duration and the identifier of the update data to the first terminal, so that when the first terminal determines that the update data is not stored based on the identifier of the update data, keep The sleep state of the first duration;
所述记录模块,用于:The recording module is used for:
接收在所述第一时长内所述第二终端发送的所述第二心跳信号;receiving the second heartbeat signal sent by the second terminal within the first duration;
将第二时长以及所述更新数据的标识发送至所述第二终端,并记录所述第二终端的标识,以使所述第二终端基于所述更新数据的标识确定未存储所述更新数据时,保持所述第二时长的睡眠状态,其中,所述第二时长小于所述第一时长,且所述第二时长的起始时刻为接收到所述第二心跳信号的时刻,所述第二时长的终止时刻与所述第一时长的终止时刻相同。sending the second duration and the identifier of the update data to the second terminal, and recording the identifier of the second terminal, so that the second terminal determines that the update data is not stored based on the identifier of the update data , keep the sleep state of the second duration, wherein the second duration is less than the first duration, and the start moment of the second duration is the moment when the second heartbeat signal is received, the The end moment of the second duration is the same as the end moment of the first duration.
又一方面,提供了一种数据传输装置,应用于第一终端,所述装置包括:In another aspect, a data transmission device is provided, which is applied to a first terminal, and the device includes:
发送模块,用于向中心网关发送携带所述第一终端的标识的第一心跳信号;a sending module, configured to send a first heartbeat signal carrying the identity of the first terminal to the central gateway;
接收模块,用于接收所述中心网关传输的更新数据,所述更新数据是所述中心网关确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于所述第一终端的标识和所述第二终端的标识同步传输的;The receiving module is configured to receive the update data transmitted by the central gateway, the update data is determined by the central gateway to update data, and record the second terminal carried by the second heartbeat signal received within the first duration After the identification of the first terminal, it is transmitted synchronously based on the identification of the first terminal and the identification of the second terminal;
其中,所述第二心跳信号是所述第二终端向所述中心网关发送的,所述第一终端为与所述中心网关连接的终端中的任一终端,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第一时长的起始时刻为所述中心网关接收到所述第一心跳信号的时刻。Wherein, the second heartbeat signal is sent by the second terminal to the central gateway, the first terminal is any one of the terminals connected to the central gateway, and the second terminal is connected to the central gateway. For terminals other than the first terminal among the terminals connected to the central gateway, the starting moment of the first duration is the moment when the central gateway receives the first heartbeat signal.
可选的,所述更新数据包括:多个数据包和数据包总数;Optionally, the update data includes: multiple data packets and the total number of data packets;
所述接收模块,包括:The receiving module includes:
第一接收模块,用于接收所述中心网关传输的所述数据包总数;A first receiving module, configured to receive the total number of data packets transmitted by the central gateway;
第二接收模块,用于分多次接收所述中心网关传输的所述多个数据包。The second receiving module is configured to receive the multiple data packets transmitted by the central gateway in multiple times.
可选的,所述更新数据还包括:每个所述数据包的传输次序号;Optionally, the update data also includes: a transmission sequence number of each of the data packets;
所述第二接收模块,用于:The second receiving module is used for:
对于所述多个数据包中的目标数据包,接收所述中心网关传输的所述目标数据包以及所述目标数据包的传输次序号,所述目标数据包为所述多个数据包中的任一数据包,所述传输次序号不大于次数阈值;For the target data packet in the multiple data packets, receive the target data packet transmitted by the central gateway and the transmission sequence number of the target data packet, the target data packet is the target data packet in the multiple data packets For any data packet, the transmission sequence number is not greater than the number of times threshold;
若接收到的数据包的个数不大于所述数据包总数,且所述目标数据包的传输次序号小于次数阈值,保持第三时长的睡眠状态后接收所述中心网关传输的所述目标数据包的下一个数据包,所述第三时长为所述目标数据包的传输时长与差值阈值的乘积,所述差值阈值为所述次数阈值与所述目标数据包的传输次序号的差值;If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is less than the number of times threshold, the target data transmitted by the central gateway is received after maintaining a sleep state for a third length of time The next data packet of the packet, the third duration is the product of the transmission duration of the target data packet and the difference threshold, and the difference threshold is the difference between the number of times threshold and the transmission sequence number of the target data packet value;
若接收到的数据包的个数不大于所述数据包总数,且所述目标数据包的传输次序号等于次数阈值,接收所述中心网关传输的所述目标数据包的下一个数据包。If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is equal to the number of times threshold, receive the next data packet of the target data packet transmitted by the central gateway.
又一方面,提供了一种数据传输装置,应用于第二终端,所述装置包括:In yet another aspect, a data transmission device is provided, which is applied to a second terminal, and the device includes:
发送模块,用于向中心网关发送携带所述第二终端的标识的第二心跳信号;a sending module, configured to send a second heartbeat signal carrying the identity of the second terminal to the central gateway;
接收模块,用于接收所述中心网关传输的更新数据,所述更新数据是所述中心网关接收到第一终端发送的携带有所述第一终端的标识的第一心跳信号,确定需要进行数据更新,并记录在第一时长内接收到的所述第二心跳信号所携带的第二终端的标识后,基于所述第一终端的标识和所述第二终端的标识同步传输的;The receiving module is configured to receive the update data transmitted by the central gateway, the update data is that the central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, and determines that data needs to be performed. After updating and recording the identity of the second terminal carried by the second heartbeat signal received within the first duration, synchronously transmitting based on the identity of the first terminal and the identity of the second terminal;
其中,所述第一终端为与所述中心网关连接的终端中的任一终端,所述第二终端为与所述中心网关连接的终端中除所述第一终端以外的终端,所述第一时长的起始时刻为所述中心网关接收到所述第一心跳信号的时刻。Wherein, the first terminal is any one of the terminals connected to the central gateway, the second terminal is a terminal other than the first terminal among the terminals connected to the central gateway, and the second The starting moment of a duration is the moment when the central gateway receives the first heartbeat signal.
又一方面,提供了一种数据传输装置,包括:存储器,处理器及存储在所述存储器上的计算机程序,所述处理器执行所述计算机程序时实现上述各个方面所述的数据传输方法。In yet another aspect, a data transmission device is provided, including: a memory, a processor, and a computer program stored on the memory, and the processor implements the data transmission method described in the above aspects when executing the computer program.
又一方面,提供了一种数据传输系统,所述数据传输系统包括:中心网关、第一终端和第二终端,所述中心网关包括上述方面所述的数据传输的装置;所述第一终端包括如上述方面所述的数据传输的装置;所述第二终端包括如上述方面所述的数据传输的装置。In yet another aspect, a data transmission system is provided, the data transmission system includes: a central gateway, a first terminal and a second terminal, the central gateway includes the data transmission device described in the above aspect; the first terminal It includes the device for data transmission as described in the above aspect; the second terminal includes the device for data transmission as described in the above aspect.
又一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行如上述方面所述的数据传输方法。In yet another aspect, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer, the computer is made to execute the data transmission method as described in the above aspect.
本发明实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present invention at least include:
本发明实施例提供了一种数据传输方法、装置及系统,中心网关在接收到第一终端发送的第一心跳信号后,若确定需要进行数据更新,则可以记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,并基于第一终端的标识和第二终端的标识将更新数据同步传输至第一终端和第二终端。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。Embodiments of the present invention provide a data transmission method, device, and system. After receiving the first heartbeat signal sent by the first terminal, the central gateway can record the heartbeat signal received within the first time period if it determines that data update is required. The identity of the second terminal carried by the second heartbeat signal, and synchronously transmitting the update data to the first terminal and the second terminal based on the identity of the first terminal and the identity of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.
图1是本发明各个实施例提供所涉及的实施环境的示意图;FIG. 1 is a schematic diagram of the implementation environment involved in various embodiments of the present invention;
图2是本发明实施例提供的一种数据传输方法的流程图;FIG. 2 is a flowchart of a data transmission method provided by an embodiment of the present invention;
图3是本发明实施例提供的另一种数据传输方法的流程图;FIG. 3 is a flowchart of another data transmission method provided by an embodiment of the present invention;
图4是本发明实施例提供的又一种数据传输方法的流程图;FIG. 4 is a flowchart of another data transmission method provided by an embodiment of the present invention;
图5是本发明实施例提供的再一种数据传输方法的流程图;Fig. 5 is a flowchart of another data transmission method provided by an embodiment of the present invention;
图6是本发明实施例提供的一种数据传输装置的框图;FIG. 6 is a block diagram of a data transmission device provided by an embodiment of the present invention;
图7是本发明实施例提供的一种传输模块的框图;Fig. 7 is a block diagram of a transmission module provided by an embodiment of the present invention;
图8是本发明实施例提供的另一种数据传输装置的框图;FIG. 8 is a block diagram of another data transmission device provided by an embodiment of the present invention;
图9是本发明实施例提供的又一种数据传输装置的框图;FIG. 9 is a block diagram of another data transmission device provided by an embodiment of the present invention;
图10是本发明实施例提供的一种接收模块的框图;Fig. 10 is a block diagram of a receiving module provided by an embodiment of the present invention;
图11是本发明实施例提供的又一种数据传输装置的框图。Fig. 11 is a block diagram of another data transmission device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the implementation manner of the present invention will be further described in detail below in conjunction with the accompanying drawings.
图1是本发明各个实施例所涉及的实施环境的示意图,该实施环境提供一种局域网。如图1所示,该实施环境可以包括:中心网关110、第一终端120和第二终端130。该中心网关110可以为路由器或者交换机等网络设备。该第一终端120和该第二终端130均可以是个人电脑、笔记本电脑、平板电脑、可穿戴设备、手机、公交车或者广告牌等设备,且第一终端120和第二终端130可以为相同或不同的设备,例如,如图1所示,第一终端120为个人电脑,第二终端130为手机。该中心网关110与第一终端120之间可以通过有线网络或无线网络通信连接。该中心网关110与第二终端130之间可以通过有线网络或无线网络通信连接。本领域技术人员容易理解,局域网可以包括中心网关以及与该中心网关通信连接的多个终端,第一终端120和该第二终端130可以为该多个终端中的任意两个终端。Fig. 1 is a schematic diagram of an implementation environment involved in various embodiments of the present invention, and the implementation environment provides a local area network. As shown in FIG. 1 , the implementation environment may include: a central gateway 110 , a first terminal 120 and a second terminal 130 . The central gateway 110 may be a network device such as a router or a switch. Both the first terminal 120 and the second terminal 130 can be devices such as personal computers, notebook computers, tablet computers, wearable devices, mobile phones, buses or billboards, and the first terminal 120 and the second terminal 130 can be the same Or different devices, for example, as shown in FIG. 1, the first terminal 120 is a personal computer, and the second terminal 130 is a mobile phone. The central gateway 110 can communicate with the first terminal 120 through a wired network or a wireless network. The central gateway 110 can communicate with the second terminal 130 through a wired network or a wireless network. Those skilled in the art can easily understand that the local area network may include a central gateway and a plurality of terminals communicatively connected to the central gateway, and the first terminal 120 and the second terminal 130 may be any two terminals in the plurality of terminals.
图2是本发明实施例提供的一种数据传输方法的流程图,该方法可以应用于图1所示的中心网关110中。如图2所示,该方法可以包括:FIG. 2 is a flowchart of a data transmission method provided by an embodiment of the present invention, and the method can be applied to the central gateway 110 shown in FIG. 1 . As shown in Figure 2, the method may include:
步骤201、接收第一终端发送的携带有第一终端的标识的第一心跳信号。Step 201. Receive a first heartbeat signal sent by a first terminal and carrying an identifier of the first terminal.
其中,该第一终端可以为与中心网关连接的任一终端。该第一终端的标识用于唯一标识该第一终端。可选的,该第一终端的标识可以为该第一终端的地址,或者也可以为该第一终端的序列号。Wherein, the first terminal may be any terminal connected to the central gateway. The identifier of the first terminal is used to uniquely identify the first terminal. Optionally, the identifier of the first terminal may be the address of the first terminal, or may also be the serial number of the first terminal.
在本发明实施例中,第一终端通常处于睡眠状态,且以心跳方式与中心网关保持连接,该第一终端可以每隔第四时长从睡眠状态进入唤醒状态,并向中心网关发送携带有该第一终端的标识的第一心跳信号。可选的,该第四时长可以为第一终端中预先存储的固定时长。示例的,该第四时长可以为1小时。In the embodiment of the present invention, the first terminal is usually in a sleep state and keeps connected with the central gateway in a heartbeat manner. A first heartbeat signal of the identifier of the first terminal. Optionally, the fourth duration may be a fixed duration pre-stored in the first terminal. Exemplarily, the fourth duration may be 1 hour.
步骤202、检测是否需要进行数据更新。Step 202, detecting whether data update is required.
中心网关在接收到第一终端发送的第一心跳信号后,可以检测是否需要进行数据更新。若确定无需进行数据更新,则可以执行步骤203。若确定需要进行数据更新,则可以执行步骤204。After receiving the first heartbeat signal sent by the first terminal, the central gateway may detect whether data update is required. If it is determined that no data update is required, step 203 may be performed. If it is determined that data update is required, step 204 may be performed.
步骤203、向第一终端发送心跳响应。Step 203, sending a heartbeat response to the first terminal.
中心网关在确定无需进行数据更新后,可以向第一终端发送心跳响应,以使第一终端在接收到该心跳响应后从唤醒状态再次进入睡眠状态,并在保持第四时长的睡眠状态后再次进入唤醒状态,并再次执行步骤201。After the central gateway determines that there is no need to update the data, it can send a heartbeat response to the first terminal, so that the first terminal enters the sleep state again from the wake-up state after receiving the heartbeat response, and maintains the sleep state for a fourth period of time. Enter the wake-up state, and execute step 201 again.
步骤204、记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识。Step 204: Record the identifier of the second terminal carried by the second heartbeat signal received within the first time period.
中心网关在确定需要进行数据更新后,可以接收第二终端发送的携带有该第二终端的标识的第二心跳信号,并记录第一时长内接收到的第二心跳信号所携带的第二终端的标识,该第二终端可以为与中心网关连接的终端中除第一终端以外的终端,该第一时长的起始时刻为中心网关接收到第一心跳信号的时刻,且该第一时长可以为中心网关中预先存储的固定时长。After the central gateway determines that data update is required, it can receive the second heartbeat signal carrying the identity of the second terminal sent by the second terminal, and record the second terminal heartbeat signal carried by the second heartbeat signal received within the first time period. , the second terminal may be a terminal other than the first terminal among the terminals connected to the central gateway, the starting moment of the first duration is the moment when the central gateway receives the first heartbeat signal, and the first duration may be It is a fixed duration pre-stored in the central gateway.
在本发明实施例中,该第二终端的标识用于唯一标识该第二终端,可选的,该第二终端的标识可以为该第二终端的地址,也可以为第二终端的序列号。In the embodiment of the present invention, the identifier of the second terminal is used to uniquely identify the second terminal. Optionally, the identifier of the second terminal may be the address of the second terminal or the serial number of the second terminal .
步骤205、基于第一终端的标识和第二终端的标识,将更新数据同步传输至第一终端和第二终端。Step 205: Synchronously transmit update data to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal.
综上所述,本发明实施例提供了一种数据传输方法,中心网关在接收到第一终端发送的第一心跳信号后,若确定需要进行数据更新,则可以记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,并基于第一终端的标识和第二终端的标识将更新数据同步传输至第一终端和第二终端。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission method. After the central gateway receives the first heartbeat signal sent by the first terminal, if it determines that data update is required, it can record the received heartbeat signal within the first time period. The identity of the second terminal carried in the second heartbeat signal of the heartbeat signal, and synchronously transmit the update data to the first terminal and the second terminal based on the identity of the first terminal and the identity of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图3是本发明实施例提供的另一种数据传输方法的流程图,该方法可以应用于图1所示的第一终端120中。如图3所示,该方法可以包括:FIG. 3 is a flowchart of another data transmission method provided by an embodiment of the present invention, and the method may be applied to the first terminal 120 shown in FIG. 1 . As shown in Figure 3, the method may include:
步骤301、向中心网关发送携带第一终端的标识的第一心跳信号。Step 301: Send a first heartbeat signal carrying the identifier of the first terminal to the central gateway.
在本发明实施例中,该第一终端可以为与中心网关连接的终端中的任一终端。该第一终端通常处于睡眠状态,且以心跳方式与中心网关保持连接,该第一终端可以每隔第四时长从睡眠状态进入唤醒状态,并向中心网关发送携带有第一终端的标识的第一心跳信号。可选的,该第一终端的标识可以为该第一终端的地址,或者也可以为该第一终端的序列号。该第四时长可以为第一终端中预先存储的固定时长。示例的,该第四时长可以为1小时。In this embodiment of the present invention, the first terminal may be any terminal among the terminals connected to the central gateway. The first terminal is usually in a sleep state and keeps connected with the central gateway in a heartbeat manner. The first terminal can enter the wake-up state from the sleep state every fourth time, and send the first terminal to the central gateway. A heartbeat signal. Optionally, the identifier of the first terminal may be the address of the first terminal, or may also be the serial number of the first terminal. The fourth duration may be a fixed duration pre-stored in the first terminal. Exemplarily, the fourth duration may be 1 hour.
步骤302、接收中心网关传输的更新数据。Step 302, receiving update data transmitted by the central gateway.
该更新数据是中心网关接收到第一心跳信号,确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。The update data is based on the first terminal's identification and The identity of the second terminal is transmitted synchronously.
其中,该第二心跳信号是第二终端向中心网关发送的,第二终端可以为与中心网关连接的终端中除第一终端以外的终端,该第一时长的起始时刻可以为中心网关接收到第一心跳信号的时刻。Wherein, the second heartbeat signal is sent by the second terminal to the central gateway, the second terminal may be a terminal other than the first terminal among the terminals connected to the central gateway, and the starting moment of the first duration may be received by the central gateway to the moment of the first heartbeat signal.
综上所述,本发明实施例提供了一种数据传输方法,第一终端可以向中心网关发送携带第一终端的标识的第一心跳信号,并接收中心网关发送的更新数据,该更新数据是中心网关在确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission method. The first terminal can send the first heartbeat signal carrying the identity of the first terminal to the central gateway, and receive the update data sent by the central gateway. The update data is After the central gateway determines that data update is required, and records the second terminal's identity carried by the second heartbeat signal received within the first time period, it transmits synchronously based on the first terminal's identity and the second terminal's identity. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图4是本发明实施例提供的又一种数据传输方法流程图,该方法可以应用于图1所示的第二终端130中。如图4所示,该方法可以包括:FIG. 4 is a flowchart of another data transmission method provided by an embodiment of the present invention, and the method may be applied to the second terminal 130 shown in FIG. 1 . As shown in Figure 4, the method may include:
步骤401、向中心网关发送携带第二终端的标识的第二心跳信号。Step 401, sending a second heartbeat signal carrying the identity of the second terminal to the central gateway.
在本发明实施例中,该第二终端可以为与中心网关连接的终端中除第一终端以外的终端,该第一终端可以为与中心网关连接的终端中的任一终端。该第二终端的标识用于唯一标识该第二终端,可选的,该第二终端的标识可以为该第二终端的地址,或者也可以为第二终端的序列号。In the embodiment of the present invention, the second terminal may be a terminal other than the first terminal among the terminals connected to the central gateway, and the first terminal may be any terminal among the terminals connected to the central gateway. The identifier of the second terminal is used to uniquely identify the second terminal. Optionally, the identifier of the second terminal may be an address of the second terminal, or may also be a serial number of the second terminal.
该第二终端终端通常处于睡眠状态,且以心跳方式与中心网关保持连接,该第二终端可以每隔第四时长从睡眠状态进入唤醒状态,并向中心网关发送携带有第二终端的标识的第二心跳信号。The second terminal is usually in the sleep state and keeps connected with the central gateway in a heartbeat manner. The second terminal can enter the wake-up state from the sleep state every fourth time, and send a message carrying the identity of the second terminal to the central gateway. Second heartbeat signal.
步骤402、接收中心网关传输的更新数据。Step 402, receiving update data transmitted by the central gateway.
该更新数据是中心网关接收到第一终端发送的携带有第一终端的标识的第一心跳信号,确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。其中,该第一时长的起始时刻可以为中心网关接收到第一心跳信号的时刻。The update data is that the central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, determines that data update is required, and records the first heartbeat signal carried by the second heartbeat signal received within the first duration. After the identification of the second terminal, it is transmitted synchronously based on the identification of the first terminal and the identification of the second terminal. Wherein, the starting moment of the first duration may be the moment when the central gateway receives the first heartbeat signal.
综上所述,本发明实施例提供了一种数据传输方法,第二终端可以向中心网关发送携带第二终端的标识的第二心跳信号,并接收中心网关发送的更新数据,该更新数据是中心网关接收到第一终端发送的携带有第一终端的标识的第一心跳信号,在确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission method, the second terminal can send the second heartbeat signal carrying the identity of the second terminal to the central gateway, and receive the update data sent by the central gateway, the update data is The central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, determines that data update is required, and records the second heartbeat signal received within the first duration. After identification, it is transmitted synchronously based on the identification of the first terminal and the identification of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图5是本发明实施例提供的再一种数据传输方法的流程图,该方法可以应用于图1所示的实施环境中。如图5所示,该方法可以包括:FIG. 5 is a flowchart of another data transmission method provided by an embodiment of the present invention, and the method can be applied to the implementation environment shown in FIG. 1 . As shown in Figure 5, the method may include:
步骤501、第一终端向中心网关发送携带第一终端的标识的第一心跳信号。Step 501, the first terminal sends a first heartbeat signal carrying the identity of the first terminal to the central gateway.
其中,该第一终端可以为与中心网关连接的任一终端。该第一终端的标识用于唯一标识该第一终端。可选的,该第一终端的标识可以为该第一终端的地址,或者也可以为该第一终端的序列号。Wherein, the first terminal may be any terminal connected to the central gateway. The identifier of the first terminal is used to uniquely identify the first terminal. Optionally, the identifier of the first terminal may be the address of the first terminal, or may also be the serial number of the first terminal.
在本发明实施例中,该第一终端通常处于睡眠状态,且以心跳方式与中心网关保持连接,该第一终端可以每隔第四时长从睡眠状态进入唤醒状态,并向中心网关发送携带第一终端的标识的第一心跳信号。该第四时长可以为第一终端预先存储的固定时长,示例的,该第四时长可以为1小时。In this embodiment of the present invention, the first terminal is usually in a sleep state and keeps connected with the central gateway in a heartbeat manner. The first heartbeat signal of the identity of a terminal. The fourth duration may be a fixed duration pre-stored by the first terminal, for example, the fourth duration may be 1 hour.
步骤502、中心网关检测是否需要进行数据更新。Step 502, the central gateway detects whether data update is required.
在本发明实施例中,中心网关与上位机也可以通过有线网络或者无线网络通信连接,该上位机可以每隔第五时长向中心网关发送一次数据,相应的,中心网关在接收到上位机发送的数据后,可以存储该数据并将该数据的状态信息标识为未更新状态。示例的,该第五时长可以为1个月。In the embodiment of the present invention, the central gateway and the upper computer can also be connected through a wired network or a wireless network, and the upper computer can send data to the central gateway every fifth time. After the data is stored, the data can be stored and the status information of the data can be marked as not updated. For example, the fifth time period may be 1 month.
中心网关在接收到第一终端发送的第一心跳信号后,可以查询其存储的多个数据的状态信息,若该多个数据的状态信息均为已更新状态,则可以确定无需进行数据更新,执行步骤503。若确定存在状态信息为未更新状态的数据,则可以确定需要进行数据更新,执行步骤505。After the central gateway receives the first heartbeat signal sent by the first terminal, it can query the status information of the multiple data stored in it. If the status information of the multiple data is all updated, it can be determined that there is no need to update the data. Execute step 503. If it is determined that there is data whose state information is not updated, it may be determined that data update is required, and step 505 is executed.
步骤503、中心网关向第一终端发送心跳响应。Step 503, the central gateway sends a heartbeat response to the first terminal.
中心网关在确定无需进行数据更新后,可以向第一终端发送心跳响应。The central gateway may send a heartbeat response to the first terminal after determining that data update is unnecessary.
步骤504、第一终端保持第四时长的睡眠状态。Step 504, the first terminal maintains a sleep state for a fourth duration.
第一终端在接收到中心网关发送的心跳响应后,可以从唤醒状态再次进入睡眠状态,并在保持睡眠状态第四时长后,再次执行步骤501。After receiving the heartbeat response sent by the central gateway, the first terminal may enter the sleep state again from the wake-up state, and perform step 501 again after staying in the sleep state for a fourth period of time.
需要说明的是,在步骤501中,第一终端在进入唤醒状态后可以向中心网关多次发送心跳信号,在第一终端与中心网关保持通信连接的状态下,中心网关可以针对第一终端每次发送的心跳信号发送心跳响应,若第一终端未接收到中心网关发送的心跳响应的次数超过基准次数,则第一终端可以确定与中心网关断开连接。之后第一终端可以重新与中心网关建立通信连接。It should be noted that in step 501, after the first terminal enters the wake-up state, it can send heartbeat signals to the central gateway multiple times. The first sent heartbeat signal sends a heartbeat response, and if the first terminal does not receive the number of heartbeat responses sent by the central gateway exceeding the reference number, the first terminal may determine to disconnect from the central gateway. After that, the first terminal can re-establish a communication connection with the central gateway.
步骤505、中心网关将第一时长以及更新数据的标识发送至第一终端。Step 505, the central gateway sends the first duration and the identifier of the updated data to the first terminal.
中心网关在确定需要进行数据更新后,可以将第一时长以及更新数据的标识发送至第一终端。其中,该第一时长的起始时刻为中心网关接收到第一心跳信号的时刻,且该第一时长可以是中心网关预先存储的固定时长。该更新数据的标识可以为该更新数据的编号,例如,该更新数据的编号可以为00。或者该更新数据的标识也可以为该更新数据的循环冗余校验码(cyclic redundancy check,CRC)码。After the central gateway determines that data update is required, it may send the first duration and the identifier of the updated data to the first terminal. Wherein, the starting moment of the first duration is the moment when the central gateway receives the first heartbeat signal, and the first duration may be a fixed duration stored in advance by the central gateway. The identifier of the updated data may be the serial number of the updated data, for example, the serial number of the updated data may be 00. Alternatively, the identifier of the updated data may also be a cyclic redundancy check (cyclic redundancy check, CRC) code of the updated data.
可选的,该更新数据可以为状态信息为未更新状态的多个数据中的任一个数据,或者也可以为中心网关从上位机最新接收到的数据,本发明实施例对此不做限定。Optionally, the update data may be any one of multiple data whose state information is not updated, or may be the latest data received by the central gateway from the upper computer, which is not limited in this embodiment of the present invention.
在本发明实施例中,中心网关还可以将更新数据的长度发送至第一终端。该更新数据的长度用于指示该该更新数据的大小。示例的,更新数据的长度可以为12兆字节(megabyte,MB)。In the embodiment of the present invention, the central gateway may also send the length of the update data to the first terminal. The length of the update data is used to indicate the size of the update data. For example, the length of the update data may be 12 megabytes (megabyte, MB).
步骤506、第一终端检测是否存储有更新数据。Step 506, the first terminal detects whether update data is stored.
在本发明实施例中,第一终端中可以存储有中心网关发送的多个数据以及每个数据的标识,在接收到中心网关发送的更新数据的标识后,第一终端可以将该更新数据的标识与其存储的多个数据的标识进行比较,若第一终端存储该更新数据的标识,表明第一终端存储有该更新数据,则第一终端可以执行步骤504。若第一终端未存储该更新数据的标识,表明第一终端未存储该更新数据,则可以执行步骤507。In the embodiment of the present invention, the first terminal may store a plurality of data sent by the central gateway and the identifier of each data, and after receiving the identifier of the updated data sent by the central gateway, the first terminal may store the identifier of the updated data The identifier is compared with identifiers of multiple data stored therein, and if the first terminal stores the identifier of the updated data, which indicates that the first terminal stores the updated data, the first terminal may execute step 504 . If the first terminal does not store the identifier of the update data, indicating that the first terminal does not store the update data, step 507 may be performed.
步骤507、第一终端保持第一时长的睡眠状态。Step 507, the first terminal maintains a sleep state for a first duration.
第一终端在确定未存储该更新数据的标识后,可以再次进入睡眠状态,并保持第一时长的睡眠状态后再次进入唤醒状态。其中,该第一时长小于第四时长。After determining that the identifier of the updated data is not stored, the first terminal may enter the sleep state again, and enter the wake-up state again after maintaining the sleep state for a first duration. Wherein, the first duration is less than the fourth duration.
步骤508、第二终端向中心网关发送携带第二终端的标识的第二心跳信号。Step 508, the second terminal sends a second heartbeat signal carrying the identity of the second terminal to the central gateway.
其中,该第二终端可以为与中心网关连接的终端中除第一终端以外的终端,该第二终端的标识用于唯一标识该第二终端。该第二心跳信号是中心网关在确定需要进行数据更新后,在第一时长内接收到的第二终端发送的心跳信号。可选的,该第二终端的标识可以为该第二终端的地址,或者也可以为该第二终端的序列号。Wherein, the second terminal may be a terminal other than the first terminal among the terminals connected to the central gateway, and the identifier of the second terminal is used to uniquely identify the second terminal. The second heartbeat signal is a heartbeat signal received by the second terminal within the first time period after the central gateway determines that data update is required. Optionally, the identifier of the second terminal may be the address of the second terminal, or may also be the serial number of the second terminal.
步骤509、中心网关将第二时长以及更新数据的标识发送至第二终端,并记录第二终端的标识。Step 509, the central gateway sends the second duration and the identifier of the updated data to the second terminal, and records the identifier of the second terminal.
中心网关在接收到第二终端发送的第二心跳信号后,可以将第二时长以及更新数据的标识发送至第二终端,并记录该第二终端的标识。其中,该第二时长小于第一时长,且该第二时长的起始时刻为中心网关接收到该第二心跳信号的时刻,该第二时长的终止时刻与第一时长的终止时刻相同。After receiving the second heartbeat signal sent by the second terminal, the central gateway may send the second duration and the identification of the updated data to the second terminal, and record the identification of the second terminal. Wherein, the second duration is shorter than the first duration, and the start moment of the second duration is the moment when the central gateway receives the second heartbeat signal, and the end moment of the second duration is the same as that of the first duration.
步骤510、第二终端检测是否存储有更新数据。Step 510, the second terminal detects whether update data is stored.
在本发明实施例中,第二终端中存储有中心网关发送的多个数据以及每个数据的标识,在接收到中心网关发送的更新数据的标识后,第二终端可以将该更新数据的标识与其存储的多个数据的标识进行比较,若第二终端存储该更新数据的标识,表明第二终端存储有该更新数据,则第二终端可以执行步骤511。若第二终端未存储该更新数据的标识,表明第二终端未存储该更新数据,则可以执行步骤512。In the embodiment of the present invention, the second terminal stores a plurality of data sent by the central gateway and the identifier of each data, and after receiving the identifier of the updated data sent by the central gateway, the second terminal can store the identifier of the updated data Compared with the identifiers of multiple data stored by it, if the second terminal stores the identifier of the updated data, which indicates that the second terminal stores the updated data, the second terminal may execute step 511 . If the second terminal does not store the identifier of the update data, indicating that the second terminal does not store the update data, step 512 may be executed.
步骤511、第二终端保持第四时长的睡眠状态。Step 511, the second terminal maintains a sleep state for a fourth duration.
第二终端在确定存储有更新数据后,可以从唤醒状态再次进入睡眠状态,并在保持睡眠状态第四时长后,再次执行步骤508。After determining that the update data is stored, the second terminal may enter the sleep state again from the wake-up state, and perform step 508 again after staying in the sleep state for a fourth period of time.
步骤512、第二终端保持第二时长的睡眠状态。Step 512, the second terminal maintains a sleep state for a second duration.
第二终端在确定未存储有更新数据后,可以从唤醒状态再次进入睡眠状态,并在保持第二时长的睡眠状态后再次进入唤醒状态。其中,该第二时长小于第四时长。After determining that no update data is stored, the second terminal may enter the sleep state again from the wake-up state, and enter the wake-up state again after staying in the sleep state for a second length of time. Wherein, the second duration is less than the fourth duration.
需要说明的是,在第一时长内,中心网关可以接收到多个第二终端发送的多个第二心跳信号,每个第二终端向中心网关发送的第二心跳信号可以携带该第二终端的标识,中心网关接收到多个第二终端发送的第二心跳信号的时刻可以不同,也可以相同。若中心网关接收到不同第二终端发送的第二心跳信号的时刻不同,则该不同第二终端在确定未存储有更新数据的后,保持睡眠状态的时长不同,且该不同第二终端从睡眠状态再次进入唤醒状态的时刻(从睡眠状态再次进入唤醒状态的时刻也即是唤醒时刻)是相同的,该唤醒时刻与第一时长的终止时刻相同,也即是该多个第二终端均在第一时长的终止时刻从睡眠状态再次进入唤醒状态。It should be noted that within the first duration, the central gateway may receive multiple second heartbeat signals sent by multiple second terminals, and the second heartbeat signal sent by each second terminal to the central gateway may carry the second terminal heartbeat signal. The time when the central gateway receives the second heartbeat signals sent by multiple second terminals may be different or the same. If the central gateway receives the second heartbeat signals sent by different second terminals at different times, the different second terminals will keep the sleep state for different periods after determining that there is no update data stored, and the different second terminals will start from sleep. The time when the state enters the wake-up state again (the time when the sleep state enters the wake-up state again is the wake-up time) is the same, and the wake-up time is the same as the end time of the first duration, that is, the plurality of second terminals are all in At the end of the first duration, the sleep state enters the wake-up state again.
步骤513、中心网关基于第一终端的标识和第二终端的标识,将数据包总数同步传输至第一终端和第二终端。Step 513, the central gateway synchronously transmits the total number of data packets to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal.
在本发明实施例中,该更新数据可以包括数据包总数。在到达第一时长的终止时刻后,中心网关可以基于第一终端的标识和第二终端的标识,将数据包总数同步传输至第一终端和第二终端。相应的,该第一终端和该第二终端均在到达第一时长的终止时刻后,从睡眠状态再次进入唤醒状态,并接收中心网关发送的数据包总数。In this embodiment of the present invention, the update data may include the total number of data packets. After reaching the termination moment of the first duration, the central gateway may synchronously transmit the total number of data packets to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal. Correspondingly, both the first terminal and the second terminal enter the wake-up state again from the sleep state after reaching the end time of the first duration, and receive the total number of data packets sent by the central gateway.
可选的,中心网关还可以将更新数据的标识同步传输至第一终端和第二终端。Optionally, the central gateway may also synchronously transmit the identification of the updated data to the first terminal and the second terminal.
步骤514、中心网关基于第一终端的标识和第二终端的标识,将多个数据包分多次同步传输至第一终端和第二终端。In step 514, the central gateway transmits multiple data packets synchronously to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal.
在本发明实施例中,该更新数据还可以包括多个数据包和每个数据包的传输次序号。中心网关还可以基于第一终端的标识和第二终端的标识,将该多个数据包分多次同步传输至第一终端和第二终端。In this embodiment of the present invention, the update data may also include a plurality of data packets and a transmission sequence number of each data packet. The central gateway may also transmit the plurality of data packets to the first terminal and the second terminal synchronously in multiple times based on the identifier of the first terminal and the identifier of the second terminal.
可选的,对于该多个数据包中的目标数据包,中心网关在每次向第一终端和第二终端同步传输该目标数据包时,可以向第一终端和第二终端同步传输该目标数据包和该目标数据包的传输次序号。也即是,对于每一个数据包,中心网关可以向第一终端和第二终端多次传输该数据包。其中,该目标数据包为多个数据包中的任一数据包,该传输次序号不大于次数阈值。示例的,该次数阈值可以为2。若传输次序号为1,该传输次序号表示中心网关是第1次向第一终端和第二终端同步传输该目标数据包。Optionally, for the target data packet in the plurality of data packets, the central gateway may synchronously transmit the target data packet to the first terminal and the second terminal each time the target data packet is synchronously transmitted to the first terminal and the second terminal. The data packet and the transmission sequence number of the target data packet. That is, for each data packet, the central gateway may transmit the data packet to the first terminal and the second terminal multiple times. Wherein, the target data packet is any data packet in a plurality of data packets, and the transmission sequence number is not greater than the number of times threshold. For example, the times threshold may be 2. If the transmission sequence number is 1, the transmission sequence number indicates that the central gateway is synchronously transmitting the target data packet to the first terminal and the second terminal for the first time.
相应的,以第一终端为例,对于多个数据包中的目标数据包,第一终端在接收到中心网关传输的目标数据包以及该目标数据包的传输次序号后,可以检测接收到的数据包的个数是否小于数据包总数,以及该目标数据包的传输次序号是否小于次数阈值。若接收到的数据包的个数不大于数据包总数,且该目标数据包的传输次序号小于次数阈值,则第一终端保持第三时长的睡眠状态后接收中心网关传输的目标数据包的下一个数据包。若接收到的数据包的个数不大于数据包总数,且该目标数据包的传输次序号等于次数阈值,则第一终端接收中心网关传输的目标数据包的下一个数据包。其中,该第三时长为该目标数据包的传输时长与差值阈值的乘积,该差值阈值为次数阈值与目标数据包的传输次序号的差值,该第三时长小于第四时长。Correspondingly, taking the first terminal as an example, for a target data packet among multiple data packets, after receiving the target data packet transmitted by the central gateway and the transmission sequence number of the target data packet, the first terminal can detect the received Whether the number of data packets is less than the total number of data packets, and whether the transmission sequence number of the target data packet is less than the number of times threshold. If the number of data packets received is not greater than the total number of data packets, and the transmission sequence number of the target data packet is less than the number of times threshold, then the first terminal maintains a sleep state of a third duration and then receives the next target data packet transmitted by the central gateway. a packet. If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is equal to the number of times threshold, the first terminal receives the next data packet of the target data packet transmitted by the central gateway. Wherein, the third duration is the product of the transmission duration of the target data packet and a difference threshold, the difference threshold is the difference between the number of times threshold and the transmission sequence number of the target data packet, and the third duration is smaller than the fourth duration.
以第一终端为例,示例的,若数据包总数为10,目标数据包为该10个数据包中的第一个数据包,次数阈值为2,则中心网关向该第一终端发送数据包总数10,并在第一次向第一终端传输该第一个数据包时,向该第一终端传输该第一个数据包以及该第一个数据包的传输次序号1。Take the first terminal as an example. For example, if the total number of data packets is 10, the target data packet is the first data packet in the 10 data packets, and the number of times threshold is 2, then the central gateway sends data packets to the first terminal The total number is 10, and when the first data packet is transmitted to the first terminal for the first time, the first data packet and the transmission sequence number 1 of the first data packet are transmitted to the first terminal.
若第一终端接收到该第一个数据包以及传输次序号1,由于第一终端接收到的数据包的个数1小于数据包总数10,且传输次序号1小于次数阈值2,则第一终端可以保持第三时长的睡眠状态。中心网关在第二次向第一终端传输该第一个数据包时,向该第一终端传输该第一个数据包以及该第一个数据包的传输次序号2,由于此时第一终端处于睡眠状态,则第一终端不会接收中心网关第二次发送的该第一个数据包以及传输次序号2。在到达第三时长的终止时刻后,第一终端从睡眠状态进入唤醒状态,并继续接收中心网关发送的第二个数据包,以此类推,直至中心网关将10个数据包均传输至第一终端。If the first terminal receives the first data packet and the transmission sequence number 1, since the number 1 of the data packets received by the first terminal is less than the total number of data packets 10, and the transmission sequence number 1 is less than the number of times threshold 2, the first The terminal may maintain a sleep state for a third duration. When the central gateway transmits the first data packet to the first terminal for the second time, it transmits the first data packet and the transmission sequence number 2 of the first data packet to the first terminal, because at this time the first terminal In the sleeping state, the first terminal will not receive the first data packet and the transmission sequence number 2 sent by the central gateway for the second time. After reaching the termination moment of the third duration, the first terminal enters the wake-up state from the sleep state, and continues to receive the second data packet sent by the central gateway, and so on, until the central gateway transmits all 10 data packets to the first terminal. terminal.
若第一终端未接收到该第一个数据包以及传输次序号1,则第一终端继续接收中心网关第二次发送的第一个数据包以及该第一个数据包的传输次序号2,之后,若第一终端接收到中心网关第二次发送的该第一个数据包和该第一个数据包的传输次序号2,由于第一终端接收到的数据包的个数1小于数据包总数10,且传输次序号2等于次数阈值2,则第一终端可以保持唤醒状态并等待接收中心网关发送的第二个数据包。若第一终端仍未接收到中心网关第二次发送的该第一个数据包和该第一个数据包的传输次序号2,表明第一终端未接收到中心网关发送的第一个数据包,则可以保持唤醒状态并等待接收中心网关发送的第二个数据包,以此类推,直至中心网关将10个数据包均传输至第一终端。If the first terminal does not receive the first data packet and the transmission sequence number 1, the first terminal continues to receive the first data packet sent by the central gateway for the second time and the transmission sequence number 2 of the first data packet, After that, if the first terminal receives the first data packet sent by the central gateway for the second time and the transmission sequence number 2 of the first data packet, since the number 1 of the data packets received by the first terminal is less than the data packet The total number is 10, and the transmission sequence number 2 is equal to the number of times threshold 2, then the first terminal can stay awake and wait to receive the second data packet sent by the central gateway. If the first terminal has not received the first data packet sent by the central gateway for the second time and the transmission sequence number 2 of the first data packet, it indicates that the first terminal has not received the first data packet sent by the central gateway , you can stay awake and wait to receive the second data packet sent by the central gateway, and so on until the central gateway transmits all 10 data packets to the first terminal.
在本发明实施例中,该更新数据还可以包括每个数据包的标识,该数据包的标识可以为该数据包的名称。中心网关在将多个数据分多次同步传输至第一终端和第二终端后,可以向第一终端和第二终端发送更新信息获取指令,以使第一终端和第二终端将更新信息发送至中心网关,中心网关将接收到的第一终端发送的更新信息和第二终端发送的更新信息发送至上位机,由上位机确定是否需要再次向第一终端和第二终端传输更新数据。其中,更新信息可以包括第一终端和第二终端接收到的数据包个数以及接收到的每个数据包的标识。第一终端和第二终端在将更新信息发送至中心网关后,再次进入睡眠状态,并保持第四时长的睡眠状态后再次执行步骤501。In this embodiment of the present invention, the update data may further include an identifier of each data package, and the identifier of the data package may be the name of the data package. After the central gateway synchronously transmits multiple data to the first terminal and the second terminal, it can send an update information acquisition instruction to the first terminal and the second terminal, so that the first terminal and the second terminal will send the update information to To the central gateway, the central gateway sends the received update information sent by the first terminal and the updated information sent by the second terminal to the host computer, and the host computer determines whether to transmit update data to the first terminal and the second terminal again. Wherein, the update information may include the number of data packets received by the first terminal and the second terminal and the identifier of each received data packet. After sending the update information to the central gateway, the first terminal and the second terminal enter the sleep state again, and perform step 501 again after maintaining the sleep state for a fourth period of time.
需要说明的是,中心网关可以采用广播的方式向第一终端和第二终端同步传输多个数据包,在该过程中,中心网关会向第一终端和第二终端传输每个数据包,但是容易理解,第一终端和第二终端可能会接收到中心网关发送的所有数据包,也可能仅会接收到中心网关传输的部分数据包。It should be noted that the central gateway may transmit multiple data packets synchronously to the first terminal and the second terminal in a broadcast manner. During this process, the central gateway will transmit each data packet to the first terminal and the second terminal, but It is easy to understand that the first terminal and the second terminal may receive all the data packets sent by the central gateway, or may only receive part of the data packets transmitted by the central gateway.
在本发明实施例中,由于对于每一个数据包,中心网关会向第一终端多次传输该数据包,因此有助于提高第一终端接收到每个数据包的可靠性以及准确性。并且,由于第一终端在接收到数据包后,若传输次序号小于次数阈值,则该第一终端进入睡眠状态,并在中心网关传输下一个数据包时从睡眠状态进入唤醒状态,因此第一终端无需一直保持唤醒状态,有助于降低第一终端的功耗。In the embodiment of the present invention, since the central gateway will transmit the data packet to the first terminal multiple times for each data packet, it is helpful to improve the reliability and accuracy of each data packet received by the first terminal. And, because after the first terminal receives the data packet, if the transmission sequence number is less than the number of times threshold, the first terminal enters the sleep state, and enters the wake-up state from the sleep state when the central gateway transmits the next data packet, so the first terminal The terminal does not need to keep in the wake-up state all the time, which helps to reduce the power consumption of the first terminal.
需要说明的是,本发明实施例提供的数据传输方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行删除。例如,步骤503、步骤504以及步骤511可以根据情况删除。任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本发明的保护范围之内,因此不再赘述。It should be noted that the order of the steps of the data transmission method provided in the embodiment of the present invention can be adjusted appropriately, and the steps can also be deleted according to the situation. For example, step 503, step 504 and step 511 may be deleted according to circumstances. Any person skilled in the art within the technical scope disclosed in the present invention can easily think of changing methods, which should be covered within the scope of protection of the present invention, and thus will not be repeated here.
综上所述,本发明实施例提供了一种数据传输方法,中心网关在接收到第一终端发送的第一心跳信号后,若确定需要进行数据更新,则可以记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,并基于第一终端的标识和第二终端的标识将更新数据同步传输至第一终端和第二终端。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission method. After the central gateway receives the first heartbeat signal sent by the first terminal, if it determines that data update is required, it can record the received heartbeat signal within the first time period. The identity of the second terminal carried in the second heartbeat signal of the heartbeat signal, and synchronously transmit the update data to the first terminal and the second terminal based on the identity of the first terminal and the identity of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图6是本发明实施例提供的一种数据传输装置60的框图,该数据传输装置可以应用于图1所示的中心网关110中。如图6所示,该装置60可以包括:接收模块601、记录模块602和传输模块603。FIG. 6 is a block diagram of a data transmission device 60 provided by an embodiment of the present invention, which can be applied to the central gateway 110 shown in FIG. 1 . As shown in FIG. 6 , the apparatus 60 may include: a receiving module 601 , a recording module 602 and a transmitting module 603 .
接收模块601,用于接收第一终端发送的携带有第一终端的标识的第一心跳信号,第一终端为与中心网关连接的任一终端。The receiving module 601 is configured to receive the first heartbeat signal carrying the identifier of the first terminal sent by the first terminal, where the first terminal is any terminal connected to the central gateway.
记录模块602,用于当确定需要进行数据更新时,记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,第二终端为与中心网关连接的终端中除第一终端以外的终端,第二心跳信号是第二终端向中心网关发送的,第一时长的起始时刻为接收到第一心跳信号的时刻。The recording module 602 is configured to record the identification of the second terminal carried by the second heartbeat signal received within the first duration when it is determined that data update is required, and the second terminal is the terminal connected to the central gateway except the first For terminals other than terminals, the second heartbeat signal is sent by the second terminal to the central gateway, and the start time of the first duration is the time when the first heartbeat signal is received.
传输模块603,用于基于第一终端的标识和第二终端的标识,将更新数据同步传输至第一终端和第二终端。The transmission module 603 is configured to synchronously transmit update data to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal.
综上所述,本发明实施例提供了一种数据传输装置,中心网关在接收到第一终端发送的第一心跳信号后,若确定需要进行数据更新,则可以记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识,并基于第一终端的标识和第二终端的标识将更新数据同步传输至第一终端和第二终端。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission device. After the central gateway receives the first heartbeat signal sent by the first terminal, if it determines that data update is required, it can record the received heartbeat signal within the first time period. The identity of the second terminal carried in the second heartbeat signal of the heartbeat signal, and synchronously transmit the update data to the first terminal and the second terminal based on the identity of the first terminal and the identity of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
可选的,更新数据包括:多个数据包以及数据包总数;参考图7,该传输模块603,包括:Optionally, the update data includes: multiple data packets and the total number of data packets; referring to FIG. 7, the transmission module 603 includes:
第一传输子模块6031,用于将数据包总数同步传输至第一终端和第二终端;The first transmission sub-module 6031 is configured to synchronously transmit the total number of data packets to the first terminal and the second terminal;
第二传输子模块6032,用于将多个数据包分多次同步传输至第一终端和第二终端。The second transmission sub-module 6032 is configured to synchronously transmit multiple data packets to the first terminal and the second terminal multiple times.
可选的,更新数据还包括:每个数据包的传输次序号。Optionally, the update data also includes: a transmission sequence number of each data packet.
第二传输子模块6032,用于:The second transmission submodule 6032 is used for:
对于多个数据包中的目标数据包,在每次向第一终端和第二终端同步传输目标数据包时,向第一终端和第二终端同步传输目标数据包和目标数据包的传输次序号,目标数据包为多个数据包中的任一数据包,传输次序号不大于次数阈值。For a target data packet among the plurality of data packets, when synchronously transmitting the target data packet to the first terminal and the second terminal each time, synchronously transmitting the target data packet and the transmission sequence number of the target data packet to the first terminal and the second terminal , the target data packet is any one of the multiple data packets, and the transmission sequence number is not greater than the number of times threshold.
可选的,如图8所示,该装置60还包括:Optionally, as shown in Figure 8, the device 60 also includes:
发送模块604,用于当确定需要进行数据更新之后,将第一时长以及更新数据的标识发送至第一终端,以使第一终端基于更新数据的标识确定未存储更新数据时,保持第一时长的睡眠状态。The sending module 604 is configured to send the first duration and the identifier of the updated data to the first terminal after it is determined that data update is required, so that the first terminal maintains the first duration when it determines that the updated data is not stored based on the identifier of the updated data sleep state.
记录模块602,用于接收在第一时长内第二终端发送的第二心跳信号。The recording module 602 is configured to receive the second heartbeat signal sent by the second terminal within the first duration.
将第二时长以及更新数据的标识发送至第二终端,并记录第二终端的标识,以使第二终端基于更新数据的标识确定未存储更新数据时,保持第二时长的睡眠状态,其中,第二时长小于第一时长,且第二时长的起始时刻为接收到第二心跳信号的时刻,第二时长的终止时刻与第一时长的终止时刻相同。Sending the second duration and the identifier of the update data to the second terminal, and recording the identifier of the second terminal, so that when the second terminal determines that the update data is not stored based on the identifier of the update data, it maintains the sleep state of the second duration, wherein, The second duration is shorter than the first duration, and the start moment of the second duration is the moment when the second heartbeat signal is received, and the end moment of the second duration is the same as the termination moment of the first duration.
综上所述,本发明实施例提供了一种数据传输装置,中心网关在接收到第一终端发送的第一心跳信号后,若确定需要进行数据更新,则可以记录在第一时长内接收到的第二终端的标识,并基于第一终端的标识和第二终端的标识将更新数据同步传输至第一终端和第二终端。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission device. After the central gateway receives the first heartbeat signal sent by the first terminal, if it determines that data update is required, it can record the received heartbeat signal within the first time period. The identifier of the second terminal, and synchronously transmit the update data to the first terminal and the second terminal based on the identifier of the first terminal and the identifier of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图9是本发明实施例提供的另一种数据传输装置90的框图,该数据传输装置可以应用于图1所示的第一终端120中。如图9所示,该装置90可以包括:发送模块901和接收模块902。FIG. 9 is a block diagram of another data transmission device 90 provided by an embodiment of the present invention. The data transmission device may be applied to the first terminal 120 shown in FIG. 1 . As shown in FIG. 9 , the apparatus 90 may include: a sending module 901 and a receiving module 902 .
发送模块901,用于向中心网关发送携带第一终端的标识的第一心跳信号。The sending module 901 is configured to send the first heartbeat signal carrying the identifier of the first terminal to the central gateway.
接收模块902,用于接收中心网关传输的更新数据,更新数据是中心网关确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。The receiving module 902 is configured to receive the update data transmitted by the central gateway. The update data is that the central gateway determines that data update is required, and after recording the identity of the second terminal carried by the second heartbeat signal received within the first duration, based on The identifier of the first terminal and the identifier of the second terminal are transmitted synchronously.
其中,第二心跳信号是第二终端向中心网关发送的,第一终端为与中心网关连接的终端中的任一终端,第二终端为与中心网关连接的终端中除第一终端以外的终端,第一时长的起始时刻为中心网关接收到第一心跳信号的时刻。Wherein, the second heartbeat signal is sent by the second terminal to the central gateway, the first terminal is any terminal in the terminals connected to the central gateway, and the second terminal is a terminal other than the first terminal in the terminals connected to the central gateway , the starting moment of the first duration is the moment when the central gateway receives the first heartbeat signal.
综上所述,本发明实施例提供了一种数据传输装置,第一终端可以向中心网关发送携带第一终端的标识的第一心跳信号,并接收中心网关发送的更新数据,该更新数据是中心网关在确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission device, the first terminal can send the first heartbeat signal carrying the identity of the first terminal to the central gateway, and receive the update data sent by the central gateway, the update data is After the central gateway determines that data update is required, and records the second terminal's identity carried by the second heartbeat signal received within the first time period, it transmits synchronously based on the first terminal's identity and the second terminal's identity. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it contributes to the flexibility of data transmission.
可选的,更新数据包括:多个数据包和数据包总数;Optionally, the update data includes: multiple data packets and the total number of data packets;
参考图10,接收模块902,包括:Referring to FIG. 10, the receiving module 902 includes:
第一接收模块9021,用于接收中心网关传输的数据包总数。The first receiving module 9021 is configured to receive the total number of data packets transmitted by the central gateway.
第二接收模块9022,用于分多次接收中心网关传输的多个数据包。The second receiving module 9022 is configured to receive multiple data packets transmitted by the central gateway in multiple times.
可选的,更新数据还包括:每个数据包的传输次序号。Optionally, the update data also includes: a transmission sequence number of each data packet.
第二接收模块9022,用于:The second receiving module 9022 is used for:
对于多个数据包中的目标数据包,接收中心网关传输的目标数据包以及目标数据包的传输次序号,目标数据包为多个数据包中的任一数据包,传输次序号不大于次数阈值。For a target data packet in multiple data packets, receive the target data packet transmitted by the central gateway and the transmission sequence number of the target data packet, the target data packet is any data packet in the multiple data packets, and the transmission sequence number is not greater than the number of times threshold .
若接收到的数据包的个数不大于数据包总数,且目标数据包的传输次序号小于次数阈值,保持第三时长的睡眠状态后接收中心网关传输的目标数据包的下一个数据包,第三时长为目标数据包的传输时长与差值阈值的乘积,差值阈值为次数阈值与目标数据包的传输次序号的差值。If the number of data packets received is not greater than the total number of data packets, and the transmission sequence number of the target data packet is less than the number of times threshold, the next data packet of the target data packet transmitted by the central gateway is received after maintaining the sleep state for a third period of time. The three durations are the product of the transmission duration of the target data packet and the difference threshold, and the difference threshold is the difference between the number of times threshold and the transmission sequence number of the target data packet.
若接收到的数据包的个数不大于数据包总数,且目标数据包的传输次序号等于次数阈值,接收中心网关传输的目标数据包的下一个数据包。If the number of received data packets is not greater than the total number of data packets, and the transmission sequence number of the target data packet is equal to the times threshold, the next data packet of the target data packet transmitted by the central gateway is received.
综上所述,本发明实施例提供了一种数据传输装置,第一终端可以向中心网关发送携带第一终端的标识的第一心跳信号,并接收中心网关发送的更新数据,该更新数据是中心网关在确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission device, the first terminal can send the first heartbeat signal carrying the identity of the first terminal to the central gateway, and receive the update data sent by the central gateway, the update data is After the central gateway determines that data update is required, and records the second terminal's identity carried by the second heartbeat signal received within the first time period, it transmits synchronously based on the first terminal's identity and the second terminal's identity. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
图11是本发明实施例提供的又一种数据传输装置111的框图,该数据传输装置可以应用于图1所示的第二终端130中。如图11所示,该装置可以包括:发送模块1101和接收模块1102。FIG. 11 is a block diagram of another data transmission device 111 provided by an embodiment of the present invention, and the data transmission device may be applied to the second terminal 130 shown in FIG. 1 . As shown in FIG. 11 , the apparatus may include: a sending module 1101 and a receiving module 1102 .
发送模块1101,用于向中心网关发送携带第二终端的标识的第二心跳信号。The sending module 1101 is configured to send the second heartbeat signal carrying the identity of the second terminal to the central gateway.
接收模块1102,用于接收中心网关传输的更新数据,更新数据是中心网关接收到第一终端发送的携带有第一终端的标识的第一心跳信号,确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。The receiving module 1102 is configured to receive the update data transmitted by the central gateway. The update data is that the central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, determines that data update is required, and records it in the first heartbeat signal sent by the first terminal. After receiving the identifier of the second terminal carried by the second heartbeat signal within the time period, it is transmitted synchronously based on the identifier of the first terminal and the identifier of the second terminal.
其中,第一终端为与中心网关连接的终端中的任一终端,第二终端为与中心网关连接的终端中除第一终端以外的终端,第一时长的起始时刻为中心网关接收到第一心跳信号的时刻。Wherein, the first terminal is any one of the terminals connected to the central gateway, the second terminal is a terminal other than the first terminal among the terminals connected to the central gateway, and the starting moment of the first duration is when the central gateway receives the first terminal. The moment of a heartbeat signal.
综上所述,本发明实施例提供了一种数据传输装置,第二终端可以向中心网关发送携带第二终端的标识的第二心跳信号,并接收中心网关发送的更新数据,该更新数据是中心网关接收到第一终端发送的携带有第一终端的标识的第一心跳信号,在确定需要进行数据更新,并记录在第一时长内接收到的第二心跳信号所携带的第二终端的标识后,基于第一终端的标识和第二终端的标识同步传输的。由于中心网关可以将更新数据同步传输至第一终端和第二终端,因此有助于提高数据传输的灵活性。To sum up, the embodiment of the present invention provides a data transmission device, the second terminal can send the second heartbeat signal carrying the identity of the second terminal to the central gateway, and receive the update data sent by the central gateway, the update data is The central gateway receives the first heartbeat signal carrying the identity of the first terminal sent by the first terminal, determines that data update is required, and records the second heartbeat signal received within the first duration. After identification, it is transmitted synchronously based on the identification of the first terminal and the identification of the second terminal. Since the central gateway can synchronously transmit update data to the first terminal and the second terminal, it helps to improve the flexibility of data transmission.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described devices and modules can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
本发明实施例提供了一种数据传输装置,该装置可以包括存储器,处理器及存储在存储器上的计算机程序,该数据传输装置可以为上述实施例所提供的中心网关、第一终端或第二终端。当该装置为上述实施例所提供的中心网关时,该处理器执行计算机程序时可以实现图2所示的数据传输方法以及图5所示实施例提供的数据传输方法的部分步骤。当该装置为上述实施例所提供的第一终端时,该处理器执行计算机程序时可以实现如图3所示的数据传输方法以及图5所示实施例提供的数据传输方法的部分步骤。当该装置为上述实施例所提供的第二终端时,该处理器执行计算机程序时可以实现如图4所示的数据传输方法以及图5所示实施例提供的数据传输方法的部分步骤。An embodiment of the present invention provides a data transmission device, which may include a memory, a processor, and a computer program stored on the memory. The data transmission device may be the central gateway, the first terminal or the second terminal provided in the above embodiments. terminal. When the device is the central gateway provided by the above embodiment, when the processor executes the computer program, the data transmission method shown in FIG. 2 and some steps of the data transmission method provided by the embodiment shown in FIG. 5 can be realized. When the device is the first terminal provided in the above embodiment, when the processor executes the computer program, the data transmission method shown in FIG. 3 and some steps of the data transmission method provided in the embodiment shown in FIG. 5 can be implemented. When the device is the second terminal provided in the above embodiment, when the processor executes the computer program, it can realize the data transmission method shown in FIG. 4 and some steps of the data transmission method provided in the embodiment shown in FIG. 5 .
本发明实施例提供了一种数据传输系统,该数据传输系统可以包括图1所示的中心网关110、第一终端120和第二终端130。其中,该中心网关110可以包括上述实施例提供的数据传输装置。该第一终端110可以包括上述实施例提供的数据传输装置。该第二终端130可以包括上述实施例提供的数据传输装置。An embodiment of the present invention provides a data transmission system, and the data transmission system may include a central gateway 110 , a first terminal 120 and a second terminal 130 shown in FIG. 1 . Wherein, the central gateway 110 may include the data transmission device provided in the foregoing embodiments. The first terminal 110 may include the data transmission apparatus provided in the foregoing embodiments. The second terminal 130 may include the data transmission device provided in the foregoing embodiments.
本发明实施例提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当指令在计算机上运行时,使得计算机执行上述实施例提供的数据传输方法。An embodiment of the present invention provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on a computer, the computer is made to execute the data transmission method provided by the above-mentioned embodiments.
以上所述仅为本发明的可选实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only optional embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within range.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910923687.9ACN110535975A (en) | 2019-09-27 | 2019-09-27 | Data transmission method, apparatus and system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910923687.9ACN110535975A (en) | 2019-09-27 | 2019-09-27 | Data transmission method, apparatus and system |
| Publication Number | Publication Date |
|---|---|
| CN110535975Atrue CN110535975A (en) | 2019-12-03 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910923687.9APendingCN110535975A (en) | 2019-09-27 | 2019-09-27 | Data transmission method, apparatus and system |
| Country | Link |
|---|---|
| CN (1) | CN110535975A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060077940A1 (en)* | 2004-10-13 | 2006-04-13 | Jp Mobile Operating, L.P. | Communication system and method with mobile devices |
| US20160306619A1 (en)* | 2013-11-26 | 2016-10-20 | China Unionpay Co., Ltd. | Method and device for remotely updating application program |
| CN107071038A (en)* | 2017-04-21 | 2017-08-18 | 深圳市斑点猫信息技术有限公司 | A kind of method and device of transmitting multimedia data |
| US20190159281A1 (en)* | 2016-07-27 | 2019-05-23 | Telefonaktiebolaget Lm Ericsson (Publ) | Managing Sleep Cycles in a Wireless Communications System |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060077940A1 (en)* | 2004-10-13 | 2006-04-13 | Jp Mobile Operating, L.P. | Communication system and method with mobile devices |
| US20160306619A1 (en)* | 2013-11-26 | 2016-10-20 | China Unionpay Co., Ltd. | Method and device for remotely updating application program |
| US20190159281A1 (en)* | 2016-07-27 | 2019-05-23 | Telefonaktiebolaget Lm Ericsson (Publ) | Managing Sleep Cycles in a Wireless Communications System |
| CN107071038A (en)* | 2017-04-21 | 2017-08-18 | 深圳市斑点猫信息技术有限公司 | A kind of method and device of transmitting multimedia data |
| Publication | Publication Date | Title |
|---|---|---|
| CN107148787B (en) | Discovery method and electronic equipment thereof | |
| US9332376B2 (en) | Method and technical equipment for short range data transmission | |
| EP3095293B1 (en) | Method and apparatus for bluetooth low energy suspend and resume | |
| US9414217B2 (en) | Method and technical equipment for short range data transmission | |
| US8942632B2 (en) | Processor-independent communication of network availability | |
| US9609464B2 (en) | Method and technical equipment for short range data transmission | |
| CN104219065B (en) | Broadcasting method and Beacon equipment based on Beacon | |
| KR20150099889A (en) | Topology management method and mobile network system | |
| CN110719628A (en) | Transmission method, terminal equipment and network equipment | |
| US12302342B2 (en) | Acquisition and transmission of hybrid automatic repeat request acknowledgement feedback, terminal and network side device | |
| CN114375068A (en) | Random access method, response method, terminal and network equipment | |
| CN113099521A (en) | Dormancy awakening method and device of station, storage medium and electronic equipment | |
| WO2019015051A1 (en) | Method and apparatus for switching operating modes | |
| WO2019019285A1 (en) | Resource control method and apparatus | |
| CN107465538B (en) | Internet of things terminal migration method and gateway | |
| CN113038584A (en) | Data transmission method and system for wireless sensor network | |
| CN110535975A (en) | Data transmission method, apparatus and system | |
| CN113676990B (en) | Information detection and transmission method, terminal and network side equipment | |
| CN110022595B (en) | Downlink data transmission method, network device and computer storage medium | |
| CN111615211A (en) | Random access response receiving method, sending method, terminal and network device | |
| CN115315921B (en) | IoT communication system that supports machine-to-machine connections | |
| WO2023024896A1 (en) | Information transmission method, communication apparatus, and chip and module device thereof | |
| CN113709898A (en) | Capability reporting and acquiring method, IP address requesting method and IAB node | |
| CN112584536A (en) | Uplink transmission method, resource allocation method, terminal and network side equipment | |
| CN111278011A (en) | Network distribution method of intelligent loudspeaker box and intelligent loudspeaker box |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20191203 | |
| RJ01 | Rejection of invention patent application after publication |