Data communication method, device, equipment and computer readable storage medium

文档序号:1834649 发布日期:2021-11-12 浏览:2次 中文

阅读说明:本技术 数据通信方法、装置、设备及计算机可读存储介质 (Data communication method, device, equipment and computer readable storage medium ) 是由 陈晓涛 于 2020-04-27 设计创作,主要内容包括:本发明实施例提供一种数据通信方法、装置、设备及计算机可读存储介质。本发明实施例的方法,通过发送端在发送报文时,根据待发送指令数据的指令类型确定待发送的报文的长度,接收端在接收到报文时,根据报文的指令类型验证报文的长度,从而实现将指令数据分成多个不同的指令类型,用于发送不同指令类型的指令数据的报文的长度可以不同,也即是不同指令类型对应的报文长度不同,使得携带指令数据多的报文长度较长,携带指令数据少的报文长度较短,能够节省带宽,提高带宽占用率。(The embodiment of the invention provides a data communication method, a data communication device, data communication equipment and a computer readable storage medium. According to the method provided by the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate can be improved.)

1. A method of data communication, comprising:

when instruction data need to be sent, according to an instruction type corresponding to the instruction data to be sent, generating a first message containing the information to be sent and the corresponding instruction type, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different;

and sending the first message.

2. The method according to claim 1, wherein after generating the first packet including the information to be transmitted and the corresponding instruction type, further comprising:

and setting the sending state flag to be in a sending-required state.

3. The method of claim 2, wherein the sending the first packet comprises:

and if the sending state is marked as a state needing sending, sending the first message.

4. The method according to any one of claims 1-3, further comprising:

and if the first message needs to be responded, setting a state mark whether the first message corresponds to the state needing to be responded as a state needing to be responded.

5. The method of claim 4, wherein after sending the first packet, further comprising:

and if the response message to the first message is not received within the preset time length, the first message is sent again.

6. The method of claim 5, further comprising:

after receiving a response message to the first message, setting a state flag of whether to respond or not corresponding to the first message as a state of not requiring response, and setting the state flag of sending as a state of not requiring sending.

7. A method of data communication, comprising:

after receiving a first message, verifying whether the length of the first message is correct according to the instruction type of the first message, wherein the lengths of messages corresponding to at least two instruction types are different;

and if the length of the first message is correct, processing the first message.

8. The method of claim 7, wherein verifying whether the length of the first packet is correct based on the instruction type of the first packet comprises:

determining a preset message length corresponding to the instruction type of the first message;

if the length of the first message is consistent with the length of the preset message, the length of the first message is correct;

and if the length of the first message is inconsistent with the preset message length, the length of the first message is incorrect.

9. The method according to claim 7 or 8, wherein the processing the first packet if the length of the first packet is correct includes:

and if the length of the first message is correct, storing the instruction data of the first message.

10. The method according to claim 7 or 8, wherein the processing the first packet if the length of the first packet is correct includes:

if the length of the first message is correct and the first message is determined not to be a repeatedly sent message according to the instruction sequence number of the first message, storing the instruction data of the first message;

and if the first message is determined to be a repeatedly sent message according to the instruction sequence number of the first message, no instruction data of the first message is stored.

11. The method of claim 8, further comprising:

and if the first message needs to be responded, setting a state mark whether response needs to be generated or not corresponding to the first message as a state needing to send response.

12. The method of claim 11, further comprising:

and if the response state which needs to be generated or not is marked as the response state which needs to be sent corresponding to the first message, generating a second message with the instruction type of the response type, wherein the second message is the response message of the first message.

13. The method of claim 12, wherein after generating the second message with the instruction type being the reply type, further comprising:

and setting the state mark whether the response needs to be generated or not corresponding to the second message as a state which does not need to send the response, and setting the state mark which needs to send as a state which needs to send.

14. The method of claim 13, further comprising:

and if the sending state is marked as the state needing sending, sending the second message.

15. A data communication method is applied to a Programmable Logic Controller (PLC) or a warehouse equipment control system (WCS) in a warehouse logistics system and is used for realizing data communication between the PLC and the WCS, and the method comprises the following steps:

when instruction data need to be sent, according to an instruction type corresponding to the instruction data to be sent, generating a first message containing the information to be sent and the corresponding instruction type, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different;

and sending the first message.

16. A data communication method is applied to a Programmable Logic Controller (PLC) or a warehouse equipment control system (WCS) in a warehouse logistics system and is used for realizing data communication between the PLC and the WCS, and the method comprises the following steps:

after receiving a first message, verifying whether the length of the first message is correct according to the instruction type of the first message, wherein the lengths of messages corresponding to at least two instruction types are different;

and if the length of the first message is correct, processing the first message.

17. A data communication apparatus, comprising:

the message generating module is used for generating a first message containing the information to be sent and a corresponding instruction type according to the instruction type corresponding to the instruction data to be sent when the instruction data needs to be sent, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different;

and the sending module is used for sending the first message.

18. A data communication apparatus, comprising:

the message verification module is used for verifying whether the length of a first message is correct or not according to the instruction type of the first message after the first message is received, wherein the lengths of the messages corresponding to at least two instruction types are different;

and the message data processing module is used for processing the first message if the length of the first message is correct.

19. A data communication device, comprising:

a processor, a memory, a transmitter, a receiver, and a computer program stored on the memory and executable on the processor;

wherein the processor, when executing the computer program, implements the method of any of claims 1 to 14.

20. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 14.

Technical Field

The present invention relates to the field of communications technologies, and in particular, to a data communication method, apparatus, device, and computer readable storage medium.

Background

The automatic Warehouse logistics System comprises Warehouse equipment such as a stacker device and the like, a Warehouse Management System (WMS for short), a Warehouse equipment Control System (WCS for short) and the like. The warehouse equipment comprises a Programmable Logic Controller (PLC for short), and the PLC is controlled by the WCS to control the warehouse equipment to work.

At present, one communication mode between the PLC and the WCS is as follows: and installing an OPC UA server on the WCS server. Data are collected from warehouse equipment through the OPC UA server and are updated regularly, the WCS extracts data from the OPC UA server through the interface file, OPC UA server software needs to be purchased and installed according to an operating system of the warehouse equipment, and the field deployment cost is very high. In order to reduce the cost, another communication mode is adopted between the PLC and the WCS: and defining a communication message by establishing Socket connection, and realizing data interaction between the PLC and the WCS.

At present, the message length is fixed when the PLC communicates with the WCS through Socket connection, in order to meet the requirement, the message length is fixed to the required maximum value, the communication bandwidth is seriously wasted, and the bandwidth occupancy rate is low.

Disclosure of Invention

The embodiment of the invention provides a data communication method, a data communication device, data communication equipment and a computer readable storage medium, which are used for solving the problems that in the prior art, when a PLC and a WCS are connected through a Socket for communication, the message length is fixed to a required maximum value, the communication bandwidth is seriously wasted, and the bandwidth occupancy rate is low.

In a first aspect, an embodiment of the present invention provides a data communication method, including:

when instruction data need to be sent, according to an instruction type corresponding to the instruction data to be sent, generating a first message containing the information to be sent and the corresponding instruction type, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different; and sending the first message.

In one possible design, after generating the first packet including the information to be sent and the corresponding instruction type, the method further includes: and setting the sending state flag to be in a sending-required state.

In one possible design, the sending the first packet includes: and if the sending state is marked as a state needing sending, sending the first message.

In one possible design, the method further includes: and if the first message needs to be responded, setting a state mark whether the first message corresponds to the state needing to be responded as a state needing to be responded.

In one possible design, after sending the first packet, the method further includes: and if the response message to the first message is not received within the preset time length, the first message is sent again.

In one possible design, the method further includes: after receiving a response message to the first message, setting a state flag of whether to respond or not corresponding to the first message as a state of not requiring response, and setting the state flag of sending as a state of not requiring sending.

In a second aspect, an embodiment of the present invention provides a data communication method, including:

after receiving a first message, verifying whether the length of the first message is correct according to the instruction type of the first message, wherein the lengths of messages corresponding to at least two instruction types are different; and if the length of the first message is correct, processing the first message.

In one possible design, verifying whether the length of the first packet is correct according to the instruction type of the first packet includes: determining a preset message length corresponding to the instruction type of the first message; if the length of the first message is consistent with the length of the preset message, the length of the first message is correct; and if the length of the first message is inconsistent with the preset message length, the length of the first message is incorrect.

In a possible design, if the length of the first packet is correct, processing the first packet includes: and if the length of the first message is correct, storing the instruction data of the first message.

In a possible design, if the length of the first packet is correct, processing the first packet includes: if the length of the first message is correct and the first message is determined not to be a repeatedly sent message according to the instruction sequence number of the first message, storing the instruction data of the first message; and if the first message is determined to be a repeatedly sent message according to the instruction sequence number of the first message, no instruction data of the first message is stored.

In one possible design, the method further includes: and if the first message needs to be responded, setting a state mark whether response needs to be generated or not corresponding to the first message as a state needing to send response.

In one possible design, the method further includes: and if the response state which needs to be generated or not is marked as the response state which needs to be sent corresponding to the first message, generating a second message with the instruction type of the response type, wherein the second message is the response message of the first message.

In one possible design, after generating the second packet with the instruction type being the response type, the method further includes: and setting the state mark whether the response needs to be generated or not corresponding to the second message as a state which does not need to send the response, and setting the state mark which needs to send as a state which needs to send.

In one possible design, the method further includes: and if the sending state is marked as the state needing sending, sending the second message.

In a third aspect, an embodiment of the present invention provides a data communication apparatus, including:

the message generating module is used for generating a first message containing the information to be sent and a corresponding instruction type according to the instruction type corresponding to the instruction data to be sent when the instruction data needs to be sent, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different; and the sending module is used for sending the first message.

In one possible design, the apparatus further includes: and the state processing module is used for setting the sending state mark as a state needing sending.

In one possible design, the message generation module is further configured to: and if the sending state is marked as a state needing sending, sending the first message.

In one possible design, the state processing module is further configured to: and if the first message needs to be responded, setting a state mark whether the first message corresponds to the state needing to be responded as a state needing to be responded.

In one possible design, the message generation module is further configured to: and if the response message to the first message is not received within the preset time length, the first message is sent again.

In one possible design, the state processing module is further configured to: after receiving a response message to the first message, setting a state flag of whether to respond or not corresponding to the first message as a state of not requiring response, and setting the state flag of sending as a state of not requiring sending.

In a fourth aspect, an embodiment of the present invention provides a data communication apparatus, including:

the message verification module is used for verifying whether the length of a first message is correct or not according to the instruction type of the first message after the first message is received, wherein the lengths of the messages corresponding to at least two instruction types are different; and the message data processing module is used for processing the first message if the length of the first message is correct.

The message verification module is further configured to: determining a preset message length corresponding to the instruction type of the first message; if the length of the first message is consistent with the length of the preset message, the length of the first message is correct; and if the length of the first message is inconsistent with the preset message length, the length of the first message is incorrect.

In one possible design, the message data processing module is further configured to: and if the length of the first message is correct, storing the instruction data of the first message.

In one possible design, the message data processing module is further configured to: if the length of the first message is correct and the first message is determined not to be a repeatedly sent message according to the instruction sequence number of the first message, storing the instruction data of the first message; and if the first message is determined to be a repeatedly sent message according to the instruction sequence number of the first message, no instruction data of the first message is stored.

