Data transmission method and device, readable medium and electronic equipment

文档序号:554461 发布日期:2021-05-14 浏览:36次 中文

阅读说明:本技术 一种数据传输方法、装置、可读介质及电子设备 (Data transmission method and device, readable medium and electronic equipment ) 是由 陈士明 于 2020-12-31 设计创作,主要内容包括:本发明公开了一种数据传输方法、装置、可读介质及电子设备,该方法包括:向EMQ服务器订阅云端传输的通知指令;确定所述通知指令的认证信息;若所述认证信息符合预设条件,则基于所述通知指令,确定上传数据;向所述EMQ服务器传输所述上传数据,以使得所述云端订阅所述EMQ服务器中的上传数据。本发明提供的技术方案通过EMQ服务器对云端和边缘端的数据进行传输,从而避免直接将边缘端数据上传至云端,即使在数据量较大时,也不会出现数据阻塞的情况,并且通过EMQ服务器的订阅模式使得云端和边缘端均可以进行内容的选取,进而提高数据传输效率。(The invention discloses a data transmission method, a data transmission device, a readable medium and electronic equipment, wherein the method comprises the following steps: subscribing a notification instruction transmitted by a cloud to an EMQ server; determining authentication information of the notification instruction; if the authentication information meets the preset condition, determining to upload data based on the notification instruction; and transmitting the uploading data to the EMQ server so that the cloud end subscribes to the uploading data in the EMQ server. According to the technical scheme provided by the invention, the data of the cloud and the edge are transmitted through the EMQ server, so that the data of the edge are prevented from being directly uploaded to the cloud, the data blocking condition can not occur even if the data volume is large, and the cloud and the edge can select the content through the subscription mode of the EMQ server, so that the data transmission efficiency is improved.)

1. A method of data transmission, comprising:

subscribing a notification instruction transmitted by a cloud to an EMQ server;

determining authentication information of the notification instruction;

if the authentication information meets the preset condition, determining to upload data based on the notification instruction;

and transmitting the uploading data to the EMQ server so that the cloud end subscribes to the uploading data in the EMQ server.

2. The data transmission method of claim 1, further comprising:

and if the authentication information meets a preset condition, transmitting a notification confirmation receipt to the EMQ server, so that the EMQ server transmits the notification confirmation receipt to the cloud through a proxy server.

3. The data transmission method of claim 1, further comprising:

determining a data uploading state;

and transmitting the data uploading state to the EMQ server, so that the EMQ server transmits the data uploading state to the cloud end through a proxy server.

4. The data transmission method of claim 1, further comprising:

and receiving receipt information which is transmitted by the cloud end through the EMQ server and is based on the data uploading state.

5. The data transmission method according to claim 1, wherein the transmitting the upload data to the EMQ server includes:

and transmitting upload data to the EMQ server through an HTTP (hyper text transport protocol), so that the EMQ server transmits the upload data to the proxy server, and the proxy server transmits the upload data to a database.

6. The data transmission method of claim 1, further comprising:

confirming a configuration change state;

transmitting the configuration change status to the EMQ server, such that the EMQ server transmits the configuration change status to the cloud via a proxy server.

7. A data transmission apparatus, comprising:

the instruction acquisition module is used for subscribing a notification instruction transmitted by the cloud to the EMQ server;

the information determining module is used for determining the authentication information of the notification instruction;

the data determining module is used for determining the uploaded data based on the notification instruction if the authentication information meets the preset condition;

and the data uploading module is used for transmitting the uploading data to the EMQ server so that the cloud end subscribes the uploading data in the EMQ server.

8. The data transmission apparatus of claim 7, wherein the apparatus further comprises:

and the receipt transmission module is used for transmitting a notification confirmation receipt to the EMQ server if the authentication information meets a preset condition, so that the EMQ server transmits the notification confirmation receipt to the cloud end through the proxy server.

9. A readable medium comprising executable instructions which, when executed by a processor of an electronic device, cause the electronic device to perform the method of any of claims 1 to 6.

10. An electronic device comprising a processor and a memory storing execution instructions, the processor performing the method of any of claims 1-6 when the processor executes the execution instructions stored by the memory.

Technical Field

The present invention relates to the field of energy, and in particular, to a data transmission method, apparatus, readable medium, and electronic device.

Background

