Data message sending and receiving methods, network distribution method, related device and system

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

阅读说明:本技术 数据报文的发送、接收方法、配网方法及相关装置和系统 (Data message sending and receiving methods, network distribution method, related device and system ) 是由 陈熙彩 于 2020-04-27 设计创作,主要内容包括:本发明公开了一种数据报文的发送方法、接收方法、配网方法及相关装置和系统。所述方法包括:对待发送的至少一个数据报文,判断所述至少一个数据报文中是否存在第一类数据报文,所述第一类数据报文为有效负载全为0或全为1且在该至少一个数据报文中的数量占比超过预设的阈值的数据报文;若存在,则发送第二类数据报文并指示所发送的第二类数据报文在所有数据报文中的位置,第二类数据报文为至少一个数据报文中除了所述第一类数据报文之外的数据报文。本发明选择不发送第一类数据报文且发送第二类数据报文,使得可发送的数据报文的数量大大减少,可节约带宽资源,减少了报文分组出错的几率,同时也提升了传输效率。(The invention discloses a data message sending method, a data message receiving method, a network distribution method, a related device and a related system. The method comprises the following steps: judging whether a first type of data message exists in at least one data message to be sent, wherein the first type of data message is a data message of which the effective load is all 0 or all 1 and the quantity proportion in the at least one data message exceeds a preset threshold value; and if the data message exists, sending a second type data message and indicating the position of the sent second type data message in all the data messages, wherein the second type data message is the data message except the first type data message in at least one data message. The invention selects not to send the first type data message and sends the second type data message, so that the quantity of the data messages which can be sent is greatly reduced, the bandwidth resource can be saved, the probability of packet error is reduced, and the transmission efficiency is improved.)

1. A method for sending a data message, comprising:

judging whether a first type of data message exists in at least one data message to be sent, wherein the first type of data message is a data message of which the effective load is all 0 or all 1 and the quantity proportion in the at least one data message exceeds a preset threshold value;

and if so, sending a second type data message and indicating the position of the sent second type data message in the at least one data message, wherein the second type data message is a data message in the at least one data message except the first type data message.

2. The method of claim 1, wherein the at least one data packet to be transmitted is divided into a plurality of packets, and the data packet in each packet is encoded by:

determining the size of available space of effective load data in the data message according to the size of coding space of the data message and the size of space occupied by the data message in the packet by an index;

determining the number of data messages contained in each group according to the total size of each effective load data and the size of the available space of the effective load data;

and filling the coding space of each data message with the index of the data message, and filling the corresponding part of the effective load data in the residual coding space after the index is filled until all the data messages in the packet are filled.

3. The method of claim 2, wherein indicating the location of the transmitted second type of data message in all data messages comprises:

sending a grouping frame of a grouping in which the second type data message is positioned; the packet frame is used for indicating the sequence number of the currently sent packet;

and indicating the position of the second data message in all the data messages according to the sequence number of the packet frame and the index of each data message in the packet.

4. The method according to any of claims 1-3, wherein before said sending the second type of data packet, in case it is determined that there are first type of data packets with payload data all of 1, further comprising:

carrying out the operation of negation on the effective load data of all the data messages; the operation of negation is to change 0 of each bit in the effective load data of each data message into 1, and change 1 into 0;

re-determining the first type data message and the second type data message in the data message after the negation operation;

and sending a polarity frame, wherein the polarity frame is used for indicating the equipment receiving the data message to perform the operation of negating the effective load data of the received data message.

5. The method of any one of claims 1-3, further comprising:

when the effective load data of the first type of data message is all 1, performing negation operation on the data message of which the effective load data is all 0; or when the effective load data of the first type of data message is all 0, performing negation operation on the data message of which the effective load data is all 1; the operation of negation is to change each bit in the effective load data of each data message from 0 to 1 and from 1 to 0;

and sending a corresponding polarity frame aiming at the data message subjected to the negation operation, wherein the polarity frame is used for indicating the equipment receiving the data message to perform the negation operation on the received data message.

6. A method for receiving a data packet, comprising:

receiving second type data messages and indication information of positions of the second type data messages in all the data messages;

determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages;

and restoring all the data messages according to the position of the first type data message, the value predetermined by the first type data message, the received second type data message and the corresponding position.

7. A method for sending a data message, comprising:

judging whether a third type data message exists in at least one data message to be sent, wherein the quantity ratio of 0 or 1 in the effective load of the third type data message exceeds a preset threshold value;

if yes, dividing the effective load in the third type of data message to respectively obtain a fourth type of data message with all the effective loads being 0 and a fourth type of data message with all the effective loads being 1, and recording the position of each bit in the effective load before division;

and sending a fourth type data message of which the number ratio of the bits in the effective load before the division does not exceed a preset threshold value, and indicating the position of the effective load of the sent fourth type data message in the effective load before the division.

8. A method for receiving a data packet, comprising:

receiving a fourth type data message and position information of an effective load of the fourth type data message in the effective load before segmentation;

determining the position of the effective load in the unsent fourth type data message in the effective load before the division according to the position information;

restoring the effective load before segmentation according to the effective load of the received fourth type data message and the position of the effective load in the unsent fourth type data message in the effective load before segmentation;

and restoring the third data message containing the effective load before the division according to the effective load before the division.

9. A method of distributing a network, comprising: after the mobile terminal is connected with the WIFI network, broadcasting a data message so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; characterized in that the step of broadcasting the data packets uses the method of sending data packets according to any of claims 1 to 5 and 7.

10. A method for communication in an intelligent internet of things, wherein any two devices in the internet of things send messages by using the method for sending data messages according to any one of claims 1 to 5 and 7.

11. A device for sending data packets, comprising:

the device comprises a judging module, a sending module and a sending module, wherein the judging module is used for judging whether all data messages to be sent have first-class data messages, the first-class data messages are all 0 or all 1, and the number proportion of the first-class data messages in all the data messages exceeds a preset threshold value;

a sending module, configured to send a second data message; the second type data message is a data message except the first type data message in all the data messages;

and the indicating module is used for indicating the positions of the second type data messages in all the data messages.

12. A device for receiving a data packet, comprising:

the receiving module is used for receiving the second type data message and the indication information of the position of the second data message in all the data messages;

a position determining module, configured to determine, according to positions of the second data packets in all data packets, positions of unsent first-type data packets in all data packets;

and the data reduction module is used for reducing all the data messages according to the position of the first type of data message, the value agreed in advance by the first type of data message, the received second type of data message and the corresponding position.

13. A device for sending data packets, comprising:

the device comprises a judging module, a sending module and a sending module, wherein the judging module is used for judging whether a third type data message exists in at least one data message to be sent, and the quantity ratio of 0 or 1 in the effective load of the third type data message exceeds a preset threshold value;

the dividing module is used for dividing the effective load in the third type of data message when the judging module determines that the effective load exists, respectively obtaining a fourth type of data message with all the effective loads being 0 and a fourth type of data message with all the effective loads being 1, and recording the position of each bit in the effective load before division;

and the sending module is used for sending a fourth type data message of which the number ratio of the bits in the effective load before the division does not exceed a preset threshold value, and indicating the position of the effective load of the sent fourth type data message in the effective load before the division.

14. A device for receiving a data packet, comprising:

the receiving module is used for receiving a fourth type data message and position information of an effective load of the fourth type data message in the effective load before segmentation;

a determining module, configured to determine, according to the location information, a location of a payload in an unsent fourth-type data message in the payload before segmentation;

the data reduction module is used for reducing the effective load before segmentation according to the effective load of the received fourth type data message and the position of the effective load in the unsent fourth type data message in the effective load before segmentation; and restoring the third data message containing the effective load before the division according to the effective load before the division.

15. An apparatus for a distribution network, comprising: a broadcast module; the broadcasting module is used for broadcasting a data message after the mobile terminal is connected with the WIFI network so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; characterized in that the step of broadcasting the data packets uses the method of sending data packets according to any of claims 1 to 5 and 7.

16. An in-internet-of-things communication terminal comprising: data message transmission module, characterized in that the data message transmission module transmits a message using the method for transmitting a data message according to any of claims 1-5 and 7.

17. A system for transmitting data packets, comprising:

the data message sending end equipment is used for judging whether first-class data messages exist in all the data messages to be sent, wherein the first-class data messages are all 0 or all 1, and the number proportion of the first-class data messages in all the data messages exceeds a preset threshold value; if the data packet exists, sending a second type data packet and indicating the position of the sent second type data packet in all data packets; the second type data message is a data message except the first type data message in all the data messages;

the data message receiving end equipment is used for receiving the second type data message and the indication information of the position of the second data message in all the data messages; determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages; and restoring all the data messages according to the position of the first type data message, the value predetermined by the first type data message, the received second type data message and the corresponding position.

18. A mobile terminal, comprising: memory, processor and computer instructions stored on the memory and executable on the processor, wherein the instructions when executed by the processor are capable of implementing a method of sending a data message according to any one of claims 1-5 and 7.

19. A smart device, comprising: memory, processor and computer instructions stored on the memory and executable on the processor, which when executed by the processor are capable of implementing a method of receiving data messages according to claim 6 or 8.

20. A computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, are capable of implementing a method for sending data packets according to any one of claims 1-5 and 7, or of implementing a method for receiving data packets according to claim 6 or 8, or of implementing a method for a distribution network according to claim 9, or of implementing a method for communication within an intelligent internet of things according to claim 10.

Technical Field

The present invention relates to the field of data transmission, and in particular, to a method for sending and receiving a data packet, a method for distributing a network, and related devices and systems.

Background

In the intelligent internet of things, the intelligent mobile terminal needs to perform distribution network operation, encodes distribution network information into a WIFI data packet and sends the distribution network information to the controlled intelligent device, wherein the distribution network information comprises a Service Set Identifier (SSID) and a password of WIFI, so that the intelligent device and the intelligent mobile terminal can be connected to the same WIFI network through the SSID and the password of the WIFI obtained by monitoring a message.

The traditional encoding method used for the packet length distribution network is to completely encode payload data into a data packet preferentially, and then use redundant bit data to encode the serial number (index) of the data packet.

On one hand, in the traditional packet length coding mode, under the condition that more packets are sent and the message is sent first after the occurrence, the intelligent device end can calculate the received data into a wrong packet, and the result is that the CRC check fails, and finally the distribution network fails. The greater the number of packets, the greater the likelihood of miscalculating the packets. On the other hand, for the small programs of the mobile terminal executing the distribution network operation, due to the serious limitation of the packet sending capability, more resources are consumed, and the transmission efficiency is not very high. There is a need for a more efficient way of encoding and transmitting data.

Disclosure of Invention

In view of the above, the present invention is proposed to provide a data packet sending method, a data packet receiving method, a network distribution method, and related devices and systems, which overcome or at least partially solve the above problems.

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

judging whether a first type of data message exists in at least one data message to be sent, wherein the first type of data message is a data message of which the effective load is all 0 or all 1 and the quantity proportion in the at least one data message exceeds a preset threshold value;

and if so, sending a second type data message and indicating the position of the sent second type data message in the at least one data message, wherein the second type data message is a data message in the at least one data message except the first type data message.

In one or some possible embodiments, the at least one data packet to be sent is divided into a plurality of packets, and the data packet in each packet is obtained by encoding:

determining the size of available space of effective load data in the data message according to the size of coding space of the data message and the size of space occupied by the data message in the packet by an index;

determining the number of data messages contained in each group according to the total size of each effective load data and the size of the available space of the effective load data;

and filling the coding space of each data message with the index of the data message, and filling the corresponding part of the effective load data in the residual coding space after the index is filled until all the data messages in the packet are filled.

In one or some possible embodiments, the indicating the position of the transmitted second type data packet in all data packets includes:

sending a grouping frame of a grouping in which the second type data message is positioned; the packet frame is used for indicating the sequence number of the currently sent packet;

and indicating the position of the second data message in all the data messages according to the sequence number of the packet frame and the index of each data message in the packet.

In one or some possible embodiments, in the case that it is determined that there are first type data packets with payload data of all 1, before the sending the second type data packet, the method further includes:

carrying out the operation of negation on the effective load data of all the data messages; the operation of negation is to change 0 of each bit in the effective load data of each data message into 1, and change 1 into 0;

re-determining the first type data message and the second type data message in the data message after the negation operation;

and sending a polarity frame, wherein the polarity frame is used for indicating the equipment receiving the data message to perform the operation of negating the effective load data of the received data message.

In one or some possible embodiments, the method further comprises:

when the effective load data of the first type of data message is all 1, performing negation operation on the data message of which the effective load data is all 0; or when the effective load data of the first type of data message is all 0, performing negation operation on the data message of which the effective load data is all 1; the operation of negation is to change each bit in the effective load data of each data message from 0 to 1 and from 1 to 0;

and sending a corresponding polarity frame aiming at the data message subjected to the negation operation, wherein the polarity frame is used for indicating the equipment receiving the data message to perform the negation operation on the received data message.

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

receiving second type data messages and indication information of positions of the second type data messages in all the data messages;

determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages;

and restoring all the data messages according to the position of the first type data message, the value predetermined by the first type data message, the received second type data message and the corresponding position.

In a third aspect, an embodiment of the present invention provides a method for sending a data packet, including:

judging whether a third type data message exists in at least one data message to be sent, wherein the quantity ratio of 0 or 1 in the effective load of the third type data message exceeds a preset threshold value;

if yes, dividing the effective load in the third type of data message to respectively obtain a fourth type of data message with all the effective loads being 0 and a fourth type of data message with all the effective loads being 1, and recording the position of each bit in the effective load before division;

and sending a fourth type data message of which the number ratio of the bits in the effective load before the division does not exceed a preset threshold value, and indicating the position of the effective load of the sent fourth type data message in the effective load before the division.

In a fourth aspect, a method for receiving a data packet includes:

receiving a fourth type data message and position information of an effective load of the fourth type data message in the effective load before segmentation;

determining the position of the effective load in the unsent fourth type data message in the effective load before the division according to the position information;

restoring the effective load before segmentation according to the effective load of the received fourth type data message and the position of the effective load in the unsent fourth type data message in the effective load before segmentation;

and restoring the third data message containing the effective load before the division according to the effective load before the division.

In a fifth aspect, an embodiment of the present invention provides a method for network distribution, including: after the mobile terminal is connected with the WIFI network, broadcasting a data message so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; the step of broadcasting the data packet adopts the method for sending the data packet.

In a sixth aspect, an embodiment of the present invention provides a method for communication in an intelligent internet of things, where any two devices in the internet of things send a message by using the sending method for a data message.

In a seventh aspect, an embodiment of the present invention provides a device for sending a data packet, where the device includes:

the device comprises a judging module, a sending module and a sending module, wherein the judging module is used for judging whether all data messages to be sent have first-class data messages, the first-class data messages are all 0 or all 1, and the number proportion of the first-class data messages in all the data messages exceeds a preset threshold value;

a sending module, configured to send a second data message; the second type data message is a data message except the first type data message in all the data messages;

and the indicating module is used for indicating the positions of the second type data messages in all the data messages.

In an eighth aspect, an embodiment of the present invention provides a device for receiving a data packet, where the device includes:

the receiving module is used for receiving the second type data message and the indication information of the position of the second data message in all the data messages;

a position determining module, configured to determine, according to positions of the second data packets in all data packets, positions of unsent first-type data packets in all data packets;

and the data reduction module is used for reducing all the data messages according to the position of the first type of data message, the value agreed in advance by the first type of data message, the received second type of data message and the corresponding position.

In a ninth aspect, an embodiment of the present invention provides a device for sending a data packet, including:

the device comprises a judging module, a sending module and a sending module, wherein the judging module is used for judging whether a third type data message exists in at least one data message to be sent, and the quantity ratio of 0 or 1 in the effective load of the third type data message exceeds a preset threshold value;

the dividing module is used for dividing the effective load in the third type of data message when the judging module determines that the effective load exists, respectively obtaining a fourth type of data message with all the effective loads being 0 and a fourth type of data message with all the effective loads being 1, and recording the position of each bit in the effective load before division;

and the sending module is used for sending a fourth type data message of which the number ratio of the bits in the effective load before the division does not exceed a preset threshold value, and indicating the position of the effective load of the sent fourth type data message in the effective load before the division.

In a tenth aspect, an embodiment of the present invention provides a device for receiving a data packet, where the device includes:

the receiving module is used for receiving a fourth type data message and position information of an effective load of the fourth type data message in the effective load before segmentation;

a determining module, configured to determine, according to the location information, a location of a payload in an unsent fourth-type data message in the payload before segmentation;

the data reduction module is used for reducing the effective load before segmentation according to the effective load of the received fourth type data message and the position of the effective load in the unsent fourth type data message in the effective load before segmentation; and restoring the third data message containing the effective load before the division according to the effective load before the division.

In an eleventh aspect, an embodiment of the present invention provides a device for a network distribution, including: a broadcast module; the broadcasting module is used for broadcasting a data message after the mobile terminal is connected with the WIFI network so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; wherein, the step of broadcasting the data message adopts the sending method of the data message.

In a twelfth aspect, an embodiment of the present invention provides an internet of things communication terminal, including: and the data message sending module sends the message by adopting the data message sending method.

In a thirteenth aspect, an embodiment of the present invention provides a system for transmitting a data packet, including:

the data message sending end equipment is used for judging whether first-class data messages exist in all the data messages to be sent, wherein the first-class data messages are all 0 or all 1, and the number proportion of the first-class data messages in all the data messages exceeds a preset threshold value; if the data packet exists, sending a second type data packet and indicating the position of the sent second type data packet in all data packets; the second type data message is a data message except the first type data message in all the data messages;

the data message receiving end equipment is used for receiving the second type data message and the indication information of the position of the second data message in all the data messages; determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages; and restoring all the data messages according to the position of the first type data message, the value predetermined by the first type data message, the received second type data message and the corresponding position.

In a fourteenth aspect, an embodiment of the present invention provides a mobile terminal, including: the apparatus includes a memory, a processor, and computer instructions stored on the memory and executable on the processor, the instructions when executed by the processor being capable of implementing a method of sending a data message as previously described.

In a fifteenth aspect, an embodiment of the present invention provides an intelligent device, including: the apparatus includes a memory, a processor, and computer instructions stored on the memory and executable on the processor, the instructions when executed by the processor being capable of implementing a method of sending a data message as previously described.

In a sixteenth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer instructions are stored, and when executed by a processor, the computer instructions are capable of implementing the foregoing data packet sending method, or the foregoing data packet receiving method, or the foregoing distribution network method, or the foregoing intelligent internet of things communication method.

The technical scheme provided by the embodiment of the invention has the beneficial effects that at least:

according to the sending method, the receiving method, the network distribution method, the related device and the system of the data messages, whether first-class data messages exist in all the data messages to be sent is judged, the first-class data messages are data messages with the effective loads of all 0 or all 1 and the quantity ratio exceeding a preset threshold value, if the first-class data messages exist, the data messages except the first-class data messages are sent, and the positions of the data messages to be sent in all the data messages are indicated, so that a data receiving end can obtain all the data messages according to the first-class data messages received by default, the first-class data messages actually received and the actual positions of the first-class data messages received by default. After the first type of data message is judged to exist, the first type of data message is selected not to be sent and the second type of data message is sent, so that the quantity of the data messages which can be sent is greatly reduced.

Furthermore, the embodiment of the present invention adopts a new coding method, that is, in the coding space of each data packet, the index of the data packet contained in each data packet is filled, and the corresponding part of the payload is filled in the coding space remaining after the index is filled until all the data packets in the packet are filled, that is, in the limited coding space, the filling of the index is preferentially considered, and then the payload data is divided into a plurality of packets according to the size of the remaining space for transmission, so that it can be ensured that no erroneous packet is calculated due to the index under the condition that the data packet arrives before being transmitted and arrives before being transmitted, and the packets are grouped according to the bit sequence of the payload, the number of the packets is relatively fixed, and cannot increase due to the increase of the number of data to be transmitted, and the number of the packets is relatively small, thereby improving the accuracy of transmission and reception of the data packet, is a more robust data communication mode.

Further, according to the number proportion of the data packets with payload of all 1 or all 0, the embodiment of the present invention may select to perform data inversion on all data packets or on part of the data packets, and may further optimize the transmission flow, reduce the amount of data that can be transmitted, and improve the efficiency and accuracy of transmitting and receiving the data packets in a case of sending polar frames.

According to the other data message sending method provided by the embodiment of the invention, aiming at the situation that the quantity ratio of 0 or 1 in the effective load exceeds the preset threshold value, the effective load is divided to obtain the fourth type data message with the load of all 0 or all 1, then the part with smaller effective load is sent and the position of the part in the effective load before division is indicated, at the data message receiving end, the unsent data messages are restored by utilizing the received fourth type data message and the position information, and the third type data message is finally restored, so that the quantity of the data messages which can be sent can be greatly reduced, the bandwidth resources can be saved, the error probability of message grouping is reduced, and the transmission efficiency is improved.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.

Drawings

The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:

fig. 1 is a flowchart of a method for sending a data packet according to an embodiment of the present invention;

fig. 2 is a schematic diagram of a conventional encoding method of a data packet in the case of 16 data packets;

fig. 3A to 3C are schematic encoding diagrams of dividing 16 data into 3 packets in a 6-bit encoding space according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a conventional encoding method of a data packet in the case of 32 data;

fig. 5A to 5B are schematic encoding diagrams of dividing 32 data into 2 packets in a 6-bit encoding space according to an embodiment of the present invention;

fig. 6 is a flowchart of a method for receiving a data packet according to an embodiment of the present invention;

FIG. 7 is a schematic diagram of encoding and grouping for transmitting data packets of 0 to 7 according to an embodiment of the present invention;

fig. 8 is a distribution network process flow diagram in a scenario involving a packet length coded distribution network of the internet of things according to an embodiment of the present invention;

fig. 9 is a schematic interface diagram of an APP of a mobile terminal according to an embodiment of the present invention;

fig. 10 is a flowchart of another data packet sending method according to an embodiment of the present invention;

fig. 11 is a flowchart of a method for receiving a data packet according to an embodiment of the present invention;

fig. 12 is a block diagram of a data packet sending apparatus according to an embodiment of the present invention;

fig. 13 is a block diagram of a structure of a data packet receiving apparatus according to an embodiment of the present invention;

fig. 14 is a block diagram of another data packet sending apparatus according to an embodiment of the present invention;

fig. 15 is a block diagram of another structure of a data packet receiving apparatus according to an embodiment of the present invention;