In one possible design, the apparatus further includes: a state processing module to: and if the first message needs to be responded, setting a state mark whether response needs to be generated or not corresponding to the first message as a state needing to send response.

In one possible design, the apparatus further includes: a message generation module, configured to: and if the response state which needs to be generated or not is marked as the response state which needs to be sent corresponding to the first message, generating a second message with the instruction type of the response type, wherein the second message is the response message of the first message.

In one possible design, the state processing module is further configured to: and setting the state mark whether the response needs to be generated or not corresponding to the second message as a state which does not need to send the response, and setting the state mark which needs to send as a state which needs to send.

In one possible design, the apparatus further includes: and the message sending module is used for sending the second message if the sending state is marked as the state needing sending.

In a fifth aspect, an embodiment of the present invention provides a data communication device, including:

a processor, a memory, a transmitter, a receiver, and a computer program stored on the memory and executable on the processor; wherein the processor, when executing the computer program, implements the method of any of the above aspects.

In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the data communication method described above.

According to the data communication method, the data communication device, the data communication equipment and the computer readable storage medium, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data are divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

Drawings

Fig. 1 is a schematic overall architecture diagram of a warehouse logistics system according to an embodiment of the invention;

fig. 2 is a flowchart of a data communication method according to an embodiment of the present invention;

fig. 3 is a schematic diagram of a message structure provided in the first embodiment of the present invention;

fig. 4 is a flowchart of a data communication method according to a second embodiment of the present invention;

fig. 5 is an overall flowchart of a data communication method according to a second embodiment of the present invention;

fig. 6 is a schematic diagram of a status word that a message needs to respond to according to a second embodiment of the present invention;

fig. 7 is a flowchart of a data communication method according to a third embodiment of the present invention;

fig. 8 is a flowchart of a data communication method according to a fourth embodiment of the present invention;

fig. 9 is a schematic diagram of a message required to send a status word according to the fourth embodiment of the present invention;

fig. 10 is a schematic structural diagram of a data communication device according to a fifth embodiment of the present invention;

fig. 11 is a schematic structural diagram of a data communication device according to a sixth embodiment of the present invention;

fig. 12 is a schematic structural diagram of a data communication device according to a tenth embodiment of the present invention.

With the above figures, certain embodiments of the invention have been illustrated and described in more detail below. The drawings and the description are not intended to limit the scope of the inventive concept in any way, but rather to illustrate it by those skilled in the art with reference to specific embodiments.

Detailed Description

Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.

The terms to which the present invention relates will be explained first:

programmable Logic Controller (PLC): it is a programmable memory for storing program, executing logic operation, sequence control, timing, counting and arithmetic operation, etc. and controlling various kinds of machine or production process by digital or analog input/output.

SOCKET: the application program can send or receive data through the application program, and can perform opening, reading, writing, closing and other operations on the application program like files. Sockets allow applications to plug I/O into the network and communicate with other applications in the network. A network socket is a combination of an IP address and a port.

Warehouse equipment Control System (spare Control System, WCS for short): equipment control refers to a mechanism for coordinating and scheduling operations of the underlying logistics equipment. The WCS will be responsible for controlling the flow of material objects.

OPC UA: based on the new generation of technology provided by the OPC foundation, it is provided that the transfer of raw data and preprocessed information from the manufacturing level to the production planning or ERP level is safe, reliable and vendor independent. With OPC UA, all required information is available to every authorized person at any time, any place, for every authorized application. This functionality is independent of the manufacturer's original application, programming language and operating system. OPC UA is a complement to the OPC industry standard that is currently in use, providing important features such as platform independence, scalability, high reliability, and the ability to connect to the internet. The OPCUA no longer depends on DCOM, but is based on a Service Oriented Architecture (SOA), and the use of OPC UA is simpler. OPC UA has now become a bridge between microsoft, UNIX or other operating system enterprise layers and embedded automation components independent.

Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.

The data communication method provided by the embodiment of the invention is particularly applied to a Programmable Logic Controller (PLC) and a warehouse equipment control system (WCS) in a warehouse logistics system. The overall architecture of the warehouse logistics system is shown in fig. 1, the warehouse logistics system can be roughly divided into three levels, the top level is a warehouse management system WMS which is responsible for processing the warehouse business logic; the lowest layer comprises warehouse equipment and the like controlled by a specific Programmable Logic Controller (PLC); the WCS is a middle layer between the WMS and the PLC and is responsible for coordinating and scheduling various warehouse devices at the bottom layer.

At present, one communication mode between the PLC and the WCS is as follows: and installing an OPC UA server on the WCS server. Data are collected from warehouse equipment through the OPC UA server and are updated regularly, the WCS extracts data from the OPC UA server through the interface file, OPC UA server software needs to be purchased and installed according to an operating system of the warehouse equipment, and the field deployment cost is very high. In order to reduce the cost, another communication mode is adopted between the PLC and the WCS: and defining a communication message by establishing Socket connection, and realizing data interaction between the PLC and the WCS. At present, the message length is fixed when the PLC communicates with the WCS through Socket connection, in order to meet the requirement, the message length is fixed to the required maximum value, the communication bandwidth is seriously wasted, and the bandwidth occupancy rate is low.

The data communication method provided by the invention is used for data transmission between the PLC and the WCS, can be applied to the PLC or the WCS, and aims to solve the technical problems in the prior art.

The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.

Fig. 2 is a flowchart of a data communication method according to an embodiment of the present invention. The embodiment of the invention provides a data communication method aiming at the problems that in the prior art, when a PLC and a WCS are connected through a Socket for communication, the message length is fixed to the required maximum value, the communication bandwidth is seriously wasted, and the bandwidth occupancy rate is low.

