CN106060962B - Communication method and device - Google Patents

Communication method and device Download PDF

Info

Publication number
CN106060962B
CN106060962B CN201610477845.9A CN201610477845A CN106060962B CN 106060962 B CN106060962 B CN 106060962B CN 201610477845 A CN201610477845 A CN 201610477845A CN 106060962 B CN106060962 B CN 106060962B
Authority
CN
China
Prior art keywords
data
request message
data request
slave device
notification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610477845.9A
Other languages
Chinese (zh)
Other versions
CN106060962A (en
Inventor
徐国祥
张海涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN201610477845.9A priority Critical patent/CN106060962B/en
Publication of CN106060962A publication Critical patent/CN106060962A/en
Application granted granted Critical
Publication of CN106060962B publication Critical patent/CN106060962B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/15Setup of multiple wireless link connections
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/12Setup of transport tunnels
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/20Manipulation of established connections
    • H04W76/25Maintenance of established connections

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention provides a communication method and a device, which are applied to a Bluetooth system, wherein the method comprises the following steps: the method comprises the steps that the slave device receives a data request message sent by the master device in the last first time window after sending a first notice, when the data request message is a read request message, response data are determined, the number N of second time windows is determined according to the response data, then the response data are divided into N data slices according to the data transmission capacity in the second time windows, and finally the divided data slices are sent in a broadcasting mode after sending a second notice. And the master device receives the data in the second time window and restores the response data sent by the slave device according to all the received data. The master device and the slave device in the invention carry out information interaction in a broadcasting mode, do not need to establish and maintain connection, can reduce electric quantity consumption and prolong communication distance.

Description

Communication method and device
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a communication method and apparatus.
Background
With the development of smart homes, smart industries and smart phones, BLE (BlueTooth Low Energy) is applied more and more widely. In the BLE technology, bidirectional communication between master and slave devices is established on the basis of connection, and in order to ensure the reliability of connection, mechanisms such as timeout, flow control, repeated detection and the like are usually introduced, so that communication interruption is easy to occur in some severe application environments, connection needs to be reestablished when communication is performed again, the complexity of bidirectional communication is increased, power consumption is high, and the communication distance between two parties is shortened.
Disclosure of Invention
The invention aims to provide a communication method and a communication device, which are used for realizing bidirectional communication between master equipment and slave equipment in a broadcasting mode.
In order to realize the purpose, the invention provides the technical scheme that:
the invention provides a communication method, which is applied to slave equipment in a Bluetooth system, and comprises the following steps:
receiving a data request message sent by the main equipment in the last first time window after the first notice is sent;
when the data request message is a read request message, determining response data;
determining the number N of second time windows required for sending the response data, wherein the number N of the second time windows is smaller than a preset threshold value, and the preset threshold value is the maximum number of the time windows which can be followed after a single notification;
dividing the response data into N data pieces according to the data volume which can be transmitted in a second time window;
and sending a second notice in a broadcasting mode, and sending the divided data slices in N second time windows in the broadcasting mode after the second notice.
The invention also provides a communication method, which is applied to the main equipment in the Bluetooth system, and the method comprises the following steps:
receiving a first advertisement sent from a device, the first advertisement followed by at least one first time window;
judging whether data is received in the initial time period of the first time window;
when data is not received in the initial time period of the first time window, sending a data request message to the slave equipment in the subsequent time of the current first time window;
when the data request message is a read request message, receiving a second notice sent by the slave equipment, wherein the second notice is followed by at least one second time window;
judging whether data is received in the starting time period of the second time window;
and after the data reception in all the second time windows is finished, restoring the response data sent by the slave equipment according to all the received data.
The present invention also provides a communication apparatus applied to a slave device in a bluetooth system, the apparatus comprising:
the message receiving unit is used for receiving a data request message sent by the main equipment in the last first time window after the first notice is sent;
a data determining unit, configured to determine response data when the data request packet is a read request packet;
a quantity determining unit, configured to determine a quantity N of second time windows required for sending the response data, where the quantity N of the second time windows is smaller than a preset threshold, and the preset threshold is a maximum quantity of time windows that can be followed after a single notification;
a data slice dividing unit for dividing the response data into N data slices according to the amount of data transmittable within the second time window;
and the data slice sending unit is used for sending a second notice in a broadcasting mode and sending the divided data slices in N second time windows in the broadcasting mode after the second notice.
The present invention also provides a communication apparatus applied to a master device in a bluetooth system, the apparatus comprising:
a first receiving unit for receiving a first advertisement sent from a device, the first advertisement followed by at least one first time window;
a first judging unit, configured to judge whether data is received within a starting time period of the first time window;
a request sending unit, configured to send a data request packet to the slave device in a time subsequent to a current first time window when no data is received in a starting time period of the first time window;
a second receiving unit, configured to receive a second notification sent by the slave device when the data request packet is a read request packet, where the second notification is followed by at least one second time window;
a second determining unit, configured to determine whether data is received within a starting time period of the second time window;
and the data restoring unit is used for restoring the response data sent by the slave equipment according to all the received data after the data in all the second time windows are received.
It can be seen from the above description that the master device and the slave device of the present invention perform information interaction in a broadcast manner without establishing and maintaining a connection, so that power consumption can be reduced and communication distance can be extended.
Drawings
Fig. 1 is a flow chart illustrating a communication method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a message format according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating dividing a data piece according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a message interaction process according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating a multi-response message interaction process according to an embodiment of the present invention;
FIG. 6 is a flow chart illustrating another method of communication according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of master and slave devices according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a communication apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another communication device according to an embodiment of the present invention.
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 terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present invention. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The embodiment of the invention provides a communication method, which carries out bidirectional communication between master equipment and slave equipment in a broadcasting mode, reduces the complexity of a communication process, and has low power consumption and increased communication distance.
Referring to fig. 1, a flowchart of an embodiment of the communication method of the present invention is shown, and the embodiment describes a communication process from a slave device side.
Step 101, receiving a data request message sent by a master device in a last first time window after sending a first notification.
In the embodiment of the invention, the slave equipment periodically sends the notice, and reserves a certain amount of time windows after the notice for sending data and receiving the data request sent by the master equipment. The size of the time window may be set according to characteristics of the application data (e.g., the size of the data packet).
In the embodiment of the invention, the operation that the slave device receives the data request message sent by the master device and responds to the response data according to the data request message is not completed in the same notification period. The slave device first receives the data request message sent by the master device through one notification period, and then responds to the request of the master device from the next notification period, that is, a complete data request process is completed in at least two notification periods. In the embodiment of the invention, an announcement period for receiving the data request message is called a first announcement period, and announcements in the period are called first announcements; the advertisement period for responding to the request is referred to as a second advertisement period, and the advertisements in this period are referred to as second advertisements.
In the time window set by the slave device, the last time window is reserved to receive the data request message sent by the master device. The slave device determines whether the master device has a data request in a last time window (hereinafter, the time window after the first notification is referred to as a first time window), and receives a data request message sent by the master device in the last first time window. The data request message carries the MAC address of the slave device and the MAC address of the master device, so that the current slave device can determine whether the current slave device processes the data request of the master device, and can know which master device sent the data request.
And 102, determining response data when the data request message is a read request message.
The slave device completes the read-write operation according to the request of the master device. When the operation type carried in the data request message is read operation, determining that the currently received data request message is a read request message, namely that the master device requests the slave device to read data. The slave device determines response data to be provided to the master device according to request information (e.g., a data object) carried in the read request message.
Step 103, determining the number N of second time windows required for sending the response data, where the number N of second time windows is smaller than a preset threshold, and the preset threshold is the maximum number of time windows that can be followed after a single notification.
Specifically, the response data determined in step 102 is subjected to packet encapsulation to be encapsulated into a read response packet, where the source MAC address of the read response packet is the MAC address of the slave device, and the destination MAC address of the read response packet is the MAC address of the master device, so that the master device knows, according to the destination MAC address, that the response data is sent to the master device, and also knows which slave device sends the response data. And carrying specific response data in the load of the read response message. The format of the packet encapsulation is shown in fig. 2.
The embodiment of the invention presets a time window quantity threshold (a preset threshold for short), wherein the preset threshold is the maximum time window quantity which can be followed after a single notification, and can be set according to the flow of practical application. The flow is large, and a large preset threshold value can be set, so that data can be transmitted as much as possible after single notification, and the data transmission efficiency is improved. However, the preset threshold cannot be infinite, and is set to comply with the BLE requirement for the channel duration, so that a single announcement and the data transmitted following the announcement do not occupy the channel for a long time.
After the read response message is encapsulated, the number of time windows is set according to the data volume needing to be sent at this time. The read response packet is sent following the second advertisement, and therefore, the time window used for sending the read response packet is referred to as a second time window. If the size of a single time window is uniformly set to be 10ms, the read response message is calculated and can be sent in several time windows according to the data quantity (comprehensively considering the sending rate and the like) required to be sent at this time. When the calculated number N of the second time windows reaches or exceeds a preset threshold, determining that the number N of the second time windows for sending the read response messages after single notification is equal to the preset threshold minus one, and sending the residual data amount again in the next notification period; and when the calculated number N of the second time windows is smaller than a preset threshold value, the actually calculated number is used as a standard.
In addition, the master device and the slave device can negotiate the maximum length of the data object which can be requested once in advance, so that the data volume (corresponding to the response data of the slave device) requested once by the master device can complete response in one notification period, namely, the read response message is sent in one notification period without being divided into a plurality of notification periods, and the processing process of the slave device is simplified.
And 104, dividing the response data into N data slices according to the data volume which can be transmitted in the second time window.
In this step, the read response packet is divided into N data slices according to the amount of data that can be transmitted in the second time window, and referring to fig. 3, each data slice includes a time window header, in addition to a specific payload (packet content of the read response packet), and the time window header may carry a time window identifier for indicating which time window.
And 105, sending a second notice in a broadcasting mode, and sending the divided data slices in N second time windows in the broadcasting mode after the second notice.
The slave device may transmit the divided pieces of data in a next advertisement period, i.e., a second advertisement period, of the first advertisement period. Specifically, the second advertisement is sent by a broadcast manner, and after a certain frame interval (for example, the frame interval of BLE specified in the bluetooth standard is 150 microseconds), the divided data pieces are sent in N second time windows, and a certain frame interval is also reserved between adjacent second time windows. It should be added that, if the response data of the slave device is not completely sent in one notification period, the response data can be continuously sent in the next notification period, and details are not described herein again.
After the slave device completes the transmission of the response data, a second time window is reserved for receiving a new data request message transmitted by the master device, that is, the step 101 is returned to continue the execution.
Referring to fig. 4, an interaction diagram of a master device and a slave device according to an embodiment of the present invention is shown. If the slave device sends the first notification, and there is no data to be sent locally, only one first time window 1 follows the first notification, and the slave device receives the read request message 1 sent by the master device within the first time window 1. And determining response data to be sent, encapsulating the read response message 1 (carrying the response data), and determining that the number of second time windows for sending the response data is 1, namely the read response message can be sent in one second time window. Sending a second notice, and sending a read response message 1 in a second time window 1 after the second notice; and reserving a second time window 2, receiving a read request message 2 sent by the master device, and so on.
In order to avoid message misordering, in the embodiments of the present invention, a sequence number is added to a message exchanged between a master device and a slave device, that is, the master device carries the sequence number in a data request message sent, and the slave device carries the same sequence number in a data response message (for example, a read response message) responded. Therefore, when the slave device receives the data request message sent by the master device, the serial number carried in the data request message can be obtained first, and whether the currently received data request message is legal or not can be judged.
Specifically, a sequence number (first sequence number for short) carried in the data request packet is obtained, and it is determined whether the first sequence number is smaller than a sequence number (second sequence number for short) carried in a data request packet (data request packet with a correct sequence number) correctly received last time.
According to the judgment result, the following conditions can be processed: when the first sequence number is equal to the second sequence number, retransmitting the last data response message (for example, the last read response message); when the first serial number is larger than the second serial number, the serial number of the message is correct, and the current data request message is processed, namely, the step 102 to the step 105 are executed; when the first serial number is smaller than the second serial number, the messages are out of sequence, and the main equipment is informed to resend correct data request messages.
Specifically, in an embodiment, the third notification is sent in a broadcast manner, and the third notification carries the last correct second sequence number and the MAC address of the master device that sent the data request packet, so that when the master device confirms that it needs to retransmit the data request packet according to the MAC address, the master device re-determines the sequence number according to the second sequence number carried in the third notification (for example, if the second sequence number is 5, the sequence number is 5+1 — 6), and retransmits the data request packet.
In another embodiment, the slave device sends a third notification in a broadcast manner, and sends a data retransmission command in a broadcast manner in a time window (referred to as a third time window for short) after the third notification, where the data retransmission command carries a second sequence number and a MAC address of the master device that sent the data request packet, so that when the master device confirms that it needs to retransmit the data request packet according to the MAC address, the master device retransmits the data request packet according to the second sequence number.
In order to avoid the volatility of the message sent in the broadcast manner, particularly, in the read response message (carrying response data), the master device carries the response times M in the sent read request message, the slave device acquires the response times M carried in the read request message after completing the sending of the first response data, then sends the M-1 response data to the master device, and completes the sending of the M-1 response data in different second notification periods, as shown in fig. 5.
The master device may send a read request message to the slave device, and may also send a write request message to the slave device (the operation type carried in the data request message is write operation). The slave device does not need to send a special write response message aiming at the write request message, and can carry the serial number of the write request message in the subsequent notice, so that the master device judges whether the serial number is consistent with the serial number of the sent write request message or not according to the serial number carried in the notice, and if the serial number is consistent, the slave device receives the written data; if the two messages are inconsistent, the write fails, for example, the messages may be out of order, and the master device is required to resend the write request message.
Of course, in the aforementioned response to the read request packet, the serial number of the read request packet may also be directly carried in the second notification, so that the master device can determine whether the read data is successful according to the serial number in the second notification without analyzing the serial number carried in the read response packet.
Referring to fig. 6, a flowchart of an embodiment of the communication method of the present invention is shown, where the communication process is described from the master device side.
Step 601, receiving a first advertisement sent from a device, the first advertisement followed by at least one first time window.
Step 602, determining whether data is received in the starting time period of the first time window.
Step 603, when no data is received in the starting time period of the first time window, sending a data request message to the slave device in the subsequent time of the current first time window.
The first advertisement sent by the slave device is followed by at least one first time window, see the description of the slave device side above. After receiving the first advertisement, the master device determines whether data is received in a starting time period of the first time window (usually the first few time slots of the first time window). When the data sent by the slave device is not received in the starting time period of the first time window, the last first time window reserved for the slave device by the current first time window is determined, and the master device can send a data request message to the slave device in the remaining time of the first time window. The encapsulation format of the data request packet is shown in fig. 2, where the destination MAC address is the MAC address of the slave device, the source MAC address is the MAC address of the master device, and the payload carries information to be transmitted to the slave device.
Step 604, when the data request packet is a read request packet, receiving a second notification sent by the slave device, where the second notification is followed by at least one second time window.
The master device may carry the operation type (read/write operation) in the transmitted data request message. And when the operation type carried in the data request message is read operation, the current data request message is a read request message. And the master equipment receives a read response message responded by the slave equipment according to the read request message. As described above, the slave device sends the read response packet after the second notification, and the read response packet is distributed in a plurality of second time windows after the second notification.
Step 605, determine whether data is received in the starting time period of the second time window.
And step 606, after all the data in the second time window are received, restoring the response data sent by the slave device according to all the received data.
The master equipment restores the read response message sent by the slave equipment after receiving all the data, can acquire the serial number in the read response message, and acquires the response data carried in the read response message if the serial number is consistent with the serial number in the read request message sent by the master equipment; otherwise, discarding the read response message, and waiting for the read response message retransmitted by the slave device according to the response times M, and if the response times M are still incorrect, retransmitting the read request message.
As described above, in order to avoid message out-of-sequence, the slave device may notify the master device to resend the data request message when detecting that the sequence number of the data request message is incorrect. The master device receives a notification of a retransmission data request packet sent by the slave device, and specifically, the notification may be received in the following two manners:
in an embodiment, the master device receives a third notification sent by the slave device, where the third notification carries a second sequence number of a data request packet correctly received last time by the slave device and a MAC address of the master device that sends the data request packet to the slave device.
In another embodiment, the master device receives a third notification sent by the slave device, and receives a data retransmission command sent by the slave device in a third time window after the third notification, where the data retransmission command carries a second sequence number of a data request packet correctly received last time by the slave device and a MAC address of the master device sending the data request packet to the slave device.
After receiving the notification of retransmitting the data request message in the above manner, it is determined whether the MAC address of the master device that currently transmits the data request message to the slave device is the same as the MAC address of the master device, and if so, it indicates that the master device is required to perform the processing. And acquiring a second serial number carried in the notification, judging whether the second serial number is the same as a first serial number in a data request message which is sent to the slave equipment last time, if the second serial number is different from the first serial number, indicating that the message is out of sequence, the master equipment needs to re-determine the serial number, for example, adding one to the second serial number to obtain a new serial number, and re-sending the data request message according to the re-determined serial number.
As mentioned above, the master device may send a write request message to the slave device in addition to the read request message to the slave device, and also send the write request message to the slave device in the last time window after the slave device sends the notification. The write request message carries data to be written into the slave device, and the encapsulation format is as shown in fig. 2, where the destination MAC address is the MAC address of the slave device to be written, the source MAC address is the MAC address of the master device, and the payload carries the data to be written. The embodiment of the invention controls the data volume of the write request message of the main equipment in a time window by setting the maximum length of the data object, and can be realized by sending the write request message for many times when the data needing to be written is more.
In order to ensure the security of broadcast message interaction, the master device may establish a connection with a slave device (the slave device is a connectable device) according to a connection process defined by the existing bluetooth standard, obtain a Key consistent between the two parties, for example, LTK (Long-Term Key) and CSRK (ConnectionSignature verification Key) in the connection process according to the actual encryption/verification requirement, and then disconnect the connection with the slave device. In the subsequent bidirectional broadcast interaction of the master device and the slave device, the encryption/authentication can be carried out through the key. Therefore, in order to improve the security, the embodiment of the invention can complete the key negotiation at least through one connection, namely the security problem is solved, and meanwhile, no extra burden is generated on normal information interaction.
In addition, it should be particularly emphasized that all the interaction processes in the embodiment of the present invention are performed in the same channel, so that channel resources are saved.
As can be seen from the above description, the master device and the slave device in the embodiment of the present invention perform information interaction in a broadcast manner without establishing and maintaining a connection, so that power consumption is reduced and communication distance is extended.
Corresponding to the embodiment of the communication method, the invention also provides an embodiment of the communication device.
The embodiment of the communication device of the invention can be applied to the master equipment or the slave equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. A software implementation is taken as an example, and a logical means is formed by a processor of the device in which it is located running corresponding computer program instructions in a memory. From a hardware aspect, as shown in fig. 7, it is a hardware structure diagram of a device in which the communication apparatus of the present invention is located, except for the processor and the nonvolatile memory shown in fig. 7, the device in which the apparatus is located in the embodiment may also include other hardware according to an actual function of the device, which is not described again.
Fig. 8 is a schematic structural diagram of a communication device according to an embodiment of the present invention. The communication device comprises a message receiving unit 801, a data determining unit 802, a number determining unit 803, a data slice dividing unit 804 and a data slice transmitting unit 805, wherein:
a message receiving unit 801, configured to receive a data request message sent by a master device in a last first time window after sending the first notification;
a data determining unit 802, configured to determine response data when the data request packet is a read request packet;
a quantity determining unit 803, configured to determine a quantity N of second time windows required for sending the response data, where the quantity N of the second time windows is smaller than a preset threshold, and the preset threshold is a maximum quantity of time windows that can be followed after a single notification;
a data slice dividing unit 804, configured to divide the response data into N data slices according to the data amount transmittable within the second time window;
a data slice sending unit 805, configured to send a second notification in a broadcast manner, and send the divided data slices in the N second time windows in the broadcast manner after the second notification.
Further, the apparatus further comprises:
a sequence number obtaining unit, configured to obtain a first sequence number carried in the data request message before the data determining unit 802 determines response data;
a sequence number judging unit, configured to judge whether the first sequence number is smaller than a second sequence number carried in a data request message that was received correctly last time;
and a retransmission notification unit, configured to notify the master device to retransmit the data request packet when the first sequence number is smaller than the second sequence number.
Further, the air conditioner is provided with a fan,
the retransmission notification unit is specifically configured to send a third notification in a broadcast manner, where the third notification carries the second sequence number and an MAC address of a master device that sends the data request packet, so that when the master device confirms that it needs to retransmit the data request packet according to the MAC address, the master device retransmits the data request packet according to the second sequence number; or, the third notice is sent in a broadcasting mode; and sending a data retransmission command in a broadcast mode in a third time window after the third notification, wherein the data retransmission command carries the second sequence number and the MAC address of the main device sending the data request message, so that the main device resends the data request message according to the second sequence number when confirming that the main device needs to retransmit the data request message according to the MAC address.
Further, the apparatus further comprises:
a repeat response unit, configured to obtain the response times M carried in the read request message after the data slice sending unit 805 sends the divided data slices in N second time windows in a broadcast manner after the second notification; and sending M-1 times of response data to the main equipment aiming at the reading request message.
Fig. 9 is a schematic structural diagram of a communication device according to another embodiment of the present invention. The communication device comprises a first receiving unit 901, a first judging unit 902, a request sending unit 903, a second receiving unit 904, a second judging unit 905 and a data restoring unit 906, wherein:
a first receiving unit 901, configured to receive a first advertisement sent from a device, the first advertisement being followed by at least one first time window;
a first determining unit 902, configured to determine whether data is received in a starting time period of the first time window;
a request sending unit 903, configured to send a data request packet to the slave device in a time subsequent to the current first time window when no data is received in the starting time period of the first time window;
a second receiving unit 904, configured to receive a second notification sent by the slave device when the data request packet is a read request packet, where the second notification is followed by at least one second time window;
a second determining unit 905, configured to determine whether data is received within a starting time period of the second time window;
a data restoring unit 906, configured to restore, after completing data reception in all second time windows, the response data sent by the slave device according to all received data.
Further, the apparatus further comprises:
a notification receiving unit, configured to receive a notification of a retransmission data request packet sent by the slave device, where the notification carries a second sequence number of a data request packet correctly received last time by the slave device and an MAC address of a master device that sends the data request packet to the slave device;
a serial number obtaining unit, configured to obtain the second serial number when the MAC address of the master device that currently sends the data request packet to the slave device is the same as the MAC address of the master device;
a serial number judging unit, configured to judge whether the second serial number is the same as a first serial number in a data request message that is sent to the slave device last time;
and the sequence number determining unit is used for re-determining the sequence number when the second sequence number is different from the first sequence number, and re-sending the data request message according to the re-determined sequence number.
Further, the air conditioner is provided with a fan,
the notification receiving unit is specifically configured to receive a third notification sent by the slave device, where the third notification carries a second sequence number of a data request packet correctly received last time by the slave device and an MAC address of a master device that sends the data request packet to the slave device; or, receiving a third notification sent by the slave device; and receiving a data retransmission command sent by the slave device in a third time window after the third notification, wherein the data retransmission command carries a second sequence number of a data request message correctly received last time by the slave device and an MAC address of the master device sending the data request message to the slave device.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (14)

1. A communication method applied to a slave device in a bluetooth system, the method comprising:
receiving a data request message sent by a master device in a broadcast mode in a last first time window after a first notice is sent in the broadcast mode, wherein the data request message carries an MAC address of the slave device and an MAC address of the master device;
when the data request message is a read request message, determining response data;
determining the number N of second time windows required for sending the response data, wherein the number N of the second time windows is smaller than a preset threshold value, and the preset threshold value is the maximum number of the time windows which can be followed after a single notification;
dividing the response data into N data pieces according to the data volume which can be transmitted in a second time window;
and sending a second notice in a broadcasting mode, and sending the divided data slices in N second time windows in the broadcasting mode after the second notice.
2. The method of claim 1, wherein prior to determining the response data, further comprising:
acquiring a first serial number carried in the data request message;
judging whether the first sequence number is smaller than a second sequence number carried in a data request message which is correctly received last time;
and when the first sequence number is smaller than the second sequence number, informing the main equipment to resend the data request message.
3. The method of claim 2, wherein the notifying the master device to resend the data request message comprises:
sending a third notice in a broadcasting mode, wherein the third notice carries the second serial number and an MAC address of a main device sending the data request message, so that the main device resends the data request message according to the second serial number when confirming that the main device needs to resend the data request message according to the MAC address;
alternatively, the first and second electrodes may be,
sending a third notice in a broadcasting mode; and sending a data retransmission command in a broadcast mode in a third time window after the third notification, wherein the data retransmission command carries the second sequence number and the MAC address of the main device sending the data request message, so that the main device resends the data request message according to the second sequence number when confirming that the main device needs to retransmit the data request message according to the MAC address.
4. The method of claim 1, wherein after transmitting the divided data slices within N second time windows by broadcast after the second advertisement, further comprising:
acquiring response times M carried in the read request message;
and sending M-1 times of response data to the main equipment aiming at the reading request message.
5. A communication method applied to a master device in a Bluetooth system, the method comprising:
receiving a first advertisement sent by a slave device in a broadcast manner, wherein the first advertisement is followed by at least one first time window;
judging whether data is received in the initial time period of the first time window;
when data is not received in the initial time period of the first time window, sending a data request message to the slave equipment in a broadcasting mode in the subsequent time of the current first time window, wherein the data request message carries the MAC address of the slave equipment and the MAC address of the master equipment;
when the data request message is a read request message, receiving a second notification sent by the slave device in a broadcast mode, wherein the second notification is followed by at least one second time window;
judging whether data is received in the starting time period of the second time window;
and after the data reception in all the second time windows is finished, restoring the response data sent by the slave equipment according to all the received data.
6. The method of claim 5, wherein the method further comprises:
receiving a notification of a retransmission data request message sent by the slave device, wherein the notification carries a second serial number of a data request message which is correctly received last time by the slave device and an MAC address of a master device which sends the data request message to the slave device;
when the MAC address of the master device which sends the data request message to the slave device at present is the same as the MAC address of the master device, acquiring the second serial number;
judging whether the second sequence number is the same as a first sequence number in a data request message which is sent to the slave equipment last time or not;
and when the second serial number is different from the first serial number, re-determining the serial number, and re-sending the data request message according to the re-determined serial number.
7. The method of claim 6, wherein said receiving the notification of the retransmission data request message sent by the slave device comprises:
receiving a third notification sent by the slave device in a broadcast manner, wherein the third notification carries a second serial number of a data request message which is correctly received by the slave device last time and an MAC address of the master device which sends the data request message to the slave device;
alternatively, the first and second electrodes may be,
receiving a third notice sent by the slave device in a broadcasting mode; and receiving a data retransmission command sent by the slave device in a broadcast manner in a third time window after the third notification, wherein the data retransmission command carries a second sequence number of a data request message correctly received last time by the slave device and an MAC address of the master device sending the data request message to the slave device.
8. A communication apparatus, applied to a slave device in a bluetooth system, the apparatus comprising:
a message receiving unit, configured to receive, in a last first time window after sending the first notification in a broadcast manner, a data request message sent by a master device in a broadcast manner, where the data request message carries an MAC address of the slave device and an MAC address of the master device;
a data determining unit, configured to determine response data when the data request packet is a read request packet;
a quantity determining unit, configured to determine a quantity N of second time windows required for sending the response data, where the quantity N of the second time windows is smaller than a preset threshold, and the preset threshold is a maximum quantity of time windows that can be followed after a single notification;
a data slice dividing unit for dividing the response data into N data slices according to the amount of data transmittable within the second time window;
and the data slice sending unit is used for sending a second notice in a broadcasting mode and sending the divided data slices in N second time windows in the broadcasting mode after the second notice.
9. The apparatus of claim 8, wherein the apparatus further comprises:
a serial number obtaining unit, configured to obtain a first serial number carried in the data request message before the data determining unit determines the response data;
a sequence number judging unit, configured to judge whether the first sequence number is smaller than a second sequence number carried in a data request message that was received correctly last time;
and a retransmission notification unit, configured to notify the master device to retransmit the data request packet when the first sequence number is smaller than the second sequence number.
10. The apparatus of claim 9, wherein:
the retransmission notification unit is specifically configured to send a third notification in a broadcast manner, where the third notification carries the second sequence number and an MAC address of a master device that sends the data request packet, so that when the master device confirms that it needs to retransmit the data request packet according to the MAC address, the master device retransmits the data request packet according to the second sequence number; or, the third notice is sent in a broadcasting mode; and sending a data retransmission command in a broadcast mode in a third time window after the third notification, wherein the data retransmission command carries the second sequence number and the MAC address of the main device sending the data request message, so that the main device resends the data request message according to the second sequence number when confirming that the main device needs to retransmit the data request message according to the MAC address.
11. The apparatus of claim 8, wherein the apparatus further comprises:
a repeated response unit, configured to obtain the response times M carried in the read request message after the data slice sending unit sends the divided data slices in N second time windows in a broadcast manner after the second notification; and sending M-1 times of response data to the main equipment aiming at the reading request message.
12. A communication apparatus applied to a master device in a bluetooth system, the apparatus comprising:
a first receiving unit, configured to receive a first advertisement sent by a slave device in a broadcast manner, where the first advertisement is followed by at least one first time window;
a first judging unit, configured to judge whether data is received within a starting time period of the first time window;
a request sending unit, configured to send, when no data is received within an initial time period of the first time window, a data request packet to the slave device in a broadcast manner within a subsequent time of a current first time window, where the data request packet carries an MAC address of the slave device and an MAC address of the master device;
a second receiving unit, configured to receive, when the data request packet is a read request packet, a second notification sent by the slave device in a broadcast manner, where the second notification is followed by at least one second time window;
a second determining unit, configured to determine whether data is received within a starting time period of the second time window;
and the data restoring unit is used for restoring the response data sent by the slave equipment according to all the received data after the data in all the second time windows are received.
13. The apparatus of claim 12, wherein the apparatus further comprises:
a notification receiving unit, configured to receive a notification of a retransmission data request packet sent by the slave device, where the notification carries a second sequence number of a data request packet correctly received last time by the slave device and an MAC address of a master device that sends the data request packet to the slave device;
a serial number obtaining unit, configured to obtain the second serial number when the MAC address of the master device that currently sends the data request packet to the slave device is the same as the MAC address of the master device;
a serial number judging unit, configured to judge whether the second serial number is the same as a first serial number in a data request message that is sent to the slave device last time;
and the sequence number determining unit is used for re-determining the sequence number when the second sequence number is different from the first sequence number, and re-sending the data request message according to the re-determined sequence number.
14. The apparatus of claim 13, wherein:
the notification receiving unit is specifically configured to receive a third notification sent by the slave device in a broadcast manner, where the third notification carries a second serial number of a data request packet correctly received by the slave device last time and an MAC address of a master device that sends the data request packet to the slave device; or receiving a third notice sent by the slave device in a broadcasting mode; and receiving a data retransmission command sent by the slave device in a broadcast manner in a third time window after the third notification, wherein the data retransmission command carries a second sequence number of a data request message correctly received last time by the slave device and an MAC address of the master device sending the data request message to the slave device.
CN201610477845.9A 2016-06-22 2016-06-22 Communication method and device Active CN106060962B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610477845.9A CN106060962B (en) 2016-06-22 2016-06-22 Communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610477845.9A CN106060962B (en) 2016-06-22 2016-06-22 Communication method and device

Publications (2)

Publication Number Publication Date
CN106060962A CN106060962A (en) 2016-10-26
CN106060962B true CN106060962B (en) 2020-01-03

Family

ID=57165719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610477845.9A Active CN106060962B (en) 2016-06-22 2016-06-22 Communication method and device

Country Status (1)

Country Link
CN (1) CN106060962B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108512634A (en) * 2017-02-28 2018-09-07 北京华为数字技术有限公司 A kind of method and relevant device of data processing
CN109831746B (en) * 2018-11-27 2020-09-01 阿里巴巴集团控股有限公司 Method and device for data transmission based on Bluetooth broadcast and Bluetooth equipment
CN110351669B (en) * 2019-06-28 2022-05-31 南京中感微电子有限公司 Bluetooth wireless broadcast transmitting and receiving method, equipment and communication system
CN115687233A (en) * 2021-07-29 2023-02-03 腾讯科技(深圳)有限公司 Communication method, device, equipment and computer readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571162A (en) * 2011-12-15 2012-07-11 重庆大学 Broadcasting-data-packet-based rope skipping process data transmission method
CN102804664A (en) * 2009-05-08 2012-11-28 日本电气株式会社 Communication system, communication device, communication method, and program
CN104717762A (en) * 2013-12-13 2015-06-17 上海科勒电子科技有限公司 Pairing method, primary terminal and slave terminal of wireless communication device
CN104811895A (en) * 2015-04-01 2015-07-29 广东小天才科技有限公司 Low-power Bluetooth connecting method and device
WO2015137601A1 (en) * 2014-03-12 2015-09-17 엘지전자(주) Method and device for adjusting data transmission rate in wireless communication system
WO2016007188A1 (en) * 2014-07-07 2016-01-14 Bayer Healthcare Llc Improved device pairing taking into account at least one condition
CN105471478A (en) * 2015-09-28 2016-04-06 小米科技有限责任公司 Message sending method, message receiving method and devices

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104883723B (en) * 2015-05-07 2018-08-28 深圳洲斯移动物联网技术有限公司 A kind of wireless communication system based on wireless sensor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102804664A (en) * 2009-05-08 2012-11-28 日本电气株式会社 Communication system, communication device, communication method, and program
CN102571162A (en) * 2011-12-15 2012-07-11 重庆大学 Broadcasting-data-packet-based rope skipping process data transmission method
CN104717762A (en) * 2013-12-13 2015-06-17 上海科勒电子科技有限公司 Pairing method, primary terminal and slave terminal of wireless communication device
WO2015137601A1 (en) * 2014-03-12 2015-09-17 엘지전자(주) Method and device for adjusting data transmission rate in wireless communication system
WO2016007188A1 (en) * 2014-07-07 2016-01-14 Bayer Healthcare Llc Improved device pairing taking into account at least one condition
CN104811895A (en) * 2015-04-01 2015-07-29 广东小天才科技有限公司 Low-power Bluetooth connecting method and device
CN105471478A (en) * 2015-09-28 2016-04-06 小米科技有限责任公司 Message sending method, message receiving method and devices

Also Published As

Publication number Publication date
CN106060962A (en) 2016-10-26

Similar Documents

Publication Publication Date Title
JP7313347B2 (en) Communication method and device
CN108322414B (en) Feedback information transmission method and device
CN108282897B (en) Random access feedback and processing method, base station and terminal
US8370696B2 (en) Method and arrangement for retransmission using HARQ
CN106060962B (en) Communication method and device
US10284340B2 (en) Multicast sending apparatus, multicast receiving apparatus, and multicast transmission determining method
CN110139239B (en) Method and terminal for service transmission
CN108370293B (en) Relay method, relay, destination device, and communication system thereof
CN104885395A (en) System and method for collision resolution
KR102323496B1 (en) Communication method, network device and terminal
US10623145B2 (en) Network node, wireless device and methods performed thereby for the network node to provide information to the wireless device
US20220077966A1 (en) Receiver, transmitter, communication network, data signal and method improving a retransmission process in a communication network
KR20160050481A (en) Method and apparatus for transmitting in mobile communication system
CN101369879B (en) Method and apparatus for requesting data retransmission
KR101751051B1 (en) Method and apparatus for transmitting and receiving management message in communication network
US11026214B2 (en) Method of error recovery in transmitting and receiving voice service in packet based mobile communication systems
CN111432371A (en) Communication method and device
KR20090094948A (en) Apparatus and method for controling automatic repeat request reset in wireless broadbandinternet system
CN106453613B (en) Message retransmission method and device
CN111294167B (en) Method and device for determining time-frequency position of resource, storage medium and terminal
CN108023718B (en) Retransmission indication transmission method and device
CN109075959B (en) Method, device, storage medium and terminal for transmitting information
CN112969238A (en) Intelligent building information transmission method and system based on multi-priority data transmission
WO2019127280A1 (en) Method for retransmission data, terminal device, and network device
CN111698726B (en) Data transmission method, device, related equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Applicant after: Xinhua three Technology Co., Ltd.

Address before: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Applicant before: Huasan Communication Technology Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant