An online detection method and device based on heartbeat packets
By controlling the sending and receiving timing of heartbeat packets and using clock difference to receive heartbeat packets in the window reception state, the problem of low-power online detection in multiple device scenarios is solved, and fast and accurate online detection and power consumption savings are achieved.
Patent Information
- Application Number
- CN202110603439.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-31
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-05-31
AI Technical Summary
In multi-device scenarios, how to conduct online inspections at low power consumption to ensure that electronic devices are quickly and accurately networked and provide online status so that users can enjoy the business experience in a timely manner.
By controlling the sending and receiving timing of the heartbeat packet based on the clock difference between electronic devices in the network, the receiving device can receive the heartbeat packet in the window reception state, reducing the number of message interactions and duration and reducing power consumption.
It realizes low-power consumption, fast and accurate online detection, improves the efficiency of heartbeat packet reception, reduces the number and duration of message interactions, and saves the power consumption of electronic devices.
Smart Images

Figure CN115484576B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic technologies, and in particular, to an online detection method and device based on heartbeat packets. Background Art
[0002] With more and more electronic devices entering scenarios such as homes or offices, the dynamic intelligent connection, intelligent networking, and collaborative completion of services among different electronic devices have become an irresistible trend. In a multi-device scenario, users hope to pre-organize the network of each electronic device before a service request and accurately provide the online status of the electronic devices, so that users can quickly enjoy various experiences brought by the service through the online devices.
[0003] Among them, since most electronic devices are sensitive to power consumption, how each electronic device performs online detection with low power consumption is an important problem to be solved. Summary of the Invention
[0004] The embodiments of the present application provide an online detection method and device based on heartbeat packets, which can control the sending timing and / or receiving timing of heartbeat packets based on the clock difference between electronic devices in a network, so that the receiving end device receives the heartbeat packets when it is in the window receiving state, thereby improving the receiving efficiency of the heartbeat packets, reducing the number and duration of sending and receiving heartbeat packets, reducing the power consumption of the electronic devices, and thus realizing fast, timely, and accurate online detection of multiple electronic devices in the network based on the heartbeat packets.
[0005] To achieve the above object, the embodiments of the present application adopt the following technical solutions:
[0006] On the one hand, the embodiments of the present application provide a message interaction method for a network composed of multiple devices, and the network includes a first electronic device and one or more second electronic devices. The method includes: one or more second electronic devices obtain their respective corresponding first clock differences, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device; the first electronic device sends corresponding one or more first target messages to one or more second electronic devices; and one or more second electronic devices control the second electronic devices to receive the corresponding first target messages when they are in the window receiving state according to their respective corresponding first clock differences.
[0007] Among them, the network can be an intelligent connection network, the first electronic device is the upper-level node of the second electronic device, and the second electronic device is the lower-level node of the first electronic device. For example, the first electronic device can be the above-mentioned central node, and the second electronic device can be the above-mentioned first-level node; or, the first electronic device can be the above-mentioned first-level node, and the second electronic device can be the above-mentioned second-level node, etc. The first target message is the heartbeat packet expected to be received by the second electronic device.
[0008] Based on this solution, the second electronic device can control the sending timing and / or receiving timing of the first target message based on the clock difference, so that the receiving device receives the corresponding first target message when it is in the window receiving state, thereby efficiently receiving the first target message and reducing power consumption. In this way, between any electronic devices with an upper and lower node relationship in the intelligent connection network, the method provided in the embodiments of the present application can be used to transmit the first target message, and receive the corresponding first target message when in the window receiving state according to the clock difference, so as to be able to receive the first target message efficiently, quickly, and accurately, reduce the number and duration of message interactions, save the power consumption of the electronic devices in the intelligent connection network, and improve the efficiency of corresponding processing according to the target message.
[0009] In a possible design, the first electronic device sends one or more corresponding first target messages to one or more second electronic devices, including: the first electronic device periodically sends one or more corresponding first target messages to one or more second electronic devices according to a first preset period. One or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window receiving state according to their respective corresponding first clock differences, including: one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window receiving state according to their respective corresponding first clock differences and the first preset period.
[0010] In this solution, the first target message can be periodically sent and received between the first electronic device and the second electronic device.
[0011] In another possible design, one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window receiving state according to their respective corresponding first clock differences and the first preset period, including: one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message, so that the second electronic device receives the corresponding first target message when in the window receiving state.
[0012] In this solution, the second electronic device enters the window receiving state when the first electronic device sends the first target message. When the first target message is transmitted to the second electronic device, the window of the second electronic device is already in the receiving state, so that the second electronic device can receive the first target message when in the window receiving state, and thus can quickly and efficiently receive the first target message and reduce the device power consumption.
[0013] In another possible design, before one or more second electronic devices obtain their respective corresponding first clock differences, the method further includes: the first electronic device calculates the first clock difference according to the second target messages respectively recently received by the one or more second electronic devices. Wherein, the second target message is from the first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval, the second target message is the Xth message in the first message group, N is a positive integer, and X is a positive integer less than or equal to N. One or more second electronic devices obtaining their respective corresponding first clock differences includes: one or more second electronic devices obtain their respective corresponding first clock differences from the first electronic device.
[0014] That is to say, the first clock difference can be calculated according to the second target message recently received by the second electronic device. Wherein, the first message group is used to determine X and tX corresponding to the second electronic device. For example, it can be the heartbeat packet group broadcast by the large screen to the mobile phone later. The X corresponding to the second target message is used for subsequent window alignment. For example, it can be the first heartbeat packet received by the mobile phone from the large screen, and this heartbeat packet is the Xth heartbeat packet in the heartbeat packet group broadcast by the large screen.
[0015] In another possible design, the method further includes: the first electronic device sends the first message group to one or more second electronic devices at time t1; after one or more second electronic devices receive the Xth message in the first message group at their respective tr times, they respectively send a first response message to the first electronic device, and the first response message includes an indication information of tr and the transmission timestamp tX of the Xth message; when the first electronic device receives the one or more first response messages at one or more tnow times, it calculates the transmission delays corresponding to the one or more second electronic devices according to tnow and tX respectively. The first electronic device calculating the first clock difference according to the second target messages respectively recently received by the one or more second electronic devices includes: the first electronic device calculates the first clock differences respectively corresponding to the one or more second electronic devices according to the transmission delays, tr and tX respectively corresponding to the one or more second electronic devices.
[0016] That is to say, the first clock difference is calculated according to information such as the number and transmission time of the second target message in the second message group received by the second electronic device. Wherein, different second electronic devices have different parameters such as tX, X and tr corresponding to them. For example, when the second electronic device is a mobile phone, tX is tX1; when the second electronic device is a watch, tX is tX2. The second message group is the message group sent by the first electronic device after window alignment. For example, the first message group can be the heartbeat packet group broadcast by the large screen after window alignment with the mobile phone later.
[0017] In another possible design, the first electronic device sends one or more corresponding first target messages to one or more second electronic devices, including: the first electronic device periodically sends a second message group to one or more second electronic devices according to t1 and a first preset period, the second message group includes a plurality of messages sent at preset intervals, and the first target message corresponding to each of the one or more second electronic devices is the Xth message corresponding to each of the one or more second electronic devices in the second message group; one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to their respective first clock differences and the first preset period, including: one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the second message group according to their respective first clock differences, t1 and the first preset period, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
[0018] In this solution, the second electronic device can enter the window receiving state when the first electronic device sends the second message group, so as to receive the first target message when in the window receiving state, and thus can receive the first target message quickly and efficiently, reducing the device power consumption. This solution can correspond to the first strategy of window alignment described later.
[0019] In another possible design, the first electronic device sends one or more corresponding first target messages to one or more second electronic devices, including: the first electronic device periodically sends a second message group to one or more second electronic devices according to t1 and a first preset period, the second message group includes a plurality of messages sent at preset intervals, and the first target message corresponding to each of the one or more second electronic devices is the Xth message corresponding to each of the one or more second electronic devices in the second message group; one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to their respective first clock differences and the first preset period, including: one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to their respective first clock differences, tX and the first preset period.
[0020] In this solution, the second electronic device can enter the window receiving state when the first electronic device sends the first target message, so as to receive the first target message when in the window receiving state, and thus can receive the first target message quickly and efficiently, reducing the device power consumption. This solution can correspond to the second strategy of window alignment described later.
[0021] In another possible design, the first electronic device sends one or more corresponding first target messages to one or more second electronic devices, including: The first electronic device periodically sends a second message group to one or more second electronic devices according to tX0 and a first preset period. tX0 is the value of tX with a relatively earlier timing among one or more electronic devices, and tX0 corresponds to the X0th message in the first message group. The second message group includes multiple messages sent at a preset interval. The first target message corresponding to each of the one or more second electronic devices is the (X - X0 + 1)th message in the second message group corresponding to it. One or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to their respective first clock differences and the first preset period, including: One or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the second message group according to their respective first clock differences, tX, and the first preset period, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
[0022] In this solution, the second electronic device can enter the window receiving state when the first electronic device sends the second message group where the first target message is located, so as to receive the first target message when in the window receiving state, and thus can quickly and efficiently receive the first target message and reduce the device power consumption. This solution corresponds to the third strategy of window alignment described later.
[0023] In another possible design, the network includes a second electronic device. The first electronic device sends one or more corresponding first target messages to the second electronic device, including: The first electronic device periodically sends a second message group to the second electronic device according to tX and a first preset period. The second message group includes multiple messages sent at a preset interval. The first target message is the first message in the second message group. The second electronic device controls the second electronic device to enter the receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, including: The second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference, tX, and the first preset period.
[0024] In this solution, the second electronic device can enter the window receiving state when the first electronic device sends the first target message, so as to receive the first target message when in the window receiving state, and thus can quickly and efficiently receive the first target message and reduce the device power consumption.
[0025] In another possible design, the method further includes: if the second electronic device receives the Xi-th message in the second message group, and the number of messages between the Xi-th message and the X-th message is greater than or equal to a preset value, then request the first electronic device to update the first clock difference.
[0026] In this solution, if the second electronic device receives the Xi-th message in the second message group, and the number of messages between Xi and the X-th message is greater than or equal to a preset value, then it is possible that the clock difference between the second electronic device and the first electronic device changes greatly. Therefore, the second electronic device can request the first electronic device to update the first clock difference.
[0027] In another possible design, the method further includes: if the first electronic device determines according to the response message from the second electronic device that the number of messages between the Xi-th message received by the second electronic device and the X-th message is greater than or equal to a preset value, then the first electronic device updates the first clock difference.
[0028] In this solution, if the first electronic device learns that the Xi-th message in the second message group received by the second electronic device, and the number of messages between Xi and the X-th message is greater than or equal to a preset value, then it is possible that the clock difference between the second electronic device and the first electronic device changes greatly. Therefore, the first electronic device can trigger an update of the first clock difference.
[0029] In another possible design, one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window reception state according to their respective corresponding first clock differences, including: one or more second electronic devices control, according to their respective corresponding first clock differences, the second electronic device to enter the window reception state before the moment when the corresponding first target message arrives at the second electronic device calculated according to the pre-obtained transmission delay, so that the second electronic device receives the corresponding first target message when in the window reception state.
[0030] In this solution, the second electronic device can enter the window reception state before the first target message arrives, so that the second electronic device receives the first target message when in the window reception state. Therefore, the second electronic device can receive the first target message quickly and efficiently, reducing the device power consumption.
[0031] In another possible design, the network further includes one or more third electronic devices, each third electronic device corresponding to a second electronic device, and each second electronic device corresponding to one or more third electronic devices. The method further includes: one or more third electronic devices obtain their respective corresponding second clock differences, where the second clock difference is the difference between the local clock of the third electronic device and the local clock of the second electronic device corresponding to the third electronic device; the second electronic device sends a third target message to the corresponding one or more third electronic devices; and one or more third electronic devices control the third electronic devices to receive the third target message when in the window receiving state according to their respective corresponding second clock differences.
[0032] That is to say, similar to between the first electronic device and the second electronic device, the same method can also be used to transmit target messages between the second electronic device and the third electronic device.
[0033] In another possible design, the first target message is an advertising non-connectable indication (ADV_NONCONN_IND) message of Bluetooth Low Energy (BLE).
[0034] Among them, the advertising non-connectable message does not require a dedicated response message to reply, so it can reduce the bandwidth occupancy of the response message packet, reduce the number of message interactions during the online detection process, save power consumption, simplify the interaction process, and improve the efficiency of online detection.
[0035] In another possible design, for the second electronic device to obtain the first clock difference, it includes: the second electronic device obtains the first clock difference updated according to the second preset period from the first electronic device.
[0036] That is to say, the first electronic device can update the first clock difference regularly so that the second electronic device can perform window alignment based on the updated first clock difference.
[0037] In another possible design, the second preset period corresponds to a preset cumulative change threshold of the clock difference.
[0038] That is to say, within the second preset period, the cumulative change of the first clock difference may have exceeded the threshold, so the first electronic device can trigger recalculation of the clock difference.
[0039] In another possible design, the first target message is used to transmit heartbeat packets.
[0040] For example, the message group can be a heartbeat packet group, which can include multiple heartbeat packets, and the first target message is used to transmit the target heartbeat packet. In this way, the second electronic device can receive the heartbeat packet quickly and efficiently based on the first clock difference, so as to perform heartbeat detection quickly and efficiently.
[0041] On the other hand, an embodiment of the present application provides a message interaction method for a first electronic device in a network composed of multiple devices, and the network further includes one or more second electronic devices. The method includes: the first electronic device calculates a first clock difference corresponding to each of the one or more second electronic devices, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device. The first electronic device sends the first clock difference corresponding to each of the one or more second electronic devices to the corresponding second electronic device, and the first clock difference is used to control the second electronic device to receive the corresponding first target message when in the window receiving state. The first electronic device sends the corresponding one or more first target messages to the one or more second electronic devices.
[0042] In this solution, the first electronic device can notify the second electronic device of the first clock difference, so that the second electronic device can control the sending timing and / or receiving timing of the first target message based on the clock difference, enabling the receiving device to receive the first target message when in the window receiving state, thereby efficiently receiving the first target message and reducing power consumption.
[0043] In a possible design, the first electronic device sending the corresponding one or more first target messages to the one or more second electronic devices includes: the first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period.
[0044] In another possible design, the first electronic device calculating the first clock difference corresponding to each of the one or more second electronic devices includes: the first electronic device calculates the first clock difference according to the second target messages recently received by the one or more second electronic devices respectively. The second target message comes from a first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval. The second target message is the Xth message in the first message group, where N is a positive integer and X is a positive integer less than or equal to N.
[0045] In another possible design, the first electronic device calculates a first clock difference based on the second target messages respectively recently received by one or more second electronic devices, including: the first electronic device sends a first message group to one or more second electronic devices at time t1; the first electronic device receives, at one or more tnow times, first response messages from one or more second electronic devices, where the first response messages include indication information of the time tr when the second electronic device receives the Xth message in the first message group and the transmission timestamp tX of the Xth message; the first electronic device calculates the transmission delays respectively corresponding to one or more second electronic devices according to the tnow and tX respectively corresponding to one or more second electronic devices; the first electronic device calculates the first clock differences respectively corresponding to one or more second electronic devices according to the transmission delays, tr, and tX respectively corresponding to one or more second electronic devices.
[0046] In another possible design, the first electronic device periodically sends corresponding one or more first target messages to one or more second electronic devices according to a first preset period, including: the first electronic device periodically sends a second message group to one or more second electronic devices according to t1 and the first preset period, where the second message group includes multiple messages sent at a preset interval, and the first target message corresponding to each of one or more second electronic devices is the Xth message in the second message group corresponding to each of one or more second electronic devices.
[0047] In another possible design, the first electronic device periodically sends corresponding one or more first target messages to one or more second electronic devices according to a first preset period, including: the first electronic device periodically sends a second message group to one or more second electronic devices according to tX0 and the first preset period, where tX0 is the earlier value among the tX values corresponding to one or more electronic devices, tX0 corresponds to the X0th message in the first message group, the second message group includes multiple messages sent at a preset interval, and the first target message corresponding to each of one or more second electronic devices is the (X - X0 + 1)th message in the second message group corresponding to each of one or more second electronic devices.
[0048] In another possible design, the network includes a second electronic device, and the first electronic device periodically sends corresponding one or more first target messages to one or more second electronic devices according to a first preset period, including: the first electronic device periodically sends a second message group to the second electronic device according to tX and the first preset period, where the second message group includes multiple messages sent at a preset interval, and the first target message is the first message in the second message group.
[0049] In another possible design, the method further includes: if the first electronic device determines according to the response message from the second electronic device that the number of messages between the Xi-th message received by the second electronic device and the X-th message is greater than or equal to a preset value, the first electronic device updates the first clock difference.
[0050] In another possible design, the first clock difference is used to control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
[0051] In another possible design, the first clock difference is used to control the second electronic device to enter the window receiving state before the moment when the corresponding first target message arrives at the second electronic device calculated according to the pre-obtained transmission delay, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
[0052] On the other hand, an embodiment of the present application provides a message interaction method for a second electronic device in a network composed of multiple devices, and the network further includes a first electronic device. The method includes: the second electronic device obtains a first clock difference, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device; the second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state according to the first clock difference.
[0053] Based on this solution, the second electronic device can control the sending time and / or receiving time of the first target message based on the clock difference, so that the receiving end device receives the first target message when it is in the window receiving state, thereby efficiently receiving the first target message and reducing power consumption.
[0054] In a possible design, the second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state according to the first clock difference, including: the second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state according to the first clock difference and the first preset period.
[0055] In another possible design, the second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state according to the first clock difference and the first preset period, including: the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, so that the second electronic device receives the corresponding first target message from the first electronic device when it is in the window receiving state.
[0056] In another possible design, the second electronic device obtains the first clock difference, including: the second electronic device obtains the first clock difference from the first electronic device, and the first clock difference is obtained according to the second target message recently received by the second electronic device. Among them, the second target message comes from the first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval, the second target message is the Xth message in the first message group, N is a positive integer, and X is a positive integer less than or equal to N.
[0057] In another possible design, the method further includes: the second electronic device receives the Xth message in the first message group from the first electronic device at time tr; the second electronic device sends a first response message to the first electronic device, and the first response message includes an indication information of tr and the transmission timestamp tX of the Xth message, and tr and tX are used to calculate the first clock difference.
[0058] In another possible design, the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, including: the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the second message group according to the first clock difference, the sending time t1 of the first message in the first message group and the first preset period, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message, where the second message group includes multiple messages sent at a preset interval, and the first target message is the Xth message in the second message group.
[0059] In another possible design, the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, including: the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference, the sending time tX of the Xth message in the first message group and the first preset period, where the second message group includes multiple messages sent at a preset interval, and the first target message is the first message in the second message group.
[0060] In another possible design, the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, including: the second electronic device controls the second electronic device to enter the window receiving state when the first electronic device sends the second message group according to the first clock difference, tX, and the first preset period, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message, where the second message group includes multiple messages sent at preset intervals, the first target message is the first message or the (X - X0 + 1)-th message in the second message group, and the X0-th message is sent before the X-th message in the first message group.
[0061] In another possible design, the method further includes: if the second electronic device receives the Xi-th message in the second message group, and the number of intervals between the Xi-th message and the X-th message is greater than or equal to a preset value, then request the first electronic device to update the first clock difference.
[0062] In another possible design, the second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when in the window receiving state according to the first clock difference, including: the second electronic device controls to enter the window receiving state before the moment when the corresponding first target message arrives at the second electronic device calculated according to the pre-obtained transmission delay according to the first clock difference, so that the second electronic device receives the corresponding first target message from the first electronic device when in the window receiving state.
[0063] In another possible design, the network further includes one or more third electronic devices, each second electronic device corresponds to one or more third electronic devices, and the method further includes: the second electronic device sends a third target message to the corresponding one or more third electronic devices.
[0064] In another possible design, the second electronic device obtains the first clock difference, including: the second electronic device obtains the first clock difference updated according to the second preset period from the first electronic device.
[0065] On the other hand, an embodiment of the present application provides a message interaction device, which is included in the first electronic device or the second electronic device, and the device has the function of implementing the behavior of the first electronic device or the second electronic device in any of the above aspects and any possible implementation manners. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a sending module or unit, a receiving module or unit, a processing module or unit, etc.
[0066] On the other hand, an embodiment of the present application provides an electronic device, including one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code. The computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device is caused to execute the message interaction method performed by the first electronic device in any of the above aspects and any possible implementation manners, or the electronic device is caused to execute the message interaction method performed by the second electronic device in any of the above aspects and any possible implementation manners.
[0067] On the other hand, an embodiment of the present application provides a computer-readable storage medium, including computer instructions. When the computer instructions run on an electronic device, the electronic device is caused to execute the message interaction method performed by the first electronic device in any of the above aspects and any possible implementation manners, or the electronic device is caused to execute the message interaction method performed by the second electronic device in any of the above aspects and any possible implementation manners.
[0068] On the other hand, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, the computer is caused to execute the message interaction method performed by the first electronic device in any of the above aspects and any possible implementation manners, or the computer is caused to execute the message interaction method performed by the second electronic device in any of the above aspects and any possible implementation manners.
[0069] On the other hand, an embodiment of the present application provides a network system composed of devices. The system may include a first electronic device and a second electronic device, and the first electronic device and the second electronic device may execute the message interaction method in any of the above aspects and any possible implementation manners.
[0070] Among them, for the beneficial effects of other aspects, reference may be made to the beneficial effects of the multi-device network method, which will not be elaborated here. Description of the Drawings
[0071] Figure 1A It is a networking schematic diagram of an intelligent connection network provided by an embodiment of the present application;
[0072] Figure 1B It is a hardware structure schematic diagram of an electronic device provided by an embodiment of the present application;
[0073] Figure 2 It is a schematic diagram of the relationship between upper and lower nodes in an intelligent connection network provided by an embodiment of the present application;
[0074] Figure 3A It is a timing diagram of heartbeat packet interaction between electronic devices in an intelligent connection network provided by an embodiment of the present application;
[0075] Figure 3B A flowchart of the interaction regarding the clock difference between a large screen and a mobile phone provided by an embodiment of the present application;
[0076] Figure 4 A comparison schematic diagram before and after window alignment corresponding to the first strategy provided by an embodiment of the present application;
[0077] Figure 5 A comparison schematic diagram before and after window alignment corresponding to the second strategy provided by an embodiment of the present application;
[0078] Figure 6 A comparison schematic diagram before and after window alignment corresponding to the third strategy provided by an embodiment of the present application;
[0079] Figure 7 A schematic diagram of the heartbeat packet scanning effect in the case of no window alignment provided by the prior art;
[0080] Figure 8 A flowchart of the interaction regarding the clock difference between a mobile phone and a speaker provided by an embodiment of the present application;
[0081] Figure 9 A flowchart of a message interaction method provided by an embodiment of the present application;
[0082] Figure 10 Another schematic diagram of the hardware structure of the electronic device provided by an embodiment of the present application. Detailed implementation manners
[0083] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; herein, "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0084] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of this embodiment, unless otherwise specified, the meaning of "a plurality of" is two or more than two.
[0085] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplarily" or "for example" in the embodiments of the present application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.
[0086] Currently, it has become a general trend for multiple electronic devices to form an intelligent network and cooperate to complete services. After multiple electronic devices that can establish a mutual trust relationship discover each other, they can automatically form a network, which is called an intelligent connection network. For example, if multiple electronic devices log in to the same account (i.e., the same Account ID), or the user performs a binding and authentication process on multiple electronic devices (such as binding through a pin code or a quick response (QR) code, etc.), then a mutual trust relationship is established between the multiple electronic devices.
[0087] In the embodiments of the present application, for multiple electronic devices within the range of short-distance communication that have a trust relationship, one electronic device will maintain a logical connection with other electronic devices, and the states and information of these electronic devices can be synchronized during system operation. These mutually trusted electronic devices can form an intelligent connection network.
[0088] It should be noted that the intelligent connection network is only a name of the network involved in the embodiments of the present application. The network involved in the embodiments of the present application may also have other names, which are not limited.
[0089] Multiple electronic devices in the intelligent connection network support local short-distance communication methods. For example, they can support short-distance wireless communication methods such as Bluetooth, Wi-Fi, or near field communication (NFC), or support short-distance wired communication methods such as universal serial bus (USB). Exemplarily, a schematic diagram of a networking of the intelligent connection network can be seen Figure 1A . As Figure 1A shown, between the large screen and the mobile phone, between the large screen and the smart watch (abbreviated as watch), between the watch and the earphone, and between the mobile phone and the earphone, all support Bluetooth low energy (BLE) communication methods. Between the mobile phone and the smart speaker (abbreviated as speaker), Wi-Fi communication method is supported.
[0090] After the intelligent connection network is set up, the electronic devices in the intelligent connection network go online. Specifically, during or after mutual discovery, multiple electronic devices can exchange information (including the identity information of the electronic devices) to notify each other of the identities of the online electronic devices. Then, the electronic devices in the intelligent connection network can perform online detection through heartbeat packets to learn about the status of each online electronic device. In the embodiments of the present application, being online means that an electronic device can be detected through a heartbeat packet, and it does not necessarily mean that a well-established network connection or data channel already exists.
[0091] For example, after an electronic device 1 in the intelligent connection network sends a heartbeat packet to an electronic device 2, if a heartbeat response message sent by the electronic device 2 is received within a preset time period, it is considered that the electronic device 2 is online. Business data transmission can be initiated at any time between the online electronic devices in the intelligent connection network, enabling rapid, direct, and collaborative business processing. If the electronic device 1 does not receive a heartbeat response message sent by the electronic device 2 within the preset time period, it is considered that the electronic device 2 is offline. The electronic devices in the intelligent connection network can also notify each other of the identity information of the offline devices so that each electronic device can learn about the current online and offline devices.
[0092] The embodiments of the present application provide an online detection method that can control the sending timing and / or receiving timing of heartbeat packets based on the clock difference between the sending-end electronic device and the receiving-end electronic device in the network, enabling the receiving-end electronic device to receive the heartbeat packet when it is in the window receiving state. This can improve the receiving efficiency of the heartbeat packet, reduce the number and duration of sending and receiving heartbeat packets, and lower the power consumption of the electronic device. Thus, low-power, fast, timely, and accurate online detection of multiple electronic devices in the network can be achieved based on heartbeat packets. Here, the window of the receiving-end electronic device for receiving heartbeat packets can be referred to as the receiving window, such as specifically the scanning window of the receiving-end electronic device.
[0093] For example, the electronic devices in the intelligent connection network can be mobile terminals such as mobile phones, tablet computers, wearable devices (such as earphones, smart watches, smart bracelets, smart glasses, etc.), smart home devices (such as large screens, speakers, smart lights, etc.), in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs). The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0094] Exemplarily, Figure 1BShows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0095] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0096] Among them, the controller may be the nerve center and command center of the electronic device 100. The controller may generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0097] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly retrieved from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0098] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a USB interface, etc.
[0099] The USB interface 130 is an interface compliant with the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used for data transmission between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other electronic devices, such as AR devices, etc.
[0100] The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0101] Antenna 1 and antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: Antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0102] The mobile communication module 150 may provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., which are applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.
[0103] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
[0104] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0105] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0106] In the embodiments of the present application, the electronic device 100 may send or receive heartbeat packets through the mobile communication module 150, the wireless communication module 160, or USB, etc.
[0107] The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.). In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0108] The electronic device 100 can implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, and an application processor, etc. For example, music playback, recording, etc.
[0109] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0110] In the embodiments of the present application, by running the instructions stored in the internal memory 121, the processor 110 enables the electronic device 100 in the intelligent connection network to control the sending timing and / or receiving timing of heartbeat packets based on the clock difference between electronic devices, so that the receiving-end electronic device receives the heartbeat packets when it is in the window receiving state, thereby improving the receiving efficiency of the heartbeat packets, reducing the number of transmissions and receptions and the duration of the heartbeat packets, reducing the power consumption of the electronic device, and thus enabling fast, timely, and accurate online detection of multiple electronic devices in the network based on the heartbeat packets.
[0111] The following will elaborate on the online detection method based on heartbeat packets provided by the embodiments of the present application in conjunction with the accompanying drawings.
[0112] An electronic device in the intelligent connection network can also be referred to as a node. In the embodiments of the present application, there is an upper and lower level relationship between nodes in the intelligent connection network. The upper-level node can send heartbeat packets to the lower-level node to detect whether the lower-level node is online. Among them, the upper and lower level relationship between nodes can be determined according to factors such as the information of the nodes themselves and / or the mutual relationship between the nodes. In the intelligent connection network, a lower-level node of a node can have one or more.
[0113] For example, the information of a node itself may include one or more of network capability information, processing capability information, network quality, power information, motion information, service information, and service set identifier (SSID). Among them, the network capability information may include at least one of the network connections supported by the node, the maximum bandwidth supported by the network connections supported by the node, and the connection information of the network connections supported by the node (such as port number, media access control (MAC) address, or internet protocol (IP) address). The processing capability information of the node represents the processing capability of the node, for example, including the power consumption of the node, the chip processing capability, and the memory.
[0114] For example, the relationships between nodes may include network topology relationships and the like. The network topology relationship includes the network connection methods supported between each node and the communication paths between nodes.
[0115] Exemplarily, the superior-subordinate relationships between nodes can be determined according to the weights of the nodes and the network topology relationships between the nodes. Among them, the weight of a node can be determined by the node itself according to the network capability information and the processing capability information of the node. For example, a node with high power consumption, insensitivity to power consumption, good chip processing capability, large memory, and strong network capability has a high weight; on the contrary, a node with low power consumption, sensitivity to power consumption, poor chip processing capability, small memory, and weak network capability has a low weight.
[0116] In the embodiments of the present application, the nodes in the intelligent connection network, according to the relationship from superior to inferior, may include a central node, a first-level node, a second-level node, etc. Among them, the central node is the top-level node, having only subordinate nodes and no superior nodes. The subordinate nodes of the central node are called first-level nodes, and the central node is the superior node of the first-level nodes; the subordinate nodes of the first-level nodes are called second-level nodes, and the first-level nodes are the superior nodes of the second-level nodes; and so on. The embodiments of the present application do not limit the number of levels of nodes included in the intelligent connection network. Usually, an intelligent connection network includes one central node and may have one or more subordinate nodes belonging to different levels. In addition, if a node has both a superior node and a subordinate node, then this node can also be called an intermediate node. If a node has only a superior node and no subordinate node, then this node can also be called a tail node.
[0117] For example, in Figure 1AIn the intelligent connection network shown, Bluetooth BLE network connection is supported between the large screen and the mobile phone, and between the large screen and the watch. Bluetooth BLE network connection is supported between the mobile phone and the earphone, and Wi-Fi network connection is supported between the mobile phone and the speaker. According to factors such as weight and network topology relationship among the electronic devices, the large screen is determined as the central node. The large screen is the superior node of the mobile phone and the watch, and the mobile phone is the superior node of the earphone and the speaker. Correspondingly, the mobile phone and the watch are the inferior nodes of the large screen, and the earphone and the speaker are the inferior nodes of the mobile phone.
[0118] In Figure 1A In the intelligent connection network shown, according to the network topology relationship, network connection is supported between the mobile phone and the earphone, and between the watch and the earphone. However, according to factors such as the weight of the nodes, the earphone is the inferior node of the mobile phone and not the inferior node of the watch.
[0119] In this intelligent connection network, the large screen is the central node, the mobile phone and the watch are the first-level nodes, and the earphone and the speaker are the second-level nodes. Exemplarily, the hierarchical relationship between the superior and inferior nodes in this intelligent connection network can be referred to Figure 2 . Among them, the mobile phone can also be called an intermediate node, and the watch, earphone, and speaker can also be called tail nodes.
[0120] In the embodiment of the present application, after the network formation is completed, one or more network connection methods can be supported between any two electronic devices in the intelligent connection network, but the network connection between the electronic devices may not have been established. The network connection methods supported between the electronic devices can be short-range wireless network connection methods or wired network connection methods, etc. Among them, the wireless network connection method that can be online detected by using the method provided in the embodiment of the present application can be called the first network connection method. For example, the first network connection method can be a short-range wireless network connection method that supports the air interface scanning mechanism. Other network connection methods other than the first network connection method can be called the second network connection method. Exemplarily, Bluetooth BLE can be the first network connection method, USB can be the second network connection method, and Wi-Fi, Bluetooth base rate (BR), or Bluetooth enhanced data rate (EDR), etc. can be either the first network connection method or the second network connection method.
[0121] In the intelligent connection network, between two electronic devices that support the first network connection method, heartbeat packets and other information can be interacted through the communication mode of sending and receiving windows through the air interface. That is, the sending-end electronic device sends messages through the air interface, and the receiving-end electronic device receives messages within the receiving window. For example, the air interface sending method can be broadcast or unicast, etc., and the receiving window can be a scanning window.
[0122] If the first network connection method is not supported between two electronic devices in the intelligent connection network, but the second network connection method is supported, information such as heartbeat packets is exchanged based on the second network connection method, so as to perform online detection.
[0123] In the embodiments of the present application, the priority of the first network connection method may be higher than that of the second network connection method. If the first network connection method and the second network connection method are both supported between two electronic devices in the intelligent connection network, information such as heartbeat packets is exchanged based on the first network connection method through the communication mode of the transmission and reception window over the air interface, so as to perform online detection.
[0124] The solution provided by the embodiments of the present application can start from the central node of the intelligent connection network, and heartbeat packets are sent from the upper-level node to the lower-level node level by level, so as to uniformly perform online detection on the electronic devices in the intelligent connection network, and uniformly determine the online and offline states of each electronic device in the intelligent connection network, so that the online electronic devices can be used to quickly, directly and collaboratively complete services.
[0125] In the intelligent connection network, between the upper-level and lower-level nodes that support the first network connection method, control can be performed based on the clock difference and the first network connection method, so as to align the sending timing of the heartbeat packet with the opening timing of the reception window, which is simply referred to as window alignment or phase alignment, so that the receiving and sending timing of the heartbeat packet is synchronized.
[0126] Among them, in the intelligent connection network, the upper-level node sends a heartbeat packet to the lower-level node. The upper-level and lower-level nodes for exchanging heartbeat packets here refer to two adjacent levels of nodes. For example, the upper-level node refers to the central node, and the lower-level node refers to the first-level node; for another example, the upper-level node refers to the first-level node, and the lower-level node refers to the second-level node. That is to say, the upper-level node is the sending-end electronic device of the heartbeat packet, and the lower-level node is the receiving-end electronic device of the heartbeat packet.
[0127] In the embodiments of the present application, window alignment can be understood as that the receiving-end electronic device can receive the heartbeat packet sent by the sending-end electronic device when it is in the window reception state based on the clock difference between it and the sending-end electronic device, so as to efficiently receive the heartbeat packet, reduce power consumption, and perform online detection quickly based on the heartbeat packet.
[0128] In some embodiments, window alignment means that the difference between the time when the receiving-end electronic device enters the receiving state and the time when the sending-end electronic device sends a heartbeat packet is less than or equal to a first preset value. Among them, after the receiving window of the receiving-end electronic device is opened, it enters the receiving state and can be used to receive heartbeat packets. In this way, the receiving-end electronic device can open the receiving window at the appropriate time when the sending-end electronic device sends a heartbeat packet, so as to ensure that neither communication resources are wasted by opening the receiving window too early, nor the heartbeat packet cannot be obtained normally due to opening the receiving window too late, thereby ensuring that the receiving window can receive the heartbeat packet more quickly and efficiently.
[0129] For example, the time when the receiving window enters the receiving state is earlier than the time when the heartbeat packet is sent. For instance, the opening time of the receiving window is earlier than the time when the heartbeat packet is sent. In this way, when the heartbeat packet is sent, the receiving window is already in the receiving state, and the receiving-end electronic device can receive the heartbeat packet more quickly and efficiently.
[0130] For another example, the receiving window enters the receiving state when the heartbeat packet is sent. For instance, the receiving window is opened when the heartbeat packet is sent. In this way, when the heartbeat packet starts to be sent, the receiving window just opens and enters the receiving state. Considering the transmission delay, when the heartbeat packet reaches the receiving-end electronic device, the receiving window is already in the receiving state, and the receiving-end electronic device can receive the heartbeat packet more quickly and efficiently.
[0131] For another example, before the heartbeat packet reaches the receiving-end electronic device, the receiving window enters the receiving state. For instance, the receiving-end electronic device can determine in advance the time when the heartbeat packet reaches the receiving-end electronic device based on the sending time of the heartbeat packet and the pre-calculated transmission delay, so as to open the receiving window in advance before the heartbeat packet arrives, making the receiving window wait for the heartbeat packet in the receiving state, and thus being able to receive the heartbeat packet quickly and efficiently.
[0132] For another example, when the heartbeat packet reaches the receiving-end electronic device, the receiving window opens and thus enters the receiving state. For instance, the receiving-end electronic device can determine in advance the time when the heartbeat packet reaches the receiving-end electronic device based on the sending time of the heartbeat packet and the pre-calculated transmission delay, so as to open the receiving window and enter the receiving state when the heartbeat packet arrives, and thus being able to receive the heartbeat packet quickly and efficiently.
[0133] For the upper and lower nodes that support the first network connection method, after the window alignment, after a certain node subsequently sends a small number (such as 1 or 2, etc.) of heartbeat packets, the lower node of this node can quickly detect the heartbeat packets. That is to say, after the receiving and sending timing of the heartbeat packets is synchronized, the lower node can quickly, accurately, and efficiently receive the heartbeat packets within the receiving window subsequently, thereby reducing the number of heartbeat packet interactions per unit time, improving the reliability of heartbeat packet reception, reducing communication costs and power consumption, and achieving fast, accurate, and timely online detection among multiple devices.
[0134] In addition, for electronic devices that only support the second network connection method, the upper and lower nodes can interact heartbeat packets and heartbeat response messages based on the clock difference and the second network connection method.
[0135] In this way, this solution can achieve fast, accurate, and timely online detection of each electronic device that supports the first network connection method or the second network connection method in the intelligent connection network.
[0136] The following will take Figure 1A and Figure 2 the central node, the first-level node, and the second-level node in the intelligent connection network shown as an example, where the air interface sending method of the heartbeat packet is broadcast and the receiving window of the heartbeat packet is the scanning window, and in combination with the accompanying drawings, the online detection method provided by the embodiments of the present application will be described. The method may include:
[0137] After the upper and lower relationships of each node in the intelligent connection network are determined, referring to the timing diagram shown in Figure 3A , the large screen, as the central node, starts to broadcast a group of heartbeat packets to the mobile phone and the watch, which are the first-level nodes, at time t1. The group of heartbeat packets may include N (N is an integer greater than 1) heartbeat packets sequentially sent at a preset interval (such as 20 ms, 30 ms, etc.) within a preset period. In some embodiments, each heartbeat packet in the group of heartbeat packets carries its own sending timestamp respectively. For example, the first heartbeat packet carries its own sending timestamp t1, and the X1th heartbeat packet carries its own sending timestamp tX1.
[0138] Referring to Figure 3A , the mobile phone, as the first-level node, after receiving the X1th (X1 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packet at time tr1, sends a heartbeat response message to the large screen.
[0139] In some embodiments, the heartbeat response message sent by the mobile phone to the large screen includes tr1 and the sending timestamp tX1 of the X1th heartbeat packet. In other embodiments, the heartbeat response message sent by the mobile phone to the large screen includes tr1 and the identifier of the X1th heartbeat packet, and the large screen can determine the sending timestamp tX1 of the X1th heartbeat packet according to the identifier of the X1th heartbeat packet.
[0140] After the large screen receives the heartbeat response message sent by the mobile phone at time tnow1, it calculates the transmission delay between the large screen and the mobile phone as tdelay1 = (tnow1 - tX1) / 2. According to this transmission delay, the clock difference between the mobile phone and the large screen is tC1 = tr1 - tX1 - tdelay1. The large screen can send this clock difference to the mobile phone so that the mobile phone and the large screen can align the windows according to the clock difference, thereby synchronizing the receiving and sending times of the heartbeat packets. Exemplarily, the interaction process regarding the clock difference between the large screen and the mobile phone can be referred to Figure 3B .
[0141] In the solution described in the above embodiments, it is the large screen side that calculates the clock difference between the mobile phone and the large screen and sends it to the mobile phone side. In some other embodiments, the mobile phone side can also calculate the clock difference with the large screen by itself, and the embodiments of the present application do not limit the device side for calculating the clock difference.
[0142] Among them, the clock difference is used to represent the difference between the local clocks of two electronic devices. An electronic device can obtain its local clock based on its own operating system. For example, the Java usage interface System.nanoTime() in the android system is used to obtain the relative clock, and the embedded system OS of a non-android system can use the interface getTickCount() to obtain the relative clock, etc. This local clock can be a relative clock, and this relative clock may be different from the world time displayed by the terminal device to the user. This local clock can be, for example, the time after power-on or the time from a certain reference time (such as January 1, 1970) to the present. For example, the local clock of the large screen is the time after power-on, and the local clock of the mobile phone is also the time after power-on, and the clock difference is 3658*10 9 ns. Again, for example, the local clock of the large screen is the time after power-on, and the local clock of the mobile phone is the time from January 1, 1970 to the present.
[0143] Similarly, referring to Figure 3A , the watch, as a primary node, after receiving the X2th (X2 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packet at time tr2, sends a heartbeat response message to the large screen and carries tr2 and the sending timestamp tX2 of the X2th heartbeat packet. After the large screen receives the heartbeat response message sent by the watch at time tnow2, it calculates the transmission delay tdelay2 = (tnow2 - tX2) / 2. The clock difference between the watch and the large screen is tC2 = tr2 - tX2 - tdelay2.
[0144] If the first network connection method is supported between the central node and the first-level node, the central node and the first-level node can control the broadcast timing of subsequent heartbeat packets and / or the opening timing of the scanning window according to the clock difference, so that the broadcast timing of the heartbeat packets and the opening timing of the scanning window are aligned. That is, window alignment is performed between the central node and the first-level node, so that the scanning window is in the receiving state when the heartbeat packet is broadcast, and the receiving and sending timings of the heartbeat packet are synchronized. After window alignment, the first-level node can quickly and accurately receive the heartbeat packet broadcast by the central node within the subsequent scanning window, thereby reducing the number of heartbeat packet interactions per unit time, reducing communication costs and power consumption, improving the reliability of heartbeat packet reception, and achieving fast, accurate, and timely online detection between devices.
[0145] For example, in Figure 1A In the intelligent connection network shown, Bluetooth BLE, a first network connection method, is supported between the large screen and the mobile phone. The large screen and the mobile phone can control the broadcast timing of subsequent heartbeat packets and / or the opening timing of the scanning window according to the clock difference, so that the scanning window of the mobile phone is also in the receiving state when the large screen broadcasts the heartbeat packet. In this way, the mobile phone can quickly and accurately receive the heartbeat packet broadcast by the large screen within the subsequent scanning window, thereby reducing the number of heartbeat packet interactions per unit time, reducing ineffective broadcasts and scanning duty cycles, improving the reliability of heartbeat packet reception, reducing communication costs and power consumption, and achieving fast, accurate, and timely online detection between devices.
[0146] Similarly, Bluetooth BLE in the first network connection method is supported between the large screen and the watch. The large screen and the watch can control the broadcast timing of subsequent heartbeat packets and / or the opening timing of the scanning window according to the clock difference, so that the scanning window of the watch is also in the receiving state when the large screen broadcasts the heartbeat packet. In this way, the watch can quickly and accurately receive the heartbeat packet broadcast by the large screen within the subsequent scanning window, thereby reducing the number of heartbeat packet interactions per unit time, reducing ineffective broadcasts and scanning duty cycles, improving the reliability of heartbeat packet reception, reducing communication costs and power consumption, and achieving fast, accurate, and timely online detection between devices.
[0147] In some embodiments, when the first network connection method is Bluetooth BLE, a broadcast message for sending a heartbeat packet can be an ADV_NONCONN_IND message of non-connectable broadcast. According to the Bluetooth protocol, this type of broadcast message does not require a dedicated response message to reply, so it can reduce the bandwidth occupancy of the response message packet, reduce the number of message interactions during online detection, save power consumption, simplify the interaction process, and improve the efficiency of online detection.
[0148] In the embodiments of the present application, window alignment can adopt a variety of different strategies to control the broadcast timing of subsequent heartbeat packets and / or the opening timing of the scanning window according to the clock difference.
[0149] For example, in the first strategy, the large screen, the mobile phone, and between the large screen and the watch, window alignment is performed according to the first heartbeat packet in the heartbeat packet group broadcast at time t1. Refer to Figure 3A , the large screen broadcasts the heartbeat packet group periodically at the time t1 + m * T1 corresponding to the local clock according to the first preset period T1, where m is a positive integer. Based on the clock difference, the mobile phone controls to periodically open the scanning window at the time t1 + m * T1 + tC1 corresponding to the local clock to receive the heartbeat packet. In this way, the timing of the large screen broadcasting the heartbeat packet group is consistent with the activation timing of the scanning window of the mobile phone. When the large screen broadcasts the first heartbeat packet in the heartbeat packet group, the scanning window of the mobile phone just opens. When the first heartbeat packet in the heartbeat packet group arrives at the mobile phone, the scanning window of the mobile phone has already opened. Therefore, the detection efficiency and response speed of the heartbeat packet can be improved, the invalid broadcast and scanning duty cycle can be reduced, and the fast, accurate, and timely connection and online detection between the large screen and the mobile phone can be realized.
[0150] Similarly, the large screen broadcasts the heartbeat packet group periodically at the time t1 + m * T1 corresponding to the local clock according to the first preset period T1. Based on the clock difference, the watch controls to periodically open the scanning window at the time t1 + m * T1 + tC2 corresponding to the local clock to receive the heartbeat packet. Exemplarily, the comparison schematic diagram before and after the window alignment corresponding to the first strategy can be referred to Figure 4 .
[0151] In this scheme, the first heartbeat packet in the heartbeat packet group can be the target heartbeat packet (also called the target message) corresponding to the mobile phone and the watch. Based on this scheme, the mobile phone and the watch can enter the receiving state when the large screen sends the heartbeat packet group (that is, sends the first heartbeat packet in the heartbeat packet group), that is, can enter the receiving state when the large screen sends the target heartbeat packet in the heartbeat packet group, so as to be able to quickly receive the target heartbeat packet and improve the online detection efficiency.
[0152] Or, in this scheme, the X1th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone. Based on this scheme, the mobile phone can enter the receiving state when the large screen sends the heartbeat packet group (that is, sends the first heartbeat packet in the heartbeat packet group) and is in the receiving state when the large screen sends the target heartbeat packet, so as to be able to quickly receive the target heartbeat packet and improve the online detection efficiency. In this scheme, the X2th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch. Based on this scheme, the watch can enter the receiving state when the large screen sends the heartbeat packet group and is in the receiving state when the large screen sends the target heartbeat packet, so as to be able to quickly receive the target heartbeat packet and improve the online detection efficiency.
[0153] Exemplarily, the large screen broadcasts a heartbeat packet group for the first time at 16:00 corresponding to the local clock (i.e., starting at 16:00, a plurality of heartbeat packets in a heartbeat packet group are sequentially broadcast at a preset interval such as 20 ms). T1 is 5 minutes (i.e., the large screen broadcasts a heartbeat packet group every 5 minutes). The clock difference between the mobile phone and the large screen is 30 minutes, and the clock difference between the watch and the large screen is 2 hours. After window alignment based on the clock difference, the large screen starts to broadcast the heartbeat packet group at 16:05, 16:10, 16:15... corresponding to the local clock respectively; the mobile phone opens the scanning window to receive the heartbeat packet at 16:35, 16:40, 16:45... corresponding to the local clock respectively; the watch opens the scanning window to receive the heartbeat packet at 18:05, 18:10, 18:15... corresponding to the local clock respectively.
[0154] Exemplarily again, the large screen broadcasts a heartbeat packet group for the first time at the 30 ns corresponding to the local clock (i.e., starting at the 30 ns, a plurality of heartbeat packets in a heartbeat packet group are sequentially broadcast at a preset interval such as 20 ms). T1 is 5 minutes, the clock difference between the mobile phone and the large screen is 30 minutes, and the clock difference between the watch and the large screen is 2 hours. After window alignment based on the clock difference, the large screen starts to broadcast the heartbeat packet group at the 5 minutes and 30 ns, 10 minutes and 30 ns, 15 minutes and 30 ns... corresponding to the local clock respectively; the mobile phone opens the scanning window to receive the heartbeat packet at the 35 minutes and 30 ns, 40 minutes and 30 ns, 45 minutes and 30 ns... corresponding to the local clock respectively; the watch opens the scanning window to receive the heartbeat packet at the 2 hours 5 minutes and 30 ns, 2 hours 10 minutes and 30 ns, 2 hours 15 minutes and 30 ns... corresponding to the local clock respectively.
[0155] In addition, since the mobile phone is more likely to receive the heartbeat packet broadcast by the large screen at the tX1 moment corresponding to the X1th heartbeat packet in the heartbeat packet for the first time, and then is more likely to receive the X1th heartbeat packet in the heartbeat packet again later. Therefore, when performing window alignment, the mobile phone can adjust the start scanning time of the heartbeat packet to the moment corresponding to the X1th heartbeat packet. In this way, the window alignment accuracy is higher. The mobile phone can receive the heartbeat packets sent within the broadcast window more quickly and accurately within the scanning window later, thereby reducing the number of heartbeat packet interactions per unit time, improving the reliability of heartbeat packet reception, reducing communication costs and power consumption, and realizing fast, accurate, and timely online detection between devices.
[0156] Therefore, in the second strategy, the mobile phone and the watch perform window alignment based on the X1th heartbeat packet and the X2th heartbeat packet corresponding to them respectively. Specifically, the large screen broadcasts a heartbeat packet group periodically at the moment of t1 + m*T1 corresponding to the local clock according to the first preset period T1. The mobile phone adjusts the opening time of the subsequent heartbeat packet scanning window based on the sending time tX1 of the first received X1th heartbeat packet to perform window alignment. Based on the clock difference, the mobile phone controls to periodically open the scanning window at the moment of tX1 + m*T1 + tC1 corresponding to the local clock, that is, the moment when the large screen broadcasts the X1th heartbeat packet, to receive the heartbeat packet.
[0157] Similarly, the large screen broadcasts a heartbeat packet periodically at the moment of t1 + m*T1 corresponding to the local clock according to the first preset period T1. The watch adjusts the opening time of the subsequent heartbeat packet scanning window based on the sending time tX2 of the first received X2th heartbeat packet to perform window alignment. Based on the clock difference, the watch controls to periodically open the scanning window at the moment of tX2 + m*T1 + tC2 corresponding to the local clock, that is, the moment when the large screen broadcasts the X2th heartbeat packet, to receive the heartbeat packet. Exemplarily, the comparison schematic diagram before and after the window alignment corresponding to the second strategy can be seen Figure 5 。
[0158] In this solution, the X1th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone, and the X2th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch. Based on this solution, the mobile phone and the watch can be in the receiving state when the large screen sends the target heartbeat packet, so as to be able to quickly receive the target heartbeat packet and improve the online detection efficiency.
[0159] Exemplarily, the large screen starts to broadcast the heartbeat packet group (including multiple heartbeat packets broadcast in sequence at a preset interval) at 16:00 corresponding to the local clock for the first time. tX1 is 16:00:01, tX2 is 16:00:02, T1 is 5 minutes, the clock difference between the mobile phone and the large screen is 30 minutes, and the clock difference between the watch and the large screen is 2 hours. After performing window alignment based on the clock difference, the large screen broadcasts the heartbeat packet group at 16:05, 16:10, 16:15... corresponding to the local clock respectively; the mobile phone opens the scanning window at 16:35:01, 16:40:01, 16:45:01... corresponding to the local clock respectively to receive the heartbeat packet; the watch opens the scanning window at 18:05:02, 18:10:02, 18:15:02... corresponding to the local clock respectively to receive the heartbeat packet.
[0160] In the first strategy or the second strategy, the large screen broadcasts a heartbeat packet group periodically at the moment of t1 + m*T1, and the mobile phone and the watch open the scanning window respectively according to the corresponding timing of their own window alignment, so as to receive the heartbeat packet.
[0161] In addition, after the subordinate node of the large screen receives the Xᵢ (i is a positive integer from 1 to N)th heartbeat packet of the large screen broadcast for the first time, the probability of receiving the Xᵢth heartbeat packet in the subsequent heartbeat packets is relatively high. Therefore, in the third strategy, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group to the sending moment corresponding to the Xᵢth heartbeat packet, that is, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to tₓᵢ. When the large screen has multiple subordinate nodes, the large screen can broadcast a group of heartbeat packets to multiple subordinate nodes at once, instead of broadcasting a group of heartbeat packets to each subordinate node separately, so as to simplify the sending process of the heartbeat packets, reduce the number of message interactions, and save power consumption. At this time, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to the earlier timing (which can also be called tₓ₀) among the tₓᵢ corresponding to multiple subordinate nodes respectively, so that after the multiple subordinate nodes perform window alignment, they can all scan the heartbeat packets broadcast by the large screen efficiently, quickly, and in a timely manner.
[0162] For example, the mobile phone receives the X₁th heartbeat packet in the heartbeat packet broadcast by the large screen for the first time, and the smartwatch receives the X₂th heartbeat packet in the heartbeat packet broadcast by the large screen for the first time. If the timing of the sending moment tₓ₁ corresponding to the X₁th heartbeat packet is earlier, that is, X₀ is X₁ and tₓ₀ is tₓ₁, then the large screen broadcasts a group of heartbeat packets periodically at the sending moment corresponding to the X₁th heartbeat packet in the future. That is, the large screen broadcasts a group of heartbeat packets periodically at the moment of tₓ₁ + m * T₁. The mobile phone opens the scanning window to receive the heartbeat packet at the moment of tₓ₁ + m * T₁ + tC₁; the smartwatch opens the scanning window to receive the heartbeat packet at the moment of tₓ₂ + m * T₁ + tC₂. Exemplarily, the comparison schematic diagram before and after the window alignment corresponding to the third strategy can be seen in Figure 6 .
[0163] In this solution, the 1st (i.e., X₁ - X₁ + 1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone, and the (X₂ - X₁ + 1)th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the smartwatch. Based on this solution, the mobile phone and the smartwatch can enter the receiving state when the large screen sends the heartbeat packet group (i.e., the 1st heartbeat packet in the heartbeat packet group), so that they can quickly receive the target heartbeat packet and improve the online detection efficiency. For example, if X₁ is 2 and X₂ is 3, the large screen broadcasts a group of heartbeat packets periodically at the sending moment corresponding to the 2nd heartbeat packet in the future. The 1st (i.e., 2 - 2 + 1) heartbeat packet in this heartbeat packet group is the target heartbeat packet corresponding to the mobile phone, and the 2nd (i.e., 3 - 2 + 1) heartbeat packet in this heartbeat packet group is the target heartbeat packet corresponding to the smartwatch.
[0164] Alternatively, if the sending time tX2 of the X2th heartbeat packet is early, that is, X0 is X2 and tX0 is tX2, the large screen will subsequently broadcast the heartbeat packet group periodically at the sending time corresponding to the X2th heartbeat packet. That is, the large screen broadcasts the heartbeat packet group periodically at the moment of tX2 + m * T1. The mobile phone opens the scanning window to receive the heartbeat packet at the moment of tX2 + m * T1 + tC1; the smartwatch opens the scanning window to receive the heartbeat packet at the moment of tX2 + m * T1 + tC2.
[0165] In this solution, the 1st (i.e., X1 - X2 + 1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the smartwatch, and the (X1 - X2 + 1)th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone. Based on this solution, the mobile phone and the smartwatch can enter the receiving state when the large screen sends the heartbeat packet group, so that they can quickly receive the target heartbeat packet and improve the online detection efficiency.
[0166] Exemplarily, the large screen starts to broadcast the heartbeat packet group for the first time at 16:00 corresponding to the local clock, tX1 is 16:00:01, tX2 is 16:00:02, tX1 is earlier than tX2, T1 is 5 minutes, the clock difference between the mobile phone and the large screen is 30 minutes, and the clock difference between the smartwatch and the large screen is 2 hours. After window alignment based on the clock difference and tX1, the large screen broadcasts the heartbeat packet group at 16:05:01, 16:06:01, 16:15:01... corresponding to the local clock respectively; the mobile phone opens the scanning window to receive the heartbeat packet at 16:35:01, 16:40:01, 16:45:01... corresponding to the local clock respectively; the smartwatch opens the scanning window to receive the heartbeat packet at 18:05:02, 18:06:02, 18:15:02... corresponding to the local clock respectively.
[0167] In the second and third strategies, the timing of the large screen broadcasting the heartbeat packet is inconsistent with the timing of the mobile phone opening the scanning window, and the timing of the large screen broadcasting the heartbeat packet is also inconsistent with the timing of the smartwatch opening the scanning window. However, the difference between the broadcasting timing and the opening timing of the scanning window is small, less than or equal to the first preset value. This situation also belongs to window alignment, and the mobile phone and the smartwatch can also receive the heartbeat packet efficiently, quickly, accurately, and in a timely manner, so as to perform online detection.
[0168] In addition, if there is only one primary node in the central node, and the primary node receives the Xth heartbeat packet in the heartbeat packet group broadcast by the central node starting at t1 for the first time, then the central node and the primary node can perform window alignment according to the clock difference tC and this Xth heartbeat packet. For example, the central node broadcasts the heartbeat packet group periodically at the moment of tX + m * T1 corresponding to the local clock according to the first preset period T1. The primary node controls to periodically open the scanning window to receive the heartbeat packet at the moment of tX + m * T1 + tC corresponding to the local clock based on the clock difference tC.
[0169] In this solution, the first heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the first-level node. The first-level node can enter the receiving state when the central node sends the target heartbeat packet, so that it can quickly receive the target heartbeat packet and improve the online detection efficiency.
[0170] In addition, if the window alignment is not performed between the first-level node and the central node according to the solution provided in the embodiments of the present application, then as Figure 7 shown, the first-level node usually needs multiple scanning windows to receive the heartbeat packet sent by the large screen. The receiving efficiency of the heartbeat packet is poor, the number of times of sending the heartbeat packet is large, the number of scanning times of the scanning window is large, and the power consumption of the first-level node and the central node is large.
[0171] In the embodiments of the present application, after the first-level node receives the heartbeat packet sent by the large screen for the first time, it sends a heartbeat packet to the second-level node to perform online detection on the second-level node. For example, in Figure 1A the intelligent connection network shown, after the mobile phone of the first-level node receives the heartbeat packet for the first time, it sends a heartbeat packet to the earphone and the speaker of the second-level node.
[0172] Among them, if the first-level node and the second-level node support the first network connection method, the first-level node and the second-level node can perform window alignment according to the clock difference, and control the timing of the first-level node broadcasting the heartbeat packet and / or the timing of the second-level node opening the scanning window, so that the scanning window enters the receiving state when the first-level node broadcasts the heartbeat packet. After the window alignment, the second-level node can quickly and accurately receive the heartbeat packet broadcast by the first-level node in the subsequent scanning window, thereby reducing the number of heartbeat packet interactions per unit time, improving the reliability of heartbeat packet reception, reducing communication costs and power consumption, and realizing fast, accurate, and timely online detection between devices.
[0173] For example, in Figure 1A the intelligent connection network shown, the mobile phone and the earphone support the first network connection method Bluetooth BLE. After the mobile phone receives the heartbeat packet for the first time, refer to Figure 3A, at time tA, start broadcasting a heartbeat packet group so that the headset can receive the heartbeat packets in the group. If the headset receives the X3rd heartbeat packet and the clock difference between the headset and the mobile phone is tC3, then the headset and the mobile phone can perform window alignment based on the clock difference tC3 using the above strategy. For example, when using the first strategy, the mobile phone broadcasts the heartbeat packet group periodically at the time of tA + m * T1 corresponding to its local clock according to the first preset period T1. Based on the clock difference, the mobile phone periodically opens the scanning window at the time of tA + m * T1 + tC3 corresponding to its local clock to receive the heartbeat packet. In this way, the timing of the mobile phone broadcasting the heartbeat packet is consistent with the activation timing of the headset's scanning window. When the mobile phone broadcasts the heartbeat packet, the scanning window of the headset is also open, which can reduce the invalid broadcast and scanning duty cycle, improve the efficiency and response speed of heartbeat packet detection, and achieve fast, accurate, and timely connection and online detection between the mobile phone and the headset.
[0174] If the first-level node and the second-level node support the second network connection method but do not support the first network connection method, the first-level node can send heartbeat packets to the second-level node periodically based on the second network connection method according to the first preset period T1, and the second-level node can wake up and run periodically and perform real-time response according to the clock difference and the first preset period T1. In this way, the second-level node can wake up and run regularly and respond to the heartbeat, can receive and respond to the heartbeat packet efficiently, accurately, and timely, reduce the disordered heartbeat packets and multiple repeated heartbeat responses, and save the power consumption of the second-level node.
[0175] Exemplarily, Wi-Fi is supported between the mobile phone and the speaker. Here, Wi-Fi belongs to the second network connection method and does not support the first network connection method. As Figure 8 shown, the mobile phone sends a heartbeat packet group to the speaker at time tA based on the Wi-Fi connection and carries the sending timestamp tA. After receiving the heartbeat packet at time tr4, the speaker sends a response message to the mobile phone and carries the receiving timestamp tr4. After receiving the response message sent by the speaker at time tnow4, the mobile phone calculates the transmission delay tdelay4 = (tnow4 - tA) / 2. The clock difference between the mobile phone and the speaker is tC4 = tr4 - tA - tdelay4. The mobile phone can notify the clock difference to the speaker so that the speaker can wake up regularly to receive the heartbeat packet according to the clock difference and the first preset period T1 in the future.
[0176] Subsequently, the mobile phone periodically sends a heartbeat packet group from the kernel bottom protocol stack to the speaker at the time of tA + m * T1 corresponding to its local clock based on the Wi-Fi connection. The speaker wakes up and runs periodically at the time of tA + m * T1 + tC4 corresponding to its local clock, and performs real-time response after receiving the heartbeat packet through the Wi-Fi connection, which can reduce the disordered heartbeat packets and multiple repeated heartbeat responses, and does not require window alignment like the first network connection method.
[0177] That is to say, Figure 1A In the shown smart network, the mobile phone as the primary node and the headset as the secondary node support Bluetooth BLE in the first network connection mode, can perform window alignment based on the clock difference, and periodically exchange heartbeat packets after the window alignment, so as to perform online detection of electronic devices. The mobile phone as the primary node and the speaker as the secondary node support Wi-Fi in the second network connection mode, but do not support the first network connection mode, and can periodically exchange heartbeat packets based on the clock difference, so as to perform online detection of electronic devices.
[0178] The above is based on Figure 1A In the shown intelligent network, the central node, the first-level node and the second-level node are taken as examples to illustrate the online detection method provided by the embodiment of the present application. When the intelligent network also includes nodes of other levels (such as third-level nodes and fourth-level nodes), the central node sends a heartbeat packet to the first-level node, the first-level node sends the heartbeat packet to the second-level node, the second-level node can also send the heartbeat packet to the third-level node, the third-level node can also send the heartbeat packet to the fourth-level node, and so on, which will not be repeated here. In this way, the heartbeat packet is efficiently, quickly and accurately received between the adjacent upper and lower nodes (or directly connected upper and lower nodes) of the whole network, thereby improving the receiving efficiency of the heartbeat packet, reducing the number and duration of sending and receiving the heartbeat packet, and reducing the power consumption of the electronic device, so that the multiple electronic devices in the network can be based on the heartbeat packet. Fast, timely and accurate online detection can be achieved, and the number of electronic devices that can be connected to the intelligent network can also be increased.
[0179] Therefore, this solution can transmit heartbeat packets in sequence between the upper and lower nodes in the entire intelligent network (this can also be called heartbeat synchronization in the entire intelligent network), reduce disordered heartbeats, and perform unified and orderly online detection of each electronic device in the intelligent network, so that online electronic devices can be used to quickly, directly and collaboratively execute services.
[0180] In addition, when the intelligent network is constructed before the service request, the efficiency of the network heartbeat synchronization can be improved, making the device status and online and offline responses in the intelligent network more real-time and accurate. In addition, it can reduce the energy consumption of the background network, make the network orderly, and improve the network stability when there are a large number of devices.
[0181] Understandably, Figure 1A The smart network shown is only an example. The smart network can also have different network topologies, more electronic devices (such as smart lights, smart curtains, smart remote controls or electronic locks, etc.) and more complex network connections. Smart networks of various structures can use the above method to exchange heartbeat packets for online detection.
[0182] In addition, in some embodiments of the present application, when a certain node enters the screen-on state, it is usually performing a service and thus is not sensitive to power consumption. The scanning operation has little impact on the power consumption of this node. Therefore, when this node opens a scanning window to align the window, the duty cycle of the scanning window can also be relatively large to ensure that this node can receive the heartbeat packet in a timely and fast manner and reduce the missed reception of the heartbeat packet due to strong interference. Conversely, when this node enters the screen-off state, the duty cycle of the scanning window can be relatively small to save power consumption.
[0183] In some other embodiments of the present application, if the device types of the nodes are different, the duty cycles of the scanning windows can also be different. For example, if a node is not sensitive to power consumption, the duty cycle of the scanning window can be relatively large to ensure that the heartbeat packet can be received in a timely and fast manner and reduce the missed reception of the heartbeat packet due to strong interference. If a node is relatively sensitive to power consumption, the duty cycle of the scanning window can be relatively small to save power consumption.
[0184] In addition, in the embodiments of the present application, the duration of the scanning window of the node can be preset in advance, and this duration is greater than the duration of one heartbeat packet. For example, it can be set to the time length of 3 heartbeat packets, so as to try to ensure that the heartbeat packet can be received within the scanning window and the duration of the scanning window is relatively short, thereby reducing the power consumption of this node.
[0185] In some embodiments of the present application, when a certain node is performing a service, it can suspend sending the heartbeat packet group according to the first preset period T1. The central node can also trigger an adjustment to the time when it starts to send the heartbeat packet group periodically. For example, when the central node is performing a service, it can suspend sending the heartbeat packet group according to the first preset period T1. After the service ends, the central node can trigger starting to send the heartbeat packet group periodically according to the first preset period T1 from the moment tAdj. The central node can notify the adjusted time tAdj to the first-level node, and the first-level node adjusts the scanning window accordingly for window alignment. The subsequent nodes will sequentially pass the adjusted time tAdj to their respective lower-level nodes.
[0186] In addition, in some embodiments, the central node can trigger a recalculation of the clock difference according to a preset second preset period T2, and clock difference calibration is performed among the nodes at all levels. When the clock difference changes or when the change in the clock difference is greater than or equal to the second preset value, the nodes in the intelligent connection network update the clock difference and re-align the windows based on the clock difference. Among them, the second preset period T2 is greater than the first preset period T1. For example, the first preset period T1 can be 5 minutes, and the second preset period can be 1 hour. The central node broadcasts a heartbeat packet group every 5 minutes and triggers an update of the clock difference every 1 hour.
[0187] In some technical solutions, over time, the clock difference between nodes in the intelligent connection network may change. The second preset period T2 can be a preset empirical value, which is related to the threshold of the cumulative change of the clock difference. That is to say, after an interval of T2, the cumulative change of the clock difference may have exceeded the threshold, so the central node can trigger the recalculation of the clock difference.
[0188] In some other embodiments, if a certain node finds that the number of heartbeat packets received this time is greater than or equal to a third preset value compared with the first received heartbeat packet, the clock difference may have changed greatly, so it can request the central node to trigger the update of the clock difference. For example, the third preset value is 3. When the mobile phone first receives the second heartbeat packet of the large screen broadcast, if the mobile phone receives the seventh heartbeat packet of the large screen broadcast this time, 7 - 2 = 5 is greater than the third preset value 3, the clock difference may have changed greatly, so the mobile phone can request the large screen to trigger the recalculation of the clock difference. Then, each node realigns the window based on the clock difference again.
[0189] In some other embodiments, if a certain node finds that the number of heartbeat packets received this time is greater than or equal to a fourth preset value compared with the first received heartbeat packet, it can report to the upper node of this node, and the upper node of this node can request the central node to trigger the update of the clock difference. For example, the fourth preset value is 4. When the earphone first receives the third heartbeat packet of the mobile phone broadcast, if the earphone receives the ninth heartbeat packet of the mobile phone broadcast this time, 9 - 3 = 6 is greater than the fourth preset value 4, the clock difference may have changed greatly, so the earphone can report to the mobile phone, and the mobile phone can request the large screen to trigger the recalculation of the clock difference. Then, each node realigns the window based on the clock difference again.
[0190] In some other embodiments, if a certain node finds, according to the received heartbeat response message, that the number of heartbeat packets received this time by the lower node of this node is greater than or equal to a fifth preset value compared with the first received heartbeat packet, it can request the central node to trigger the update of the clock difference. For example, the fifth preset value is 3. When the mobile phone determines that the earphone receives the eighth heartbeat packet of the mobile phone broadcast this time, if the earphone first receives the fourth heartbeat packet of the mobile phone broadcast, then 8 - 4 = 4 is greater than the fifth preset value 3, the clock difference may have changed greatly, so the mobile phone can request the large screen to trigger the recalculation of the clock difference. If this node is the central node, the clock difference is directly triggered to be updated in this case. Then, each node realigns the window based on the clock difference again.
[0191] In addition, in the embodiments of the present application, if a new node is added to the intelligent connection network, each node re-determines the network topology relationship, re-calculates the clock difference, and performs window alignment, so as to exchange heartbeat packets after window alignment for online detection. If a certain node leaves the intelligent connection network, each node re-determines the network topology relationship, re-calculates the clock difference, and performs window alignment, so as to exchange heartbeat packets after window alignment for online detection. If the central node changes due to reasons such as adding a new node or a node leaving, the new central node triggers the re-calculation of the clock difference and performs window alignment, so as to exchange heartbeat packets after window alignment for online detection.
[0192] In some embodiments, as described above, after the devices in the intelligent connection network are successfully networked, it can be determined that all electronic devices are online. If it is found that a certain electronic device has left during online detection through heartbeat packets, the offline information of the electronic device can be notified to the central node or to each electronic device in the intelligent connection network, so that the central node or each electronic device can uniformly learn about the online status of each electronic device.
[0193] In the intelligent connection network, after a certain node receives the heartbeat packet sent by its upper-level node for the first time, it sends a group of heartbeat packets to its lower-level node. Subsequently, according to the time when the heartbeat packet group is sent to the lower-level node for the first time, the node periodically sends the heartbeat packet group to the lower-level node according to T1. Therefore, generally, when the node subsequently sends the heartbeat packet group to the lower-level node according to T1, it has already received the heartbeat packet from the upper-level node. If the node does not receive the heartbeat packet from the upper-level node when sending the heartbeat packet group to the lower-level node according to the period subsequently, it may be due to network reasons, a change in the clock difference, or the upper-level node leaving, etc., resulting in an abnormality. Thus, the heartbeat packet group can be sent to the lower-level node according to the normal period, and an abnormal recovery process is triggered. For example, after window alignment, the mobile phone determines to broadcast a group of heartbeat packets to the earphone at 18:05, 18:10, 18:15... every 5 minutes; if the mobile phone does not receive the heartbeat packet broadcast by the large screen at 18:05, an abnormality may occur. Thus, the mobile phone still broadcasts the group of heartbeat packets to the earphone at 18:05 according to the normal period, and an abnormal recovery process is triggered.
[0194] During the abnormal recovery process, if the node receives the heartbeat packet from the upper-level node within the preset duration, the clock difference can be calibrated according to the received heartbeat packet; if the intermediate node still does not receive the heartbeat packet from the upper-level node within the preset duration, it can be determined whether the upper-level node has left, whether the network topology relationship needs to be re-determined, whether the clock difference needs to be re-calculated, and other related abnormal processing.
[0195] In the above embodiments of the present application, window alignment is used to send and receive heartbeat packets for online detection. In other embodiments, the clock difference can also be determined based on other messages other than heartbeat packets, and window alignment can also be used to interact with other target information instead of sending and receiving heartbeat packets, so that other applications other than online detection can be performed. The application scenarios and scopes of window alignment in the embodiments of the present application are not limited. In this way, the electronic device can quickly and accurately receive the target information within the receiving window, thereby reducing the number of message interactions per unit time, reducing communication costs and power consumption, improving the reliability of target information reception, and making the transmission and reception of target information between multiple electronic devices in the intelligent connection network faster, more accurate, and more timely.
[0196] For example, the target information may include changes in the basic information or network capability information of an electronic device in the intelligent connection network. By adopting the solution provided by the embodiments of the present application, other electronic devices in the intelligent connection network can quickly and accurately receive the target information within the receiving window after window alignment, so as to learn about changes in the basic information or network capability information of the electronic device, etc., so that other electronic devices can perform corresponding adaptation or other related processing according to the changed basic information or network capability information of the electronic device. This solution can improve the reliability of target information reception, improve the efficiency of multiple electronic devices in the intelligent connection network to synchronously learn about changes in the basic information or network capability information of an electronic device, and make the transmission and reception of target information between multiple electronic devices in the intelligent connection network faster, more accurate, and more timely.
[0197] For example, the basic information of the electronic device may include at least one of the following: the identifier of the electronic device (deviceID), the name of the electronic device (device name), the type of the electronic device (device type), the network identifier (NetworkID), the weight information of the electronic device, the role information of the electronic device, and the version information of the electronic device. Among them, the identifier of the electronic device is used to uniquely identify an electronic device; the name of the electronic device is the name defined by the user for the electronic device or the name defined by the electronic device at the factory; the type of the electronic device indicates which type the electronic device belongs to, for example, the type is: mobile phone, PC, wearable, earphone, glasses, speaker, car machine, smart screen, or car machine, etc. The network identifier is a unique networking identifier assigned by the network to the electronic device after the electronic device accesses the network, for example, it can be a unique device identifier (unique device identifier, UDID). The version information of the electronic device represents the version number of the current system of the electronic device. The network capability information can refer to the relevant description above.
[0198] Exemplarily, other electronic devices in the intelligent connection network have previously saved the IP address of electronic device 1 so as to be able to perform business data transmission with electronic device 1, and the target information is that electronic device 1 has changed its IP address. Other electronic devices in the intelligent connection network can efficiently and accurately receive this target information based on window alignment. After receiving this target information, other electronic devices in the intelligent connection network can update the previously saved IP address of electronic device 1.
[0199] Another exemplarily, the previous network capability of electronic device 1 did not support point-to-point (P2P) communication, and the target information is that electronic device 1 supports P2P communication. Other electronic devices in the intelligent connection network can efficiently and accurately receive this target information based on window alignment. After receiving this target information, other electronic devices in the intelligent connection network can perform P2P communication with electronic device 1.
[0200] Another exemplarily, the target information is whether other content such as the hotspot of electronic device 1 has been changed.
[0201] Other embodiments of the present application further provide an online detection method, which can be used between any two electronic devices supporting the first network connection method, or between any two electronic devices supporting the first network connection method in other network formations, and is not limited to being applied in an intelligent connection network composed of multiple devices. Any two electronic devices can calculate the clock difference and perform window alignment in the above manner, and interact heartbeat packets after window alignment for online detection. In this way, an electronic device can quickly and accurately receive heartbeat packets within the receiving window, thereby reducing the transceiver of heartbeat packets per unit time, reducing communication costs, improving the reliability of heartbeat packet reception, and making the online detection faster, more accurate, and more timely. In some other embodiments, any two electronic devices can interact other target information other than heartbeat packets after window alignment, so as to achieve other possible functions other than online detection.
[0202] The above embodiments of the present application perform window alignment by calculating the clock difference between each electronic device. Among them, the local clocks of each electronic device are independent of each other, do not need to be consistent with the world time, and do not affect the user's perception of time through each electronic device. This solution can also be compatible with electronic devices running different operating systems, and lightweight devices can also adopt this solution to efficiently interact heartbeat packets or target information and other content.
[0203] In addition, in combination with the above embodiments and the corresponding drawings, another embodiment of the present application provides an online detection method, which can be used in an intelligent connection network composed of multiple devices. The intelligent connection network includes a first electronic device and one or more second electronic devices. The first electronic device and the second electronic device can have Figure 1BThe structure shown. Among them, the first electronic device is the upper-level node of the second electronic device, and the second electronic device is the lower-level node of the first electronic device. For example, the first electronic device can be the above-mentioned central node, and the second electronic device can be the above-mentioned first-level node; or, the first electronic device can be the above-mentioned first-level node, and the second electronic device can be the above-mentioned second-level node, etc. Refer to Figure 9 , the method may include:
[0204] 901. One or more second electronic devices obtain their respective corresponding first clock differences, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device.
[0205] Exemplarily, the first electronic device can be Figure 1A the large screen shown, and the second electronic device can be Figure 1A the mobile phone shown, and the first clock difference can be the clock difference tC1 between the mobile phone and the large screen.
[0206] 902. The first electronic device sends corresponding one or more first target messages to one or more second electronic devices.
[0207] Exemplarily, the second electronic device is a mobile phone, and the first target message is a heartbeat packet. For example, the first target message can be the 1st heartbeat packet in the heartbeat packet group corresponding to the above-mentioned first strategy, or the X1th heartbeat packet in the heartbeat packet group corresponding to the above-mentioned second strategy, or the 1st heartbeat packet or the X1-X0th heartbeat packet in the heartbeat packet group corresponding to the above-mentioned third strategy, etc.
[0208] 903. One or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window receiving state according to their respective corresponding first clock differences.
[0209] For example, the second electronic device can control the timing of the first electronic device sending the first target message and / or the timing of the second electronic device entering the receiving state according to the first clock difference and any one of the above-mentioned first to third strategies, so as to control the second electronic device to receive the corresponding first target message when in the window receiving state.
[0210] For example, one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to their respective corresponding first clock differences and a first preset period, so that the second electronic device receives the corresponding first target message when in the window receiving state.
[0211] For another example, one or more second electronic devices control, according to their respective first clock differences, that the second electronic devices are in a window receiving state before the corresponding first target message arrives at the second electronic devices at a moment calculated based on a pre-obtained transmission delay, so that the second electronic devices receive the corresponding first target message when in the window receiving state.
[0212] Based on this solution, the second electronic devices can control the sending timing and / or receiving timing of the target message based on the clock difference, so that the receiving end device receives the target message when in the window receiving state, can receive the target message efficiently, and reduce power consumption.
[0213] In this way, between any electronic devices with a superior-subordinate node relationship in the intelligent connection network, the method provided in the embodiments of the present application can be used to transmit the first target message, and receive the first target message when in the window receiving state according to the clock difference, so as to be able to receive the first target message efficiently, quickly, and accurately, reduce the number and duration of interactions of the first target message, save the power consumption of the electronic devices in the intelligent connection network, and improve the efficiency of corresponding processing based on the first target message. For example, when the first target message includes a heartbeat packet, the online detection of the electronic device can be efficiently performed according to the heartbeat packet in the first target message.
[0214] It can be understood that, in order to implement the above functions, the above electronic devices include the corresponding hardware and / or software modules for executing each function. Combining the algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraint conditions of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to exceed the scope of the present application.
[0215] In this embodiment, the electronic device can be divided into function modules according to the above method examples. For example, each function module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative, only a logical function division, and there may be other division methods in actual implementation.
[0216] In the case of dividing each function module corresponding to each function, the electronic device may include: a processing unit, a receiving unit, a sending unit, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be cited to the function description of the corresponding function module, and will not be repeated here.
[0217] The embodiments of the present application also provide an electronic device, such as Figure 10 shown, including: one or more processors 1001, a memory 1002, and one or more computer programs 1003. The above-mentioned devices can be connected through one or more communication buses 1004. Wherein the one or more computer programs 1003 are stored in the above-mentioned memory 1002 and configured to be executed by the one or more processors 1001. The one or more computer programs 1003 include instructions, and the above instructions can be used to execute each step in the above embodiments. Among them, all relevant contents of each step involved in the above method embodiments can be cited in the function description of the corresponding physical devices, and will not be elaborated here.
[0218] Exemplarily, the above-mentioned processor 1001 can specifically be Figure 1B the processor 110 shown, and the above-mentioned memory 1002 can specifically be Figure 1B the internal memory 121 shown.
[0219] The embodiments of the present application also provide an electronic device, including one or more processors and one or more memories. The one or more memories are coupled to the one or more processors. The one or more memories are used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the above-mentioned related method steps to implement the online detection method in the above embodiments.
[0220] The embodiments of the present application also provide a computer-readable storage medium, in which computer instructions are stored. When the computer instructions run on an electronic device, the electronic device executes the above-mentioned related method steps to implement the online detection method in the above embodiments.
[0221] The embodiments of the present application also provide a computer program product. When the computer program product runs on a computer, the computer executes the above-mentioned related steps to implement the online detection method executed by the electronic device in the above embodiments.
[0222] In addition, the embodiments of the present application also provide a device, which can specifically be a chip, a component or a module. The device can include a processor and a memory connected to each other. Wherein, the memory is used to store computer execution instructions. When the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip executes the online detection method executed by the electronic device in each of the above method embodiments.
[0223] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be elaborated here.
[0224] Another embodiment of this application provides a network system. This network system can be the above-mentioned intelligent connection network, can include multiple electronic devices, and can be used to implement the above-mentioned online detection method.
[0225] Through the description of the above embodiments, those skilled in the art can understand that for the convenience and simplicity of description, only the above-mentioned division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0226] In several embodiments provided in this application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above-mentioned modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0227] The unit described as a separated component may or may not be physically separated. The component displayed as a unit may be a physical unit or multiple physical units, that is, it can be located in one place, or it can be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0228] In addition, each functional unit in each embodiment of this application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0229] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0230] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A message interaction method for a network composed of multiple devices, the network including a first electronic device and one or more second electronic devices, characterized in that, The method includes: The one or more second electronic devices obtain respective corresponding first clock differences, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device, and the local clocks of the first electronic device and the second electronic device are independent of each other; The first electronic device sends corresponding one or more first target messages to the one or more second electronic devices; The one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window reception state according to their respective corresponding first clock differences.
2. The method according to claim 1, characterized in that, The first electronic device sending corresponding one or more first target messages to the one or more second electronic devices includes: The first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period; The one or more second electronic devices controlling the second electronic device to receive the corresponding first target message when in the window reception state according to their respective corresponding first clock differences includes: The one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window reception state according to their respective corresponding first clock differences and the first preset period.
3. The method according to claim 2, wherein The one or more second electronic devices controlling the second electronic device to receive the corresponding first target message when in the window reception state according to their respective corresponding first clock differences and the first preset period includes: The one or more second electronic devices control the second electronic device to enter the window reception state when the first electronic device sends the corresponding first target message according to their respective corresponding first clock differences and the first preset period, so that the second electronic device receives the corresponding first target message when in the window reception state.
4. The method according to claim 3, wherein Before the one or more second electronic devices obtain their respective corresponding first clock differences, the method further includes: The first electronic device calculates the first clock difference according to the second target messages recently received by the one or more second electronic devices respectively; Wherein, the second target message comes from a first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval, the second target message is the Xth message in the first message group, N is a positive integer, and X is a positive integer less than or equal to N; The one or more second electronic devices obtaining their respective corresponding first clock differences includes: The one or more second electronic devices obtain their respective corresponding first clock differences from the first electronic device.
5. The method according to claim 4, wherein The method further includes: The first electronic device sends the first message group to the one or more second electronic devices at time t1; After receiving the Xth message in the first message group at their respective tr moments, the one or more second electronic devices respectively send a first response message to the first electronic device, and the first response message includes indication information of the tr and the transmission timestamp tX of the Xth message; At one or more tnow moments, after receiving the one or more first response messages from the one or more second electronic devices, the first electronic device respectively calculates the transmission delays corresponding to the one or more second electronic devices according to the tnow and the tX; The first electronic device calculates the first clock difference according to the second target messages respectively recently received by the one or more second electronic devices, including: The first electronic device calculates the first clock difference corresponding to each of the one or more second electronic devices according to the transmission delays, the tr, and the tX respectively corresponding to the one or more second electronic devices; 6. The method according to claim 5, wherein The first electronic device sends one or more corresponding first target messages to the one or more second electronic devices, including: The first electronic device periodically sends a second message group to the one or more second electronic devices according to the t1 and the first preset period, the second message group includes a plurality of messages sent at a preset interval, and the first target message corresponding to each of the one or more second electronic devices is the Xth message corresponding to each of the one or more second electronic devices in the second message group; The one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period respectively corresponding to each of them, including: The one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the second message group according to the first clock difference, the t1, and the first preset period respectively corresponding to each of them, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message; 7. The method according to claim 5, characterized in that The first electronic device sends one or more corresponding first target messages to the one or more second electronic devices, including: The first electronic device periodically sends a second message group to the one or more second electronic devices according to the t1 and the first preset period, the second message group includes a plurality of messages sent at a preset interval, and the first target message corresponding to each of the one or more second electronic devices is the Xth message corresponding to each of the one or more second electronic devices in the second message group; The one or more second electronic devices control the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period respectively corresponding to each of them, including: The one or more second electronic devices control the second electronic devices to enter a window receiving state when the first electronic device sends a corresponding first target message according to the respective corresponding first clock difference, the tX, and the first preset period.
8. The method according to claim 5, wherein The first electronic device sending the corresponding one or more first target messages to the one or more second electronic devices includes: The first electronic device periodically sends a second message group to the one or more second electronic devices according to tX0 and the first preset period, where tX0 is the value of tX with a relatively early timing among the corresponding tXs of the one or more second electronic devices, tX0 corresponds to the X0th message in the first message group, the second message group includes a plurality of messages sent at a preset interval, and the first target message corresponding to each of the one or more second electronic devices is the (X - X0 + 1)th message in the second message group; The one or more second electronic devices controlling the second electronic devices to enter a window receiving state when the first electronic device sends a corresponding first target message according to the respective corresponding first clock difference and the first preset period includes: The one or more second electronic devices control the second electronic devices to enter a window receiving state when the first electronic device sends the second message group according to the respective corresponding first clock difference, the tX, and the first preset period, so that the second electronic devices enter a window receiving state when the first electronic device sends a corresponding first target message.
9. The method according to claim 5, wherein The network includes one second electronic device, and the first electronic device periodically sending the corresponding one or more first target messages to the one or more second electronic devices according to the first preset period includes: The first electronic device periodically sends a second message group to the second electronic device according to the tX and the first preset period, the second message group includes a plurality of messages sent at a preset interval, and the first target message is the first message in the second message group; The one or more second electronic devices controlling the second electronic devices to enter a window receiving state when the first electronic device sends a corresponding first target message according to the respective corresponding first clock difference and the first preset period includes: The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a corresponding first target message according to the first clock difference, the tX, and the first preset period.
10. The method according to any one of claims 1-9, characterized in that The method further includes: If the second electronic device receives the Xi-th message in the second message group, and the number of intervals between the Xi-th message and the X-th message is greater than or equal to a preset value, then request the first electronic device to update the first clock difference.
11. The method according to any one of claims 1-9, characterized in that, The method further includes: If the first electronic device determines according to the response message from the second electronic device that the number of messages between the Xi-th message received by the second electronic device and the X-th message is greater than or equal to a preset value, the first electronic device updates the first clock difference.
12. The method according to claim 2, wherein The one or more second electronic devices control the second electronic device to receive the corresponding first target message when in the window receiving state according to their respective corresponding first clock differences, including: The one or more second electronic devices control the second electronic device to enter the window receiving state before the moment when the corresponding first target message arrives at the second electronic device calculated according to the pre-obtained transmission delay according to their respective corresponding first clock differences, so that the second electronic device receives the corresponding first target message when in the window receiving state.
13. The method according to any one of claims 1-9, characterized in that, The network further includes one or more third electronic devices, each third electronic device corresponding to one second electronic device, and each second electronic device corresponding to one or more third electronic devices. The method further includes: The one or more third electronic devices obtain their respective corresponding second clock differences, where the second clock difference is the difference between the local clock of the third electronic device and the local clock of the second electronic device corresponding to the third electronic device; The second electronic device sends a third target message to the corresponding one or more third electronic devices; The one or more third electronic devices control the third electronic device to receive the third target message when in the window receiving state according to their respective corresponding second clock differences.
14. The method according to any one of claims 1-9, characterized in that, The first target message is an advertising non-connectable indication (ADV_NONCONN_IND) message of Bluetooth Low Energy (BLE).
15. The method according to any one of claims 1-9, characterized in that, The second electronic device obtains the first clock difference, including: The second electronic device obtains the first clock difference updated according to the second preset period from the first electronic device.
16. The method according to claim 15, characterized in that, The second preset period corresponds to a preset clock difference cumulative change threshold.
17. The method according to any one of claims 1-9, characterized in that, The first target message is used to transmit heartbeat packets.
18. A message interaction method for a first electronic device in a network composed of multiple devices, the network further including one or more second electronic devices, characterized in that, The method includes: The first electronic device calculates the first clock differences respectively corresponding to the one or more second electronic devices, where the first clock difference is the difference between the local clock of the second electronic device and the local clock of the first electronic device, and the local clocks of the first electronic device and the second electronic device are independent of each other; The first electronic device sends the first clock differences respectively corresponding to the one or more second electronic devices to the corresponding second electronic devices, and the first clock difference is used to control the second electronic device to receive the corresponding first target message when in the window receiving state; The first electronic device sends the corresponding one or more first target messages to the one or more second electronic devices.
19. The method according to claim 18, wherein The first electronic device sends the corresponding one or more first target messages to the one or more second electronic devices, including: The first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period.
20. The method according to claim 19, wherein The first electronic device calculates the first clock differences corresponding to the one or more second electronic devices respectively, including: The first electronic device calculates the first clock differences according to the second target messages respectively received most recently by the one or more second electronic devices; Wherein, the second target messages are from a first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval, the second target messages are the Xth messages in the first message group, N is a positive integer, and X is a positive integer less than or equal to N.
21. The method according to claim 20, wherein The first electronic device calculates the first clock differences according to the second target messages respectively received most recently by the one or more second electronic devices, including: The first electronic device sends the first message group to the one or more second electronic devices at time t1; The first electronic device receives, at one or more tnow times, first response messages from the one or more second electronic devices, and the first response messages include indication information of the time tr when the second electronic device receives the Xth message in the first message group and the transmission timestamp tX of the Xth message; The first electronic device calculates the transmission delays corresponding to the one or more second electronic devices respectively according to the tnow and the tX corresponding to the one or more second electronic devices respectively; The first electronic device calculates the first clock differences corresponding to the one or more second electronic devices respectively according to the transmission delays, the tr and the tX corresponding to the one or more second electronic devices respectively.
22. The method according to claim 21, wherein The first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period, including: The first electronic device periodically sends a second message group to the one or more second electronic devices according to the t1 and the first preset period, the second message group includes a plurality of messages sent at a preset interval, and the first target messages corresponding to the one or more second electronic devices respectively are the Xth messages corresponding to the one or more second electronic devices respectively in the second message group.
23. The method according to claim 21, wherein The first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period, including: The first electronic device periodically sends a second message group to the one or more second electronic devices according to tX0 and the first preset period, tX0 is the value of tX corresponding to the one or more second electronic devices with an earlier timing, tX0 corresponds to the X0th message in the first message group, the second message group includes a plurality of messages sent at a preset interval, and the first target messages corresponding to the one or more second electronic devices respectively are the (X - X0 + 1)th messages in the second message group corresponding to the one or more second electronic devices respectively.
24. The method according to claim 21, wherein The network includes a second electronic device, and the first electronic device periodically sends the corresponding one or more first target messages to the one or more second electronic devices according to a first preset period, including: The first electronic device periodically sends a second message group to the second electronic device according to the tX and the first preset period, the second message group includes a plurality of messages sent at a preset interval, and the first target message is the first message in the second message group.
25. The method according to any one of claims 18 - 24, characterized in that, The method further includes: If the first electronic device determines according to the response message from the second electronic device that the number of messages between the Xi-th message received by the second electronic device and the X-th message is greater than or equal to a preset value, the first electronic device updates the first clock difference.
26. The method according to any one of claims 18-24, characterized in that, The first clock difference is used to control the second electronic device to enter a window reception state when the first electronic device sends the corresponding first target message, so that the second electronic device receives the corresponding first target message when in the window reception state.
27. The method according to any one of claims 18-24, characterized in that, The first clock difference is used to control the second electronic device to enter a window reception state before the moment when the corresponding first target message calculated according to the pre-obtained transmission delay arrives at the second electronic device, so that the second electronic device receives the corresponding first target message when in the window reception state.
28. A message interaction method for a second electronic device in a network composed of multiple devices, the network further including a first electronic device, characterized in that, The method includes: The second electronic device obtains a first clock difference, which is the difference between the local clock of the second electronic device and the local clock of the first electronic device, and the local clocks of the first electronic device and the second electronic device are independent of each other; The second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when in the window reception state according to the first clock difference.
29. The method according to claim 28, wherein The second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when in the window reception state according to the first clock difference, including: The second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when in the window reception state according to the first clock difference and the first preset period.
30. The method according to claim 29, wherein The second electronic device controls the second electronic device to receive the corresponding first target message from the first electronic device when in the window reception state according to the first clock difference and the first preset period, including: The second electronic device controls the second electronic device to enter a window reception state when the first electronic device sends the corresponding first target message according to the first clock difference and the first preset period, so that the second electronic device receives the corresponding first target message from the first electronic device when in the window reception state.
31. The method according to claim 30, wherein The second electronic device obtains the first clock difference, including: The second electronic device obtains the first clock difference from the first electronic device, and the first clock difference is obtained according to the second target message recently received by the second electronic device. Wherein, the second target message is from a first message group sent by the first electronic device, and the first message group includes N messages sent at a preset interval. The second target message is the Xth message in the first message group, N is a positive integer, and X is a positive integer less than or equal to N.
32. The method according to claim 31, wherein The method further includes: The second electronic device receives the Xth message in the first message group from the first electronic device at time tr; The second electronic device sends a first response message to the first electronic device. The first response message includes indication information of tr and the transmission timestamp tX of the Xth message, and tr and tX are used to calculate the first clock difference.
33. The method according to claim 32, wherein The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a corresponding first target message according to the first clock difference and the first preset period, including: The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a second message group according to the first clock difference, the transmission time t1 of the first message in the first message group, and the first preset period, so that the second electronic device enters a window receiving state when the first electronic device sends a corresponding first target message. Wherein, the second message group includes multiple messages sent at a preset interval, and the first target message is the Xth message in the second message group.
34. The method according to claim 32, wherein The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a corresponding first target message according to the first clock difference and the first preset period, including: The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a corresponding first target message according to the first clock difference, the transmission time tX of the Xth message in the first message group, and the first preset period.
35. The method according to claim 32, characterized in that, The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a corresponding first target message according to the first clock difference and the first preset period, including: The second electronic device controls the second electronic device to enter a window receiving state when the first electronic device sends a second message group according to the first clock difference, tX, and the first preset period, so that the second electronic device enters a window receiving state when the first electronic device sends a corresponding first target message. Wherein, the second message group includes multiple messages sent at a preset interval, and the first target message is the first message or the (X - X0 + 1)th message in the second message group, and the X0th message is sent before the Xth message in the first message group.
36. The method according to any one of claims 28-35, characterized in that, The method further includes: If the second electronic device receives the Xi th message in the second message group, and the number of intervals between Xi and the Xth message is greater than or equal to a preset value, the first electronic device is requested to update the first clock difference.
37. The method according to any one of claims 28-35, characterized in that The second electronic device controls, according to the first clock difference, the second electronic device to receive a corresponding first target message from the first electronic device when the second electronic device is in a window receiving state, including: The second electronic device controls, according to the first clock difference, the second electronic device to enter a window receiving state before the moment when a corresponding first target message arrives at the second electronic device calculated according to a pre-obtained transmission delay, so that the second electronic device receives the corresponding first target message from the first electronic device when the second electronic device is in the window receiving state.
38. The method according to any one of claims 28-35, characterized in that, The network further includes one or more third electronic devices, and each second electronic device corresponds to one or more of the third electronic devices. The method further includes: The second electronic device sends a third target message to the corresponding one or more third electronic devices.
39. The method according to any one of claims 28 - 35, characterized in that, The second electronic device obtains a first clock difference, including: The second electronic device obtains the first clock difference updated according to a second preset period from the first electronic device.
40. An electronic device, characterized in that, Including: One or more processors; A memory; And one or more computer programs, where the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to execute the message interaction method performed by the first electronic device according to any one of claims 18-27, or cause the electronic device to execute the message interaction method performed by the second electronic device according to any one of claims 28-39.
41. A computer-readable storage medium, characterized in that, Including computer instructions that, when running on a computer, cause the computer to execute the message interaction method performed by the first electronic device according to any one of claims 18-27, or cause the computer to execute the message interaction method performed by the second electronic device according to any one of claims 28-39.
42. A computer program product, characterized in that, When the computer program product runs on a computer, it causes the computer to execute the message interaction method performed by the first electronic device according to any one of claims 18-27, or causes the computer to execute the message interaction method performed by the second electronic device according to any one of claims 28-39.
43. A network system, characterized in that, Including a first electronic device, a second electronic device, and a third electronic device, and the first electronic device, the second electronic device, and the third electronic device are used to execute the message interaction method according to any one of claims 1-17.
Citation Information
Patent Citations
Synchronized low-energy detection technique
CN107889201A