The data communication method in this embodiment relates to a sending end and a receiving end of a message, where the sending end may also serve as the receiving end when needing to receive the message, and the receiving end may also serve as the sending end when needing to send the message. In practical application, both the PLC and the WCS have functions of a transmitting end and a receiving end. As shown in fig. 2, the method comprises the following specific steps:

step S101, when instruction data needs to be sent, a sending end generates a first message containing information to be sent and a corresponding instruction type according to the instruction type corresponding to the instruction data to be sent, wherein the length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent, and the lengths of the messages corresponding to at least two instruction types are different.

In this embodiment, the structure of the message is as shown in fig. 3, where the message includes a message header, whether to respond, a receiver device number, an instruction type, an instruction sequence number, instruction data, and a message trailer. The instruction data refers to data information to be sent, and the instruction type refers to the type of the instruction data. The instruction sequence number is used for uniquely identifying one message, and the instruction sequence numbers corresponding to different messages are different.

For convenience of description, the instruction type of the message in this embodiment refers to the instruction type contained in the message, that is, the instruction type corresponding to the instruction data carried in the message; a message of a certain instruction type is a message containing the instruction type in the message.

Exemplary instruction types may include: registration, response, task state reporting, device state reporting, and the like.

For different devices, the instruction type of the instruction data to be sent may be different, that is, the instruction type of the message that can be sent by different devices may be different. For example, the type of the instruction corresponding to the message that the PLC needs to send to the WCS may include: the instruction types corresponding to the messages that the WCS needs to send to the PLC may include: register, respond, and issue tasks, etc.

In this embodiment, the length of the message corresponding to the same instruction type is fixed, and the length of the message corresponding to each instruction type may be preset. The message lengths corresponding to different instruction types may be different, and the message lengths corresponding to at least two instruction types are different.

Step S102, the sending end sends a first message to the receiving end.

Step S103, after receiving the first message, the receiving end verifies whether the length of the first message is correct according to the instruction type of the first message, wherein the lengths of the messages corresponding to at least two instruction types are different.

Because the lengths of the messages of different instruction types may be different, after the receiving end receives the first message, the receiving end needs to verify the length of the first message according to the instruction type of the first message, and only when the actual length of the first message is consistent with the preset message length corresponding to the instruction type of the first message, it is determined that the length of the first message is correct.

And step S104, if the length of the first message is correct, the receiving end processes the first message.

The first packet may be subsequently processed only after the length of the first packet is correct.

In this embodiment, the verification of the received message may include, in addition to the verification of the length of the message, the verification of any other content of the received message in the prior art, which is not described herein again.

For example, after receiving the first packet, the verifying the first packet may further include: and the receiving end verifies the number, the end symbol and the like of the receiving end equipment in the first message, and the first message is subsequently processed after the number, the end symbol and the like of the receiving end equipment are both verified to be correct.

In addition, after the received first packet is verified, the subsequent processing on the first packet may be specifically implemented by using a processing procedure of the received packet with the same function or a similar function in the prior art, for example, storing data carried in the packet, modifying state information corresponding to the packet, and the like, which is not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

Fig. 4 is a flowchart of a data communication method according to a second embodiment of the present invention; fig. 5 is an overall flowchart of a data communication method according to a second embodiment of the present invention. On the basis of the first embodiment, in this embodiment, the warehouse logistics system may be a shuttle system, and in the shuttle system, the PLC is a client and the WCS is a server. When the PLC and the WCS network hardware are normal, the PLC actively tries to create a Socket link with the WCS. And after the link is established successfully, message interaction is started.

In this embodiment, an embodiment of a data communication method is described by taking an example of sending a registration message to a WCS by a PLC, where an instruction type corresponding to a first message is a registration type, the first message is a registration message, an instruction type corresponding to a second message is a response type, and the second message is a response message to the first message. As shown in fig. 4 and 5, the method comprises the following specific steps:

step S201, the PLC generates a registration message according to a first preset message length corresponding to the registration type.

When equipment is registered, the PLC splices the data required for generating the registration message to generate the registration message. The value of whether the registration message needs to be responded is the value of needing to be responded, the device number of the receiving party is the device number of the WCS, the instruction type is the registration type, and the instruction data can be information needed by registration.

Step S202, the PLC sets the state mark whether the registration message corresponds to needs to be responded as a state which needs to be responded, and sets the sending state mark as a state which needs to be sent.

The message state mark whether to answer is used to indicate whether the message needs to answer by the receiving end, including the state of needing to answer and the state of not needing to answer.

For example, the flag indicating whether a response state is required or not corresponding to the registration packet may be stored by using a 1 bit (bit), a value of the flag bit "true" (or "1") indicates that a response state is required, and a value of the flag bit "false" (or "0") indicates that a response state is not required.

Illustratively, a message Need answer status word Need _ Response may be used to store information of whether various types of messages Need answer status flags. For example, as shown in fig. 6, the message required Response status word Need _ Response may be an integer (sint type), occupies one byte, and includes 8 flag bits, where the 0 th bit may be used as a flag bit for whether Response is required for registering a message, the 1 st bit may be used as a reserved bit, and the 1 st to 7 th bits are respectively used as flag bits whether Response is required for messages of different instruction types.

And step S203, if the sending state is marked as a sending-needed state, the PLC sends a registration message to the WCS.

The sending state flag is used for indicating whether a message is in a state to be sent, that is, whether the message is in a state of needing to be sent currently, and the sending state flag includes a state needing to be sent and a state not needing to be sent. If the sending state is marked as the state needing sending, the PLC does not process other message generating programs, triggers the message sending function and sends the current message to be sent to the WCS.

Illustratively, the transmit state flag may be represented by a stat tsend.