fig. 16 is a block diagram of a data packet transmission system according to an embodiment of the present invention.

Detailed Description

Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

In order to better describe the sending method, the receiving method, the network distribution method, the device and the system for communication in the intelligent internet of things provided by the embodiments of the present invention, firstly, a simple description is made on the network architecture related to the embodiments of the present invention, the embodiments of the present invention are based on the data message sending end and the data message receiving end, in different specific scenarios, the data message sending end and the data message receiving end may be a plurality of different devices and/or terminals, for example, the above-mentioned communication may occur in a local area network or a wide area network, and the sending end of the data message and the receiving end of the data message involved may be various mobile terminals, personal PCs, industrial-grade servers, etc., for example, in the field of smart home in the subdivision field of the smart internet of things and in the scene of a distribution network, a sending end of the data message is a mobile terminal, and controlled smart home equipment is used for receiving the data message; in other scenarios, for example, in the communication scenario of the local area network, the data message sending end and the data message receiving end may be various computers, mobile terminal handsets, or other devices. For example, in a mobile payment scenario, the sending end of the data packet may be a mobile terminal device initiating payment, and the receiving end of the data packet may be various barcode scanning guns with a scanning function. The technical solutions disclosed in the embodiments of the present invention can be implemented into any possible technical scenarios by those skilled in the art.

In order to solve the problems of more data packet, possible erroneous reception of a packet, transmission resource consumption, and low transmission efficiency in the conventional data packet, an embodiment of the present invention provides a method for transmitting a data packet, where, for a data transmitting end, as shown in fig. 1, at least the following steps are performed:

s11, judging whether a first type of data message exists in at least one data message to be sent; the first type of data message is a data message which is all 0 or all 1 and the quantity ratio of the first type of data message in the at least one data message exceeds a preset threshold value; if yes, execute the following step S12;

and S12, sending the second type data message and indicating the position of the sent second type data message in the at least one data message.

The second type of data message is a data message except the first type of data message in the at least one data message.

The embodiment of the invention does not limit the number of the data messages to be sent.

In step S11, if the first type of data packets are all 1 data, the second type of data packets include the following two types of data packets: one is data with all 0 bits, and the other is data message with part of bit being 0 and part of bit being 1.

Conversely, if the first type of data packet is data with all 0, the second type of data packet includes the following two types of data packets: one is data with all 1 bits, and the other is data message with part of bit being 0 and part of bit being 1.

In the step S12, only the second type data packet is sent and the position of the second type data packet in all the data packets is indicated, but the first type data packet is not sent, and the data receiving end can determine the position of the first type data packet in all the data packets according to the received second data packet and the position information thereof, and since the data of the first type data packet (all 1S or all 0S) is preset by both communication parties, all the data packets can be restored according to the preset data of the first type data packet, the received second type data packet, and the positions of the first type data packet and the second type data packet in all the data packets.

According to the method for sending the data message, after the first type of data message is judged to exist, the second type of data message is sent without sending the first type of data message, so that the quantity of the data messages which can be sent is greatly reduced.

As mentioned above, the conventional encoding method used in the packet length distribution network is to encode a payload (payload) data into a data packet completely, and then use the number of redundant bits to encode the serial number (index) of the data packet, and the encoding method is shown in fig. 2, where in fig. 2, each payload occupies 6 bits of space, and if there is redundant encoding space, then carries an index.

Referring to fig. 2, each data packet completely carries all its payload, each data packet contains a complete payload, and a sequence (index) field (limited by the range that can be represented by the packet length, the index field often cannot represent an absolute sequence, but can only represent a relative sequence, such as a relative sequence in a packet like packets 1-4), in a case where the coding space of the data packet is limited, for example, the number of bits in the coding space is consistent with the number of bits in the payload data, the coded transmission of the data packet of table 1 is complete, because the payload has used all the unsuitable bits, and no bits can be used to accommodate the index field.

The data packet receiving end is not provided with an index or the coding space is not enough to accommodate the index field, so that the coded data packet lacks the index indicating the sequence in the packet or the indicating information is simplified.

Based on this, the embodiment of the present invention further provides an optimized encoding method for data packets, where all data packets are divided into a plurality of groups, and different from the conventional method, in the encoding process of the data packets:

determining the size of available space of payload data payload in each data message according to the size of coding space of each data message and the size of space occupied by each data message in an index in a packet;

determining the number of data messages contained in each group according to the total size of each payload and the size of the available space of the payload;

and filling the index of the data message contained in each data message in the coding space of each data message, and filling the corresponding part of the payload in the residual coding space after the index is filled until all the data messages in the packet are filled.

And the data message sending end sends the packet frame of the packet where the second type data message is located, wherein the packet frame is used for indicating the serial number of the currently sent packet, so that the receiving end can know the packet where the currently to-be-received data message is located, and the sending of the data message finally indicates the position of the second data message in all data messages according to the serial number of the packet frame and the index (used for indicating the relative position in the corresponding packet) of each data message in the packet.

Each data packet preferably ensures that the index has enough space, and the remaining space holds a part of the payload, and referring to the examples in fig. 3A to 3C, the 6-bit payload is divided into 3 data packets to be sent, which are respectively a packet of bit0 to bit1, a packet of bit2 to bit3, and a packet of bit4 to bit5, and 16 data packets are in each packet. In the scheme, under the condition that the total coding space is 6 bits, 4 bits of the data packets are used as the index, so that the problem that no coding space exists in the prior art to accommodate the index is solved, the remaining 2 bits in the data packets are used for transmitting the corresponding parts of the payload, the data packets in the first group respectively transmit bits 0-bit1 of 16 payloads, the data packets in the second group respectively transmit bits 2-bit3 of 16 payloads, and the data packets in the third group respectively transmit bits 4-bit5 of 16 payloads.