With the development of science and technology, data becomes more and more important resources, and after the data is collected at the edge end, the collected data can be transmitted to the cloud end, so that the collected data can be analyzed and processed at the cloud end to obtain various prediction models. At present, when collected data are transmitted to a cloud end at an edge end, a mode of direct uploading through an interface is adopted, when the data volume is too large, data blocking is easily caused, and data uploading can be completed only by waiting for a long time, so that the determination of a new data transmission mode is of great importance.

Disclosure of Invention

The invention provides a data transmission method, a data transmission device, a readable medium and electronic equipment, wherein data of a cloud end and an edge end are transmitted through an EMQ server, so that the situation that the data of the edge end is directly uploaded to the cloud end is avoided, even if the data volume is large, the situation of data blocking does not occur, the cloud end and the edge end can select contents through a subscription mode of the EMQ server, and the data transmission efficiency is further improved.

In a first aspect, the present invention provides a data transmission method, including:

subscribing a notification instruction transmitted by a cloud to an EMQ server;

determining authentication information of the notification instruction;

if the authentication information meets the preset condition, determining to upload data based on the notification instruction;

and transmitting the uploading data to the EMQ server so that the cloud end subscribes to the uploading data in the EMQ server.

Preferably, the first and second electrodes are formed of a metal,

the method further comprises the following steps:

and if the authentication information meets a preset condition, transmitting a notification confirmation receipt to the EMQ server, so that the EMQ server transmits the notification confirmation receipt to the cloud through a proxy server.

Preferably, the first and second electrodes are formed of a metal,

the method further comprises the following steps:

determining a data uploading state;

and transmitting the data uploading state to the EMQ server, so that the EMQ server transmits the data uploading state to the cloud end through a proxy server.

Preferably, the first and second electrodes are formed of a metal,

the method further comprises the following steps:

and receiving receipt information which is transmitted by the cloud end through the EMQ server and is based on the data uploading state.

Preferably, the first and second electrodes are formed of a metal,

the transmitting the upload data to the EMQ server includes:

and transmitting upload data to the EMQ server through an HTTP (hyper text transport protocol), so that the EMQ server transmits the upload data to the proxy server, and the proxy server transmits the upload data to a database.

Preferably, the first and second electrodes are formed of a metal,

the method further comprises the following steps:

confirming a configuration change state;

transmitting the configuration change status to the EMQ server, such that the EMQ server transmits the configuration change status to the cloud via a proxy server.

In a second aspect, the present invention provides a data transmission apparatus, including:

the instruction acquisition module is used for subscribing a notification instruction transmitted by the cloud to the EMQ server;

the information determining module is used for determining the authentication information of the notification instruction;

the data determining module is used for determining the uploaded data based on the notification instruction if the authentication information meets the preset condition;

and the data uploading module is used for transmitting the uploading data to the EMQ server so that the cloud end subscribes the uploading data in the EMQ server.

Preferably, the first and second electrodes are formed of a metal,

the device further comprises:

and the receipt transmission module is used for transmitting a notification confirmation receipt to the EMQ server if the authentication information meets a preset condition, so that the EMQ server transmits the notification confirmation receipt to the cloud end through the proxy server.

In a third aspect, the invention provides a readable medium comprising executable instructions, which when executed by a processor of an electronic device, perform the method according to any of the first aspect.

In a fourth aspect, the present invention provides an electronic device, comprising a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor performs the method according to any one of the first aspect.

The invention provides a data transmission method, a data transmission device, a readable medium and electronic equipment. According to the technical scheme provided by the invention, the data of the cloud and the edge are transmitted through the EMQ server, so that the data of the edge are prevented from being directly uploaded to the cloud, the data blocking condition can not occur even if the data volume is large, and the cloud and the edge can select the content through the subscription mode of the EMQ server, so that the data transmission efficiency is improved.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.

Fig. 1 is a schematic flowchart of a first data transmission method provided in an embodiment of the present invention;

fig. 2 is a schematic flowchart of a second data transmission method provided in the embodiment of the present invention;

fig. 3 is a schematic flowchart of a third data transmission method according to an embodiment of the present invention;

fig. 4 is a schematic structural diagram of a data transmission apparatus provided in an embodiment of the present invention;

fig. 5 is a schematic structural diagram of another data transmission apparatus provided in the embodiment of the present invention;

fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail and completely with reference to the following embodiments and accompanying drawings. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

As shown in fig. 1, an embodiment of the present invention provides a data transmission method, where the method includes:

step 11, subscribing a notification instruction transmitted by a cloud to an EMQ server;