In this embodiment, after the registration message is generated, the PLC sends the registration message to the WCS by setting the sending status flag to the sending-required status and triggering the execution of this step.

Step S204, after receiving the registration message, the WCS verifies whether the equipment number of the receiving party is correct.

After receiving the registration message, the WCS may obtain the device number of the receiving party in the registration message by parsing the registration message. The WCS may first verify whether the receiver device number in the registration message is consistent with its own device number.

If the equipment number of the receiving party in the registration message is not consistent with the equipment number of the receiving party, the message is received in error, and the message is discarded.

If the receiver device number in the registration message is consistent with the device number of the receiver, the subsequent step S205 is continued.

Step S205, the WCS verifies whether the length of the registration message is correct according to the instruction type of the registration message.

The WCS may obtain the instruction type in the registration message by parsing the registration message, and in this step, the WCS may verify the length of the registration message according to the instruction type of the registration message.

Specifically, the step may be specifically implemented as follows:

the WCS determines a first preset message length corresponding to the instruction type of the registration message; and judging whether the length of the registration message is consistent with the length of the first preset message. If the length of the registration message is consistent with the first preset message length, the length of the registration message is correct, and step S206 is continuously executed. And if the length of the registration message is inconsistent with the length of the first preset message, the length of the registration message is incorrect, and the registration message is discarded.

The first preset message length may be set and modified according to an actual application scenario, and this embodiment is not specifically limited here.

In this embodiment, the verification of the received message may include, in addition to the verification of the device number of the receiving party and the message length, the verification of any other content of the received message in the prior art, which is not described herein again.

And step S206, the WCS performs registration processing on the registration message.

Illustratively, the WCS may store the command data in the registration message for device registration of the PLC.

And step S207, the WCS determines that a response message to the registration message needs to be sent to the PLC according to the registration message, determines the length of the response message according to the instruction type of the response message, and generates the response message to the registration message.

The WCS can know that the registration message needs to be responded by analyzing the registration message.

The WCS may determine a second preset message length corresponding to the response message according to the instruction type corresponding to the response message. And the WCS splices the data required for generating the response message to the registration message to generate the response message to the registration message.

The second preset message length may be different from the first preset length, and the second preset message length may be set and modified according to an actual application scenario, which is not specifically limited in this embodiment.

And step S208, the WCS sends a response message to the registration message to the PLC.

Step S209, after the PLC receives the response message to the registration message, the PLC sets the state flag of whether the response is needed corresponding to the registration message as the state of no response, and sets the state flag of sending as the state of no sending.

After receiving the response message to the registration message, the PLC sets the state flag of whether response is required corresponding to the registration message to a state of not requiring response, and the device is successfully registered.

Step S210, if the response message to the registration message is not received within the preset time, the registration message is sent again.

In this embodiment, an overtime retransmission mechanism may be configured, after a sending end sends a message, if no response of the receiving end is received within a preset time length, the sending end sends the message to the receiving end again and starts timing again, and if the receiving end still does not receive a response of the receiving end after the sending end times out again, the sending end continues to send the same message to the receiving end again and starts timing … … again until a response of the receiving end to the message is received.

In this embodiment, after the PLC sends the registration message, the PLC may start a retransmission timer (TimeReSend) to start timing for a preset duration, and if the PLC does not receive a response message to the registration message before timing is completed, step S202 and subsequent steps are performed, the PLC sends the registration message to the WCS again, and the retransmission timer is reset to restart timing until step S209 is performed, and the device registration is successful.

The preset duration may be set and modified according to an actual application scenario, and this embodiment is not specifically limited herein.

The embodiment of the invention takes the example that a PLC sends a registration message to a WCS, and the instruction type corresponding to a first message is the registration type, and describes an implementation mode of a data communication method in detail, so that the instruction data are divided into a plurality of different instruction types, and the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, so that the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate can be improved.

Fig. 7 is a flowchart of a data communication method according to a third embodiment of the present invention. Based on the first embodiment or the second embodiment, in this embodiment, taking the example that the warehouse logistics system may be a shuttle system, in the shuttle system, the PLC is a client and the WCS is a server. When the PLC and the WCS network hardware are normal, the PLC actively tries to create a Socket link with the WCS. And after the link is established successfully, message interaction is started.

In this embodiment, another implementation of the data communication method is described by taking an example that after the PLC is successfully registered, the PLC receives a task issuing message sent by the WCS and sends a response message to the WCS, in this embodiment, an instruction type corresponding to a first message is the task issuing type, the first message is the task issuing message, an instruction type corresponding to a second message is the response type, and the second message is the response message to the first message. As shown in fig. 7, the method comprises the following specific steps:

and S301, receiving a task issuing message sent by the WCS by the PLC.

When a task instruction needs to be issued to the PLC, the PLC splices data required by the generated task instruction, generates a task issuing message and sends the task issuing message to the PLC.

Illustratively, the value of whether the response is needed in the task issuing message is the response needed, the device number of the receiving party is the device number of the PLC, the instruction type is the task issuing type, and the instruction data may be information such as task instruction data.

In this embodiment, a process of generating a message and sending the message to the PLC by the WCS is similar to a process of generating a message and sending the message to the WCS by the PLC, except that specific contents of the message are different, other processing processes are similar, and this example is not described herein again.

And step S302, after receiving the task issuing message, the PLC verifies whether the length of the task issuing message is correct according to the instruction type of the task issuing message.

The PLC can obtain the instruction type in the task issuing message by analyzing the task issuing message, and in the step, the PLC can verify the length of the task issuing message according to the instruction type of the task issuing message.

Specifically, the step may be specifically implemented as follows:

the PLC determines a third preset message length corresponding to the instruction type of the task issuing message; and judging whether the length of the task issuing message is consistent with the length of a third preset message. If the length of the task issuing message is consistent with the length of the third preset message, the length of the task issuing message is correct, and the step S303 is continuously executed. And if the length of the task issuing message is not consistent with the length of the third preset message, the length of the task issuing message is incorrect, and the task issuing message is discarded.

The third preset message length may be different from the first preset length and the second preset length, and the third preset message length may be set and modified according to an actual application scenario, which is not specifically limited in this embodiment.

Through the verification of the task issuing message, if the PLC determines that the length of the task issuing message is incorrect, the task issuing message is discarded.

In this embodiment, the verification of the received message by the PLC may also include, in addition to the verification of the length of the message, the verification of other contents such as the device number of the receiving party of the received message, the end identifier of the message, and the like in the prior art, which is not described herein again.

In addition, through the verification of the task issuing message, if the PLC determines that the length, the equipment number of the receiving party, the end symbol or any other information needing to be verified is incorrect, the task issuing message is discarded.

Step S303, if the length of the task issuing message is correct, the PLC judges whether the task issuing message is a repeatedly sent message.

In this embodiment, an overtime retransmission mechanism may be configured, after a sending end sends a message, if no response of the receiving end is received within a preset time length, the sending end sends the message to the receiving end again and starts timing again, and if the receiving end still does not receive a response of the receiving end after the sending end times out again, the sending end continues to send the same message to the receiving end again and starts timing … … again until a response of the receiving end to the message is received.

After the WCS sends the task issuing message to the PLC, if the response message of the PLC is not received before the timeout, the WCS can repeatedly send the same task issuing message to the PLC.

In this embodiment, after the PLC successfully verifies the task delivery packet and before performing data processing on the task delivery packet, it may first determine whether the task delivery packet is a repeatedly sent packet.

If the task issuing message is determined to be a repeatedly sent message, it is indicated that the instruction data in the task issuing message is already stored, and the step S305 and subsequent steps are directly executed without storing the instruction data again, and a response message is sent to the WCS.

If the task issuing message is determined not to be the repeatedly sent message, the PLC executes the step S304 and the subsequent steps, stores the instruction data in the task issuing message firstly, and then sends a response message to the WCS.

And step S304, if the task issuing message is not a repeatedly sent message, the PLC stores the instruction data in the task issuing message.

Specifically, the PLC stores the instruction data in the task download message according to a preset storage address.

And S305, if the task issuing message is determined to need to be responded, the PLC sets whether a response state mark needs to be generated as a response state needing to be sent.

The message sending end sends a message to the sending end, wherein whether the response state mark needs to be generated is used for indicating whether the response message of the currently received message needs to be sent to the sending end of the message, including a state that the response needs to be sent and a state that the response does not need to be sent.

Illustratively, whether a response state flag needs to be generated may be stored with a 1 flag bit (bit) whose value "true" (or "1") indicates that a response state needs to be sent, and whose value "false" (or "0") indicates that a response state does not need to be sent.

And S306, if the response state which needs to be generated is marked as the response state which needs to be sent, the PLC determines the length of the response message according to the instruction type of the response message, and generates the response message of the task issuing message.

If the response state is required to be generated and marked as the response state required to be sent, the PLC can determine a second preset message length corresponding to the response message according to the instruction type corresponding to the response message. And the PLC splices the data required for generating the response message of the task issuing message to generate the response message of the task issuing message.

The second preset message length may be set and modified according to an actual application scenario, and this embodiment is not specifically limited here.

Step S307 sets the state flag indicating whether or not the response needs to be generated as the state of not requiring the transmission of the response, and sets the state flag indicating the transmission needs to be transmitted.

After the PLC generates a response message for the task issuing message, whether a response state mark needs to be generated is set as a state which does not need to send a response.

After the PLC generates a response message to the task issuing message, the sending state mark is set to be a state needing sending, and a message sending function is triggered. When the sending state mark is in a state needing sending, the PLC does not process other message generating programs.

And step S308, the PLC sends a response message to the WCS for the task issuing message.

And if the sending state mark is in a state needing sending, the PLC sends a response message of the task issuing message to the WCS.

In the embodiment of the invention, by taking the example that a PLC receives a task issuing message sent by a WCS and sends a response message to the WCS, the instruction type corresponding to a first message is the task issuing type, and the instruction type corresponding to a second message is the response type, another implementation mode of the data communication method is explained in detail, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate can be improved.

Fig. 8 is a flowchart of a data communication method according to a fourth embodiment of the present invention. On the basis of any of the above embodiments, in this embodiment, taking as an example that the warehouse logistics system may be a shuttle system, in the shuttle system, the PLC is a client and the WCS is a server. When the PLC and the WCS network hardware are normal, the PLC actively tries to create a Socket link with the WCS. And after the link is established successfully, message interaction is started.

In this embodiment, another embodiment of the data communication method is described by taking an example that after the PLC successfully registers, the PLC sends another message to the WCS. As shown in fig. 8, the method comprises the following specific steps:

step S401, when command data needs to be reported to the WCS, the PLC sets a state flag of whether data needing to be sent exists corresponding to the command data as the data needing to be sent.

In this embodiment, the message Need-to-Send status word Need _ Send may be used to store a status flag indicating whether each instruction type has data that needs to be sent. For example, as shown in fig. 9, the message required-to-Send status word Need _ Send may be an integer (single), occupy one byte, and include 8 flag bits, where the 0 th bit may be a reserved bit, the 1 st bit may be a bit indicating whether response status needs to be generated, and the 2 nd to 7 th bits respectively indicate whether the data array corresponding to the instruction type is not empty, that is, whether data needs to be sent. If the data array of the instruction type corresponding to a certain bit is not empty, it indicates that the data of the instruction type to be sent exists, and a message of the instruction type needs to be generated and sent. If the data array of the instruction type corresponding to a certain bit is empty, it indicates that there is no data of the instruction type to be sent, and there is no need to generate a message of the instruction type.