Taking an encoding space of 8 bits as an example, according to a conventional encoding mode, and a grouping and encoding mode thereof is shown in fig. 4, 32 data packets are divided into 8 groups, and each group contains 4 data packets. Before the data message of each packet is sent, a corresponding packet frame needs to be sent.

According to the optimized coding mode of the embodiment of the invention, the payload is divided into two packet frames to be sent, in the first packet, the data message sends the first 3 bits of the 32 payloads, namely bits 0-2, and in the second packet, the data message sends the last 3 bits of the 32 payloads, namely bits 3-5. The two groups refer to fig. 5A and 5B, respectively; there are 32 data messages in each packet, fig. 5A shows the data messages for the packets from bit0 to bit2 in the payload, and fig. 5B shows the data messages for the packets from bit3 to bit5 in the payload. Packet frame 1 and packet frame 2 are sent before the two packets, respectively.

The scheme can improve the correct rate of data reception, and because the grouping is performed according to the bit sequence of the payload, the number of the grouping is relatively fixed, and the increase of the number of the data to be transmitted is avoided. For example, the data to be transmitted is 8 bits, and generally, only 4 groups are grouped according to one group of 2 bits, so that the number of groups in the scheme is not greatly increased compared with the ten-fold grouping situation when the data size is large in the conventional coding mode. The small number of packets reduces the possibility that packets received by the device end are divided into erroneous packets, thereby improving the success rate of data reception.

Compared with the conventional coding mode, the coding and grouping mode of the data messages provided by the embodiment of the invention has the problems of increase of the total number of the data messages and increase of data sending time to a certain extent, so that whether the coding mode is adopted or the conventional coding mode is adopted can be selected according to actual requirements in specific implementation.

In one or some possible embodiments, in order to further simplify the manner of appointing the first type of data packet by both parties, the both parties of the communication may default that all the payload in all the data packets that are not received are data with 0, in this case, when the data packet proportion of all the payload that is 1 in all the data packets exceeds a preset threshold, for example, when the data packet proportion exceeds 60%, the data packet of this type may be determined as the first type of data packet, because all the payload in all the data packets that are not received by both parties of the communication may default are data with 0, in this embodiment of the present invention, the payload of all the data packets may also be negated; the negation operation is to change 0 of each bit in each data packet payload to 1 and change 1 to 0.

For example, if the payload of the data message is "111", the inverse is "000", and if the payload is "000", the inverse is "111", the payload is "001", and the inverse is "110".

After negation, the data of all 1S of the payload is changed into data messages with the proportion exceeding 60%, namely first-class data messages, and then the first-class data messages and the second-class data messages in the data messages after negation operation are determined again according to the steps from S11 to S12; the second type of data message is then sent and its position in all data messages is indicated.

In addition to normal data packet transmission, a polarity frame is also required to be transmitted, and the polarity frame is used to instruct a device receiving the data packet to perform an operation of inverting a payload of the received data packet. That is, the receiving end will invert the payload of the received data packet, and restore the previous original data.

In one or some possible embodiments, in order to further reduce the number of the second type data packets that need to be sent, in step S11, when it is determined that all the payloads in the first type data packets are 1, an operation of inverting the data packets whose payloads in all the data packets are 0 is performed, or when all the payloads in the first type data packets are 0, an operation of inverting the data packets whose payloads in all the payload in all the data packets are 1 is performed, so that the local data packets may be inverted, the number of the first type data packets may be increased, and the sending workload of the second type data packets may be further reduced, but when a corresponding polarity frame needs to be sent for the data packets that have been inverted, the polarity frame is used to instruct the device that receives the data packets to perform an operation of inverting the received data packets, so as to restore the original data.

It should be noted that, although the foregoing manner will reduce the transmission of the corresponding data packet, the transmission amount of the polar frame is relatively increased, so in other possible embodiments, the data packet as a whole may be selected to be subjected to numerical inversion according to the proportion that the payload is all 1 and the payload is all 0 in the data packet, in other words, the data packet in the whole packet is subjected to numerical inversion by taking the packet as a unit, so that the corresponding polar frame may be transmitted for one packet. The method achieves the purposes of reducing the quantity of the second class data messages and reducing the sending quantity of the polar frames.

The embodiment of the present invention further provides a method for receiving a data packet corresponding to the method for sending a data packet, where the method is applicable to a receiving end of a data packet, and as shown in fig. 6, the method for receiving a data packet includes the following steps:

s61, receiving the second type data message and the indication information of the position of the second type data message in all the data messages;

s62, determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages;

s63, restoring all data messages according to the position of the first type data message and the value predetermined by the first type data message, and the received second type data message and the corresponding position.

For the situation of receiving the polar frame, the receiving end of the data packet may further perform, according to the data packet that is indicated by the received polar frame and has undergone the negation operation, after restoring all the data packets, the corresponding negation operation according to the polar frame, and finally restore the original data of all the data packets.

In order to better describe the method for sending a data packet and the method for receiving a data packet provided by the present invention, the embodiments of the present invention are described with reference to two specific embodiments.

The first embodiment is as follows:

taking 8 data to be transmitted, i.e. 0, 1, 2, 3, 4, 5, 6 and 7, and taking 6 bits as an example of the range in which a data packet can be encoded, a schematic diagram of encoding and grouping of the data packet is shown in fig. 7.

4 of the 6 bits are taken to encode the absolute position of the data packet and the remaining 2 bits are used to encode payload. Taking the number 7 (binary 0b00000111) as an example, when a complete payload is 8 bits, the payload needs to be divided into 4 groups of 8 numbers, namely, 0b00, 0b00, 0b01 and 0b11, after the 4 groups are split, 8 data totally needs 8 × 4 segments to complete transmission, that is, the data totally needs to be sent 32 times to complete transmission.