step 12, determining the authentication information of the notification instruction;

step 13, if the authentication information meets the preset condition, determining to upload data based on the notification instruction;

and step 14, transmitting the uploading data to the EMQ server so that the cloud end subscribes to the uploading data in the EMQ server.

In the above embodiment, the notification instruction transmitted by the cloud is subscribed to an EMQ server (Erlang/Enterprise/Elastic MQTT Broker, an open-source internet of things MQTT message server developed based on an Erlang/OTP platform), then the authentication information of the notification instruction is determined, whether the authentication information meets the preset condition is determined, if the authentication information meets the preset condition, the upload data is determined according to the notification instruction, the upload data is transmitted to the EMQ server, and the cloud acquires the acquisition data of the edge end by subscribing the upload data in the EMQ server. The technical scheme that this embodiment provided transmits the data of high in the clouds and edge through the EMQ server to avoid directly uploading the edge data to the high in the clouds, even when the data bulk is great, the condition of data blocking can not appear yet, and make the high in the clouds and the edge all can carry out the chosing of content through the subscription mode of EMQ server, and then improve data transmission efficiency.

It should be noted that the EMQ server has both the notification instruction transmitted by the cloud and the upload data of the edge, the edge can subscribe the notification instruction in the EMQ server, select the notification instruction executable by the edge to execute, the cloud subscribes the upload data in the EMQ server, selects the data that the cloud is interested in, and pulls the selected data to the cloud.

In an embodiment, if the authentication information meets a preset condition, a notification acknowledgement receipt is transmitted to the EMQ server, so that the EMQ server transmits the notification acknowledgement receipt to the cloud through a proxy server. In the above embodiment, the notification instruction transmitted by the cloud is executed by the edge end through the authentication information, so as to increase the security of data transmission, where the preset condition may be that the authentication information exists, and therefore, when the authentication information exists in the notification instruction, that is, the authentication information meets the preset condition, the notification instruction needs to be executed to determine to upload data. Certainly, the preset condition may also be some predetermined information with identification, and the security index of the authentication information is increased, if the authentication information carries a specific character string, the authentication information only carries the specific character string in the notification instruction and meets the preset condition. If the authentication information does not meet the preset condition, the content of the notification instruction is not executed, and at this time, the edge terminal can re-subscribe the notification instruction to the EMQ server to perform subsequent operations according to the new notification instruction. Due to the existence of the EMQ server, the data transmission between the cloud end and the edge end is not synchronous any more, namely the data transmission between the cloud end and the edge end is asynchronous, so that the cloud end and the edge end are required to timely feed back information in order to enable the cloud end and the edge end to mutually know the data transmission process. The method comprises the steps that a notification instruction is subscribed at an edge terminal, and after the notification instruction meets a preset condition, the edge terminal transmits a notification confirmation receipt to an EMQ server through an MQTT (Message Queuing Telemetry Transport) protocol, the notification confirmation receipt can enable a cloud terminal to know that the edge terminal receives the notification instruction, when the EMQ server transmits the notification confirmation receipt to the cloud terminal, the notification confirmation receipt is transmitted to a proxy server through the MQTT protocol, and then the proxy server transmits the notification confirmation receipt to the cloud terminal through an HTTP protocol. The proxy server refers to a server for data interaction with the EMQ server.

In an embodiment of the present invention, when the upload data is transmitted to the EMQ server, an HTTP Protocol (Hypertext Transfer Protocol) is used to upload the data, after the EMQ server obtains the upload data, the upload data is transmitted to the proxy server, and the proxy server transmits the upload data to the database, so as to ensure that the upload data in the EMQ server can be timely stored in the database, thereby ensuring the integrity and timeliness of the data in the database.

In a possible application scenario, the edge terminal is a device terminal in the energy system, and energy data transmission is performed to the cloud terminal through the EMQ server, so that a large amount of energy data can be transmitted to the cloud terminal through the EMQ server under the condition that data blockage is not caused. Different notification instructions correspond to different contents, for example, when a certain notification instruction is executed, the uploaded data is the energy data acquired in the last month, and when another notification instruction is executed, the uploaded data is the energy data acquired in the last week. Of course, the uploaded data can also be determined as fault data within a preset time period (within one month) through the notification instruction, so that when the fault data is transmitted to the database through the EMQ server and the proxy server, the corresponding fault database is obtained.

As shown in fig. 2, in an embodiment of the present invention, the method further includes:

step 15, determining a data uploading state;

and step 16, transmitting the data uploading state to the EMQ server, so that the EMQ server transmits the data uploading state to the cloud end through a proxy server.

In the above embodiment, the edge needs to determine a data upload state, where the data upload state includes a data upload success and a data upload failure, and after determining the data upload state, the edge transmits the data upload state to the EMQ server, so that the EMQ server transmits the data upload state to the cloud via the proxy server, and after receiving the data upload state, the cloud determines that the data upload of the edge is successful or failed, so that the cloud knows the data upload condition of the edge in time. And when the cloud determines that the edge data is successfully uploaded according to the data uploading state, the cloud subscribes the uploaded data to the EMQ server. In one possible case, after receiving the data uploading state, the cloud determines the receipt information again according to the data uploading state, and transmits the receipt information to the edge end through the EMQ server, so that the edge end can master the progress of the cloud.

As shown in fig. 3, in an embodiment of the present invention, the method further includes:

step 17, confirming the configuration change state;

step 18, transmitting the configuration change status to the EMQ server, so that the EMQ server transmits the configuration change status to the cloud through a proxy server.

In the above embodiment, if the configuration change exists at the edge, the cloud needs to know the configuration change of the edge in time, so that when the configuration change exists at the edge, the configuration change state is determined, where the configuration change state includes a success or failure of the configuration change, the edge transmits the configuration change state to the EMQ server through an MQTT protocol, the EMQ server transmits the configuration change state to the proxy server through the MQTT protocol, and the proxy server transmits the configuration change state to the cloud through an HTTP protocol, so that the cloud knows the configuration change condition of the edge. In one possible implementation, the edge may perform configuration changes based on notification instructions transmitted from the cloud subscribed to by the EMQ server.

Based on the same inventive concept as the above method, as shown in fig. 4, an embodiment of the present invention provides a data transmission apparatus, including:

the instruction acquisition module 41 is configured to subscribe a notification instruction transmitted by the cloud to the EMQ server;

an information determination module 42, configured to determine authentication information of the notification instruction;

a data determining module 43, configured to determine, based on the notification instruction, to upload data if the authentication information meets a preset condition;

a data uploading module 44, configured to transmit the uploading data to the EMQ server, so that the cloud subscribes to the uploading data in the EMQ server.

As shown in fig. 5, in one embodiment of the present invention, the apparatus further comprises:

a receipt transmission module 45, configured to transmit a notification confirmation receipt to the EMQ server if the authentication information meets a preset condition, so that the EMQ server transmits the notification confirmation receipt to the cloud through a proxy server.

For convenience of description, the above device embodiments are described with functions divided into various units or modules, and the functions of the units or modules may be implemented in one or more software and/or hardware when implementing the present invention.

Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. On the hardware level, the electronic device includes a processor 601 and a memory 602 storing executable instructions, and optionally further includes an internal bus 603 and a network interface 604. The Memory 602 may include a Memory 6021, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory 6022 (e.g., at least 1 disk Memory); the processor 601, the network interface 604, and the memory 602 may be connected to each other by an internal bus 603, and the internal bus 603 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like; the internal bus 603 may be divided into an address bus, a data bus, a control bus, etc., which is indicated by only one double-headed arrow in fig. 6 for convenience of illustration, but does not indicate only one bus or one type of bus. Of course, the electronic device may also include hardware required for other services. When the processor 601 executes execution instructions stored by the memory 602, the processor 601 performs a method in any of the embodiments of the present invention and at least for performing the method as shown in fig. 1-3.

In a possible implementation manner, the processor reads the corresponding execution instruction from the nonvolatile memory to the memory and then runs the execution instruction, and the corresponding execution instruction can also be obtained from other equipment, so as to form a data transmission device on a logic level. The processor executes the execution instructions stored in the memory, so that the data transmission method provided by any embodiment of the invention is realized through the executed execution instructions.

The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

Embodiments of the present invention further provide a computer-readable storage medium, which includes an execution instruction, and when a processor of an electronic device executes the execution instruction, the processor executes a method provided in any one of the embodiments of the present invention. The electronic device may specifically be the electronic device shown in fig. 6; the execution instruction is a computer program corresponding to the data transmission device.

It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects.

The embodiments of the present invention are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or boiler that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or boiler. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or boiler that comprises the element.

The above description is only an example of the present invention, and is not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于多传输路径进行声音数据传输的系统及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!