For example, the 3 rd bit obtained in the message Need-to-Send status word Need-to-Send can indicate whether the data reported by the device status is not null, and no device status report data Need to be sent exists; if the value of the 3 rd bit is "true" or "1", it indicates that the device state reporting type data is not null, and there is device state reporting data to be sent, and a message of the device state reporting type needs to be generated and sent.

For example, when the PLC has data to be reported to the WCS, the reported data is first put into a corresponding data array in a first-in first-out manner, and when the PLC finds that the data in the first element of the array is not 0, it indicates that there is data to be reported, and then the corresponding flag position in the status word Need to be sent in the corresponding packet Need _ Send is set as data to be sent, for example, the corresponding flag position in the status word Need to be sent in the packet Need _ Send may be set to "true" or "1", which indicates that there is data to be sent. If the corresponding flag position in the message Need to Send the status word Need _ Send is "false" or "0", it indicates that there is no data to Send.

Step S402, if the value of the marking bit corresponding to the instruction data of one instruction type in the message Need-to-Send state word Need _ Send indicates that the data Need to be sent, the PLC generates a first message containing the information to be sent and the corresponding instruction type according to the instruction type corresponding to the instruction data to be sent.

In this embodiment, the lengths of the messages corresponding to at least two instruction types are different.

The length of the first message is consistent with the length of a preset message corresponding to the instruction type corresponding to the information to be sent.

When the first message is generated, the PLC splices the required data to generate the first message.

For example, the first message may be a task state report message sent by a shuttle PLC in the shuttle system to the WCS, and the data required to generate the first message may include: reporting type, task number, target position information corresponding to the task, current position of the shuttle car, task completion state and the like. The target position information corresponding to the task and the current position of the shuttle car may include information such as a roadway, a layer, a column, a depth and the like.

Step S403, the PLC sets the value of the flag bit corresponding to the instruction type in the message Need-to-Send status word Need _ Send as data that does not Need to be sent, and sets the Send status flag as a Need-to-Send status.

After the first message for sending the instruction data of the instruction type is generated, the value of the flag bit corresponding to the instruction type in the message Need-to-Send status word Need _ Send is set to "false" or "0", which indicates that no data Need to be sent.

After the first message for transmitting the instruction data of the instruction type, the PLC transmits the first message to the WCS by setting the transmission status flag to the transmission-required status, and triggering the execution of step S404.

And S404, if the sending state is marked as a sending-needed state, the PLC sends a first message to the WCS.

And S405, if the first message needs to be responded, the PLC sets the state mark whether the first message corresponds to the state needing to be responded as the state needing to be responded.

Illustratively, a message Need answer status word Need _ Response may be used to store information of whether various types of messages Need answer status flags. For example, as shown in fig. 5, the message required Response status word Need _ Response may be an integer (sint type), occupies one byte, and includes 8 flag bits, where the 0 th bit may be used as a flag bit for whether Response is required for registering a message, the 1 st bit may be used as a reserved bit, and the 1 st to 7 th bits are respectively used as flag bits whether Response is required for messages of different instruction types.

In this step, if the first message needs to be responded, the PLC sets a state flag whether the first message needs to be responded in a message Need Response state word Need _ Response, which corresponds to the first message, as a state that needs to be responded according to an instruction type corresponding to the first message.

If the first message does not Need to be responded, the PLC sets the state mark whether the first message needs to be responded in the message Response-needed state word Need _ Response to be in the state which does not Need to be responded according to the instruction type corresponding to the first message.

Step S406, if a response message to the first message is received within a preset time length, setting a state flag of whether response is needed corresponding to the first message as a state of no response, and setting a state flag of sending as a state of no sending.

In this step, after receiving the response message to the first message, the sending status flag is set to the no-sending-required status, and the PLC may start processing the generation program of another message.

Step S407, if the response message to the first message is not received within the preset time length, the first message is sent again.

In this embodiment, an overtime retransmission mechanism may be configured, after a sending end sends a message, if no response of the receiving end is received within a preset time length, the sending end sends the message to the receiving end again and starts timing again, and if the receiving end still does not receive a response of the receiving end after the sending end times out again, the sending end continues to send the same message to the receiving end again and starts timing … … again until a response of the receiving end to the message is received. The preset duration may be set and modified according to an actual application scenario, and this embodiment is not specifically limited herein.

If the state flag of whether the first message is in need of response is set as a state in need of response, after the first message is sent, a retransmission timer (TimeReSend) can be started to start timing for a preset time length, and if the response message to the first message is not received before timing is completed, the first message is sent to the WCS again, the retransmission timer is reset, and timing is restarted; and until receiving a response message of the WCS to the first message, the first message is successfully sent.

In this embodiment, as shown in fig. 5, after the first message is successfully sent, the flow of this embodiment may be executed in a loop, and other messages may be continuously sent.

The embodiment of the invention takes the example that the PLC sends other messages to the WCS as an example, and describes an implementation manner of the data communication method in detail, so that the instruction data is divided into a plurality of different instruction types, and the lengths of the messages for sending the instruction data of different instruction types can be different, that is, the lengths of the messages corresponding to different instruction types are different, so that the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate can be improved.

Fig. 10 is a schematic structural diagram of a data communication device according to a fifth embodiment of the present invention. The data communication device provided by the embodiment of the invention can execute the processing flow provided by the embodiment of the data communication method. As shown in fig. 10, the data communication apparatus 50 includes: a message generating module 501 and a sending module 502.