An applet (e.g., APP) of a sending end device (e.g., mobile terminal, etc.) sends packet 0 for the first time, for 8 messages, and then sends packet 1, packet 2, and packet 3, respectively.

For the data packets that need to be sent after grouping, it can be observed from fig. 7 that a large amount of data in the data packets are all zero payload data, and only a small portion of the data packets are not.

Thus, the payload non-zero data packets in each group exceed a certain threshold (e.g., 60%) based on their ratio to the number of all data packets.

If the remaining data packets with payload not all 0 are identified in fig. 7, only 4 data packets with payload not all zero in group 2 (marked with filled light gray) and 6 data packets with payload not all zero in group 3 (marked with filled dark gray) can be seen, and then 10 data packets with payload not all zero are obtained.

For the case that all zero data is mostly, for example, more than 60%, it is considered as the first type of data packet, the receiving end device may default to receive the data, and such data packet is not actually transmitted.

It is assumed that if the data packet with payload of all 1 is in majority (for example, the threshold value exceeds 60%), the data packet may be marked as abnormal polarity data, all data is inverted before transmission, that is, 1 in the payload of the data packet is changed to 0, and 0 is changed to 1, and meanwhile, a polarity frame needs to be transmitted to the receiving end device, and after receiving the data packet, the receiving end device inverts the payload in the data packet according to the polarity frame to restore the real original data.

The sending end equipment only needs to send the data message or the data messages with the payload not all zero, so that after the coding, only 10 data packets are needed to be sent in total instead of all 32 data packets, and the total sending times are greatly saved. The transmitting end device may skip packet 0 and packet 1, send packet frame 3 directly, then send 4 data identified in light gray, then send packet frame 4, then send 6 data identified in dark gray.

After a round of data transmission is finished, the transmitting end device transmits an end frame, and after receiving the end frame, the receiving end device defaults that actually received data is 0, so that the transmission of the data message in the round is finished. If a polar frame is received before, the receiving end device will invert the payload data in all data messages received to restore the original data.

Example two:

in the second embodiment of the present invention, a scenario of a packet length coding distribution network of the internet of things is related, in which a mobile terminal, for example, an APP of a mobile phone, codes an SSID and a password of a WIFI network into a UDP message, and sends the SSID and the password through a broadcast packet or a multicast message.

Referring to fig. 8, the general flow includes the following steps:

s81, connecting an APP at the mobile phone side with a WIFI;

s82, the APP sends network UDP packets, and circularly sends SSID and PASSSWORD.

In the process of sending the distribution network UDP data packet by the APP, the coding method of the data packet can be adopted, namely for each data packet, the index part is filled preferentially, the rest bit is filled preferentially, and then the part of payload data is filled, so that the packet quantity is determined. Under the condition that the number of payload data is more than 1 or 0, the data packets are selected not to be sent, but those payload data packets which are not all zero are sent, and data inversion is performed and corresponding polar frames are sent if necessary.

S83, the intelligent device monitors all messages in the network and acquires the SSID and the corresponding password through the UDP packet;

the smart devices may be, for example, various devices that can implement a specific function, such as common household appliances, e.g., televisions, air conditioners, water heaters, and so on. Or office equipment such as projection equipment, scanners, printers, etc.

S84, the intelligent device is connected with the WIFI router according to the obtained SSID and the corresponding password, and the mobile phone and the intelligent device are located in the same WIFI network.

S85, the mobile phone APP may add various smart devices in the same WIFI network through the interface shown in fig. 9, so as to implement intelligent control on the smart devices through the router.

In the data messages to be sent, there is a type of data message, and the payload of the data message is not completely 0 or 1, but mostly 0, and less 1, or mostly 1 and less 0, for such data message, a method similar to the aforementioned data message sending method can also be adopted to reduce the number of actually sent data messages, save bandwidth resources, and improve transmission efficiency.

For such a scheme, an embodiment of the present invention provides another method for sending a data packet, which is shown in fig. 10 and includes the following steps:

s101, judging whether a third type data message exists in at least one data message to be sent, wherein the quantity ratio of 0 or 1 in the effective load of the third type data message exceeds a preset threshold value; if yes, executing step S102; otherwise, executing step S104;

s102, dividing the effective loads in the third type of data messages to respectively obtain fourth type of data messages with all the effective loads being 0 and fourth type of data messages with all the effective loads being 1, and recording the positions of all bits in the effective loads before division;

s103, sending a fourth type data message of which the number ratio of bits in the effective load before division does not exceed a preset threshold, and indicating the position of the effective load of the sent fourth type data message in the effective load before division.

And S104, ending the flow.

For example, the payload of a certain data packet is "1111111111111111111001", and since the majority is 1 and the minority is 0, in terms of the number ratio of each bit, where the number ratio of 1 exceeds 90%, the data packet is considered to be a third type data packet, and for this type of data packet, the bits of 0 in minority can be stripped, that is, the payload is divided into two, two fourth type data packets in which the bits of the payload are all 1 and the bits of the payload are all 0 are obtained, and the position of each bit in the payload before division is recorded, so that the receiving end of the subsequent data packet restores the unsent part.

When the data packet is subsequently sent, for the third type of data packet, only the part of the bits with smaller ratio in the payload, for example, the above example, only the part of the divided payloads with all 0 is sent and the positions of the bits with all 0 in the original non-divided payload are indicated. Therefore, the purposes of transmitting less data messages, saving bandwidth and improving the data message transmission efficiency can be achieved.

Correspondingly, for the receiving end of the data packet, the receiving method of the data packet, as shown in fig. 11, includes the following steps:

s111, receiving a fourth type data message and position information of an effective load of the fourth type data message in the effective load before segmentation;

s112, determining the position of the effective load in the unsent fourth type data message in the effective load before the division according to the position information;