Specifically, the message generating module 501 is configured to, when instruction data needs to be sent, generate a first message including information to be sent and a corresponding instruction type according to an instruction type corresponding to the instruction data to be sent, where a length of the first message is consistent with a preset message length corresponding to the instruction type corresponding to the information to be sent, where lengths of messages corresponding to at least two instruction types are different;

the sending module 502 is configured to send a first message.

The apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing procedure executed by the sending end in the first embodiment, and specific functions are not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

Fig. 11 is a schematic structural diagram of a data communication device according to a sixth embodiment of the present invention. The data communication device provided by the embodiment of the invention can execute the processing flow provided by the embodiment of the data communication method. As shown in fig. 11, the data communication device 60 includes: a message verification module 601 and a message data processing module 602.

Specifically, the message verification module 601 is configured to verify whether the length of the first message is correct according to the instruction type of the first message after the first message is received, where lengths of messages corresponding to at least two instruction types are different.

The message data processing module 602 is configured to process the first message if the length of the first message is correct.

The apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing procedure executed by the receiving end in the first embodiment, and specific functions are not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

On the basis of the fifth embodiment and the sixth embodiment, in the seventh embodiment, the data communication apparatus may have functions of both the transmitting end and the receiving end, and the data communication apparatus may simultaneously include: the system comprises a message generating module, a sending module, a message verifying module and a message data processing module.

Specifically, the message generation module is configured to generate, when instruction data needs to be sent, a first message including information to be sent and a corresponding instruction type according to the instruction type corresponding to the instruction data to be sent, where a length of the first message is consistent with a preset message length corresponding to the instruction type corresponding to the information to be sent, and lengths of messages corresponding to at least two instruction types are different;

the sending module is used for sending the first message.

The message verification module is used for verifying whether the length of the first message is correct or not according to the instruction type of the first message after the first message is received, wherein the lengths of the messages corresponding to at least two instruction types are different.

The message data processing module is used for processing the first message if the length of the first message is correct.

The apparatus provided in the embodiment of the present invention has the functions of the transmitting end and the receiving end in the first embodiment, and can execute the processing flows executed by the transmitting end and the receiving end, and specific functions are not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

In the fifth or seventh embodiment, in an eighth embodiment, the data communication apparatus as a transmitting end may further include: and a state processing module.

The state processing module is used for: and setting the sending state flag to be in a sending-required state.

In one possible design, the message generation module is further configured to: and if the sending state is marked as the state needing sending, sending the first message.

In one possible design, the state processing module is further configured to: and if the first message needs to be responded, setting the state mark whether the first message corresponds to the state needing to be responded as the state needing to be responded.

In one possible design, the message generation module is further configured to: and if the response message to the first message is not received within the preset time length, the first message is sent again.

In one possible design, the state processing module is further configured to: after receiving the response message to the first message, setting the state mark whether the response is needed or not corresponding to the first message as a state which does not need to be responded, and setting the state mark for sending as a state which does not need to be sent.

The apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing procedure executed by the sending end in the second to fourth embodiments, and specific functions are not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

On the basis of the sixth embodiment or the seventh embodiment, in this ninth embodiment, in the data communication apparatus as the receiving end, the message verification module is further configured to:

determining a preset message length corresponding to the instruction type of the first message; if the length of the first message is consistent with the length of the preset message, the length of the first message is correct; and if the length of the first message is not consistent with the preset message length, the length of the first message is incorrect.

In one possible design, the message data processing module is further configured to:

and if the length of the first message is correct, storing the instruction data of the first message.

In one possible design, the message data processing module is further configured to:

if the length of the first message is correct and the first message is determined not to be a repeatedly sent message according to the instruction sequence number of the first message, storing the instruction data of the first message;

and if the first message is determined to be a repeatedly sent message according to the instruction sequence number of the first message, no instruction data of the first message is stored.

In one possible design, the data communication apparatus as the receiving end may further include: and a state processing module. The state processing module is used for: and if the first message needs to be responded, setting a state mark whether the first message needs to generate a response state or not as a state needing to send the response.

In a possible design, the data communication apparatus as the receiving end may also be used as a data sending end, and may further include a message generating module and a sending module. The message generation module is used for: and if the response state needing to be generated corresponding to the first message is marked as a response state needing to be sent, generating a second message with the instruction type of the response type, wherein the second message is a response message to the first message.

In one possible design, the state processing module is further configured to:

and setting the state mark whether the response needs to be generated or not corresponding to the second message as a state which does not need to send the response, and setting the state mark which needs to send as a state which needs to send.

In one possible design, the sending module is configured to: and if the sending state is marked as the state needing sending, sending the second message.

The apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing procedure executed by the receiving end in the second to fourth embodiments, and specific functions are not described herein again.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

Fig. 12 is a schematic structural diagram of a data communication device according to a tenth embodiment of the present invention. As shown in fig. 12, the data communication apparatus 100 includes: a processor 1001, a memory 1002, a transmitter 1003, a receiver 1004 and computer programs stored on the memory 1002 and executable on the processor 1001.

When the processor 1001 runs the computer program, the data communication method executed by the receiving end and/or the transmitting end in any one of the method embodiments is implemented.

According to the embodiment of the invention, when the sending end sends the message, the length of the message to be sent is determined according to the instruction type of the instruction data to be sent, and when the receiving end receives the message, the length of the message is verified according to the instruction type of the message, so that the instruction data is divided into a plurality of different instruction types, the lengths of the messages used for sending the instruction data of different instruction types can be different, namely the lengths of the messages corresponding to different instruction types are different, the length of the message carrying more instruction data is longer, the length of the message carrying less instruction data is shorter, the bandwidth can be saved, and the bandwidth occupancy rate is improved.

In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the data communication method executed by the receiving end and/or the sending end in any of the method embodiments.

Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

26页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种检测伪造流量的方法、装置及电子设备

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类