s113, restoring the effective load before segmentation according to the effective load of the received fourth type data message and the position of the effective load in the unsent fourth type data message in the effective load before segmentation;

and S114, restoring the third type data message containing the effective load before the division according to the effective load before the division.

By using the above steps S111 to S114, the receiving end of the data packet can restore the part of the payload that is not received, and finally restore the whole third type data packet.

Those skilled in the art can think that, in the specific implementation process, the sending methods of the data packets in the different manners may be simultaneously applied in some situations, that is, when it is determined that the data packet to be sent includes the first type of data packet and/or the third type of data packet, the sending method of the corresponding data packet may be selected, or the two sending methods of the data packet are simultaneously used, which can achieve the purposes of reducing the sending number of the data packet, saving the bandwidth, reducing the probability of packet errors, and improving the transmission efficiency.

The embodiment of the invention also provides a network distribution method, which comprises the following steps: after the mobile terminal is connected with the WIFI network, broadcasting a data message so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; the step of broadcasting the data message adopts the sending method of the data message.

The embodiment of the invention also provides a method for communication in the intelligent Internet of things, wherein any two devices in the Internet of things send messages by adopting the method for sending the data messages.

Based on the same inventive concept, embodiments of the present invention further provide a device for sending a data packet, a device for receiving a data packet, a terminal, and a system, and because the principles of the problems solved by these devices and terminals are similar to the foregoing method for sending a data packet and receiving a data packet, the implementation of the device, the client, and the system can refer to the implementation of the foregoing method, and repeated details are omitted.

An embodiment of the present invention provides a data packet sending apparatus, as shown in fig. 12, including:

a determining module 121, configured to determine whether all data packets to be sent have a first type of data packet, where the first type of data packet is all 0 s or all 1 s, and a ratio of the number of the first type of data packets in all data packets exceeds a preset threshold;

a sending module 122, configured to send a second data packet; the second type data message is a data message except the first type data message in all the data messages;

an indicating module 123, configured to indicate positions of the second type data packet in all data packets.

An embodiment of the present invention provides a data packet receiving apparatus, as shown in fig. 13, including:

a receiving module 131, configured to receive the second type data packet and indication information of positions of the second type data packet in all data packets;

a position determining module 132, configured to determine, according to positions of the second data packet in all data packets, positions of the first type of unsent data packets in all data packets;

the data restoring module 133 is configured to restore all the data packets according to the position of the first type data packet and a predetermined value of the first type data packet, and according to the received second type data packet and the corresponding position.

The embodiment of the invention provides a device for a distribution network, which comprises: a broadcast module; the broadcasting module is used for broadcasting a data message after the mobile terminal is connected with the WIFI network so that the intelligent equipment can be connected with the WIFI network according to the distribution network information in the data message; the step of broadcasting the data message adopts the sending method of the data message.

An embodiment of the present invention provides a data packet sending apparatus, as shown in fig. 14, including:

the determining module 141 is configured to determine whether a third type of data packet exists in at least one data packet to be sent, where a ratio of 0 or 1 in a payload of the third type of data packet exceeds a preset threshold;

a dividing module 142, configured to, when the determining module determines that the data packet exists, divide the payload in the third type of data packet to obtain a fourth type of data packet with all payloads being 0 and a fourth type of data packet with all payloads being 1, and record the position of each bit in the payload before division;

a sending module 143, configured to send a fourth type data packet in which the number ratio of bits in the payload before segmentation does not exceed the preset threshold, and indicate a position of a payload of the sent fourth type data packet in the payload before segmentation.

Referring to fig. 15, a receiving apparatus for a data packet according to an embodiment of the present invention includes:

a receiving module 1501, configured to receive a fourth type data packet and position information of an effective load of the fourth type data packet in the effective load before being divided;

a determining module 1502, configured to determine, according to the location information, a location of a payload in an unsent fourth-type data message in a payload before segmentation;

a data restoring module 1503, configured to restore the payload before the segmentation according to the payload of the received fourth-type data packet and a position of the payload in the unsent fourth-type data packet in the payload before the segmentation; and restoring the third data message containing the effective load before the division according to the effective load before the division.

The embodiment of the invention provides a communication terminal in an internet of things, which comprises: and the data message sending module sends the message by adopting the sending method of the data message.

An embodiment of the present invention provides a data packet transmission system, as shown in fig. 16, including:

the data packet sending end device 161 is configured to determine whether all data packets to be sent have a first type of data packet, where the first type of data packet is a data packet that is all 0 s or all 1 s and the number proportion of the first type of data packet in all data packets exceeds a preset threshold; if the data packet exists, sending a second type data packet and indicating the position of the sent second type data packet in all data packets; the second type data message is a data message except the first type data message in all the data messages;

a data packet receiving end device 162, configured to receive the second type data packet and indication information of positions of the second type data packet in all data packets; determining the positions of the first type of unsent data messages in all the data messages according to the positions of the second data messages in all the data messages; and restoring all the data messages according to the position of the first type data message, the value predetermined by the first type data message, the received second type data message and the corresponding position.

An embodiment of the present invention further provides a mobile terminal, where the mobile terminal includes: the apparatus includes a memory, a processor, and computer instructions stored on the memory and executable on the processor, the instructions when executed by the processor being capable of implementing a method of sending a data message as previously described.

An embodiment of the present invention further provides an intelligent device, including: the data message receiving method comprises a memory, a processor and computer instructions which are stored on the memory and can run on the processor, wherein the instructions can realize the data message receiving method when being executed by the processor.

The embodiment of the present invention further provides a computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the method for sending the data message, or the method for receiving the data message, or the method for distributing the network, or the method for communicating in the intelligent internet of things, can be implemented.

As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, 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. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.

The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

33页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数据传输时的波束确定方法及装置、存储介质、UE、基站

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!