WO2022252796A1 - Online detection method based on heartbeat packet, and device - Google Patents

Online detection method based on heartbeat packet, and device Download PDF

Info

Publication number
WO2022252796A1
WO2022252796A1 PCT/CN2022/084879 CN2022084879W WO2022252796A1 WO 2022252796 A1 WO2022252796 A1 WO 2022252796A1 CN 2022084879 W CN2022084879 W CN 2022084879W WO 2022252796 A1 WO2022252796 A1 WO 2022252796A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
message
electronic devices
target
electronic
Prior art date
Application number
PCT/CN2022/084879
Other languages
French (fr)
Chinese (zh)
Inventor
魏治宇
李世军
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022252796A1 publication Critical patent/WO2022252796A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0225Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0225Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
    • H04W52/0248Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal dependent on the time of the day, e.g. according to expected transmission activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/20Manipulation of established connections
    • H04W76/25Maintenance of established connections
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the embodiment of the present application relates to the field of electronic technology, and in particular to an online detection method and device based on a heartbeat packet.
  • Embodiments of the present application provide an online detection method and device based on heartbeat packets, which can control the timing of sending and/or receiving heartbeat packets based on the clock difference between electronic devices in the network, so that the receiving end device is in the window receiving state
  • Receive heartbeat packets in real time which can improve the receiving efficiency of heartbeat packets, reduce the number and duration of sending and receiving heartbeat packets, and reduce the power consumption of electronic devices, so that multiple electronic devices in the network can be quickly, timely and accurately based on heartbeat packets online test.
  • an embodiment of the present application provides a method for message interaction, which is used in a network composed of multiple devices, where the network includes a first electronic device and one or more second electronic devices.
  • the method includes: one or more second electronic devices acquire 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;
  • An electronic device sends corresponding one or more first target messages to one or more second electronic devices; one or more second electronic devices control the second electronic devices to receive The corresponding first target message is received in the state.
  • the network may be an intelligent connection network
  • the first electronic device is an upper-level node of the second electronic device
  • the second electronic device is a lower-level node of the first electronic device.
  • the first electronic device may be the above-mentioned central node
  • the second electronic device may be the above-mentioned primary node
  • the first electronic device may be the above-mentioned primary node
  • the second electronic device may be the above-mentioned secondary node, etc.
  • the first target message is a heartbeat packet expected to be received by the second electronic device.
  • 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 end device receives the corresponding first target message when it is in the window receiving state, thereby efficiently receiving the first target message message, reducing power consumption.
  • any electronic device in the Zhilian network that has the relationship between upper and lower nodes can use the method provided by the embodiment of the present application to transmit the first target message, and receive the corresponding first target message when it is in the window receiving state according to the clock difference.
  • Target message so that the first target message can be received efficiently, quickly and accurately, the number and duration of message interaction can be reduced, the power consumption of electronic devices in the Smart Connect network can be saved, and the efficiency of corresponding processing according to the target message can be improved.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: sending the first electronic device to one or more A second electronic device periodically sends corresponding one or more first target messages.
  • the one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences, including: one or more second electronic devices according to their corresponding The first clock difference and the first preset period control the second electronic device to receive the corresponding first target message when it is in the window receiving state.
  • the first target message can be sent and received periodically between the first electronic device and the second electronic device.
  • one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock difference and first preset period , including: one or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and the first preset period, so as to Make the second electronic device receive the corresponding first target message when it is in the window receiving state.
  • the second electronic device enters the window receiving state when the first electronic device sends the first target message, and 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, thus The first target message can be received in the window receiving state, so the first target message can be received quickly and efficiently, and the power consumption of the device can be reduced.
  • the method further includes: the first electronic device according to the latest clock difference respectively received by the one or more second electronic devices
  • the second target message calculates the first clock difference.
  • 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 preset intervals, and 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 acquiring respective corresponding first clock differences includes: the one or more second electronic devices acquiring respective corresponding first clock differences from the first electronic device.
  • the first clock difference may be calculated according to the second target message recently received by the second electronic device.
  • the first message group is used to determine the X and tX corresponding to the second electronic device, for example, it may be the heartbeat packet group broadcast to the mobile phone by the large screen for the first time later.
  • the X corresponding to the second target message is used for subsequent window alignment.
  • it may be the heartbeat packet received by the mobile phone from the large screen for the first time, and the heartbeat packet is the Xth heartbeat packet in the heartbeat packet group broadcast by the large screen.
  • the method further includes: the first electronic device sends the first message group to one or more second electronic devices at time t1; one or more second electronic devices receive the message group at respective time tr After reaching the Xth message in the first message group, respectively send the first response message to the first electronic device, the first response message includes indication information of tr and the sending time stamp tX of the Xth message; At one or more tnow times, after receiving one or more first response messages, respectively calculate transmission delays corresponding to one or more second electronic devices according to tnow and tX.
  • the first electronic device calculates the first clock difference according to the second target messages recently received by one or more second electronic devices, including: the first electronic device calculates the transmission delay corresponding to one or more second electronic devices respectively , tr and tX, calculating the first clock difference corresponding to each of the one or more second electronic devices.
  • the first clock difference is calculated and obtained according to information such as the serial number and sending time of the second target message in the second message group received by the second electronic device.
  • the second electronic devices are different, and parameters such as tX, X, and tr corresponding to the second electronic devices are also different.
  • tX is tX1
  • tX is tX2
  • tX is tX2.
  • the second message group is a message group sent by the first electronic device after the windows are aligned.
  • the first message group may be the heartbeat packet group broadcast by the large screen after the windows of the mobile phone and the large screen are aligned later.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to t1 and the first preset period, the first electronic device sends One or more second electronic devices periodically send a second message group, the second message group includes a plurality of messages sent at preset intervals, and the first target messages corresponding to each of the one or more second electronic devices are In the second message group, one or more second electronic devices respectively correspond to the Xth message; one or more second electronic devices control the second electronic device according to the corresponding first clock difference and the first preset cycle.
  • an electronic device When an electronic device sends the corresponding first target message, it enters the window receiving state, including: one or more second electronic devices control the second electronic device according to the corresponding first clock difference, t1 and the first preset period.
  • An electronic device enters the window receiving state when sending the second message group, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
  • 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption.
  • This scheme can correspond to the first strategy of window alignment described later.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to t1 and the first preset period, the first electronic device sends One or more second electronic devices periodically send a second message group, the second message group includes a plurality of messages sent at preset intervals, and the first target messages corresponding to each of the one or more second electronic devices are In the second message group, one or more second electronic devices respectively correspond to the Xth message; one or more second electronic devices control the second electronic device according to the corresponding first clock difference and the first preset cycle.
  • an electronic device When an electronic device sends the corresponding first target message, it enters the window receiving state, including: one or more second electronic devices control the second electronic device according to the corresponding first clock difference, tX and the first preset period.
  • an electronic device When an electronic device sends the corresponding first target message, it enters the window receiving state.
  • 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption.
  • This solution can correspond to the second strategy of window alignment described later.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to tX0 and the first preset period, the first electronic device sends One or more second electronic devices periodically send the second message group, tX0 is the value of the earlier timing in tX corresponding to one or more electronic devices, tX0 corresponds to the X0th message in the first message group, and the first The second message group includes a plurality of messages sent at preset intervals, and the first target message corresponding to 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. -X0+1 messages.
  • One or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and first preset period, including: one or Multiple second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the second message group according to their corresponding first clock difference, tX and the first preset period, so that the second electronic device The window receiving state is entered when the first electronic device sends the corresponding first target message.
  • 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 that it can receive the first target message while in the window receiving state, so it can quickly and efficiently The first target message is successfully received, and power consumption of the device is reduced.
  • This scheme corresponds to the third strategy of window alignment in the following text.
  • the network includes a second electronic device, and the first electronic device sends one or more corresponding first target messages to the second electronic device, including: the first electronic device
  • the preset period is to periodically send the second message group to the second electronic device
  • the second message group includes a plurality of messages sent at preset intervals
  • the first target message is the first message in the second message group.
  • the second electronic device controls the first window to enter the receiving state when the first electronic device sends the corresponding first target message, including: the second electronic device according to the first clock difference, tX and the first preset period, controlling the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message.
  • 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption.
  • the method further includes: if the second electronic device receives the Xi th message in the second message group, and the interval between the Xi th message and the X th message is greater than or equal to the preset If the value is set, the first electronic device is requested to update the first clock difference.
  • the second electronic device may be connected to the first The clock difference between electronic devices varies greatly, so the first electronic device may be requested to update the first clock difference.
  • the method further includes: if the first electronic device determines according to the response message from the second electronic device, the number of intervals between the Xi th message and the X th message received by the second electronic device is greater than or equal to a preset value, the first electronic device updates the first clock difference.
  • the first electronic device may trigger to update the first clock difference.
  • one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences, including: one or more Each second electronic device controls the second electronic device to enter the window receiving state before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device according to the corresponding first clock difference, so as to Make the second electronic device receive the corresponding first target message when it is in the window receiving state.
  • the second electronic device can enter the window receiving state before the arrival of the first target message, so that the second electronic device can receive the first target message when it is in the window receiving state, and thus can quickly and efficiently receive the second target message.
  • a targeted message to reduce device power consumption.
  • the network further includes one or more third electronic devices, each third electronic device corresponds to one second electronic device, and each second electronic device corresponds to one or more third electronic devices
  • the method further includes: one or more third electronic devices obtain their corresponding second clock differences, and 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 difference between them; the second electronic device sends a third target message to the corresponding one or more third electronic devices; one or more third electronic devices control the third electronic device according to the corresponding second clock difference The third object message is received when the window receives state.
  • the target message may also be transferred between the second electronic device and the third electronic device in the same manner.
  • the first target message is a non-connectable advertisement ADV_NONCONN_IND message of Bluetooth Low Energy BLE.
  • the non-connectable broadcast message does not require a special response message to reply, so it can reduce the bandwidth occupation 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.
  • the acquiring the first clock difference by the second electronic device includes: acquiring, by the second electronic device, the first clock difference updated according to a second preset period from the first electronic device.
  • the first electronic device may periodically update the first clock difference, so that the updated first clock difference of the second electronic device performs window alignment.
  • the second preset period corresponds to a preset clock difference cumulative change threshold.
  • the cumulative change of the first clock difference may have exceeded the threshold, so the first electronic device may trigger recalculation of the clock difference.
  • the first target message is used to transmit heartbeat packets.
  • the message group may be a heartbeat packet group, which may include multiple heartbeat packets, and the first target message is used to transmit the target heartbeat packet.
  • the second electronic device can quickly and efficiently receive the heartbeat packet based on the first clock difference, thereby performing heartbeat detection quickly and efficiently.
  • an embodiment of the present application provides a method for message interaction, which is used for a first electronic device in a network composed of multiple devices, where the network further includes one or more second electronic devices.
  • the method includes: the first electronic device calculates first clock differences respectively corresponding to one or more second electronic devices, and 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 difference.
  • the first electronic device sends the first clock difference corresponding to 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 clock difference when it is in the window receiving state.
  • First target message The first electronic device sends the corresponding one or more first target messages to the one or more second electronic devices.
  • the first electronic device may notify the second electronic device of the first clock difference, so that the second electronic device can control the timing of sending and/or receiving the first target message based on the clock difference, so that the receiving end device can The first target message is received when in the window receiving state, thereby efficiently receiving the first target message and reducing power consumption.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: sending the first electronic device to one or more A second electronic device periodically sends corresponding one or more first target messages.
  • the first electronic device calculates first clock differences respectively corresponding to one or more second electronic devices, including: The second target message calculates the first clock difference.
  • 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 preset intervals, and 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 first electronic device calculates the first clock difference according to the second target messages recently received by one or more second electronic devices, including: the first electronic device sends a clock difference to one or Multiple second electronic devices send a first message group; the first electronic device receives a first response message from one or more second electronic devices at one or more tnow moments, and the first response message includes the second electronic device Receive the time tr of the Xth message in the first message group and the indication information of the sending time stamp tX of the Xth message; the first electronic device calculates according to the tnow and tX respectively corresponding to one or more second electronic devices The transmission delays corresponding to one or more second electronic devices respectively; the first electronic device calculates the respective corresponding transmission delays, tr and tX of one or more second electronic devices The first clock difference.
  • 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 According to t1 and the first preset period, periodically send a second message group to one or more second electronic devices, the second message group includes multiple messages sent at preset intervals, one or more second electronic devices
  • the respective first target messages are Xth messages corresponding to each of the one or more second electronic devices in the second message group.
  • 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 According to tX0 and the first preset period, periodically send the second message group to one or more second electronic devices, tX0 is the value with the earlier timing in tX corresponding to one or more electronic devices, and tX0 corresponds to the first
  • the X0th message in the message group the second message group includes a plurality of messages sent at preset intervals
  • the first target message corresponding to one or more second electronic devices is the first target message in the second message group associated with one or more X-X0+1 messages corresponding to each second electronic device.
  • the network includes a second electronic device, and the first electronic device periodically sends corresponding one or more first electronic devices to one or more second electronic devices according to a first preset cycle.
  • the target message includes: the first electronic device periodically sends a second message group to the second electronic device according to tX and the first preset period, the second message group includes multiple messages sent at preset intervals, the first target The message is the first message in the second message group.
  • the method further includes: if the first electronic device determines according to the response message from the second electronic device, the number of intervals between the Xi th message and the X th message received by the second electronic device is greater than or equal to a preset value, the first electronic device updates the first clock difference.
  • 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 is in the window receiving state When the corresponding first target message is received.
  • the first clock difference is used to control the second electronic device to enter the window receiving state before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device , so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
  • an embodiment of the present application provides a method for message interaction, which is used for a second electronic device in a network composed of multiple devices, and the network further includes the first electronic device.
  • the method includes: the second electronic device acquires a first clock difference, and 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; Poor, controlling the second electronic device to receive the corresponding first target message from the first electronic device when in the window receiving state.
  • 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 end device receives the first target message when it is in the window receiving state, thereby efficiently receiving the first target message, Reduce power consumption.
  • 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 according to The first clock difference and the first preset period control the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state.
  • 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: according to the first clock difference and the first preset period, 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, so that the second electronic device is in the window A corresponding first target message is received from the first electronic device while in the receiving state.
  • the acquiring the first clock difference by the second electronic device includes: acquiring the first clock difference from the first electronic device by the second electronic device, and the first clock difference is based on the first clock difference recently received by the second electronic device Two target messages are obtained.
  • 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 preset intervals, and 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 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 the message to the first electronic device A first response message, where the first response message includes tr and indication information of the sending time stamp tX of the Xth message, and tr and tX are used to calculate the first clock difference.
  • 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 reception 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, wherein the second message group includes a plurality of messages sent at preset intervals, and the first target message is the second message The Xth message in the group.
  • 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: According to the first clock difference, the sending time tX of the Xth message in the first message group and the first preset period, the second electronic device controls the second electronic device to enter the window when the first electronic device sends the corresponding first target message
  • the second message group includes a plurality of messages sent at preset intervals
  • 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 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: According to the first clock difference, tX and the first preset period, 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, so that the second electronic device Enter the window receiving state when sending the corresponding first target message, wherein the second message group includes multiple messages sent at preset intervals, and the first target message is the first message or the X-X0th message in the second message group +1 message, the X0th message is sent before the Xth message in the first message group.
  • the method further includes: if the second electronic device receives the Xi th message in the second message group, and the interval between the Xi th message and the X th message is greater than or equal to the preset If the value is set, the first electronic device is requested to update the first clock difference.
  • 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 According to the first clock difference, before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device, the second electronic device enters the window receiving state, so that the second electronic device is in the window A corresponding first target message is received from the first electronic device while in the receiving state.
  • the network further includes one or more third electronic devices, and each second electronic device corresponds to one or more third electronic devices, and the method further includes: sending the second electronic device to the corresponding one The one or more third electronic devices send a third targeted message.
  • the acquiring the first clock difference by the second electronic device includes: acquiring, by the second electronic device, the first clock difference updated according to a second preset period from the first electronic device.
  • an embodiment of the present application provides a message interaction device, the device is included in the first electronic device or the second electronic device, and the device has the first A function of the behavior of an electronic device or a second electronic device.
  • This function may be implemented by hardware, or may be implemented by executing corresponding software on the hardware.
  • Hardware or software includes one or more modules or units corresponding to the functions described above. For example, a sending module or unit, a receiving module or unit, a processing module or unit, and the like.
  • 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 with one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device performs The message interaction method executed by the first electronic device in any of the above aspects and any possible implementation manners, or causing the electronic device to execute the message executed by the second electronic device in any of the above aspects and any possible implementation manners interactive method.
  • an embodiment of the present application provides a computer-readable storage medium, including computer instructions.
  • the computer instructions When the computer instructions are run on an electronic device, the electronic device executes any one of the above aspects and any one of the possible implementations.
  • the message interaction method performed by the first electronic device, or the message interaction method performed by the second electronic device in any one of the foregoing aspects and any possible implementation manners.
  • an embodiment of the present application provides a computer program product.
  • the computer program product runs on a computer, it causes the computer to execute the message executed by the first electronic device in any of the above aspects and any possible implementation manners.
  • the 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 perform any of the above aspects and any A message interaction method in one possible implementation.
  • FIG. 1A is a schematic diagram of a smart connection network provided by an embodiment of the present application.
  • FIG. 1B is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of the relationship between upper and lower nodes in a smart connection network provided by an embodiment of the present application;
  • FIG. 3A is a sequence diagram of heartbeat packets exchanged between electronic devices in a smart connected network provided by an embodiment of the present application
  • Fig. 3B is a flow chart of interaction between a large screen and a mobile phone regarding clock difference provided in the embodiment of the present application;
  • FIG. 4 is a schematic diagram of comparison before and after window alignment corresponding to the first strategy provided by the embodiment of the present application;
  • FIG. 5 is a schematic diagram of comparison before and after window alignment corresponding to the second strategy provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of comparison before and after window alignment corresponding to the third strategy provided by the embodiment of the present application.
  • FIG. 7 is a schematic diagram of a heartbeat packet scanning effect provided by the prior art without window alignment
  • FIG. 8 is a flowchart of an interaction between a mobile phone and a speaker regarding clock differences provided in an embodiment of the present application
  • FIG. 9 is a flowchart of a message interaction method provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of another hardware structure of an electronic device provided by an embodiment of the present application.
  • first and second are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of this embodiment, unless otherwise specified, “plurality” means two or more.
  • Multiple electronic devices that can establish a mutual trust relationship can automatically form a network after discovering each other, which is called a smart connection network. For example, multiple electronic devices have logged in the same account (that is, the Account ID is the same), or the user has performed a binding and authentication process on multiple electronic devices (such as binding through a pin code or a quick response (quick response, QR) code, etc. determined), then a mutual trust relationship is established between the multiple electronic devices.
  • a smart connection network For example, multiple electronic devices have logged in the same account (that is, the Account ID is the same), or the user has performed a binding and authentication process on multiple electronic devices (such as binding through a pin code or a quick response (quick response, QR) code, etc. determined), then a mutual trust relationship is established between the multiple electronic devices.
  • QR quick response
  • one electronic device will maintain a logical connection with other electronic devices, and the status and information of these electronic devices can be synchronized when the system is running .
  • These mutually trusted electronic devices can form a smart connection network.
  • the Zhilian network is only a name of the network involved in the embodiment of the present application, and the network involved in the embodiment of the present application may also have other names, which are not limited.
  • FIG. 1A a schematic diagram of a smart connection network can be referred to in FIG. 1A .
  • FIG. 1A a schematic diagram of a smart connection network can be referred to in FIG. 1A .
  • BLE Bluetooth low energy
  • the Wi-Fi communication mode is supported between the mobile phone and the smart speaker (speaker for short).
  • the electronic devices in the Smart Connect network go online. Specifically, multiple electronic devices may exchange information (including identity information of the electronic devices, etc.) with each other during or after mutual discovery, so as to notify each other of the identities of the online electronic devices. Then, the electronic devices in the Zhilian network can perform online detection through the heartbeat packet, so as to know the status of each online electronic device.
  • being online means that the electronic device can be detected through a heartbeat packet, and does not necessarily mean that a network connection or data channel has been established.
  • the electronic device 1 in the Smart Connect network sends a heartbeat packet to the electronic device 2, if it receives a heartbeat response message sent by the electronic device 2 within a preset time period, the electronic device 2 is considered to be online.
  • Online electronic devices in the Zhilian network can initiate business data transmission at any time, so that business processing can be completed quickly, directly and collaboratively. If the electronic device 1 does not receive the heartbeat response message sent by the electronic device 2 within the preset time period, the electronic device 2 is considered to be offline.
  • the electronic devices in the Zhilian network can also notify each other of the identity information of offline devices, so that each electronic device can know the current situation of online devices and offline devices.
  • the embodiment of the present application provides an online detection method, which can control the timing of sending and/or receiving heartbeat packets based on the clock difference between the electronic device at the sending end and the electronic device at the receiving end in the network, so that the electronic device at the receiving end is in the
  • the heartbeat packet is received when the window is in the receiving state, which can improve the receiving efficiency of the heartbeat packet, reduce the number and duration of heartbeat packet sending and receiving, and reduce the power consumption of electronic devices, so that multiple electronic devices in the network can achieve low power consumption based on the heartbeat packet , Fast, timely and accurate online detection.
  • the window of the electronic device at the receiving end is used to receive the heartbeat packet, which may be referred to as a receiving window, for example, may specifically be a scanning window of the electronic device at the receiving end.
  • the electronic devices in the Zhilian network can be 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.), Vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs) ) and other mobile terminals, the embodiments of the present application do not impose any restrictions on specific types of electronic devices.
  • wearable devices such as earphones, smart watches, smart bracelets, smart glasses, etc.
  • smart home devices such as large screens, speakers, smart lights, etc.
  • Vehicle-mounted devices augmented reality (AR)/virtual reality (VR) devices
  • laptops laptops
  • ultra-mobile personal computers (UMPCs) ultra-mobile personal computers
  • PDAs personal digital assistants
  • FIG. 1B shows a schematic structural diagram of the 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 (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air 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, bone conduction sensor 180M, etc.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the 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 called from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or USB interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input and output
  • subscriber identity module subscriber identity module
  • SIM subscriber identity module
  • USB interface etc.
  • the USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100 , and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other electronic devices, such as AR devices.
  • the wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used for modulating 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. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor.
  • the application processor outputs sound signals through audio equipment (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194 .
  • the modem processor may be a stand-alone device. In some other embodiments, the modem processor may be independent from the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wireless Fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite, etc. applied on the electronic device 100.
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • 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 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • 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 technology.
  • Wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband code division Multiple access (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 technology, etc.
  • GNSS can include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou satellite navigation system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi-zenith) satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • Beidou satellite navigation system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quasi-zenith satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 can send or receive a heartbeat packet through the mobile communication module 150, the wireless communication module 160, or USB.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like.
  • the storage data area can store data created during the use of the electronic device 100 (such as audio data, phonebook, etc.) and the like.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • the electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components.
  • the illustrated components can be realized in hardware, software or a combination of software and hardware.
  • the processor 110 executes the instructions stored in the internal memory 121, so that the electronic device 100 in the smart connection network can control the sending timing of the heartbeat packet and/or based on the clock difference between the electronic devices.
  • the receiving timing enables the electronic device at the receiving end to receive the heartbeat packet when it is in the window receiving state, 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.
  • Multiple electronic devices in the system realize fast, timely and accurate online detection.
  • the electronic devices in the Zhilian network can also be called nodes.
  • there is a superior-subordinate relationship between the nodes of the Smart Connect network and the superior node can send a heartbeat packet to the subordinate node to detect whether the subordinate node is online.
  • the upper-lower relationship between nodes may be determined according to the information of the nodes themselves, and/or the mutual relationship between the nodes and other factors.
  • a node can have one or more subordinate nodes.
  • the information of the node itself may include one or more of network capability information, processing capability information, network quality, power information, movement information, service information, and service set identifier (service set identifier, SSID).
  • the network capability information may include the network connection supported by the node, the maximum bandwidth supported by the network connection supported by the node, the connection information of the network connection supported by the node (such as port number, media access control address (media access control, MAC) address or At least one of Internet protocol (internet protocol, IP) address).
  • the processing capability information of the node represents the processing capability of the node, and includes, for example, power consumption of the node, chip processing capability, and memory.
  • the interrelationships between nodes may include content such as network topology relations.
  • the network topology relationship includes the network connection modes supported by each node, and the communication path between nodes.
  • the upper-lower relationship between nodes may be determined according to the weight of the nodes and the network topology relationship between the nodes.
  • the weight of the node can be determined by the node itself according to the network capability information of the node and the processing capability information of the node, for example, the weight of a node with high power consumption, insensitivity to power consumption, good chip processing capability, large memory and strong network capability High; on the contrary, nodes with low power consumption, sensitivity to power consumption, poor chip processing capabilities, small memory and weak network capabilities have low weights.
  • the nodes in the Zhilian network may include a central node, a first-level node, and a second-level node, etc. according to the relationship from the upper level to the lower level.
  • the central node is the highest-level node, only the lower-level nodes, no upper-level nodes.
  • the lower-level nodes of the central node are called first-level nodes, and the central node is the upper-level node of the first-level node; the lower-level nodes of the first-level node are called second-level nodes, and the first-level node is the upper-level node of the second-level node;
  • the network may also include tertiary nodes or quaternary nodes, etc.
  • the embodiment of the present application does not limit the number of layers of nodes included in the Smart Connect network.
  • a Zhilian network usually includes a central node, and may have one or more subordinate nodes belonging to different levels.
  • the node can also be called an intermediate node. If a node has only upper-level nodes and no lower-level nodes, the node can also be called a tail node.
  • the connection between the large screen and the mobile phone, and between the large screen and the watch support the Bluetooth BLE network connection.
  • the Bluetooth BLE network connection is supported between the mobile phone and the headset
  • the Wi-Fi network connection is supported between the mobile phone and the speaker.
  • the central node is determined as the large screen
  • the large screen is the upper node of mobile phones and watches
  • the mobile phone is the upper node of earphones and speakers.
  • mobile phones and watches are subordinate nodes of large screens
  • earphones and speakers are subordinate nodes of mobile phones.
  • the network connection is supported between the mobile phone and the earphone, and between the watch and the earphone. It is not a subordinate node of the watch.
  • the large screen is the central node
  • the mobile phone and watch are the first-level nodes
  • the earphones and speakers are the second-level nodes.
  • the hierarchical relationship between upper-level nodes and lower-level nodes in the Smart Connect network can be referred to in FIG. 2 .
  • the mobile phone can also be called an intermediate node
  • watches, earphones, and speakers can also be called tail nodes.
  • any two electronic devices in the Smart Connect network may support one or more network connection modes, but the electronic devices do not necessarily have established network connections.
  • the network connection mode supported between the electronic devices may be a short-distance wireless network connection mode or a wired network connection mode.
  • the wireless network connection mode in which the online detection can be performed by using the method provided in the embodiment of the present application may be referred to as the first network connection mode.
  • the first network connection manner may be a short-distance wireless network connection manner supporting an air interface scanning mechanism.
  • a network connection manner other than the first network connection manner may be referred to as a second network connection manner.
  • Bluetooth BLE can be the first network connection mode
  • USB can be the second network connection mode
  • Wi-Fi Wi-Fi
  • Bluetooth basic rate base rate, BR
  • Bluetooth enhanced rate enhanced data rate, EDR
  • the first network connection mode may also be the second network connection mode.
  • the air interface sending mode may be broadcast or unicast
  • the receiving window may be a scanning window
  • the two electronic devices in the Smart Connect network do not support the first network connection mode but support the second network connection mode, information such as heartbeat packets is exchanged based on the second network connection mode to perform online detection.
  • the priority of the first network connection manner may be higher than that of the second network connection manner. If the two electronic devices in the Zhilian network support both the first network connection method and the second network connection method, then based on the first network connection method, information such as heartbeat packets can be exchanged through the communication mode of the sending and receiving window through the air interface, In order to carry out online detection.
  • the solution provided by the embodiment of this application can start from the central node of the Smart Connect network, and the upper node sends heartbeat packets to the lower nodes step by step, so as to uniformly perform online detection on the electronic devices in the Smart Connect network, and uniformly determine the Smart Connect network Online and offline status of each electronic device in the system, so that online electronic devices can be used to complete business quickly, directly and collaboratively.
  • the upper and lower nodes that support the first network connection method can be controlled 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 receiving window, referred to as Window alignment or phase alignment, so that the receiving and sending timing of heartbeat packets are synchronized.
  • the upper-level node sends a heartbeat packet to the lower-level node.
  • the upper and lower nodes of the interactive heartbeat packet mentioned here refer to adjacent two-level nodes.
  • the upper-level node refers to the central node
  • the lower-level node refers to the first-level node
  • the upper-level node refers to the first-level node
  • the lower-level node refers to the second-level node. That is to say, the upper node is the electronic device at the sending end of the heartbeat packet, and the lower node is the electronic device at the receiving end of the heartbeat packet.
  • window alignment can be understood as, based on the clock difference between the electronic device at the receiving end and the electronic device at the sending end, it can receive the heartbeat packet sent by the electronic device at the sending end when it is in the window receiving state, so as to efficiently receive Heartbeat packets, reduce power consumption, and quickly perform online detection based on heartbeat packets.
  • the window alignment means that the difference between the timing when the electronic device at the receiving end enters the receiving state and the timing when the electronic device at the sending end sends a heartbeat packet is less than or equal to the first preset value.
  • the receiving window of the electronic device at the receiving end enters a receiving state after being opened, and can be used to receive heartbeat packets.
  • the electronic device at the receiving end can open the receiving window at the right time when the electronic device at the sending end sends out a heartbeat packet, thereby ensuring that communication resources will not be wasted due to opening the receiving window too early, nor will it cause damage due to opening the receiving window too late.
  • the heartbeat packet cannot be obtained normally, thus ensuring that the receiving window can receive the heartbeat packet relatively quickly and efficiently.
  • the time when the receiving window enters the receiving state is earlier than the time when the heartbeat packet is sent.
  • the opening timing of the receiving window is earlier than the sending timing of the heartbeat packet.
  • the receiving window enters the receiving state when the heartbeat packet is sent.
  • the receive window is opened when a heartbeat packet is sent.
  • the receiving window happens to be opened and enters the receiving state.
  • the receiving window is already in the receiving state when the heartbeat packet reaches the electronic device at the receiving end, and the electronic device at the receiving end can be faster and faster. Efficiently receive heartbeat packets.
  • the receiving window enters a receiving state.
  • the electronic device at the receiving end can predetermine the timing at which the heartbeat packet arrives at the electronic device at the receiving end according to the sending timing of the heartbeat packet and the pre-calculated transmission delay, so as to open the receiving window in advance before the arrival of the heartbeat packet, so that the receiving window Waiting to receive the heartbeat packet in the state, so that the heartbeat packet can be received quickly and efficiently.
  • the receiving window is opened to enter a receiving state.
  • the electronic device at the receiving end can predetermine the timing at which the heartbeat packet arrives at the electronic device at the receiving end according to the sending timing 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, thereby enabling Receive heartbeat packets quickly and efficiently.
  • the lower-level nodes of the node can quickly A heartbeat packet was detected. That is to say, after the receiving and sending timing of the heartbeat packet is synchronized, the lower-level nodes can receive the heartbeat packet quickly, accurately and efficiently within the receiving window, thereby reducing the number of interactions of the heartbeat packet per unit time and improving the reception of the heartbeat packet. Reliability, reduce communication cost and power consumption, and realize fast, accurate and timely online detection among multiple devices.
  • heartbeat packets and heartbeat response messages can be exchanged between upper and lower nodes based on the clock difference and the second network connection mode.
  • the solution can realize fast, accurate and timely online detection of each electronic device in the Smart Connect network that supports the first network connection mode or the second network connection mode.
  • the following will take the central node, first-level node and second-level node in the smart connection network shown in Figure 1A and Figure 2, the air interface transmission mode of the heartbeat packet is broadcast, and the receiving window of the heartbeat packet is the scanning window
  • the online detection method provided in the embodiment of the application will be described.
  • the method can include:
  • the large screen acts as the central node and starts broadcasting heartbeat packets to mobile phones and watches as first-level nodes at time t1.
  • the heartbeat packet group may include N (N is an integer greater than 1) heartbeat packets sent sequentially at preset intervals (eg, 20 ms, 30 ms, etc.) within a preset period.
  • each heartbeat packet in the heartbeat packet group carries its own sending timestamp, for example, the first heartbeat packet carries its own sending timestamp t1, and the X1th heartbeat packet carries its own sending time Poke tX1.
  • the mobile phone as a first-level node sends a heartbeat response message to the large screen after receiving the X1th (X1 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packets at time tr1.
  • the heartbeat response message sent by the mobile phone to the large screen includes tr1 and the sending time stamp tX1 of the X1th heartbeat packet. In some 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 time stamp tX1 of the X1th heartbeat packet according to the identifier of the X1th heartbeat packet .
  • the large screen can send the clock difference to the mobile phone, so that the windows between the mobile phone and the large screen can be aligned according to the clock difference, so as to synchronize the receiving and sending timing of heartbeat packets.
  • the interaction process about the clock difference between the large screen and the mobile phone can be referred to FIG. 3B.
  • the large screen terminal calculates the clock difference between the mobile phone and the large screen and sends it to the mobile terminal.
  • the mobile phone terminal can also calculate the clock difference with the large screen by itself, and the embodiment of the present application does not limit the device terminal that calculates the clock difference.
  • the clock difference is used to represent the difference between the local clocks of two electronic devices.
  • the electronic device can obtain a local clock based on its own operating system.
  • the java of the android system uses the interface System.nanoTime() to obtain the relative clock
  • the embedded system OS of the non-android system can use the interface getTickCount() to obtain the relative clock
  • the local clock may be a relative clock
  • the relative clock may be different from the world time displayed by the terminal device to the user.
  • the local clock can be, for example, the time after power-on or the time from a certain reference time (for example, January 1, 1970) to the present.
  • the local clock of the large screen is the time after booting, and the local clock of the mobile phone is also the time after booting, and the clock difference is 3658*10 9 ns.
  • 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.
  • the watch after receiving the X2th (X2 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packets at the time tr2, the watch as a first-level node sends a heartbeat response message to the large screen and carries tr2 and the sending timestamp tX2 of the X2th heartbeat packet.
  • the central node and the first-level node can control the broadcasting timing of the subsequent heartbeat packet and/or the opening timing of the scanning window according to the clock difference, so that the heartbeat packet
  • the broadcast timing is aligned with the opening timing of the scanning window. That is, the window is aligned 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 timing of receiving and sending the heartbeat packet is synchronized.
  • the first-level node can quickly and accurately receive the heartbeat packet broadcast by the central node within the scanning window, thereby reducing the number of interactions of the heartbeat packet per unit time, reducing communication costs and power consumption, and improving heartbeat packet reception Reliability, to achieve fast, accurate and timely online detection between devices.
  • the first network connection method Bluetooth BLE is supported between the large screen and the mobile phone, and the broadcast timing and/or scanning window of subsequent heartbeat packets can be controlled between the large screen and the mobile phone according to the clock difference
  • the opening timing of the mobile phone makes the scanning window of the mobile phone also in the receiving state when the large screen broadcasts the heartbeat packet.
  • the mobile phone can quickly and accurately receive the heartbeat packets broadcast on the large screen within the scanning window, thereby reducing the number of heartbeat packet interactions per unit time, reducing invalid broadcast and scanning duty cycles, and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
  • the large screen and the watch support Bluetooth BLE in the first network connection mode, and the large screen and the watch can control the broadcast timing of subsequent heartbeat packets and/or the opening timing of the scan window according to the clock difference, so that the large screen The scan window of the watch is also in the receiving state when the heartbeat packet is broadcast.
  • the watch can quickly and accurately receive the heartbeat packets broadcast on the large screen within the scanning window, thereby reducing the number of interactions of heartbeat packets per unit time, reducing invalid broadcasts and scanning duty cycles, and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
  • a broadcast message for sending the heartbeat packet may be a non-connectable broadcast ADV_NONCONN_IND message.
  • this type of broadcast message does not require a special response message to reply, so it can reduce the bandwidth occupation 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 online detection. s efficiency.
  • multiple different strategies may be adopted for window alignment to control the timing of broadcasting subsequent heartbeat packets and/or the timing of opening the scan window according to the clock difference.
  • window alignment is performed according to the first heartbeat packet in the heartbeat packet group broadcast at time t1.
  • the large screen periodically broadcasts heartbeat packet groups at the time t1+m*T1 corresponding to the local clock according to the first preset period T1, where m is a positive integer.
  • the mobile phone controls the time t1+m*T1+tC1 corresponding to the local clock, and periodically opens the scanning window to receive heartbeat packets. In this way, the timing of broadcasting the heartbeat package group on the large screen is consistent with the activation timing of the mobile phone scanning window.
  • the large screen periodically broadcasts the heartbeat packet group at the time t1+m*T1 corresponding to the local clock according to the first preset period T1.
  • the watch is controlled to periodically open the scan window at the time t1+m*T1+tC2 corresponding to the local clock to receive heartbeat packets.
  • a schematic diagram of comparison before and after window alignment corresponding to the first strategy can be referred to in FIG. 4 .
  • the first heartbeat packet in the heartbeat packet group may be a target heartbeat packet (also called a target message) corresponding to the mobile phone and the watch.
  • the mobile phone and the watch can enter the receiving state when the large screen sends the heartbeat packet group (that is, the first heartbeat packet in the heartbeat packet group), that is, they can enter the receiving state when the large screen sends the target heartbeat packet in the heartbeat packet group.
  • Receive status so that the target heartbeat packet can be quickly received, and the online detection efficiency can be improved.
  • the X1 heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone.
  • the mobile phone can send the heartbeat packet group (that is, send the first heartbeat packet in the heartbeat packet group) on the large screen. packet) into the receiving state, and is in the receiving state when sending the target heartbeat packet on the large screen, so that the target heartbeat packet can be quickly received and the online detection efficiency is improved.
  • the X2 heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch.
  • the watch can enter the receiving state when sending the heartbeat packet group on the large screen, and be in the receiving state when sending the target heartbeat packet on the large screen. Receive status, so that the target heartbeat packet can be quickly received, and the online detection efficiency can be improved.
  • the large screen broadcasts the heartbeat packet group at 16:00 corresponding to the local clock for the first time (that is, broadcasts multiple heartbeat packets in a heartbeat packet group sequentially at a preset interval such as 20ms at 16:00), and T1 is 5 minutes (that is, the big screen broadcasts a heartbeat packet every 5 minutes), the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours.
  • the large screen starts broadcasting heartbeat packets at 16:05, 16:10, 16:15... corresponding to the local clock; 40, 16:45... Open the scanning window to receive the heartbeat packet; the watch opens the scanning window at 18:05, 18:10, 18:15... corresponding to the local clock to receive the heartbeat packet.
  • the large screen broadcasts the heartbeat packet group at the 30ns corresponding to the local clock for the first time (that is, broadcasts multiple heartbeat packets in a heartbeat packet group sequentially at a preset interval such as 20ms at the 30ns), T1 is 5 Minutes, the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours.
  • the large screen starts broadcasting the heartbeat packet group at the 5th minute 30ns, the 10th minute 30ns, the 15th minute 30ns... of the local clock; the mobile phone respectively at the 35th minute corresponding to the local clock 30ns, 30ns at the 40th minute, 30ns at the 45th minute... Open the scan window to receive the heartbeat packet; the watch opens at the 2nd hour, 5min 30ns, 2nd hour, 10min 30ns, 2nd hour, 15min 30ns... Scan windows for heartbeat packets.
  • the mobile phone since the mobile phone receives the heartbeat packet of the large-screen broadcast for the first time at the time tX1 corresponding to the X1-th heartbeat packet in the heartbeat packet, the probability of receiving the X1-th heartbeat packet in the heartbeat packet again is relatively high.
  • the mobile phone can adjust the start scanning time of the heartbeat packet to the time corresponding to the X1th heartbeat packet. In this way, the window alignment accuracy is higher, and the mobile phone can receive the heartbeat packets sent in the broadcast window more quickly and accurately in the scan window, thereby reducing the number of heartbeat packet interactions per unit time and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
  • the mobile phone and the watch perform window alignment according to the X1th heartbeat packet and the X2th heartbeat packet corresponding to each other.
  • the large screen periodically broadcasts the heartbeat packet group at the time t1+m*T1 corresponding to the local clock according to the first preset period T1.
  • the mobile phone adjusts the opening timing of the subsequent heartbeat packet scanning window to perform window alignment.
  • the mobile phone controls the time tX1+m*T1+tC1 corresponding to the local clock, that is, the moment when the X1th heartbeat packet is broadcast on the large screen, and periodically opens the scanning window to receive the heartbeat packet.
  • the large screen periodically broadcasts heartbeat packets at the time t1+m*T1 corresponding to the local clock according to the first preset period T1.
  • the watch adjusts the opening timing of the subsequent heartbeat packet scanning window for window alignment. Based on the clock difference, the watch is controlled at the time tX2+m*T1+tC2 corresponding to the local clock, that is, the moment when the X2 heartbeat packet is broadcast on the large screen, and periodically opens the scanning window to receive the heartbeat packet.
  • a schematic diagram of comparison before and after window alignment corresponding to the second strategy can be referred to FIG. 5 .
  • the X1th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone
  • the X2th heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch.
  • the large screen starts to broadcast the heartbeat packet group (including multiple heartbeat packets broadcast in sequence according to the preset interval) at 16:00 corresponding to the local clock for the first time, tX1 is 16:00:01, and tX2 is 16:00 : 02, T1 is 5 minutes, the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours.
  • the large screen broadcasts heartbeat packet groups at 16:05, 16:10, 16:15... corresponding to the local clock; :40:01, 16:45:01...open the scan window to receive the heartbeat packet; the watch respectively opens the scan window to receive the heartbeat packet.
  • the large screen periodically broadcasts a heartbeat packet group at t1+m*T1, and the mobile phone and the watch respectively open the scanning window according to the timing corresponding to their own window alignment, so as to receive the heartbeat Bag.
  • the large screen can adjust the broadcast timing of the subsequent heartbeat packet group to the sending time corresponding to the Xi-th heartbeat packet, that is, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to tXi.
  • the big screen can broadcast a heartbeat packet group to multiple lower-level nodes, instead of broadcasting a heartbeat packet group to each lower-level node, so as to simplify the sending process of heartbeat packets and reduce message interaction
  • the number of strips saves power consumption.
  • the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to the front timing (also called tX0) of tXi corresponding to multiple lower-level nodes, so that after window alignment of multiple lower-level nodes, even It can efficiently, quickly and timely scan the heartbeat packets of large-screen broadcasts.
  • the mobile phone receives the X1-th heartbeat packet in the heartbeat packets broadcast on the large screen for the first time, and the watch receives the X2-th heartbeat packet in the heartbeat packets broadcast on the large-screen broadcast for the first time.
  • the sending time tX1 corresponding to the X1 heartbeat packet is earlier, that is, X0 is X1 and tX0 is tX1
  • the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the X1 heartbeat packet. That is, the large screen periodically broadcasts heartbeat packets at the time tX1+m*T1.
  • the mobile phone opens the scanning window to receive the heartbeat packet at the time tX1+m*T1+tC1; the watch opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC2.
  • a schematic diagram of comparison before and after window alignment corresponding to the third strategy can be referred to FIG. 6 .
  • the first (X1-X1+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone
  • the X2-X1+1 heartbeat packet in the heartbeat packet group is the target corresponding to the watch. heartbeat packet.
  • the mobile phone and the watch can enter the receiving state when the large screen sends the heartbeat packet group (that is, the first heartbeat packet in the heartbeat packet group), so that the target heartbeat packet can be quickly received and the online detection efficiency is improved.
  • the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the second heartbeat packet.
  • the first (ie 2-2+1) heartbeat packet in the heartbeat packet group It is the target heartbeat packet corresponding to the mobile phone
  • the second (ie 3-2+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch.
  • the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the X2th heartbeat packet. That is, the large screen periodically broadcasts heartbeat packets at the time tX2+m*T1.
  • the mobile phone opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC1; the watch opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC2.
  • the first (X1-X2+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch
  • the X1-X2+1 heartbeat packet in the heartbeat packet group is the target corresponding to the mobile phone heartbeat packet.
  • the large screen starts to broadcast the heartbeat packet group at 16:00 corresponding to the local clock for the first time, tX1 is 16:00:01, tX2 is 16:00:02, tX1 is ahead of tX2, T1 is 5 minutes, the mobile phone
  • the clock difference with the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours.
  • the large screen starts broadcasting heartbeat packets at 16:05:01, 16:06:01, 16:15:01... corresponding to the local clock; Corresponding 16:35:01, 16:40:01, 16:45:01... Open the scanning window to receive the heartbeat packet; the watch is at 18:05:02, 18:06:02, 18:02 corresponding to the local clock 15:02...opened scan window to receive heartbeat packets.
  • the timing of broadcasting the heartbeat packet on the large screen is inconsistent with the timing of opening the scanning window on the mobile phone, and the timing of broadcasting the heartbeat packet on the large screen is also inconsistent with the timing of opening the scanning window on the watch, but the broadcasting timing is consistent with the timing of the scanning window.
  • the difference between the opening timings is small, less than or equal to the first preset value. This situation also belongs to window alignment, and the mobile phone and watch can also receive heartbeat packets efficiently, quickly, accurately, and in time for online detection. .
  • the central node and the first-level node can be based on the clock difference tC performs window alignment with the Xth heartbeat packet. For example, the central node periodically broadcasts the heartbeat packet group at the time tX+m*T1 corresponding to the local clock according to the first preset period T1. Based on the clock difference tC, the first-level node controls to periodically open the scan window to receive heartbeat packets at the time tX+m*T1+tC corresponding to the local clock.
  • the first heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the first-level node, and 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.
  • Improve online detection efficiency is the first heartbeat packet in the heartbeat packet group.
  • 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 the heartbeat packet is sent is large, the number of scans of the scanning window is large, and the power consumption of the first-level node and the central node is large.
  • the first-level node after the first-level node receives the heartbeat packet sent by the large screen for the first time, it sends the heartbeat packet to the second-level node to perform online detection on the second-level node.
  • the mobile phone of the first-level node after receiving the heartbeat packet for the first time, sends the heartbeat packet to the earphone and speaker of the second-level node.
  • the window alignment between the first-level node and the second-level node can be performed according to the clock difference, and the timing and/or The timing when the secondary node opens the scanning window makes the scanning window enter the receiving state when the primary node broadcasts the heartbeat packet.
  • the second-level node can quickly and accurately receive the heartbeat packet broadcast by the first-level node within the scanning window, thereby reducing the number of heartbeat packet interactions per unit time, improving the reliability of heartbeat packet reception, and reducing communication. Cost and power consumption, to achieve fast, accurate and timely online detection between devices.
  • the first network connection mode Bluetooth BLE is supported between the mobile phone and the headset.
  • the mobile phone After the mobile phone receives the heartbeat packet for the first time, referring to FIG. 3A , it starts to broadcast the heartbeat packet group at time tA, so that the earphone can receive the heartbeat packet in the heartbeat packet group.
  • the earphone receives the X3th heartbeat packet, and the clock difference between the earphone and the mobile phone is tC3
  • the above strategy can be used for window alignment between the earphone and the mobile phone based on the clock difference tC3.
  • the mobile phone when adopting the first strategy, the mobile phone periodically broadcasts the heartbeat packet group at the time tA+m*T1 corresponding to the 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 tA+m*T1+tC3 corresponding to the 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 earphone scanning window. Fast, accurate and timely connection and online detection between mobile phone and headset.
  • the first-level node can periodically send the second network connection method to the second-level network according to the first preset period T1.
  • the node sends a heartbeat packet
  • the secondary node can wake up periodically and respond in real time according to the clock difference and the first preset period T1.
  • the secondary node can periodically wake up and run and respond to the heartbeat, can receive and respond to the heartbeat packet efficiently, accurately, and in a timely manner, reduce disordered heartbeat packets and repeated heartbeat responses, and save power consumption of the secondary node.
  • Wi-Fi is supported between the mobile phone and the speaker, and Wi-Fi here belongs to the second network connection mode and does not support the first network connection mode.
  • the mobile phone sends a heartbeat packet to the speaker at time tA based on the Wi-Fi connection, and carries the sending time stamp tA.
  • the speaker receives the heartbeat packet at time tr4, it replies a response message to the mobile phone, and carries the receiving time stamp tr4.
  • the mobile phone receives the response message sent by the speaker at time tnow4
  • the mobile phone can notify the speaker of the clock difference, so that the speaker can wake up regularly to receive the heartbeat packet according to the clock difference and the first preset period T1.
  • the mobile phone periodically sends a heartbeat packet group from the kernel bottom layer protocol stack to the speaker at the time tA+m*T1 corresponding to the local clock.
  • the speaker periodically wakes up and runs at the time tA+m*T1+tC4 corresponding to the local clock, and responds in real time after receiving the heartbeat packet through the Wi-Fi connection, which can reduce disordered heartbeat packets and repeated heartbeat responses. And there is no need to perform window alignment like the first network connection method.
  • the Smart Connect network shown in Figure 1A between the mobile phone as the first-level node and the earphone as the second-level node, Bluetooth BLE in the first network connection mode is supported, and window alignment can be performed based on the clock difference. And periodically exchange heartbeat packets after the windows are aligned, so as to perform online detection of electronic equipment.
  • the mobile phone as the first-level node and the speaker as the second-level node support Wi-Fi in the second network connection mode, but do not support the first network connection mode.
  • Heartbeat packets can be exchanged periodically based on the clock difference, thereby On-line inspection of electronic equipment.
  • the online detection method provided by the embodiment of the present application is described above by taking the central node, the first-level node and the second-level node in the smart connection network shown in FIG. 1A as examples.
  • the Wi-Fi network also includes nodes at other levels (such as third-level nodes and fourth-level nodes)
  • the central node sends the heartbeat packet to the first-level node
  • the first-level node sends the heartbeat packet to the second-level node.
  • the heartbeat packet can be sent to the third-level node, and the third-level node can also send the heartbeat packet to the fourth-level node, and so on, which will not be described here.
  • heartbeat packets can be efficiently, quickly and accurately received between adjacent upper and lower nodes (or directly connected upper and lower nodes) in the entire network, thereby improving the receiving efficiency of heartbeat packets and reducing the number of sending and receiving of heartbeat packets and It can reduce the power consumption of electronic devices, so that multiple electronic devices in the network can be detected quickly, timely and accurately based on heartbeat packets, and the number of electronic devices that can be connected to the Smart Connect network can also be increased.
  • this solution can sequentially transmit heartbeat packets between the upper and lower nodes in the entire SmartConnect network (this can also be called heartbeat synchronization in the entire SmartConnect network), reducing disordered heartbeats and improving the performance of the SmartConnect network.
  • Each electronic device performs unified and orderly online detection, and then the online electronic device can be used to perform business quickly, directly and collaboratively.
  • the efficiency of network heartbeat synchronization can be improved, and the device status and online and offline responses in the smart connection network can be more real-time and accurate. Moreover, it can reduce the energy consumption of background networking, make the network orderly, and improve the network stability in the case of a large number of devices.
  • smart connection network shown in Figure 1A is only an example, and the smart connection network can also have different network topologies, and can also have more electronic devices (such as smart lights, smart curtains, smart remote control or electronic lock, etc.) and more complex network connection relationship.
  • SmartConnect networks with various structures can use the above method to exchange heartbeat packets for online detection.
  • the duty cycle of the scan window can also be larger to ensure that the node can receive heartbeat packets in a timely and fast manner, reducing heartbeat misses caused by large interference The reception of the package.
  • the duty cycle of the scan window may be smaller to save power consumption.
  • the duty cycle of the scan window may also be different if the device types of the nodes are different. For example, if the node is not sensitive to power consumption, the duty cycle of the scanning window can be larger to ensure that heartbeat packets can be received in a timely and fast manner, and to reduce missed reception of heartbeat packets due to large interference. If the node is more sensitive to power consumption, the duty cycle of the scan window can be smaller to save power consumption.
  • the duration of the node scanning window can be preset, and the duration is longer than the duration of one heartbeat packet, for example, it can be set to the duration of three heartbeat packets, so as to make it possible to receive The heartbeat packet is received and the scanning window is short, so that the power consumption of the node is small.
  • a certain node when a certain node is performing services, it may suspend sending heartbeat packet groups according to the first preset period T1.
  • the central node can also trigger and adjust the time to start periodically sending the heartbeat packet group. For example, when the central node is performing services, it may suspend sending heartbeat packet groups according to the first preset period T1. After the service ends, the central node may trigger the heartbeat packet group to be sent periodically according to the first preset period T1 starting from time tAdj.
  • the central node can notify the first-level node of the adjusted time tAdj, and the first-level node adjusts the scan window accordingly for window alignment. Subsequent nodes transmit the adjusted time tAdj to their respective subordinate nodes in turn.
  • the central node may trigger recalculation of the clock difference according to the preset second preset period T2, and perform clock difference calibration between nodes at all levels.
  • the nodes in the Smart Connect network update the clock difference, and perform window alignment based on the clock difference again.
  • the second preset period T2 is greater than the first preset period T1.
  • the first preset period T1 may be 5 minutes
  • the second preset period may be 1 hour.
  • the central node broadcasts a heartbeat packet every 5 minutes, and triggers an update of the clock difference every 1 hour.
  • the clock difference between nodes in the Smart Connect network may change, and the second preset period T2 may be a preset experience value, which is the same as the cumulative change of the clock difference Threshold related. That is to say, after the interval T2, the cumulative change of the clock difference may have exceeded the threshold, so the central node may trigger recalculation of the clock difference.
  • a certain node finds that the number of heartbeat packets between the heartbeat packet received this time and the heartbeat packet received for the first time is greater than or equal to the third preset value, it may be that the clock difference is relatively large. Large changes, so the central node can be requested to trigger an update clock difference.
  • a node finds that the number of heartbeat packets between the heartbeat packet received this time and the heartbeat packet received for the first time is greater than or equal to the fourth preset value, it can report to the node's The superior node, the superior node of the node can request the central node to trigger to update the clock difference.
  • each node will re-determine the network topology relationship, recalculate the clock difference, and perform window alignment, so that after the window alignment, exchange heartbeat packets for online detection. If a node in the Zhilian network leaves, each node will re-determine the network topology relationship, recalculate the clock difference and perform window alignment, so as to exchange heartbeat packets for online detection after window alignment. If the central node changes due to the addition of a new node or the departure of a node, the new central node triggers recalculation of the clock difference and window alignment, so that heartbeat packets can be exchanged for online detection after window alignment.
  • each electronic device in the Smart Connect network after each device in the Smart Connect network is successfully established, it may be determined that each electronic device is online. If it is found that an electronic device has left during the online detection through the heartbeat packet, the offline information of the electronic device can be notified to the central node or to each electronic device in the Zhilian network, so that the central node or each electronic device can be unified. Know the online status of each electronic device.
  • a node After a node receives the heartbeat packet sent by the upper node of the node for the first time, it sends the heartbeat packet group to the lower node of the node. Subsequently, the node periodically sends the heartbeat packet group to the subordinate node according to T1 according to the time when the heartbeat packet is sent to the subordinate node for the first time. Therefore, under normal circumstances, when the node subsequently sends the heartbeat packet group to the subordinate node according to T1, it has already received the heartbeat packet from the superior node.
  • the node does not receive the heartbeat packet from the upper-level node when it sends the heartbeat packet group to the lower-level node according to the cycle, it may be due to network reasons, changes in the clock difference, or the departure of the upper-level node.
  • Send a heartbeat packet group to the lower-level node in a normal period and trigger abnormal recovery processing. For example, after the windows are aligned, the mobile phone determines to start broadcasting heartbeat packets to the earphones at 18:05, 18:10, 18:15... in a period of 5 minutes; If there is an abnormality in the heartbeat packet, the heartbeat packet group will be broadcast to the earphone at 18:05 according to the normal cycle, and the exception recovery process will be triggered.
  • the node if it receives the heartbeat packet from the superior node within the preset time period, it can perform clock difference calibration according to the received heartbeat packet; if the intermediate node has not received the heartbeat packet from the The heartbeat packet of the upper-level node can determine whether the upper-level node has left, whether it is necessary to re-determine the network topology relationship, whether it is necessary to recalculate the clock difference and other related exception handling.
  • window alignment is used to send and receive heartbeat packets, so as to perform online detection.
  • the clock difference can also be determined based on other messages other than heartbeat packets, and window alignment can also be used to exchange other target information instead of sending and receiving heartbeat packets, so that other applications other than online detection can be performed.
  • the embodiment of the present application does not limit the application scenarios and scope of window alignment. 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, and improving the reliability of receiving target information.
  • the sending and receiving of target information between electronic devices is more rapid, accurate and timely.
  • the target information may include basic information of an electronic device in the Smart Connect network or changes in network capability information.
  • other electronic devices in the Zhilian network can quickly and accurately receive the target information within the receiving window after the windows are aligned, so as to know the changes in the basic information of the electronic device or network capability information 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 receiving target information, improve the efficiency of multiple electronic devices in the Smart Connect network synchronously obtaining the basic information of an electronic device or the change of network capability information, and make the target information between multiple electronic devices in the Smart Connect network Sending and receiving more quickly, accurately and timely.
  • the basic information of an electronic device may include at least one of the following: the identification (device ID) of the electronic device, the name (device name) of the electronic device (device name), the type (device type) of the electronic device, the network identification (Network ID), the electronic device At least one of the weight information of the electronic device, the role information of the electronic device, and the version information of the electronic device.
  • the identification of the electronic device is used to uniquely identify an electronic device;
  • the name of the electronic device is the name of the electronic device defined by the user or the name defined by the factory of the electronic device;
  • the type of the electronic device indicates which type the electronic device belongs to, for example, the type is: Mobile phones, PCs, wearables, earphones, glasses, speakers, car phones, smart screens or car phones, etc.
  • the network identifier is a unique network identifier assigned by the network to the electronic device after the electronic device is connected to the network, for example, it may be a unique device identifier (UDID).
  • the version information of the electronic device indicates the version number of the current system of the electronic device. For network capability information, please refer to the relevant description above.
  • other electronic devices in the Zhilian network previously saved the IP address of the electronic device 1 so as to transmit business data with the electronic device 1, and the target information is that the IP address of the electronic device 1 has been changed.
  • Other electronic devices in the Smart Connect network can efficiently and accurately receive the target information based on window alignment. After receiving the target information, other electronic devices in the Zhilian network can update the IP address of the electronic device 1 saved before.
  • the previous network capability of the electronic device 1 does not support point-to-point (point to point, P2P) communication
  • the target information is that the electronic device 1 supports P2P communication.
  • Other electronic devices in the Smart Connect network can efficiently and accurately receive the target information based on window alignment. After receiving the target information, other electronic devices in the Zhilian network can perform P2P communication with the electronic device 1 .
  • the target information is whether the electronic device 1 has replaced a hotspot or other content.
  • an online detection method which can be used between any two electronic devices that support the first network connection mode, or between any two electronic devices that support the first network connection mode in other networking
  • Any two electronic devices can use the above method to calculate the clock difference and perform window alignment, and exchange heartbeat packets for online detection after window alignment.
  • the electronic device can quickly and accurately receive heartbeat packets within the receiving window, thereby reducing the sending and receiving of heartbeat packets per unit time, reducing communication costs, improving the reliability of heartbeat packet reception, and making online detection faster, more accurate and more efficient. timely.
  • any two electronic devices after the windows are aligned, can exchange target information other than heartbeat packets, so as to realize other possible functions other than online detection.
  • window alignment is performed by calculating clock differences between electronic devices.
  • the local clocks of each electronic device are independent of each other and do not need to be consistent with the world time, which does not affect the user's perception of time through each electronic device.
  • This solution is also compatible with electronic devices running different operating systems, and lightweight devices can also use this solution to efficiently exchange content such as heartbeat packets or target information.
  • another embodiment of the present application provides an online detection method, which can be used in a smart-connected network composed of multiple devices, and the smart-connected network includes a first electronic device and one or A plurality of second electronic devices.
  • the first electronic device and the second electronic device may have the structure shown in FIG. 1B .
  • the first electronic device is an upper-level node of the second electronic device
  • the second electronic device is a lower-level node of the first electronic device.
  • the first electronic device may be the above-mentioned central node, and the second electronic device may be the above-mentioned primary node; or, the first electronic device may be the above-mentioned primary node, and the second electronic device may be the above-mentioned secondary node, etc.
  • the method may include:
  • One or more second electronic devices acquire respective corresponding first clock differences, where the first clock difference is a difference between a local clock of the second electronic device and a local clock of the first electronic device.
  • the first electronic device may be the large screen shown in FIG. 1A
  • the second electronic device may be the mobile phone shown in FIG. 1A
  • the first clock difference may be the clock difference tC1 between the mobile phone and the large screen.
  • the first electronic device sends corresponding one or more first target messages to one or more second electronic devices.
  • the second electronic device is a mobile phone
  • the first target message is a heartbeat packet.
  • the first target message may be the first 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 above-mentioned
  • the third strategy corresponds to the first heartbeat packet or the X1-X0th heartbeat packets in the heartbeat packet group.
  • the one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences.
  • the second electronic device may control the timing at which the first electronic device sends the first target message and/or the second electronic device enters the receiving state according to the first clock difference and any one of the above-mentioned first to third strategies timing, so as to control the second electronic device to receive the corresponding first target message when it is in the window receiving state.
  • one or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and first preset period, so that The second electronic device receives the corresponding first target message when it is in the window receiving state.
  • one or more second electronic devices control, according to their corresponding first clock differences, that the second electronic device Being in the window receiving state, so that the second electronic device receives the corresponding first target message when in the window receiving state.
  • the second electronic device can control the timing of sending and/or receiving the target message based on the clock difference, so that the receiving device receives the target message when it is in the window receiving state, which can efficiently receive the target message and reduce power consumption.
  • any electronic device in the Zhilian network that has the relationship between upper and lower nodes can use the method provided by the embodiment of the application to transmit the first target message, and receive the first target message when it is in the window receiving state according to the clock difference , so that the first target message can be received efficiently, quickly and accurately, the number and duration of the first target message interaction can be reduced, the power consumption of electronic devices in the Smart Connect network can be saved, and the efficiency of corresponding processing according to the first target message can be improved.
  • the first target message includes a heartbeat packet
  • online detection of the electronic device can be efficiently performed according to the heartbeat packet in the first target message.
  • the above electronic device includes corresponding hardware and/or software modules for performing each function.
  • 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 by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions in combination with the embodiments for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
  • the functional modules of the electronic device may be divided according to the above method example.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules may be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
  • the electronic device may include: a processing unit, a receiving unit, a sending unit, and the like. It should be noted that all relevant content of the steps involved in the above method embodiments can be referred to the function description of the corresponding function module, and will not be repeated here.
  • the embodiment of the present application also provides an electronic device, as shown in FIG. 10 , including: one or more processors 1001, memory 1002, and one or more computer programs 1003, each of which can be connected via one or more communication buses 1004 connected.
  • 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-mentioned instructions can be used to perform the above-mentioned implementation steps in the example.
  • all relevant content of each step involved in the above method embodiment can be referred to the functional description of the corresponding physical device, and will not be repeated here.
  • the foregoing processor 1001 may specifically be the processor 110 shown in FIG. 1B
  • the foregoing memory 1002 may specifically be the internal memory 121 shown in FIG. 1B .
  • the embodiment of the present application also provides an electronic device, including one or more processors and one or more memories.
  • the one or more memories are coupled with one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device performs The above related method steps realize the online detection method in the above embodiment.
  • Embodiments of the present application also provide a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the electronic device, the electronic device executes the above-mentioned relevant method steps to realize the above-mentioned embodiment The online detection method in .
  • Embodiments of the present application also provide a computer program product, which, when running on a computer, causes the computer to execute the above-mentioned related steps, so as to implement the online detection method performed by the electronic device in the above-mentioned embodiments.
  • an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the online detection method performed by the electronic device in the above method embodiments.
  • the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment is all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the above-mentioned The beneficial effects of the corresponding method will not be repeated here.
  • the network system may be the above-mentioned Smart Connect network, may include a plurality of electronic devices, and may be used to implement the above-mentioned online detection method.
  • the disclosed devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation.
  • multiple units or components can be Incorporation or may be integrated into another device, or some features may be omitted, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places . Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solution of the embodiment of the present application is essentially 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, and the software product is stored in a storage medium Among them, several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: various media that can store program codes such as U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk.

Abstract

An online detection method based on a heartbeat packet, and a device, which relate to the technical field of electronics. A sending occasion and/or a receiving occasion of a heartbeat packet can be controlled on the basis of a clock difference, such that a receiving-end device receives the heartbeat packet in a window receiving state, such that the heartbeat packet can be efficiently received, thereby reducing the power consumption; and online detection can be performed quickly on the basis of the heartbeat packet. The solution is used for a network composed of a plurality of devices, and the network comprises a first electronic device and one or more second electronic devices. The solution comprises: one or more second electronic devices acquiring respective corresponding first clock differences, wherein the first clock difference is a difference value between a local clock of the second electronic device and a local clock of a first electronic device; the first electronic device respectively sending one or more corresponding first target messages to the one or more second electronic devices; and according to the respective corresponding first clock differences, the one or more second electronic devices controlling the second electronic devices to receive the corresponding first target messages in a window receiving state.

Description

一种基于心跳包的在线检测方法及设备An online detection method and device based on heartbeat packets
本申请要求于2021年05月31日提交国家知识产权局、申请号为202110603439.3、申请名称为“一种基于心跳包的在线检测方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the State Intellectual Property Office on May 31, 2021, with the application number 202110603439.3 and the application name "An online detection method and device based on heartbeat packets", the entire content of which is by reference incorporated in this application.
技术领域technical field
本申请实施例涉及电子技术领域,尤其涉及一种基于心跳包的在线检测方法及设备。The embodiment of the present application relates to the field of electronic technology, and in particular to an online detection method and device based on a heartbeat packet.
背景技术Background technique
随着越来越多的电子设备进入家庭或办公等场景,不同电子设备之间动态地智能连接,智能组网,协同完成业务已成为大势所趋。在多设备场景下,用户希望能够在业务请求前把各电子设备预先组成网络,并准确提供电子设备的在线状态,从而使得用户通过在线设备快速享受业务带来的各种体验。As more and more electronic devices enter home or office scenarios, dynamic and intelligent connections between different electronic devices, intelligent networking, and collaborative business completion have become the general trend. In a multi-device scenario, users hope to form a network of electronic devices in advance before requesting services, and provide accurate online status of electronic devices, so that users can quickly enjoy various experiences brought by services through online devices.
其中,由于多数电子设备对耗电敏感,因此各电子设备如何低功耗地进行在线检测,是一个需要解决的重要问题。Wherein, 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.
发明内容Contents of the invention
本申请实施例提供一种基于心跳包的在线检测方法及设备,能够基于网络中电子设备之间的时钟差,控制心跳包的发送时机和/或接收时机,使得接收端设备在处于窗口接收状态时接收心跳包,从而可以提高心跳包的接收效率,减少心跳包的收发次数和时长,降低电子设备的功耗,从而可以基于心跳包对网络中的多个电子设备实现快速、及时、准确的在线检测。Embodiments of the present application provide an online detection method and device based on heartbeat packets, which can control the timing of sending and/or receiving heartbeat packets based on the clock difference between electronic devices in the network, so that the receiving end device is in the window receiving state Receive heartbeat packets in real time, which can improve the receiving efficiency of heartbeat packets, reduce the number and duration of sending and receiving heartbeat packets, and reduce the power consumption of electronic devices, so that multiple electronic devices in the network can be quickly, timely and accurately based on heartbeat packets online test.
为达到上述目的,本申请实施例采用如下技术方案:In order to achieve the above purpose, the embodiment of the present application adopts the following technical solutions:
一方面,本申请实施例提供了一种消息交互方法,用于多设备组成的网络,该网络包括第一电子设备以及一个或多个第二电子设备。该方法包括:一个或多个第二电子设备获取各自对应的第一时钟差,第一时钟差为第二电子设备的本机时钟与第一电子设备的本机时钟之间的差值;第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息;一个或多个第二电子设备根据各自对应的第一时钟差,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息。On the one hand, an embodiment of the present application provides a method for message interaction, which is used in a network composed of multiple devices, where the network includes a first electronic device and one or more second electronic devices. The method includes: one or more second electronic devices acquire 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; An electronic device sends corresponding one or more first target messages to one or more second electronic devices; one or more second electronic devices control the second electronic devices to receive The corresponding first target message is received in the state.
其中,该网络可以为智连网络,第一电子设备为第二电子设备的上级节点,第二电子设备为第一电子设备的下级节点。例如,第一电子设备可以为上述中心节点、第二电子设备可以为上述一级节点;或者,第一电子设备可以为上述一级节点、第二电子设备可以为上述二级节点等。第一目标消息为第二电子设备期望接收的心跳包。Wherein, the network may be an intelligent connection network, the first electronic device is an upper-level node of the second electronic device, and the second electronic device is a lower-level node of the first electronic device. For example, the first electronic device may be the above-mentioned central node, and the second electronic device may be the above-mentioned primary node; or, the first electronic device may be the above-mentioned primary node, and the second electronic device may be the above-mentioned secondary node, etc. The first target message is a heartbeat packet expected to be received by the second electronic device.
基于该方案,第二电子设备能够基于时钟差控制第一目标消息的发送时机和/或接收时机,使得接收端设备在处于窗口接收状态时接收对应的第一目标消息,从而高效接收第一目标消息,降低功耗。这样,智连网络中任意具有上、下级节点关系的电子设备之间,都可以采用本申请实施例提供的方法传递第一目标消息,并根据时钟差在处于窗口接收状态时接收对应的第一目标消息,从而能够高效、快速、准确地接收第一目标消息,减少消息交互的条数和时长,节省智连网络中电子设备的功耗,提高根 据目标消息进行相应处理的效率。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 end device receives the corresponding first target message when it is in the window receiving state, thereby efficiently receiving the first target message message, reducing power consumption. In this way, any electronic device in the Zhilian network that has the relationship between upper and lower nodes can use the method provided by the embodiment of the present application to transmit the first target message, and receive the corresponding first target message when it is in the window receiving state according to the clock difference. Target message, so that the first target message can be received efficiently, quickly and accurately, the number and duration of message interaction can be reduced, the power consumption of electronic devices in the Smart Connect network can be saved, and the efficiency of corresponding processing according to the target message can be improved.
在一种可能的设计中,第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据第一预设周期,向一个或多个第二电子设备周期性地发送对应的一个或多个第一目标消息。一个或多个第二电子设备根据各自对应的第一时钟差,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息,包括:一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息。In a possible design, the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: sending the first electronic device to one or more A second electronic device periodically sends corresponding one or more first target messages. The one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences, including: one or more second electronic devices according to their corresponding The first clock difference and the first preset period control the second electronic device to receive the corresponding first target message when it is in the window receiving state.
在该方案中,第一电子设备和第二电子设备之间可以周期性地收发第一目标消息。In this solution, the first target message can be sent and received periodically between the first electronic device and the second electronic device.
在另一种可能的设计中,一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息,包括:一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。In another possible design, one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock difference and first preset period , including: one or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and the first preset period, so as to Make the second electronic device receive the corresponding first target message when it is in the window receiving state.
在该方案中,第二电子设备在第一电子设备发送第一目标消息时进入窗口接收状态,在第一目标消息传输至第二电子设备时,第二电子设备的窗口已经处于接收状态,从而可以在处于窗口接收状态时接收第一目标消息,因而能够快速、高效地接收到第一目标消息,降低设备功耗。In this solution, the second electronic device enters the window receiving state when the first electronic device sends the first target message, and 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, thus The first target message can be received in the window receiving state, so the first target message can be received quickly and efficiently, and the power consumption of the device can be reduced.
在另一种可能的设计中,在一个或多个第二电子设备获取各自对应的第一时钟差之前,方法还包括:第一电子设备根据一个或多个第二电子设备最近分别接收到的第二目标消息,计算第一时钟差。其中,第二目标消息来自第一电子设备发送的第一消息组,且第一消息组包括按照预设间隔发送的N个消息,第二目标消息为第一消息组中的第X个消息,N为正整数,X为小于或者等于N的正整数。一个或多个第二电子设备获取各自对应的第一时钟差,包括:一个或多个第二电子设备从第一电子设备获取各自对应的第一时钟差。In another possible design, before the one or more second electronic devices acquire their corresponding first clock differences, the method further includes: the first electronic device according to the latest clock difference respectively received by the one or more second electronic devices The second target message calculates the first clock difference. 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 preset intervals, and 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 acquiring respective corresponding first clock differences includes: the one or more second electronic devices acquiring respective corresponding first clock differences from the first electronic device.
也就是说,第一时钟差可以根据第二电子设备最近接收到的第二目标消息来计算。其中,该第一消息组用于确定第二电子设备对应的X和tX,例如可以是后文大屏首次向手机广播的心跳包组。第二目标消息对应的X用于后续进行窗口对齐,例如可以是手机首次接收到的来自大屏的心跳包,该心跳包为大屏广播的心跳包组中的第X个心跳包。That is, the first clock difference may be calculated according to the second target message recently received by the second electronic device. Wherein, the first message group is used to determine the X and tX corresponding to the second electronic device, for example, it may be the heartbeat packet group broadcast to the mobile phone by the large screen for the first time later. The X corresponding to the second target message is used for subsequent window alignment. For example, it may be the heartbeat packet received by the mobile phone from the large screen for the first time, and the heartbeat packet is the Xth heartbeat packet in the heartbeat packet group broadcast by the large screen.
在另一种可能的设计中,该方法还包括:第一电子设备在t1时刻向一个或多个第二电子设备发送第一消息组;一个或多个第二电子设备在各自的tr时刻接收到第一消息组中的第X个消息后,分别向第一电子设备发送第一响应消息,第一响应消息包括tr和第X个消息的发送时间戳tX的指示信息;第一电子设备在一个或多个tnow时刻,接收到来自一个或多个第一响应消息后,根据tnow和tX分别计算一个或多个第二电子设备对应的传输时延。第一电子设备根据一个或多个第二电子设备最近分别接收到的第二目标消息,计算第一时钟差,包括:第一电子设备根据一个或多个第二电子设备分别对应的传输时延、tr和tX,计算一个或多个第二电子设备各自对应的第一时钟差。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; one or more second electronic devices receive the message group at respective time tr After reaching the Xth message in the first message group, respectively send the first response message to the first electronic device, the first response message includes indication information of tr and the sending time stamp tX of the Xth message; At one or more tnow times, after receiving one or more first response messages, respectively calculate transmission delays corresponding to one or more second electronic devices according to tnow and tX. The first electronic device calculates the first clock difference according to the second target messages recently received by one or more second electronic devices, including: the first electronic device calculates the transmission delay corresponding to one or more second electronic devices respectively , tr and tX, calculating the first clock difference corresponding to each of the one or more second electronic devices.
也就是说,第一时钟差根据第二电子设备接收到的第二消息组中,第二目标消息 的编号和发送时间等信息计算获得。其中,第二电子设备不同,第二电子设备对应的tX、X和tr等参数也不同。例如,当第二电子设备为手机时,tX为tX1;当第二电子设备为手表时,tX为tX2。第二消息组为窗口对齐后,第一电子设备发送的消息组。例如,第一消息组可以为后文手机与大屏进行窗口对齐后,大屏广播的心跳包组。That is to say, the first clock difference is calculated and obtained according to information such as the serial number and sending time of the second target message in the second message group received by the second electronic device. Wherein, the second electronic devices are different, and parameters such as tX, X, and tr corresponding to the second electronic devices are also different. 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 a message group sent by the first electronic device after the windows are aligned. For example, the first message group may be the heartbeat packet group broadcast by the large screen after the windows of the mobile phone and the large screen are aligned later.
在另一种可能的设计中,第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据t1和第一预设周期,向一个或多个第二电子设备周期性地发送第二消息组,第二消息组包括按照预设间隔发送的多个消息,一个或多个第二电子设备各自对应的第一目标消息,为第二消息组中一个或多个第二电子设备各自对应的第X个消息;一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:一个或多个第二电子设备根据各自对应的第一时钟差、t1和第一预设周期,控制第二电子设备在第一电子设备发送第二消息组时进入窗口接收状态,以使得第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态。In another possible design, the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to t1 and the first preset period, the first electronic device sends One or more second electronic devices periodically send a second message group, the second message group includes a plurality of messages sent at preset intervals, and the first target messages corresponding to each of the one or more second electronic devices are In the second message group, one or more second electronic devices respectively correspond to the Xth message; one or more second electronic devices control the second electronic device according to the corresponding first clock difference and the first preset cycle. When an electronic device sends the corresponding first target message, it enters the window receiving state, including: one or more second electronic devices control the second electronic device according to the corresponding first clock difference, t1 and the first preset period. An electronic device enters the window receiving state when sending the second message group, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
在该方案中,第二电子设备能够在第一电子设备发送第二消息组时进入窗口接收状态,从而在处于窗口接收状态时接收第一目标消息,因而能够快速、高效地接收到第一目标消息,降低设备功耗。该方案可以与后文窗口对齐的第一种策略对应。In this scheme, 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption. This scheme can correspond to the first strategy of window alignment described later.
在另一种可能的设计中,第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据t1和第一预设周期,向一个或多个第二电子设备周期性地发送第二消息组,第二消息组包括按照预设间隔发送的多个消息,一个或多个第二电子设备各自对应的第一目标消息,为第二消息组中一个或多个第二电子设备各自对应的第X个消息;一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:一个或多个第二电子设备根据各自对应的第一时钟差、tX和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态。In another possible design, the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to t1 and the first preset period, the first electronic device sends One or more second electronic devices periodically send a second message group, the second message group includes a plurality of messages sent at preset intervals, and the first target messages corresponding to each of the one or more second electronic devices are In the second message group, one or more second electronic devices respectively correspond to the Xth message; one or more second electronic devices control the second electronic device according to the corresponding first clock difference and the first preset cycle. When an electronic device sends the corresponding first target message, it enters the window receiving state, including: one or more second electronic devices control the second electronic device according to the corresponding first clock difference, tX and the first preset period. When an electronic device sends the corresponding first target message, it enters the window receiving state.
在该方案中,第二电子设备能够在第一电子设备发送第一目标消息时进入窗口接收状态,从而在处于窗口接收状态时接收第一目标消息,因而能够快速、高效地接收到第一目标消息,降低设备功耗。该方案可以与后文窗口对齐的第二种策略对应。In this scheme, 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption. This solution can correspond to the second strategy of window alignment described later.
在另一种可能的设计中,第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据tX0和第一预设周期,向一个或多个第二电子设备周期性地发送第二消息组,tX0为一个或多个电子设备对应的tX中时机靠前的取值,tX0对应第一消息组中的第X0个消息,第二消息组包括按照预设间隔发送的多个消息,一个或多个第二电子设备各自对应的第一目标消息,为第二消息组中与一个或多个第二电子设备各自对应的第X-X0+1个消息。一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:一个或多个第二电子设备根据各自对应的第一时钟差、tX和第一预设周期,控制第二电子设备在第一电子设备发送第二消息组时进入窗口接收状态,以使得第二电子设备在第一电子设备发送对应的第一 目标消息时进入窗口接收状态。In another possible design, the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: according to tX0 and the first preset period, the first electronic device sends One or more second electronic devices periodically send the second message group, tX0 is the value of the earlier timing in tX corresponding to one or more electronic devices, tX0 corresponds to the X0th message in the first message group, and the first The second message group includes a plurality of messages sent at preset intervals, and the first target message corresponding to 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. -X0+1 messages. One or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and first preset period, including: one or Multiple second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the second message group according to their corresponding first clock difference, tX and the first preset period, so that the second electronic device The window receiving state is entered when the first electronic device sends the corresponding first target message.
在该方案中,第二电子设备能够在第一电子设备发送第一目标消息所在的第二消息组时进入窗口接收状态,从而在处于窗口接收状态时接收第一目标消息,因而能够快速、高效地接收到第一目标消息,降低设备功耗。该方案与后文窗口对齐的第三种策略对应。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 that it can receive the first target message while in the window receiving state, so it can quickly and efficiently The first target message is successfully received, and power consumption of the device is reduced. This scheme corresponds to the third strategy of window alignment in the following text.
在另一种可能的设计中,该网络包括一个第二电子设备,第一电子设备向第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据tX和第一预设周期,向第二电子设备周期性地发送第二消息组,第二消息组包括按照预设间隔发送的多个消息,第一目标消息为第二消息组中的第一个消息。第二电子设备根据第一时钟差和第一预设周期,控制第一窗口在第一电子设备发送对应的第一目标消息时进入接收状态,包括:第二电子设备根据第一时钟差、tX和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态。In another possible design, the network includes a second electronic device, and the first electronic device sends one or more corresponding first target messages to the second electronic device, including: the first electronic device The preset period is to periodically send the second message group to the second electronic device, the second message group includes a plurality of messages sent at preset intervals, and the first target message is the first message in the second message group. According to the first clock difference and the first preset period, the second electronic device controls the first window to enter the receiving state when the first electronic device sends the corresponding first target message, including: the second electronic device according to the first clock difference, tX and the first preset period, controlling the second electronic device to enter the window receiving state when the first electronic device sends the corresponding first target message.
在该方案中,第二电子设备能够在第一电子设备发送第一目标消息时进入窗口接收状态,从而在处于窗口接收状态时接收第一目标消息,因而能够快速、高效地接收到第一目标消息,降低设备功耗。In this scheme, 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 while in the window receiving state, and thus can quickly and efficiently receive the first target message message, reducing device power consumption.
在另一种可能的设计中,该方法还包括:若第二电子设备接收到第二消息组中的第Xi个消息,且第Xi个消息与第X个消息所间隔的数量大于或者等于预设值,则请求第一电子设备更新第一时钟差。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 interval between the Xi th message and the X th message is greater than or equal to the preset If the value is set, the first electronic device is requested to update the first clock difference.
在该方案中,若第二电子设备接收到第二消息组中的第Xi个消息,且Xi与第X个消息所间隔的数量大于或者等于预设值,则可能第二电子设备与第一电子设备之间的时钟差变化较大,因而可以请求第一电子设备更新第一时钟差。In this scheme, if the second electronic device receives the Xi-th message in the second message group, and the interval between Xi and the X-th message is greater than or equal to a preset value, then the second electronic device may be connected to the first The clock difference between electronic devices varies greatly, so the first electronic device may be requested to update the first clock difference.
在另一种可能的设计中,该方法还包括:若第一电子设备根据来自第二电子设备的响应消息确定,第二电子设备接收到的第Xi个消息与第X个消息所间隔的数量大于或者等于预设值,则第一电子设备更新第一时钟差。In another possible design, the method further includes: if the first electronic device determines according to the response message from the second electronic device, the number of intervals between the Xi th message and the X th message received by the second electronic device is greater than or equal to a preset value, the first electronic device updates the first clock difference.
在该方案中,若第一电子设备获知,第二电子设备接收到的第二消息组中的第Xi个消息,且Xi与第X个消息所间隔的数量大于或者等于预设值,则可能第二电子设备与第一电子设备之间的时钟差变化较大,因而第一电子设备可以触发更新第一时钟差。In this scheme, if the first electronic device knows that the Xi-th message in the second message group received by the second electronic device, and the interval between Xi and the X-th message is greater than or equal to the preset value, it may The clock difference between the second electronic device and the first electronic device varies greatly, so the first electronic device may trigger to update the first clock difference.
在另一种可能的设计中,一个或多个第二电子设备根据各自对应的第一时钟差,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息,包括:一个或多个第二电子设备根据各自对应的第一时钟差,控制在根据预先获得的传输时延计算的对应的第一目标消息到达第二电子设备的时刻之前,第二电子设备进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。In another possible design, one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences, including: one or more Each second electronic device controls the second electronic device to enter the window receiving state before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device according to the corresponding first clock difference, so as to Make the second electronic device receive the corresponding first target message when it is in the window receiving state.
在该方案中,第二电子设备能够在第一目标消息到达之前进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收第一目标消息,,因而能够快速、高效地接收到第一目标消息,降低设备功耗。In this solution, the second electronic device can enter the window receiving state before the arrival of the first target message, so that the second electronic device can receive the first target message when it is in the window receiving state, and thus can quickly and efficiently receive the second target message. A targeted message to reduce device power consumption.
在另一种可能的设计中,网络还包括一个或多个第三电子设备,每个第三电子设备对应一个第二电子设备,每个第二电子设备对应一个或多个第三电子设备,方法还包括:一个或多个第三电子设备获取各自对应的第二时钟差,第二时钟差为第三电子 设备的本机时钟与第三电子设备对应的第二电子设备的本机时钟之间的差值;第二电子设备向对应的一个或多个第三电子设备发送第三目标消息;一个或多个第三电子设备根据各自对应的第二时钟差,控制第三电子设备在处于窗口接收状态时接收第三目标消息。In another possible design, the network further includes one or more third electronic devices, each third electronic device corresponds to one second electronic device, and each second electronic device corresponds to one or more third electronic devices, The method further includes: one or more third electronic devices obtain their corresponding second clock differences, and 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 difference between them; the second electronic device sends a third target message to the corresponding one or more third electronic devices; one or more third electronic devices control the third electronic device according to the corresponding second clock difference The third object message is received when the window receives state.
也就是说,与第一电子设备和第二电子设备之间类似,第二电子设备与第三电子设备之间,也可以采用相同的方式传递目标消息。That is to say, similar to that between the first electronic device and the second electronic device, the target message may also be transferred between the second electronic device and the third electronic device in the same manner.
在另一种可能的设计中,第一目标消息为蓝牙低功耗BLE的不可连接广播ADV_NONCONN_IND消息。In another possible design, the first target message is a non-connectable advertisement ADV_NONCONN_IND message of Bluetooth Low Energy BLE.
其中,不可连接广播消息不需要专门的响应消息来回复,因而可以减少响应消息包的带宽占用,减少在线检测过程中的消息交互条数,节省功耗,简化交互流程,提高在线检测的效率。Among them, the non-connectable broadcast message does not require a special response message to reply, so it can reduce the bandwidth occupation 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.
在另一种可能的设计中,第二电子设备获取第一时钟差,包括:第二电子设备从第一电子设备获取根据第二预设周期更新后的第一时钟差。In another possible design, the acquiring the first clock difference by the second electronic device includes: acquiring, by the second electronic device, the first clock difference updated according to a second preset period from the first electronic device.
也就是说,第一电子设备可以定期更新第一时钟差,以便第二电子设备更新后的第一时钟差进行窗口对齐。That is to say, the first electronic device may periodically update the first clock difference, so that the updated first clock difference of the second electronic device performs window alignment.
在另一种可能的设计中,第二预设周期与预设的时钟差累计变化阈值相对应。In another possible design, the second preset period corresponds to a preset clock difference cumulative change threshold.
也就是说,在第二预设周期内,第一时钟差的累计变化可能已经超过了阈值,因而第一电子设备可以触发重新计算时钟差。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 may trigger recalculation of the clock difference.
在另一种可能的设计中,第一目标消息用于传输心跳包。In another possible design, the first target message is used to transmit heartbeat packets.
例如,消息组可以为心跳包组,可包括多个心跳包,第一目标消息用于传输目标心跳包。这样,第二电子设备可以基于第一时钟差,快速、高效地接收心跳包,从而快速、高效地进行心跳检测。For example, the message group may be a heartbeat packet group, which may 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 quickly and efficiently receive the heartbeat packet based on the first clock difference, thereby performing heartbeat detection quickly and efficiently.
另一方面,本申请实施例提供了一种消息交互方法,用于多设备组成的网络中的第一电子设备,该网络还包括一个或多个第二电子设备。该方法包括:第一电子设备计算一个或多个第二电子设备分别对应的第一时钟差,第一时钟差为第二电子设备的本机时钟与第一电子设备的本机时钟之间的差值。第一电子设备将一个或多个第二电子设备分别对应的第一时钟差,发送给对应的第二电子设备,第一时钟差用于控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息。第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息。On the other hand, an embodiment of the present application provides a method for message interaction, which is used for a first electronic device in a network composed of multiple devices, where the network further includes one or more second electronic devices. The method includes: the first electronic device calculates first clock differences respectively corresponding to one or more second electronic devices, and 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 difference. The first electronic device sends the first clock difference corresponding to 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 clock difference when it is in the window receiving state. First target message. The first electronic device sends the corresponding one or more first target messages to the one or more second electronic devices.
在该方案中,第一电子设备可以将第一时钟差通知给第二电子设备,以便第二电子设备能够基于时钟差控制第一目标消息的发送时机和/或接收时机,使得接收端设备在处于窗口接收状态时接收第一目标消息,从而高效接收第一目标消息,降低功耗。In this scheme, the first electronic device may notify the second electronic device of the first clock difference, so that the second electronic device can control the timing of sending and/or receiving the first target message based on the clock difference, so that the receiving end device can The first target message is received when in the window receiving state, thereby efficiently receiving the first target message and reducing power consumption.
在一种可能的设计中,第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:第一电子设备根据第一预设周期,向一个或多个第二电子设备周期性地发送对应的一个或多个第一目标消息。In a possible design, the first electronic device sends corresponding one or more first target messages to one or more second electronic devices, including: sending the first electronic device to one or more A second electronic device periodically sends corresponding one or more first target messages.
在另一种可能的设计中,第一电子设备计算一个或多个第二电子设备分别对应的第一时钟差,包括:第一电子设备根据一个或多个第二电子设备最近分别接收到的第二目标消息,计算第一时钟差。其中,第二目标消息来自第一电子设备发送的第一消息组,且第一消息组包括按照预设间隔发送的N个消息,第二目标消息为第一消息组 中的第X个消息,N为正整数,X为小于或者等于N的正整数。In another possible design, the first electronic device calculates first clock differences respectively corresponding to one or more second electronic devices, including: The second target message calculates the first clock difference. 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 preset intervals, and 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.
在另一种可能的设计中,第一电子设备根据一个或多个第二电子设备最近分别接收到的第二目标消息,计算第一时钟差,包括:第一电子设备在t1时刻向一个或多个第二电子设备发送第一消息组;第一电子设备在一个或多个tnow时刻,接收到来自一个或多个第二电子设备的第一响应消息,第一响应消息包括第二电子设备接收到第一消息组中的第X个消息的时刻tr和第X个消息的发送时间戳tX的指示信息;第一电子设备根据一个或多个第二电子设备分别对应的tnow和tX,计算一个或多个第二电子设备分别对应的传输时延;第一电子设备根据一个或多个第二电子设备分别对应的传输时延、tr和tX,计算一个或多个第二电子设备各自对应的第一时钟差。In another possible design, the first electronic device calculates the first clock difference according to the second target messages recently received by one or more second electronic devices, including: the first electronic device sends a clock difference to one or Multiple second electronic devices send a first message group; the first electronic device receives a first response message from one or more second electronic devices at one or more tnow moments, and the first response message includes the second electronic device Receive the time tr of the Xth message in the first message group and the indication information of the sending time stamp tX of the Xth message; the first electronic device calculates according to the tnow and tX respectively corresponding to one or more second electronic devices The transmission delays corresponding to one or more second electronic devices respectively; the first electronic device calculates the respective corresponding transmission delays, tr and tX of one or more second electronic devices The first clock difference.
在另一种可能的设计中,第一电子设备根据第一预设周期,向一个或多个第二电子设备周期性地发送对应的一个或多个第一目标消息,包括:第一电子设备根据t1和第一预设周期,向一个或多个第二电子设备周期性地发送第二消息组,第二消息组包括按照预设间隔发送的多个消息,一个或多个第二电子设备各自对应的第一目标消息,为第二消息组中一个或多个第二电子设备各自对应的第X个消息。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 According to t1 and the first preset period, periodically send a second message group to one or more second electronic devices, the second message group includes multiple messages sent at preset intervals, one or more second electronic devices The respective first target messages are Xth messages corresponding to each of the one or more second electronic devices in the second message group.
在另一种可能的设计中,第一电子设备根据第一预设周期,向一个或多个第二电子设备周期性地发送对应的一个或多个第一目标消息,包括:第一电子设备根据tX0和第一预设周期,向一个或多个第二电子设备周期性地发送第二消息组,tX0为一个或多个电子设备对应的tX中时机靠前的取值,tX0对应第一消息组中的第X0个消息,第二消息组包括按照预设间隔发送的多个消息,一个或多个第二电子设备各自对应的第一目标消息,为第二消息组中与一个或多个第二电子设备各自对应的X-X0+1个消息。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 According to tX0 and the first preset period, periodically send the second message group to one or more second electronic devices, tX0 is the value with the earlier timing in tX corresponding to one or more electronic devices, and tX0 corresponds to the first The X0th message in the message group, the second message group includes a plurality of messages sent at preset intervals, and the first target message corresponding to one or more second electronic devices is the first target message in the second message group associated with one or more X-X0+1 messages corresponding to each second electronic device.
在另一种可能的设计中,该网络包括一个第二电子设备,第一电子设备根据第一预设周期,向一个或多个第二电子设备周期性地发送对应的一个或多个第一目标消息,包括:第一电子设备根据tX和第一预设周期,向第二电子设备周期性地发送第二消息组,第二消息组包括按照预设间隔发送的多个消息,第一目标消息为第二消息组中的第一个消息。In another possible design, the network includes a second electronic device, and the first electronic device periodically sends corresponding one or more first electronic devices to one or more second electronic devices according to a first preset cycle. The target message includes: the first electronic device periodically sends a second message group to the second electronic device according to tX and the first preset period, the second message group includes multiple messages sent at preset intervals, the first target The message is the first message in the second message group.
在另一种可能的设计中,该方法还包括:若第一电子设备根据来自第二电子设备的响应消息确定,第二电子设备接收到的第Xi个消息与第X个消息所间隔的数量大于或者等于预设值,则第一电子设备更新第一时钟差。In another possible design, the method further includes: if the first electronic device determines according to the response message from the second electronic device, the number of intervals between the Xi th message and the X th message received by the second electronic device is greater than or equal to a preset value, the first electronic device updates the first clock difference.
在另一种可能的设计中,第一时钟差用于,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。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 is in the window receiving state When the corresponding first target message is received.
在另一种可能的设计中,第一时钟差用于,控制在根据预先获得的传输时延计算的对应的第一目标消息到达第二电子设备的时刻之前,第二电子设备进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。In another possible design, the first clock difference is used to control the second electronic device to enter the window receiving state before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device , so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
另一方面,本申请实施例提供了一种消息交互方法,用于多设备组成的网络中的第二电子设备,网络还包括第一电子设备。该方法包括:第二电子设备获取第一时钟差,第一时钟差为第二电子设备的本机时钟与第一电子设备的本机时钟之间的差值;第二电子设备根据第一时钟差,控制第二电子设备在处于窗口接收状态时接收来自第 一电子设备的对应的第一目标消息。On the other hand, an embodiment of the present application provides a method for message interaction, which is used for a second electronic device in a network composed of multiple devices, and the network further includes the first electronic device. The method includes: the second electronic device acquires a first clock difference, and 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; Poor, controlling the second electronic device to receive the corresponding first target message from the first electronic device when in the window receiving state.
基于该方案,第二电子设备能够基于时钟差控制第一目标消息的发送时机和/或接收时机,使得接收端设备在处于窗口接收状态时接收第一目标消息,从而高效接收第一目标消息,降低功耗。Based on this scheme, 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 end device receives the first target message when it is in the window receiving state, thereby efficiently receiving the first target message, Reduce power consumption.
在一种可能的设计中,第二电子设备根据第一时钟差,控制第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息,包括:第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息。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 according to The first clock difference and the first preset period control the second electronic device to receive the corresponding first target message from the first electronic device when it is in the window receiving state.
在另一种可能的设计中,第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息,包括:第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息。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: according to the first clock difference and the first preset period, 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, so that the second electronic device is in the window A corresponding first target message is received from the first electronic device while in the receiving state.
在另一种可能的设计中,第二电子设备获取第一时钟差,包括:第二电子设备从第一电子设备获取第一时钟差,第一时钟差根据第二电子设备最近接收到的第二目标消息获得。其中,第二目标消息来自第一电子设备发送的第一消息组,且第一消息组包括按照预设间隔发送的N个消息,第二目标消息为第一消息组中的第X个消息,N为正整数,X为小于或者等于N的正整数。In another possible design, the acquiring the first clock difference by the second electronic device includes: acquiring the first clock difference from the first electronic device by the second electronic device, and the first clock difference is based on the first clock difference recently received by the second electronic device Two target messages are obtained. 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 preset intervals, and 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.
在另一种可能的设计中,该方法还包括:第二电子设备在tr时刻接收到来自第一电子设备的第一消息组中的第X个消息;第二电子设备向第一电子设备发送第一响应消息,第一响应消息包括tr和第X个消息的发送时间戳tX的指示信息,tr和tX用于计算第一时钟差。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 the message to the first electronic device A first response message, where the first response message includes tr and indication information of the sending time stamp tX of the Xth message, and tr and tX are used to calculate the first clock difference.
在另一种可能的设计中,第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:第二电子设备根据第一时钟差、第一消息组中第一个消息的发送时刻t1和第一预设周期,控制第二电子设备在第一电子设备发送第二消息组时进入窗口接收状态,以使得第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,其中,第二消息组包括按照预设间隔发送的多个消息,第一目标消息为第二消息组中的第X个消息。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 reception 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, wherein the second message group includes a plurality of messages sent at preset intervals, and the first target message is the second message The Xth message in the group.
在另一种可能的设计中,第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:第二电子设备根据第一时钟差、第一消息组中第X个消息的发送时刻tX和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,其中,第二消息组包括按照预设间隔发送的多个消息,第一目标消息为第二消息组中的第一个消息。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: According to the first clock difference, the sending time tX of the Xth message in the first message group and the first preset period, the second electronic device controls the second electronic device to enter the window when the first electronic device sends the corresponding first target message In the receiving state, the second message group includes a plurality of messages sent at preset intervals, and the first target message is the first message in the second message group.
在另一种可能的设计中,第二电子设备根据第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:第二电子设备根据第一时钟差、tX和第一预设周期,控制第二电子设备在第一电子设备发送第二消息组时进入窗口接收状态,以使得第二电子设备在第一电子设备发送对应 的第一目标消息时进入窗口接收状态,其中,第二消息组包括按照预设间隔发送的多个消息,第一目标消息为第二消息组中的第一个消息或者第X-X0+1个消息,第X0个消息在第一消息组中先于第X个消息发送。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: According to the first clock difference, tX and the first preset period, 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, so that the second electronic device Enter the window receiving state when sending the corresponding first target message, wherein the second message group includes multiple messages sent at preset intervals, and the first target message is the first message or the X-X0th message in the second message group +1 message, the X0th message is sent before the Xth message in the first message group.
在另一种可能的设计中,该方法还包括:若第二电子设备接收到第二消息组中的第Xi个消息,且第Xi个消息与第X个消息所间隔的数量大于或者等于预设值,则请求第一电子设备更新第一时钟差。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 interval between the Xi th message and the X th message is greater than or equal to the preset If the value is set, the first electronic device is requested to update the first clock difference.
在另一种可能的设计中,第二电子设备根据第一时钟差,控制第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息,包括:第二电子设备根据第一时钟差,控制在根据预先获得的传输时延计算的对应的第一目标消息到达第二电子设备的时刻之前,第二电子设备进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收来自第一电子设备的对应的第一目标消息。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, including: the second electronic device According to the first clock difference, before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device, the second electronic device enters the window receiving state, so that the second electronic device is in the window A corresponding first target message is received from the first electronic device while in the receiving state.
在另一种可能的设计中,网络还包括一个或多个第三电子设备,每个第二电子设备对应一个或多个第三电子设备,该方法还包括:第二电子设备向对应的一个或多个第三电子设备发送第三目标消息。In another possible design, the network further includes one or more third electronic devices, and each second electronic device corresponds to one or more third electronic devices, and the method further includes: sending the second electronic device to the corresponding one The one or more third electronic devices send a third targeted message.
在另一种可能的设计中,第二电子设备获取第一时钟差,包括:第二电子设备从第一电子设备获取根据第二预设周期更新后的第一时钟差。In another possible design, the acquiring the first clock difference by the second electronic device includes: acquiring, by the second electronic device, the first clock difference updated according to a second preset period from the first electronic device.
另一方面,本申请实施例提供了一种消息交互装置,该装置包含在第一电子设备中或第二电子设备中,该装置具有实现上述任一方面及任一项可能的实现方式中第一电子设备或第二电子设备行为的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块或单元。例如,发送模块或单元、接收模块或单元、处理模块或单元等。On the other hand, an embodiment of the present application provides a message interaction device, the device is included in the first electronic device or the second electronic device, and the device has the first A function of the behavior of an electronic device or a second electronic device. This function may be implemented by hardware, or may be implemented by executing corresponding software on the hardware. Hardware or software includes one or more modules or units corresponding to the functions described above. For example, a sending module or unit, a receiving module or unit, a processing module or unit, and the like.
另一方面,本申请实施例提供了一种电子设备,包括一个或多个处理器以及一个或多个存储器。该一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述任一方面及任一项可能的实现方式中的第一电子设备执行的消息交互方法,或者使得电子设备执行上述任一方面及任一项可能的实现方式中的第二电子设备执行的消息交互方法。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 with one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device performs The message interaction method executed by the first electronic device in any of the above aspects and any possible implementation manners, or causing the electronic device to execute the message executed by the second electronic device in any of the above aspects and any possible implementation manners interactive method.
另一方面,本申请实施例提供了一种计算机可读存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述任一方面及任一项可能的实现方式中的第一电子设备执行的消息交互方法,或者使得电子设备执行上述任一方面及任一项可能的实现方式中的第二电子设备执行的消息交互方法。On the other hand, an embodiment of the present application provides a computer-readable storage medium, including computer instructions. When the computer instructions are run on an electronic device, the electronic device executes any one of the above aspects and any one of the possible implementations. The message interaction method performed by the first electronic device, or the message interaction method performed by the second electronic device in any one of the foregoing aspects and any possible implementation manners.
另一方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面及任一项可能的实现方式中的第一电子设备执行的消息交互方法,或者使得计算机执行上述任一方面及任一项可能的实现方式中的第二电子设备执行的消息交互方法。On the other hand, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, it causes the computer to execute the message executed by the first electronic device in any of the above aspects and any possible implementation manners. An interaction method, or causing a computer to execute the message interaction method executed by the second electronic device in any one of the foregoing aspects and any possible implementation manner.
另一方面,本申请实施例提供了一种所设备组成的网络系统,该系统可以包括第一电子设备和第二电子设备,第一电子设备和第二电子设备可以执行上述任一方面及任一项可能的实现方式中的消息交互方法。On the other hand, the 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 perform any of the above aspects and any A message interaction method in one possible implementation.
其中,关于其他方面的有益效果,可以参考关于多设备网络方法方面的有益效果, 这里不再赘述。Wherein, for other beneficial effects, reference may be made to the beneficial effects of the multi-device network method, which will not be repeated here.
附图说明Description of drawings
图1A为本申请实施例提供的一种智连网络的组网示意图;FIG. 1A is a schematic diagram of a smart connection network provided by an embodiment of the present application;
图1B为本申请实施例提供的一种电子设备的硬件结构示意图;FIG. 1B is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application;
图2为本申请实施例提供的一种智连网络中的上、下级节点关系示意图;FIG. 2 is a schematic diagram of the relationship between upper and lower nodes in a smart connection network provided by an embodiment of the present application;
图3A为本申请实施例提供的一种智连网络中电子设备之间交互心跳包的时序图;FIG. 3A is a sequence diagram of heartbeat packets exchanged between electronic devices in a smart connected network provided by an embodiment of the present application;
图3B为本申请实施例提供的一种大屏与手机之间关于时钟差的交互流程图;Fig. 3B is a flow chart of interaction between a large screen and a mobile phone regarding clock difference provided in the embodiment of the present application;
图4为本申请实施例提供的第一种策略对应的窗口对齐前后的对比示意图;FIG. 4 is a schematic diagram of comparison before and after window alignment corresponding to the first strategy provided by the embodiment of the present application;
图5为本申请实施例提供的第二种策略对应的窗口对齐前后的对比示意图;FIG. 5 is a schematic diagram of comparison before and after window alignment corresponding to the second strategy provided by the embodiment of the present application;
图6为本申请实施例提供的第三种策略对应的窗口对齐前后的对比示意图;FIG. 6 is a schematic diagram of comparison before and after window alignment corresponding to the third strategy provided by the embodiment of the present application;
图7为现有技术提供的一种未进行窗口对齐情况下心跳包扫描效果示意图;FIG. 7 is a schematic diagram of a heartbeat packet scanning effect provided by the prior art without window alignment;
图8为本申请实施例提供的一种手机与音箱之间关于时钟差的交互流程图;FIG. 8 is a flowchart of an interaction between a mobile phone and a speaker regarding clock differences provided in an embodiment of the present application;
图9为本申请实施例提供的一种消息交互方法流程图;FIG. 9 is a flowchart of a message interaction method provided by an embodiment of the present application;
图10为本申请实施例提供的电子设备的另一种硬件结构示意图。FIG. 10 is a schematic diagram of another hardware structure of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Among them, in the description of the embodiments of this application, unless otherwise specified, "/" means or means, for example, A/B can mean A or B; "and/or" in this article is only a description of associated objects The association relationship of indicates that there may be three kinds of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. In addition, in the description of the embodiments of the present application, "plurality" refers to two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
在本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplarily" or "for example" are used as examples, illustrations or descriptions. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a concrete manner.
目前,多个电子设备之间进行智能组网、协同完成业务已经成为大势所趋。多个能够建立相互信任关系的电子设备在相互发现后,可以自动组成一个网络,称之为智连网络。例如,多个电子设备登陆了相同的账号(即Account ID相同),或者用户对多个电子设备进行了绑定和认证过程(例如通过pin码或者快速反应(quick response,QR)码等进行绑定),则该多个电子设备之间建立了相互信任关系。At present, intelligent networking among multiple electronic devices and cooperative completion of services have become the general trend. Multiple electronic devices that can establish a mutual trust relationship can automatically form a network after discovering each other, which is called a smart connection network. For example, multiple electronic devices have logged in the same account (that is, the Account ID is the same), or the user has performed a binding and authentication process on multiple electronic devices (such as binding through a pin code or a quick response (quick response, QR) code, etc. determined), then a mutual trust relationship is established between the multiple electronic devices.
在本申请实施例中,对于近距离通信范围内存在信任关系的多个电子设备,一个电子设备会和其他电子设备维持一个逻辑上的连接,在系统运行时可同步这些电子设备的状态和信息。这些相互信任的电子设备可以组成一个智连网络。In the embodiment of this application, for multiple electronic devices that have a trust relationship within the short-distance communication range, one electronic device will maintain a logical connection with other electronic devices, and the status and information of these electronic devices can be synchronized when the system is running . These mutually trusted electronic devices can form a smart connection network.
需要说明的是,该智连网络仅是本申请实施例所涉及的网络的一种名称,本申请实施例涉及的网络也可以有其他的名称,不予限定。It should be noted that the Zhilian network is only a name of the network involved in the embodiment of the present application, and the network involved in the embodiment of the present application may also have other names, which are not limited.
智连网络中的多个电子设备之间支持本地近距离通信方式,例如可以支持蓝牙、 Wi-Fi或近场通信(near field communication,NFC)等近距离无线通信方式,或者支持通用串行总线(universal serial bus,USB)等近距离有线通信方式。示例性的,智连网络的一种组网示意图可以参见图1A。如图1A所示,大屏与手机之间,大屏与智能手表(简称手表)之间,手表与耳机之间,以及手机与耳机之间均支持蓝牙低功耗(bluetooth low energy,BLE)通信方式。手机与智能音箱(简称音箱)之间支持Wi-Fi通信方式。Multiple electronic devices in the Smart Connect network support local short-distance communication methods, such as Bluetooth, Wi-Fi or near field communication (near field communication, NFC) and other short-distance wireless communication methods, or support for universal serial bus (universal serial bus, USB) and other short-distance wired communication methods. For example, a schematic diagram of a smart connection network can be referred to in FIG. 1A . As shown in Figure 1A, between the large screen and the mobile phone, between the large screen and the smart watch (watch for short), between the watch and the headset, and between the mobile phone and the headset all support Bluetooth low energy (BLE) way of communication. The Wi-Fi communication mode is supported between the mobile phone and the smart speaker (speaker for short).
在智连网络组网完成后,智连网络中的电子设备上线。具体的,多个电子设备在相互发现的过程中或者在相互发现后,可以相互交换信息(包括电子设备的身份信息等),以相互通知上线电子设备的身份。而后,智连网络中的电子设备可以通过心跳包进行在线检测,以便获知各在线电子设备的情况。在本申请的实施例中,在线指的是电子设备可以通过心跳包被检测到,不必然代表已经有建立好的网络连接或数据通道了。After the Smart Connect network is completed, the electronic devices in the Smart Connect network go online. Specifically, multiple electronic devices may exchange information (including identity information of the electronic devices, etc.) with each other during or after mutual discovery, so as to notify each other of the identities of the online electronic devices. Then, the electronic devices in the Zhilian network can perform online detection through the heartbeat packet, so as to know the status of each online electronic device. In the embodiments of the present application, being online means that the electronic device can be detected through a heartbeat packet, and does not necessarily mean that a network connection or data channel has been established.
比如,智连网络中的电子设备1向电子设备2发送心跳包后,若在预设时长内接收到电子设备2发送的心跳响应消息,则认为电子设备2在线。智连网络中的在线电子设备之间可以随时发起业务数据传输,从而能够快速、直接、协同地完成业务处理。若电子设备1在预设时长内未接收到电子设备2发送的心跳响应消息,则认为电子设备2下线。智连网络中的电子设备还可以相互通知下线设备的身份信息,以使得各电子设备获知当前在线设备和下线设备的情况。For example, after the electronic device 1 in the Smart Connect network sends a heartbeat packet to the electronic device 2, if it receives a heartbeat response message sent by the electronic device 2 within a preset time period, the electronic device 2 is considered to be online. Online electronic devices in the Zhilian network can initiate business data transmission at any time, so that business processing can be completed quickly, directly and collaboratively. If the electronic device 1 does not receive the heartbeat response message sent by the electronic device 2 within the preset time period, the electronic device 2 is considered to be offline. The electronic devices in the Zhilian network can also notify each other of the identity information of offline devices, so that each electronic device can know the current situation of online devices and offline devices.
本申请实施例提供了一种在线检测方法,能够基于网络中发送端电子设备和接收端电子设备之间的时钟差,控制心跳包的发送时机和/或接收时机,使得接收端电子设备在处于窗口接收状态时接收心跳包,从而可以提高心跳包的接收效率,减少心跳包的收发次数和时长,降低电子设备的功耗,从而可以基于心跳包对网络中的多个电子设备实现低功耗、快速、及时、准确的在线检测。其中,接收端电子设备的窗口用于接收心跳包,可以称为接收窗口,例如具体可以是接收端电子设备的扫描窗口等。The embodiment of the present application provides an online detection method, which can control the timing of sending and/or receiving heartbeat packets based on the clock difference between the electronic device at the sending end and the electronic device at the receiving end in the network, so that the electronic device at the receiving end is in the The heartbeat packet is received when the window is in the receiving state, which can improve the receiving efficiency of the heartbeat packet, reduce the number and duration of heartbeat packet sending and receiving, and reduce the power consumption of electronic devices, so that multiple electronic devices in the network can achieve low power consumption based on the heartbeat packet , Fast, timely and accurate online detection. Wherein, the window of the electronic device at the receiving end is used to receive the heartbeat packet, which may be referred to as a receiving window, for example, may specifically be a scanning window of the electronic device at the receiving end.
例如,智连网络中的电子设备可以是手机、平板电脑、可穿戴设备(例如耳机、智能手表、智能手环、智能眼镜等)、智能家居设备(例如大屏、音箱、智能灯等)、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或个人数字助理(personal digital assistant,PDA)等移动终端,本申请实施例对电子设备的具体类型不作任何限制。For example, the electronic devices in the Zhilian network can be 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.), Vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs) ) and other mobile terminals, the embodiments of the present application do not impose any restrictions on specific types of electronic devices.
示例性的,图1B示出了电子设备100的一种结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Exemplarily, FIG. 1B shows a schematic structural diagram of the 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 (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air 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, bone conduction sensor 180M, etc.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Wherein, the controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. The 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 called from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或USB接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or USB interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100 , and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other electronic devices, such as AR devices.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处 理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。A modem processor may include a modulator and a demodulator. Wherein, the modulator is used for modulating 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. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs sound signals through audio equipment (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In some other embodiments, the modem processor may be independent from the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wireless Fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite, etc. applied on the electronic device 100. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. 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 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。无线通信技术可以包括全球移动通讯系统(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,和/或IR技术等。GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。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 technology. Wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband code division Multiple access (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 technology, etc. GNSS can include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou satellite navigation system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi-zenith) satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
在本申请的实施例中,电子设备100可以通过移动通信模块150、无线通信模块160或USB等,发送或接收心跳包。In the embodiment of the present application, the electronic device 100 can send or receive a heartbeat packet through the mobile communication module 150, the wireless communication module 160, or USB.
内部存储器121可以用于存储计算机可执行程序代码,可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The internal memory 121 may be used to store computer-executable program codes including instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 . The internal memory 121 may include an area for storing programs and an area for storing data. Wherein, the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like. The storage data area can store data created during the use of the electronic device 100 (such as audio data, phonebook, etc.) and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment 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 shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.
在本申请的实施例中,处理器110通过运行存储在内部存储器121中的指令,使得智连网络中的电子设备100能够基于电子设备之间的时钟差,控制心跳包的发送时机和/或接收时机,使得接收端电子设备在处于窗口接收状态时接收心跳包,从而可以提高心跳包的接收效率,减少心跳包的收发次数和时长,降低电子设备的功耗,从而可以基于心跳包对网络中的多个电子设备实现快速、及时、准确的在线检测。In the embodiment of the present application, the processor 110 executes the instructions stored in the internal memory 121, so that the electronic device 100 in the smart connection network can control the sending timing of the heartbeat packet and/or based on the clock difference between the electronic devices. The receiving timing enables the electronic device at the receiving end to receive the heartbeat packet when it is in the window receiving state, 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. Multiple electronic devices in the system realize fast, timely and accurate online detection.
以下将结合附图,对本申请实施例提供的基于心跳包的在线检测方法进行阐述。The online detection method based on the heartbeat packet provided by the embodiment of the present application will be described below with reference to the accompanying drawings.
智连网络中的电子设备也可以称为节点。在本申请实施例中,智连网络的节点之间具有上、下级关系,上级节点可以向下级节点发送心跳包,以检测下级节点是否在线。其中,节点间的上、下级关系,可以根据节点自身的信息,和/或节点之间的相互关系等因素来确定。在智连网络中,一个节点的下级节点可以有一个或多个。The electronic devices in the Zhilian network can also be called nodes. In the embodiment of the present application, there is a superior-subordinate relationship between the nodes of the Smart Connect network, and the superior node can send a heartbeat packet to the subordinate node to detect whether the subordinate node is online. Wherein, the upper-lower relationship between nodes may be determined according to the information of the nodes themselves, and/or the mutual relationship between the nodes and other factors. In the Zhilian network, a node can have one or more subordinate nodes.
例如,节点自身的信息可以包括网络能力信息、处理能力信息、网络质量、电量信息、运动信息、服务信息和服务集标识(service set identifier,SSID)等中的一项或多项。其中,网络能力信息可以包括节点支持的网络连接、节点支持的网络连接所支持的最大带宽、节点支持的网络连接的连接信息(如端口号,媒体访问控制地址(media access control,MAC)地址或互联网协议(internet protocol,IP)地址)中的至少一项。节点的处理能力信息表示节点的处理能力,例如包括节点的功耗、芯片处理能力以及内存。For example, the information of the node itself may include one or more of network capability information, processing capability information, network quality, power information, movement information, service information, and service set identifier (service set identifier, SSID). Wherein, the network capability information may include the network connection supported by the node, the maximum bandwidth supported by the network connection supported by the node, the connection information of the network connection supported by the node (such as port number, media access control address (media access control, MAC) address or At least one of Internet protocol (internet protocol, IP) address). The processing capability information of the node represents the processing capability of the node, and includes, for example, power consumption of the node, chip processing capability, and memory.
例如,节点之间的相互关系可以包括网络拓扑关系等内容。网络拓扑关系包括各节点之间支持的网络连接方式,以及节点之间的通信路径等。For example, the interrelationships between nodes may include content such as network topology relations. The network topology relationship includes the network connection modes supported by each node, and the communication path between nodes.
示例性的,节点之间的上、下级关系,可以根据节点的权重和节点间的网络拓扑关系来确定。其中,节点的权重可以是节点自身根据节点的网络能力信息和节点的处理能力信息确定的,例如,功耗高、对功耗不敏感、芯片处理能力好、内存大并且网络能力强的节点权重高;相反地,功耗低、对功耗敏感、芯片的处理能力差、内存小并且网络能力弱的节点权重低。Exemplarily, the upper-lower relationship between nodes may be determined according to the weight of the nodes and the network topology relationship between the nodes. Among them, the weight of the node can be determined by the node itself according to the network capability information of the node and the processing capability information of the node, for example, the weight of a node with high power consumption, insensitivity to power consumption, good chip processing capability, large memory and strong network capability High; on the contrary, nodes with low power consumption, sensitivity to power consumption, poor chip processing capabilities, small memory and weak network capabilities have low weights.
在本申请的实施例中,智连网络中的节点按照从上级到下级的关系,可以包括中心节点、一级节点、二级节点等。其中,中心节点是最上级的节点,只有下级节点,没有上级节点。中心节点的下级节点称为一级节点,中心节点为一级节点的上级节点;一级节点的下级节点称为二级节点,一级节点为二级节点的上级节点;依此类推,智连网络还可以包括三级节点或四级节点等。本申请实施例对智连网络包括的节点的层级数量不予限定。一个智连网络中通常包括一个中心节点,并且可以有一个或多个属于不同层级的下级节点。此外,如果一个节点既有上级节点也有下级节点,则该节点还可以称为中间节点。如果一个节点只有上级节点,没有下级节点,则该节点还可以称为尾节点。In the embodiment of the present application, the nodes in the Zhilian network may include a central node, a first-level node, and a second-level node, etc. according to the relationship from the upper level to the lower level. Among them, the central node is the highest-level node, only the lower-level nodes, no upper-level nodes. The lower-level nodes of the central node are called first-level nodes, and the central node is the upper-level node of the first-level node; the lower-level nodes of the first-level node are called second-level nodes, and the first-level node is the upper-level node of the second-level node; The network may also include tertiary nodes or quaternary nodes, etc. The embodiment of the present application does not limit the number of layers of nodes included in the Smart Connect network. A Zhilian network usually includes a central node, and may have one or more subordinate nodes belonging to different levels. In addition, if a node has both upper-level nodes and lower-level nodes, the node can also be called an intermediate node. If a node has only upper-level nodes and no lower-level nodes, the node can also be called a tail node.
举例来说,在图1A所示的智连网络中,大屏与手机之间,以及大屏与手表之间支持蓝牙BLE网络连接方式。手机与耳机之间支持蓝牙BLE网络连接方式,手机与音箱之间支持Wi-Fi网络连接方式。电子设备之间根据权重和网络拓扑关系等因素,确定中心节点为大屏,大屏是手机和手表的上级节点,手机是耳机和音箱的上级节点。相应地,手机和手表是大屏的下级节点,耳机和音箱是手机的下级节点。For example, in the Smart Connect network shown in FIG. 1A , the connection between the large screen and the mobile phone, and between the large screen and the watch support the Bluetooth BLE network connection. The Bluetooth BLE network connection is supported between the mobile phone and the headset, and the Wi-Fi network connection is supported between the mobile phone and the speaker. According to factors such as weight and network topology among electronic devices, the central node is determined as the large screen, the large screen is the upper node of mobile phones and watches, and the mobile phone is the upper node of earphones and speakers. Correspondingly, mobile phones and watches are subordinate nodes of large screens, and earphones and speakers are subordinate nodes of mobile phones.
在图1A所示的智连网络中,根据网络拓扑关系可知,手机与耳机之间,以及手 表与耳机之间均支持网络连接,但根据节点的权重等因素,耳机作为了手机的下级节点,未作为手表的下级节点。In the smart connected network shown in Figure 1A, according to the network topology, the network connection is supported between the mobile phone and the earphone, and between the watch and the earphone. It is not a subordinate node of the watch.
在该智连网络中,大屏为中心节点,手机和手表为一级节点,耳机和音箱为二级节点。示例性的,该智连网络中上、下级节点之间的层级关系可以参见图2。其中,手机也可以称为中间节点,手表、耳机和音箱也可以称为尾节点。In the Smart Connect network, the large screen is the central node, the mobile phone and watch are the first-level nodes, and the earphones and speakers are the second-level nodes. Exemplarily, the hierarchical relationship between upper-level nodes and lower-level nodes in the Smart Connect network can be referred to in FIG. 2 . Among them, the mobile phone can also be called an intermediate node, and watches, earphones, and speakers can also be called tail nodes.
在本申请实施例中,在组网完成后,智连网络中的任意两个电子设备之间可以支持一种或多种网络连接方式,但电子设备之间不一定已建立网络连接。电子设备之间支持的网络连接方式可以是近距离无线网络连接方式或有线网络连接方式等。其中,可采用本申请实施例提供的方法进行在线检测的无线网络连接方式可以称为第一网络连接方式。例如,该第一网络连接方式可以为支持空口扫描机制的近距离无线网络连接方式。除第一网络连接方式以外的其他网络连接方式,可以称为第二网络连接方式。示例性的,蓝牙BLE可以为第一网络连接方式,USB可以为第二网络连接方式,Wi-Fi、蓝牙基础速率(base rate,BR)或蓝牙增强速率(enhanced data rate,EDR)等可以是第一网络连接方式也可以是第二网络连接方式。In the embodiment of the present application, after the networking is completed, any two electronic devices in the Smart Connect network may support one or more network connection modes, but the electronic devices do not necessarily have established network connections. The network connection mode supported between the electronic devices may be a short-distance wireless network connection mode or a wired network connection mode. Wherein, the wireless network connection mode in which the online detection can be performed by using the method provided in the embodiment of the present application may be referred to as the first network connection mode. For example, the first network connection manner may be a short-distance wireless network connection manner supporting an air interface scanning mechanism. A network connection manner other than the first network connection manner may be referred to as a second network connection manner. Exemplarily, Bluetooth BLE can be the first network connection mode, USB can be the second network connection mode, Wi-Fi, Bluetooth basic rate (base rate, BR) or Bluetooth enhanced rate (enhanced data rate, EDR), etc. can be The first network connection mode may also be the second network connection mode.
在智连网络中,支持第一网络连接方式的两个电子设备之间,可以通过空口发送和接收窗口的通信模式交互心跳包等信息。即,发送端电子设备通过空口发送消息,接收端电子设备在接收窗口内接收消息。例如,该空口发送方式可以是广播或单播等方式,接收窗口可以是扫描窗口。In the Zhilian network, between two electronic devices that support the first network connection mode, information such as heartbeat packets can be exchanged through the air interface to send and receive the communication mode of the window. That is, the electronic device at the sending end sends a message through the air interface, and the electronic device at the receiving end receives the message within the receiving window. For example, the air interface sending mode may be broadcast or unicast, and the receiving window may be a scanning window.
如果智连网络中的两个电子设备之间不支持第一网络连接方式,而支持第二网络连接方式,则基于第二网络连接方式交互心跳包等信息,从而进行在线检测。If the two electronic devices in the Smart Connect network do not support the first network connection mode but support the second network connection mode, information such as heartbeat packets is exchanged based on the second network connection mode to perform online detection.
在本申请实施例中,第一网络连接方式的优先级可以高于第二网络连接方式。如果智连网络中的两个电子设备之间既支持第一网络连接方式也支持第二网络连接方式,则基于第一网络连接方式,通过空口发送和接收窗口的通信模式交互心跳包等信息,从而进行在线检测。In this embodiment of the present application, the priority of the first network connection manner may be higher than that of the second network connection manner. If the two electronic devices in the Zhilian network support both the first network connection method and the second network connection method, then based on the first network connection method, information such as heartbeat packets can be exchanged through the communication mode of the sending and receiving window through the air interface, In order to carry out online detection.
本申请的实施例提供的方案,可以从智连网络的中心节点开始,由上级节点向下级节点逐级发送心跳包,从而对智连网络中的电子设备统一进行在线检测,统一确定智连网络中各电子设备的在线和下线状态,以便可以使用在线的电子设备快速、直接、协同地完成业务。The solution provided by the embodiment of this application can start from the central node of the Smart Connect network, and the upper node sends heartbeat packets to the lower nodes step by step, so as to uniformly perform online detection on the electronic devices in the Smart Connect network, and uniformly determine the Smart Connect network Online and offline status of each electronic device in the system, so that online electronic devices can be used to complete business quickly, directly and collaboratively.
在智连网络中,支持第一网络连接方式的上、下级节点之间,可以基于时钟差和第一网络连接方式进行控制,从而将心跳包的发送时机与接收窗口的开启时机对齐,简称为窗口对齐或相位对齐,以使得心跳包的收、发时机同步。In the Zhilian network, the upper and lower nodes that support the first network connection method can be controlled 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 receiving window, referred to as Window alignment or phase alignment, so that the receiving and sending timing of heartbeat packets are synchronized.
其中,在智连网络中,由上级节点向下级节点发送心跳包。这里所说的交互心跳包的上、下级节点是指相邻的两级节点。比如,上级节点是指中心节点,下级节点是指一级节点;再比如,上级节点是指一级节点,下级节点是指二级节点。也就是说,上级节点为心跳包的发送端电子设备,下级节点为心跳包的接收端电子设备。Wherein, in the Zhilian network, the upper-level node sends a heartbeat packet to the lower-level node. The upper and lower nodes of the interactive heartbeat packet mentioned here refer to adjacent two-level 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 node is the electronic device at the sending end of the heartbeat packet, and the lower node is the electronic device at the receiving end of the heartbeat packet.
在本申请的实施例中,窗口对齐可以理解为,接收端电子设备基于与发送端电子设备之间的时钟差,可以在处于窗口接收状态时接收发送端电子设备发送的心跳包,从而高效接收心跳包,降低功耗,并基于心跳包快速进行在线检测。In the embodiment of the present application, window alignment can be understood as, based on the clock difference between the electronic device at the receiving end and the electronic device at the sending end, it can receive the heartbeat packet sent by the electronic device at the sending end when it is in the window receiving state, so as to efficiently receive Heartbeat packets, reduce power consumption, and quickly perform online detection based on heartbeat packets.
在一些实施例中,窗口对齐是指,接收端电子设备进入接收状态的时机与发送端 电子设备发送心跳包的时机之间的差值小于或者等于第一预设值。其中,接收端电子设备的接收窗口打开后进入接收状态,可用于接收心跳包。如此,接收端电子设备可以在发送端电子设备发送出心跳包的恰当时机打开接收窗口,从而保证既不会因过早打开接收窗口而浪费通信资源,也不会因太晚打开接收窗口而导致心跳包无法正常获取,由此保证接收窗口能够较为快速、高效地接收到心跳包。In some embodiments, the window alignment means that the difference between the timing when the electronic device at the receiving end enters the receiving state and the timing when the electronic device at the sending end sends a heartbeat packet is less than or equal to the first preset value. Wherein, the receiving window of the electronic device at the receiving end enters a receiving state after being opened, and can be used to receive heartbeat packets. In this way, the electronic device at the receiving end can open the receiving window at the right time when the electronic device at the sending end sends out a heartbeat packet, thereby ensuring that communication resources will not be wasted due to opening the receiving window too early, nor will it cause damage due to opening the receiving window too late. The heartbeat packet cannot be obtained normally, thus ensuring that the receiving window can receive the heartbeat packet relatively quickly and efficiently.
例如,接收窗口进入接收状态的时机早于心跳包的发送时机。比如,接收窗口的打开时机早于心跳包的发送时机。这样,在发送心跳包时接收窗口已经处于接收状态,接收端电子设备能够更为快速、高效地接收到心跳包。For example, the time when the receiving window enters the receiving state is earlier than the time when the heartbeat packet is sent. For example, the opening timing of the receiving window is earlier than the sending timing of the heartbeat packet. In this way, when the heartbeat packet is sent, the receiving window is already in the receiving state, and the electronic device at the receiving end can receive the heartbeat packet more quickly and efficiently.
再例如,在心跳包发送时接收窗口进入接收状态。比如,接收窗口在心跳包发送时打开。这样,在开始发送心跳包时,接收窗口恰好也开启,并进入接收状态,考虑到传输时延,心跳包到达接收端电子设备时接收窗口已经处于接收状态,接收端电子设备能够更为快速、高效地接收到心跳包。For another example, the receiving window enters the receiving state when the heartbeat packet is sent. For example, the receive window is opened when a heartbeat packet is sent. In this way, when the heartbeat packet starts to be sent, the receiving window happens to be opened and enters the receiving state. Considering the transmission delay, the receiving window is already in the receiving state when the heartbeat packet reaches the electronic device at the receiving end, and the electronic device at the receiving end can be faster and faster. Efficiently receive heartbeat packets.
再例如,在心跳包到达接收端电子设备之前,接收窗口进入接收状态。比如,接收端电子设备可以根据心跳包的发送时机和预先计算获得的传输时延,预先确定心跳包到达接收端电子设备的时机,从而在心跳包到达之前提前打开接收窗口,使得接收窗口在接收状态下等待接收心跳包,从而能够快速、高效地接收到心跳包。For another example, before the heartbeat packet reaches the electronic device at the receiving end, the receiving window enters a receiving state. For example, the electronic device at the receiving end can predetermine the timing at which the heartbeat packet arrives at the electronic device at the receiving end according to the sending timing of the heartbeat packet and the pre-calculated transmission delay, so as to open the receiving window in advance before the arrival of the heartbeat packet, so that the receiving window Waiting to receive the heartbeat packet in the state, so that the heartbeat packet can be received quickly and efficiently.
再例如,在心跳包到达接收端电子设备时,接收窗口打开从而进入接收状态。比如,接收端电子设备可以根据心跳包的发送时机和预先计算获得的传输时延,预先确定心跳包到达接收端电子设备的时机,从而在心跳包到达时打开接收窗口并进入接收状态,从而能够快速、高效地接收到心跳包。For another example, when the heartbeat packet arrives at the electronic device at the receiving end, the receiving window is opened to enter a receiving state. For example, the electronic device at the receiving end can predetermine the timing at which the heartbeat packet arrives at the electronic device at the receiving end according to the sending timing 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, thereby enabling Receive heartbeat packets quickly and efficiently.
对于支持第一网络连接方式的上、下级节点来说,在窗口对齐后,某个节点后续发送少量(例如1个或2个等)的心跳包后,该节点的下级节点就可以很快地检测到心跳包。也就是说,在心跳包的收、发时机同步后,下级节点后续在接收窗口内能够快速、准确、高效地接收到心跳包,从而可以减少单位时间内心跳包的交互次数,提高心跳包接收的可靠性,降低通信成本和功耗,实现多设备间快速、准确、及时地在线检测。For the upper-level and lower-level nodes that support the first network connection mode, after the windows are aligned, after a node sends a small number (such as 1 or 2, etc.) of heartbeat packets, the lower-level nodes of the node can quickly A heartbeat packet was detected. That is to say, after the receiving and sending timing of the heartbeat packet is synchronized, the lower-level nodes can receive the heartbeat packet quickly, accurately and efficiently within the receiving window, thereby reducing the number of interactions of the heartbeat packet per unit time and improving the reception of the heartbeat packet. Reliability, reduce communication cost and power consumption, and realize fast, accurate and timely online detection among multiple devices.
此外,对于仅支持第二网络连接方式的电子设备来说,上、下级节点之间可以基于时钟差和第二网络连接方式交互心跳包和心跳响应消息。In addition, for electronic devices that only support the second network connection mode, heartbeat packets and heartbeat response messages can be exchanged between upper and lower nodes based on the clock difference and the second network connection mode.
这样,该方案可以实现对智连网络中支持第一网络连接方式或第二网络连接方式的各电子设备进行快速、准确、及时的在线检测。In this way, the solution can realize fast, accurate and timely online detection of each electronic device in the Smart Connect network that supports the first network connection mode or the second network connection mode.
以下将以图1A和图2所示智连网络中的中心节点、一级节点和二级节点,心跳包的空口发送方式为广播,心跳包的接收窗口为扫描窗口为例,结合附图对本申请实施例提供的在线检测方法进行说明。该方法可以包括:The following will take the central node, first-level node and second-level node in the smart connection network shown in Figure 1A and Figure 2, the air interface transmission mode of the heartbeat packet is broadcast, and the receiving window of the heartbeat packet is the scanning window The online detection method provided in the embodiment of the application will be described. The method can include:
在智连网络中各节点的上、下级关系确定后,参见图3A所示的时序图,大屏作为中心节点,在t1时刻开始向作为一级节点的手机和手表广播心跳包组。该心跳包组可以包括预设周期内按照预设间隔(例如20ms、30ms等)依序发出的N(N为大于1的整数)个心跳包。在一些实施例中,心跳包组中的每个心跳包分别携带有各自的发送时间戳,如第1个心跳包携带有自己的发送时间戳t1,第X1个心跳包携带有自己的发送时间戳tX1。After the upper-lower relationship of each node in the Zhilian network is determined, refer to the sequence diagram shown in Figure 3A. The large screen acts as the central node and starts broadcasting heartbeat packets to mobile phones and watches as first-level nodes at time t1. The heartbeat packet group may include N (N is an integer greater than 1) heartbeat packets sent sequentially at preset intervals (eg, 20 ms, 30 ms, etc.) within a preset period. In some embodiments, each heartbeat packet in the heartbeat packet group carries its own sending timestamp, for example, the first heartbeat packet carries its own sending timestamp t1, and the X1th heartbeat packet carries its own sending time Poke tX1.
参见图3A,作为一级节点的手机,在tr1时刻接收到第X1(X1为大于或者等于1且小于或者等于N的整数)个心跳包后,向大屏发送心跳响应消息。Referring to FIG. 3A, the mobile phone as a first-level node sends a heartbeat response message to the large screen after receiving the X1th (X1 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packets at time tr1.
在一些实施例中,手机向大屏发送的心跳响应消息包括tr1和第X1个心跳包的发送时间戳tX1。在另一些实施例中,手机向大屏发送的心跳响应消息包括tr1和第X1个心跳包的标识,大屏可以根据该第X1个心跳包的标识确定第X1个心跳包的发送时间戳tX1。In some embodiments, the heartbeat response message sent by the mobile phone to the large screen includes tr1 and the sending time stamp tX1 of the X1th heartbeat packet. In some 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 time stamp tX1 of the X1th heartbeat packet according to the identifier of the X1th heartbeat packet .
大屏在tnow1时刻接收到手机发送的心跳响应消息后,计算大屏与手机之间的传输时延为tdelay1=(tnow1-tX1)/2。根据该传输时延,手机和大屏之间的时钟差为tC1=tr1-tX1-tdelay1。大屏可以将该时钟差发送给手机,以便手机与大屏之间根据时钟差进行窗口对齐,从而同步心跳包的收、发时机。示例性的,大屏与手机之间关于时钟差的交互流程可以参见图3B。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 the transmission delay, the clock difference between the mobile phone and the large screen is tC1=tr1-tX1-tdelay1. The large screen can send the clock difference to the mobile phone, so that the windows between the mobile phone and the large screen can be aligned according to the clock difference, so as to synchronize the receiving and sending timing of heartbeat packets. Exemplarily, the interaction process about the clock difference between the large screen and the mobile phone can be referred to FIG. 3B.
以上实施例描述的方案中是大屏端来计算手机与大屏之间的时钟差并发送给手机端的。在其他一些实施例中,手机端也可以自行计算与大屏之间的时钟差,本申请实施例对计算时钟差的设备端不予限定。In the solution described in the above embodiments, the large screen terminal calculates the clock difference between the mobile phone and the large screen and sends it to the mobile terminal. In some other embodiments, the mobile phone terminal can also calculate the clock difference with the large screen by itself, and the embodiment of the present application does not limit the device terminal that calculates the clock difference.
其中,时钟差用于表示两个电子设备的本机时钟之间的差值。电子设备可以基于自身的操作系统获取本机时钟。例如,android系统的java使用接口System.nanoTime()来获取相对时钟,非android系统的嵌入式系统OS可以使用接口getTickCount()来获取相对时钟等。该本机时钟可以为相对时钟,该相对时钟与终端设备向用户显示的世界时间可以不同。该本机时钟例如可以为开机后的时间或某个参考时间(例如1970年1月1日)至今的时间等。例如,大屏的本机时钟为开机后的时间,手机的本机时钟也为开机后的时间,时钟差为3658*10 9ns。再例如,大屏的本机时钟为开机后的时间,手机的本机时钟为1970年1月1日至今的时间。 Wherein, the clock difference is used to represent the difference between the local clocks of two electronic devices. The electronic device can obtain a local clock based on its own operating system. For example, the java of the android system uses the interface System.nanoTime() to obtain the relative clock, and the embedded system OS of the non-android system can use the interface getTickCount() to obtain the relative clock, etc. The local clock may be a relative clock, and the relative clock may be different from the world time displayed by the terminal device to the user. The local clock can be, for example, the time after power-on or the time from a certain reference time (for example, January 1, 1970) to the present. For example, the local clock of the large screen is the time after booting, and the local clock of the mobile phone is also the time after booting, and the clock difference is 3658*10 9 ns. For another 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.
同样地,参见图3A,作为一级节点的手表,在tr2时刻接收到第X2(X2为大于或者等于1且小于或者等于N的整数)个心跳包后,向大屏发送心跳响应消息并携带tr2和第X2个心跳包的发送时间戳tX2。大屏在tnow2时刻接收到手表发送的心跳响应消息后,计算出传输时延tdelay2=(tnow2-tX2)/2。手表和大屏之间的时钟差为tC2=tr2-tX2-tdelay2。Similarly, referring to Fig. 3A, after receiving the X2th (X2 is an integer greater than or equal to 1 and less than or equal to N) heartbeat packets at the time tr2, the watch as a first-level node 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 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.
若中心节点与一级节点之间支持第一网络连接方式,则中心节点与一级节点之间可以根据时钟差,控制后续心跳包的广播时机和/或扫描窗口的打开时机,使得心跳包的广播时机和扫描窗口的打开时机对齐。即,中心节点与一级节点之间进行窗口对齐,使得广播心跳包时扫描窗口处于接收状态,心跳包的收、发时机同步。在窗口对齐后,一级节点后续在扫描窗口内能够快速、准确地接收到中心节点广播的心跳包,从而可以减少单位时间内心跳包的交互次数,降低通信成本和功耗,提高心跳包接收的可靠性,实现设备间快速、准确、及时地在线检测。If the first network connection mode is supported between the central node and the first-level node, the central node and the first-level node can control the broadcasting timing of the subsequent heartbeat packet and/or the opening timing of the scanning window according to the clock difference, so that the heartbeat packet The broadcast timing is aligned with the opening timing of the scanning window. That is, the window is aligned 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 timing of receiving and sending the heartbeat packet is synchronized. After the window is aligned, the first-level node can quickly and accurately receive the heartbeat packet broadcast by the central node within the scanning window, thereby reducing the number of interactions of the heartbeat packet per unit time, reducing communication costs and power consumption, and improving heartbeat packet reception Reliability, to achieve fast, accurate and timely online detection between devices.
例如,在图1A所示智连网络中,大屏和手机之间支持第一网络连接方式蓝牙BLE,大屏和手机之间可以根据时钟差,控制后续心跳包的广播时机和/或扫描窗口的打开时机,使得大屏广播心跳包时手机的扫描窗口也处于接收状态。这样,手机后续在扫描窗口内能够快速、准确地接收到大屏广播的心跳包,从而可以减少单位时间内心跳包的交互次数,减少无效广播和扫描占空比,提高心跳包接收的可靠性,降低通信成本 和功耗,实现设备间快速、准确、及时地在线检测。For example, in the Smart Connect network shown in Figure 1A, the first network connection method Bluetooth BLE is supported between the large screen and the mobile phone, and the broadcast timing and/or scanning window of subsequent heartbeat packets can be controlled between the large screen and the mobile phone according to the clock difference The opening timing of the mobile phone makes the scanning window of the mobile phone 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 packets broadcast on the large screen within the scanning window, thereby reducing the number of heartbeat packet interactions per unit time, reducing invalid broadcast and scanning duty cycles, and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
类似地,大屏和手表之间支持第一网络连接方式中的蓝牙BLE,大屏和手表之间可以根据时钟差,控制后续心跳包的广播时机和/或扫描窗口的打开时机,使得大屏广播心跳包时手表的扫描窗口也处于接收状态。这样,手表后续在扫描窗口内能够快速、准确地接收到大屏广播的心跳包,从而可以减少单位时间内心跳包的交互次数,减少无效广播和扫描占空比,提高心跳包接收的可靠性,降低通信成本和功耗,实现设备间快速、准确、及时地在线检测。Similarly, the large screen and the watch support Bluetooth BLE in the first network connection mode, and the large screen and the watch can control the broadcast timing of subsequent heartbeat packets and/or the opening timing of the scan window according to the clock difference, so that the large screen The scan window of the watch is also in the receiving state when the heartbeat packet is broadcast. In this way, the watch can quickly and accurately receive the heartbeat packets broadcast on the large screen within the scanning window, thereby reducing the number of interactions of heartbeat packets per unit time, reducing invalid broadcasts and scanning duty cycles, and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
在一些实施例中,当第一网络连接方式为蓝牙BLE时,用于发送心跳包的一种广播消息可以为不可连接广播ADV_NONCONN_IND消息。根据蓝牙协议,该类型的广播消息不需要专门的响应消息来回复,因而可以减少响应消息包的带宽占用,减少在线检测过程中的消息交互条数,节省功耗,简化交互流程,提高在线检测的效率。In some embodiments, when the first network connection mode is Bluetooth BLE, a broadcast message for sending the heartbeat packet may be a non-connectable broadcast ADV_NONCONN_IND message. According to the Bluetooth protocol, this type of broadcast message does not require a special response message to reply, so it can reduce the bandwidth occupation 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 online detection. s efficiency.
在本申请的实施例中,窗口对齐可以采用多种不同的策略,来根据时钟差控制后续心跳包的广播时机和/或扫描窗口的打开时机。In the embodiment of the present application, multiple different strategies may be adopted for window alignment to control the timing of broadcasting subsequent heartbeat packets and/or the timing of opening the scan window according to the clock difference.
比如,在第一种策略中,大屏和手机,以及大屏与手表之间,根据t1时刻广播的心跳包组中的第1个心跳包进行窗口对齐。参见图3A,大屏根据第一预设周期T1,在本机时钟对应的t1+m*T1时刻,周期性地广播心跳包组,m为正整数。手机基于时钟差,控制在本机时钟对应的t1+m*T1+tC1时刻,周期性地打开扫描窗口以接收心跳包。这样,大屏广播心跳包组的时机与手机扫描窗口的激活时机相一致,大屏广播心跳包组中的第1个心跳包时手机的扫描窗口也刚好打开,心跳包组中的第1个心跳包到达手机时,手机的扫描窗口已经打开,因而能够提高心跳包的检测效率和响应速度,减少无效广播和扫描占空比,实现大屏和手机之间快速、准确、及时地连接和在线检测。For example, in the first strategy, between the large screen and 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. Referring to Fig. 3A, the large screen periodically broadcasts heartbeat packet groups 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 the time t1+m*T1+tC1 corresponding to the local clock, and periodically opens the scanning window to receive heartbeat packets. In this way, the timing of broadcasting the heartbeat package group on the large screen is consistent with the activation timing of the mobile phone scanning window. When the first heartbeat package in the large screen broadcasting heartbeat package When the heartbeat packet arrives at the mobile phone, the scanning window of the mobile phone has already been opened, which can improve the detection efficiency and response speed of the heartbeat packet, reduce invalid broadcast and scanning duty cycle, and realize fast, accurate and timely connection and online connection between the large screen and the mobile phone detection.
同样地,大屏根据第一预设周期T1,在本机时钟对应的t1+m*T1时刻,周期性地广播心跳包组。手表基于时钟差,控制在本机时钟对应的t1+m*T1+tC2时刻,周期性地打开扫描窗口以接收心跳包。示例性的,第一种策略对应的窗口对齐前后的对比示意图可以参见图4。Similarly, the large screen periodically broadcasts the heartbeat packet group 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 is controlled to periodically open the scan window at the time t1+m*T1+tC2 corresponding to the local clock to receive heartbeat packets. Exemplarily, a schematic diagram of comparison before and after window alignment corresponding to the first strategy can be referred to in FIG. 4 .
在该方案中,心跳包组中的第1个心跳包可以为手机和手表对应的目标心跳包(也可称为目标消息)。基于该方案,手机和手表可以在大屏发送心跳包组(即发送心跳包组中的第1个心跳包)时进入接收状态,即可以在大屏发送心跳包组中的目标心跳包时进入接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。In this scheme, the first heartbeat packet in the heartbeat packet group may be a target heartbeat packet (also called a 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, the first heartbeat packet in the heartbeat packet group), that is, they can enter the receiving state when the large screen sends the target heartbeat packet in the heartbeat packet group. Receive status, so that the target heartbeat packet can be quickly received, and the online detection efficiency can be improved.
或者,在该方案中,心跳包组中的第X1个心跳包为手机对应的目标心跳包,基于该方案,手机可以在大屏发送心跳包组(即发送心跳包组中的第1个心跳包)时进入接收状态,在大屏发送目标心跳包时处于接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。在该方案中,心跳包组中的第X2个心跳包为手表对应的目标心跳包,基于该方案,手表可以在大屏发送心跳包组时进入接收状态,在大屏发送目标心跳包时处于接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。Or, in this scheme, the X1 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 send the heartbeat packet group (that is, send the first heartbeat packet in the heartbeat packet group) on the large screen. packet) into the receiving state, and is in the receiving state when sending the target heartbeat packet on the large screen, so that the target heartbeat packet can be quickly received and the online detection efficiency is improved. In this scheme, the X2 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 sending the heartbeat packet group on the large screen, and be in the receiving state when sending the target heartbeat packet on the large screen. Receive status, so that the target heartbeat packet can be quickly received, and the online detection efficiency can be improved.
示例性的,大屏首次在本机时钟对应的16:00广播心跳包组(即在16:00开始按照预设间隔如20ms依序广播一个心跳包组中的多个心跳包),T1为5分钟(即大屏每隔5分钟广播一次心跳包组),手机与大屏的时钟差为30分钟,手表与大屏的时钟差 为2个小时。在基于时钟差进行窗口对齐后,大屏分别在本机时钟对应的16:05、16:10、16:15…开始广播心跳包组;手机分别在本机时钟对应的16:35、16:40、16:45…打开扫描窗口以接收心跳包;手表分别在本机时钟对应的18:05、18:10、18:15…打开扫描窗口以接收心跳包。Exemplarily, the large screen broadcasts the heartbeat packet group at 16:00 corresponding to the local clock for the first time (that is, broadcasts multiple heartbeat packets in a heartbeat packet group sequentially at a preset interval such as 20ms at 16:00), and T1 is 5 minutes (that is, the big screen broadcasts a heartbeat packet every 5 minutes), the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours. After window alignment based on the clock difference, the large screen starts broadcasting heartbeat packets at 16:05, 16:10, 16:15... corresponding to the local clock; 40, 16:45... Open the scanning window to receive the heartbeat packet; the watch opens the scanning window at 18:05, 18:10, 18:15... corresponding to the local clock to receive the heartbeat packet.
再示例性的,大屏首次在本机时钟对应的第30ns广播心跳包组(即在第30ns开始按照预设间隔如20ms依序广播一个心跳包组中的多个心跳包),T1为5分钟,手机与大屏的时钟差为30分钟,手表与大屏的时钟差为2个小时。在基于时钟差进行窗口对齐后,大屏分别在本机时钟对应的第5分30ns,第10分30ns,第15分30ns…开始广播心跳包组;手机分别在本机时钟对应的第35分30ns,第40分30ns,第45分30ns…打开扫描窗口以接收心跳包;手表分别在本机时钟对应的第2小时5分30ns、第2小时10分30ns、第2小时15分30ns…打开扫描窗口以接收心跳包。As another example, the large screen broadcasts the heartbeat packet group at the 30ns corresponding to the local clock for the first time (that is, broadcasts multiple heartbeat packets in a heartbeat packet group sequentially at a preset interval such as 20ms at the 30ns), T1 is 5 Minutes, the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours. After window alignment based on the clock difference, the large screen starts broadcasting the heartbeat packet group at the 5th minute 30ns, the 10th minute 30ns, the 15th minute 30ns... of the local clock; the mobile phone respectively at the 35th minute corresponding to the local clock 30ns, 30ns at the 40th minute, 30ns at the 45th minute... Open the scan window to receive the heartbeat packet; the watch opens at the 2nd hour, 5min 30ns, 2nd hour, 10min 30ns, 2nd hour, 15min 30ns... Scan windows for heartbeat packets.
另外,由于手机首次在心跳包中的第X1个心跳包对应的tX1时刻,接收到大屏广播的心跳包后,后续再次接收到心跳包中的第X1个心跳包的概率较大,因而在窗口对齐时,手机可以将心跳包的开始扫描时间调至第X1个心跳包对应的时刻。这样,窗口对齐精度更高,手机后续在扫描窗口内能够更为快速、准确地接收到广播窗口内发送的心跳包,从而可以减少单位时间内心跳包的交互次数,提高心跳包接收的可靠性,降低通信成本和功耗,实现设备间快速、准确、及时地在线检测。In addition, since the mobile phone receives the heartbeat packet of the large-screen broadcast for the first time at the time tX1 corresponding to the X1-th heartbeat packet in the heartbeat packet, the probability of receiving the X1-th heartbeat packet in the heartbeat packet again is relatively high. When the windows are aligned, the mobile phone can adjust the start scanning time of the heartbeat packet to the time corresponding to the X1th heartbeat packet. In this way, the window alignment accuracy is higher, and the mobile phone can receive the heartbeat packets sent in the broadcast window more quickly and accurately in the scan window, thereby reducing the number of heartbeat packet interactions per unit time and improving the reliability of heartbeat packet reception , reduce communication cost and power consumption, and realize fast, accurate and timely online detection between devices.
因此,在第二种策略中,手机和手表根据各自对应的第X1个心跳包和第X2个心跳包进行窗口对齐。具体的,大屏根据第一预设周期T1,在本机时钟对应的t1+m*T1时刻,周期性地广播心跳包组。手机根据首次接收到的第X1个心跳包的发送时刻tX1,调整后续心跳包扫描窗口的打开时机,以进行窗口对齐。手机基于时钟差,控制在本机时钟对应的tX1+m*T1+tC1时刻,即大屏广播第X1个心跳包的时刻,周期性地打开扫描窗口以接收心跳包。Therefore, in the second strategy, the mobile phone and the watch perform window alignment according to the X1th heartbeat packet and the X2th heartbeat packet corresponding to each other. Specifically, the large screen periodically broadcasts the heartbeat packet group at the time t1+m*T1 corresponding to the local clock according to the first preset period T1. According to the sending time tX1 of the X1th heartbeat packet received for the first time, the mobile phone adjusts the opening timing of the subsequent heartbeat packet scanning window to perform window alignment. Based on the clock difference, the mobile phone controls the time tX1+m*T1+tC1 corresponding to the local clock, that is, the moment when the X1th heartbeat packet is broadcast on the large screen, and periodically opens the scanning window to receive the heartbeat packet.
同样地,大屏根据第一预设周期T1,在本机时钟对应的t1+m*T1时刻,周期性地广播心跳包。手表根据首次接收到的第X2个心跳包的发送时刻tX2,调整后续心跳包扫描窗口的打开时机,以进行窗口对齐。手表基于时钟差,控制在本机时钟对应的tX2+m*T1+tC2时刻,即大屏广播第X2个心跳包的时刻,周期性地打开扫描窗口以接收心跳包。示例性的,第二种策略对应的窗口对齐前后的对比示意图可以参见图5。Similarly, the large screen periodically broadcasts heartbeat packets at the time t1+m*T1 corresponding to the local clock according to the first preset period T1. According to the sending time tX2 of the X2th heartbeat packet received for the first time, the watch adjusts the opening timing of the subsequent heartbeat packet scanning window for window alignment. Based on the clock difference, the watch is controlled at the time tX2+m*T1+tC2 corresponding to the local clock, that is, the moment when the X2 heartbeat packet is broadcast on the large screen, and periodically opens the scanning window to receive the heartbeat packet. Exemplarily, a schematic diagram of comparison before and after window alignment corresponding to the second strategy can be referred to FIG. 5 .
在该方案中,心跳包组中的第X1个心跳包为手机对应的目标心跳包,心跳包组中的第X2个心跳包为手表对应的目标心跳包。基于该方案,手机和手表可以在大屏发送目标心跳包时处于接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。In this scheme, 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 watch can be in the receiving state when the large screen sends the target heartbeat packet, so that the target heartbeat packet can be quickly received and the online detection efficiency is improved.
示例性的,大屏首次在本机时钟对应的16:00开始广播心跳包组(包括按照预设间隔依序广播的多个心跳包),tX1为16:00:01,tX2为16:00:02,T1为5分钟,手机与大屏的时钟差为30分钟,手表与大屏的时钟差为2个小时。在基于时钟差进行窗口对齐后,大屏分别在本机时钟对应的16:05、16:10、16:15…广播心跳包组;手机分别在本机时钟对应的16:35:01、16:40:01、16:45:01…打开扫描窗口以接收心跳包;手表分别在本机时钟对应的18:05:02、18:10:02、18:15:02…打开扫描窗口以接收心跳包。Exemplarily, the large screen starts to broadcast the heartbeat packet group (including multiple heartbeat packets broadcast in sequence according to the preset interval) at 16:00 corresponding to the local clock for the first time, tX1 is 16:00:01, and tX2 is 16:00 : 02, T1 is 5 minutes, the clock difference between the mobile phone and the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours. After window alignment based on the clock difference, the large screen broadcasts heartbeat packet groups at 16:05, 16:10, 16:15... corresponding to the local clock; :40:01, 16:45:01...open the scan window to receive the heartbeat packet; the watch respectively opens the scan window to receive the heartbeat packet.
在第一种策略或第二种策略中,大屏在t1+m*T1时刻周期性地广播一次心跳包组, 手机和手表分别根据自身窗口对齐所对应的时机来打开扫描窗口,从而接收心跳包。In the first strategy or the second strategy, the large screen periodically broadcasts a heartbeat packet group at t1+m*T1, and the mobile phone and the watch respectively open the scanning window according to the timing corresponding to their own window alignment, so as to receive the heartbeat Bag.
此外,大屏的下级节点首次接收到大屏广播的第Xi(i为1到N中的正整数)个心跳包后,后续再次接收到心跳包中第Xi个心跳包的概率较大。因而,在第三种策略中,大屏可以将后续心跳包组的广播时机调至第Xi个心跳包对应的发送时刻,即大屏可以根据tXi调整后续心跳包组的广播时机。当大屏有多个下级节点时,大屏可以向多个下级节点广播一次心跳包组,而不需要分别向每个下级节点广播一次心跳包组,以简化心跳包的发送流程,减少消息交互条数,节省功耗。此时,大屏可以根据多个下级节点分别对应的tXi中靠前的时机(也可称为tX0),来调整后续心跳包组的广播时机,以使得多个下级节点进行窗口对齐后,均可以高效、快速、及时地扫描到大屏广播的心跳包。In addition, after receiving the Xi-th (i is a positive integer from 1 to N) heartbeat packet broadcast by the large-screen for the first time, the lower-level node of the big screen has a higher probability of receiving the Xi-th heartbeat packet in the heartbeat packet again. Therefore, in the third strategy, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group to the sending time corresponding to the Xi-th heartbeat packet, that is, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to tXi. When the big screen has multiple lower-level nodes, the big screen can broadcast a heartbeat packet group to multiple lower-level nodes, instead of broadcasting a heartbeat packet group to each lower-level node, so as to simplify the sending process of heartbeat packets and reduce message interaction The number of strips saves power consumption. At this time, the large screen can adjust the broadcast timing of the subsequent heartbeat packet group according to the front timing (also called tX0) of tXi corresponding to multiple lower-level nodes, so that after window alignment of multiple lower-level nodes, even It can efficiently, quickly and timely scan the heartbeat packets of large-screen broadcasts.
举例来说,手机首次接收到大屏广播的心跳包中的第X1个心跳包,手表首次接收到大屏广播的心跳包中的第X2个心跳包。若第X1个心跳包对应的发送时刻tX1的时机靠前,即X0为X1,tX0为tX1,则大屏后续周期性地在第X1个心跳包对应的发送时刻广播心跳包组。即,大屏在tX1+m*T1时刻周期性地广播心跳包组。手机在tX1+m*T1+tC1时刻,打开扫描窗口以接收心跳包;手表在tX2+m*T1+tC2时刻,打开扫描窗口以接收心跳包。示例性的,第三种策略对应的窗口对齐前后的对比示意图可以参见图6。For example, the mobile phone receives the X1-th heartbeat packet in the heartbeat packets broadcast on the large screen for the first time, and the watch receives the X2-th heartbeat packet in the heartbeat packets broadcast on the large-screen broadcast for the first time. If the sending time tX1 corresponding to the X1 heartbeat packet is earlier, that is, X0 is X1 and tX0 is tX1, then the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the X1 heartbeat packet. That is, the large screen periodically broadcasts heartbeat packets at the time tX1+m*T1. The mobile phone opens the scanning window to receive the heartbeat packet at the time tX1+m*T1+tC1; the watch opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC2. Exemplarily, a schematic diagram of comparison before and after window alignment corresponding to the third strategy can be referred to FIG. 6 .
在该方案中,心跳包组中的第1(即X1-X1+1)个心跳包为手机对应的目标心跳包,心跳包组中的第X2-X1+1个心跳包为手表对应的目标心跳包。基于该方案,手机和手表可以在大屏发送心跳包组(即心跳包组中的第1个心跳包)时进入接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。比如,X1为2,X2为3,大屏后续周期性地在第2个心跳包对应的发送时刻广播心跳包组,该心跳包组中的第1(即2-2+1)个心跳包即为手机对应的目标心跳包,该心跳包组中的第2(即3-2+1)个心跳包即为手表对应的目标心跳包。In this scheme, the first (X1-X1+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the mobile phone, and the X2-X1+1 heartbeat packet in the heartbeat packet group is the target corresponding to the watch. heartbeat packet. 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, the first heartbeat packet in the heartbeat packet group), so that the target heartbeat packet can be quickly received and the online detection efficiency is improved. For example, if X1 is 2 and X2 is 3, the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the second heartbeat packet. The first (ie 2-2+1) heartbeat packet in the heartbeat packet group It is the target heartbeat packet corresponding to the mobile phone, and the second (ie 3-2+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch.
或者,若第X2个心跳包对应的发送时刻tX2的时机靠前,即X0为X2,tX0为tX2,则大屏后续周期性地在第X2个心跳包对应的发送时刻广播心跳包组。即,大屏在tX2+m*T1时刻周期性地广播心跳包组。手机在tX2+m*T1+tC1时刻,打开扫描窗口以接收心跳包;手表在tX2+m*T1+tC2时刻,打开扫描窗口以接收心跳包。Or, if the sending time tX2 corresponding to the X2th heartbeat packet is earlier, that is, X0 is X2 and tX0 is tX2, then the large screen will periodically broadcast the heartbeat packet group at the sending time corresponding to the X2th heartbeat packet. That is, the large screen periodically broadcasts heartbeat packets at the time tX2+m*T1. The mobile phone opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC1; the watch opens the scanning window to receive the heartbeat packet at the time tX2+m*T1+tC2.
在该方案中,心跳包组中的第1(即X1-X2+1)个心跳包为手表对应的目标心跳包,心跳包组中的第X1-X2+1个心跳包为手机对应的目标心跳包。基于该方案,手机和手表可以在大屏发送心跳包组时进入接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。In this scheme, the first (X1-X2+1) heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the watch, and the X1-X2+1 heartbeat packet in the heartbeat packet group is the target corresponding to the mobile phone heartbeat packet. Based on this solution, mobile phones and watches can enter the receiving state when the large screen sends heartbeat packets, so that they can quickly receive target heartbeat packets and improve online detection efficiency.
示例性的,大屏首次在本机时钟对应的16:00开始广播心跳包组,tX1为16:00:01,tX2为16:00:02,tX1比tX2靠前,T1为5分钟,手机与大屏的时钟差为30分钟,手表与大屏的时钟差为2个小时。在基于时钟差和tX1进行窗口对齐后,大屏分别在本机时钟对应的16:05:01、16:06:01、16:15:01…开始广播心跳包组;手机分别在本机时钟对应的16:35:01、16:40:01、16:45:01…打开扫描窗口以接收心跳包;手表分别在本机时钟对应的18:05:02、18:06:02、18:15:02…打开扫描窗口以接收心跳包。Exemplarily, the large screen starts to broadcast the heartbeat packet group at 16:00 corresponding to the local clock for the first time, tX1 is 16:00:01, tX2 is 16:00:02, tX1 is ahead of tX2, T1 is 5 minutes, the mobile phone The clock difference with the big screen is 30 minutes, and the clock difference between the watch and the big screen is 2 hours. After window alignment based on the clock difference and tX1, the large screen starts broadcasting heartbeat packets at 16:05:01, 16:06:01, 16:15:01... corresponding to the local clock; Corresponding 16:35:01, 16:40:01, 16:45:01... Open the scanning window to receive the heartbeat packet; the watch is at 18:05:02, 18:06:02, 18:02 corresponding to the local clock 15:02...opened scan window to receive heartbeat packets.
在第二种和第三种策略中,大屏广播心跳包的时机与手机打开扫描窗口的时机不 一致,大屏广播心跳包的时机与手表打开扫描窗口的时机也不一致,但广播时机与扫描窗口的打开时机之间的差值较小,小于或者等于第一预设值,该种情况也属于窗口对齐,手机和手表也可以高效、快速、准确、及时地接收到心跳包,从而进行在线检测。In the second and third strategies, the timing of broadcasting the heartbeat packet on the large screen is inconsistent with the timing of opening the scanning window on the mobile phone, and the timing of broadcasting the heartbeat packet on the large screen is also inconsistent with the timing of opening the scanning window on the watch, but the broadcasting timing is consistent with the timing of the scanning window. The difference between the opening timings is small, less than or equal to the first preset value. This situation also belongs to window alignment, and the mobile phone and watch can also receive heartbeat packets efficiently, quickly, accurately, and in time for online detection. .
另外,若中心节点只有一个一级节点,且一级节点首次接收到中心节点在t1时刻开始广播的心跳包组中的第X个心跳包,则中心节点和一级节点之间可以根据时钟差tC和该第X个心跳包进行窗口对齐。例如,中心节点根据第一预设周期T1,在本机时钟对应的tX+m*T1时刻,周期性地广播心跳包组。一级节点基于时钟差tC,控制在本机时钟对应的tX+m*T1+tC时刻,周期性地打开扫描窗口以接收心跳包。In addition, if the central node has only one first-level node, and the first-level node receives the Xth heartbeat packet in the heartbeat packet group broadcast by the central node at time t1 for the first time, the central node and the first-level node can be based on the clock difference tC performs window alignment with the Xth heartbeat packet. For example, the central node periodically broadcasts the heartbeat packet group at the time tX+m*T1 corresponding to the local clock according to the first preset period T1. Based on the clock difference tC, the first-level node controls to periodically open the scan window to receive heartbeat packets at the time tX+m*T1+tC corresponding to the local clock.
在该方案中,心跳包组中的第1个心跳包为一级节点对应的目标心跳包,一级节点可以在中心节点发送目标心跳包时进入接收状态,从而能够快速接收到目标心跳包,提高在线检测效率。In this scheme, the first heartbeat packet in the heartbeat packet group is the target heartbeat packet corresponding to the first-level node, and 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. Improve online detection efficiency.
此外,若一级节点与中心节点之间不采用本申请实施例提供的方案进行窗口对齐,则如图7所示,一级节点通常需要多个扫描窗口才能接收到大屏发送的心跳包,心跳包的接收效率差,心跳包的发送次数多,扫描窗口的扫描次数多,一级节点和中心节点的功耗大。In addition, if the scheme provided by the embodiment of the present application is not used for window alignment between the first-level node and the central node, as shown in Figure 7, 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 the heartbeat packet is sent is large, the number of scans of the scanning window is large, and the power consumption of the first-level node and the central node is large.
在本申请的实施例中,在一级节点首次接收到大屏发送的心跳包后,向二级节点发送心跳包,以对二级节点进行在线检测。例如,在图1A所示智连网络中,一级节点的手机首次接收到心跳包后,向二级节点的耳机和音箱发送心跳包。In the embodiment of the present application, after the first-level node receives the heartbeat packet sent by the large screen for the first time, it sends the heartbeat packet to the second-level node to perform online detection on the second-level node. For example, in the Smart Connect network shown in FIG. 1A , after receiving the heartbeat packet for the first time, the mobile phone of the first-level node sends the heartbeat packet to the earphone and speaker of the second-level node.
其中,若一级节点与二级节点之间支持第一网络连接方式,则一级节点与二级节点之间可以根据时钟差进行窗口对齐,控制后续一级节点广播心跳包的时机和/或二级节点打开扫描窗口的时机,使得一级节点广播心跳包时扫描窗口进入接收状态。在窗口对齐后,二级节点后续在扫描窗口内能够快速、准确地接收到一级节点广播的心跳包,从而可以减少单位时间内心跳包的交互次数,提高心跳包接收的可靠性,降低通信成本和功耗,实现设备间快速、准确、及时地在线检测。Among them, if the first network connection mode is supported between the first-level node and the second-level node, the window alignment between the first-level node and the second-level node can be performed according to the clock difference, and the timing and/or The timing when the secondary node opens the scanning window makes the scanning window enter the receiving state when the primary node broadcasts the heartbeat packet. After the window is aligned, the second-level node can quickly and accurately receive the heartbeat packet broadcast by the first-level node within the scanning window, thereby reducing the number of heartbeat packet interactions per unit time, improving the reliability of heartbeat packet reception, and reducing communication. Cost and power consumption, to achieve fast, accurate and timely online detection between devices.
例如,在图1A所示的智连网络中,手机与耳机之间支持第一网络连接方式蓝牙BLE。手机首次接收到心跳包后,参见图3A,在tA时刻开始广播心跳包组,以便耳机可以接收到该心跳包组中的心跳包。若耳机接收到第X3个心跳包,且耳机与手机之间的时钟差为tC3,则耳机与手机之间可以基于时钟差tC3,采用上述策略进行窗口对齐。比如,当采用第一种策略时,手机根据第一预设周期T1,在本机时钟对应的tA+m*T1时刻,周期性地广播心跳包组。手机基于时钟差,在本机时钟对应的tA+m*T1+tC3时刻周期性地打开扫描窗口以接收心跳包。这样,手机广播心跳包时机与耳机扫描窗口的激活时机一致,手机广播心跳包时,耳机的扫描窗口也打开,能够减少无效广播和扫描占空比,提高心跳包检测的效率和响应速度,实现手机和耳机之间快速、准确、及时地连接和在线检测。For example, in the Smart Connect network shown in FIG. 1A , the first network connection mode Bluetooth BLE is supported between the mobile phone and the headset. After the mobile phone receives the heartbeat packet for the first time, referring to FIG. 3A , it starts to broadcast the heartbeat packet group at time tA, so that the earphone can receive the heartbeat packet in the heartbeat packet group. If the earphone receives the X3th heartbeat packet, and the clock difference between the earphone and the mobile phone is tC3, the above strategy can be used for window alignment between the earphone and the mobile phone based on the clock difference tC3. For example, when adopting the first strategy, the mobile phone periodically broadcasts the heartbeat packet group at the time tA+m*T1 corresponding to the 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 tA+m*T1+tC3 corresponding to the 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 earphone scanning window. Fast, accurate and timely connection and online detection between mobile phone and headset.
若一级节点与二级节点之间支持第二网络连接方式而不支持第一网络连接方式,则一级节点可以根据第一预设周期T1,基于第二网络连接方式周期性地向二级节点发送心跳包,二级节点可以根据时钟差和第一预设周期T1,周期性地唤醒运行并进行实时响应。这样,二级节点可以定期唤醒运行并响应心跳,能够高效、准确、及时地接 收并响应心跳包,减少无序的心跳包和多次重复的心跳响应,节省二级节点的功耗。If the second network connection method is supported between the first-level node and the second-level node but not the first network connection method, the first-level node can periodically send the second network connection method to the second-level network according to the first preset period T1. The node sends a heartbeat packet, and the secondary node can wake up periodically and respond in real time according to the clock difference and the first preset period T1. In this way, the secondary node can periodically wake up and run and respond to the heartbeat, can receive and respond to the heartbeat packet efficiently, accurately, and in a timely manner, reduce disordered heartbeat packets and repeated heartbeat responses, and save power consumption of the secondary node.
示例性的,手机与音箱之间支持Wi-Fi,此处的Wi-Fi属于第二网络连接方式,且不支持第一网络连接方式。如图8所示,手机基于Wi-Fi连接,在tA时刻向音箱发送心跳包组,并携带发送时间戳tA。音箱在tr4时刻接收到心跳包后,向手机回复响应消息,并携带接收时间戳tr4。手机在tnow4时刻接收到音箱发送的响应消息后,计算出传输时延tdelay4=(tnow4-tA)/2。手机和音箱之间的时钟差为tC4=tr4-tA-tdelay4。手机可以将时钟差通知给音箱,以便音箱后续根据时钟差和第一预设周期T1,定期唤醒以接收心跳包。Exemplarily, Wi-Fi is supported between the mobile phone and the speaker, and Wi-Fi here belongs to the second network connection mode and does not support the first network connection mode. As shown in Figure 8, the mobile phone sends a heartbeat packet to the speaker at time tA based on the Wi-Fi connection, and carries the sending time stamp tA. After the speaker receives the heartbeat packet at time tr4, it replies a response message to the mobile phone, and carries the receiving time stamp tr4. After the mobile phone receives the response message sent by the speaker at time tnow4, it 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 speaker of the clock difference, so that the speaker can wake up regularly to receive the heartbeat packet according to the clock difference and the first preset period T1.
后续,手机基于Wi-Fi连接,在本机时钟对应的tA+m*T1时刻周期性地从内核底层协议栈向音箱发送心跳包组。音箱在本机时钟对应的tA+m*T1+tC4时刻周期性地唤醒运行,通过Wi-Fi连接接收到心跳包后进行实时响应,可以减少无序的心跳包和多次重复的心跳响应,且不需要像第一网络连接方式那样进行窗口对齐。Subsequently, based on the Wi-Fi connection, the mobile phone periodically sends a heartbeat packet group from the kernel bottom layer protocol stack to the speaker at the time tA+m*T1 corresponding to the local clock. The speaker periodically wakes up and runs at the time tA+m*T1+tC4 corresponding to the local clock, and responds in real time after receiving the heartbeat packet through the Wi-Fi connection, which can reduce disordered heartbeat packets and repeated heartbeat responses. And there is no need to perform window alignment like the first network connection method.
也就是说,在图1A所示的智连网络中,作为一级节点的手机和作为二级节点的耳机之间,支持第一网络连接方式中的蓝牙BLE,可以基于时钟差进行窗口对齐,并在窗口对齐后周期性地交互心跳包,从而进行电子设备的在线检测。作为一级节点的手机与作为二级节点的音箱之间,支持第二网络连接方式中的Wi-Fi,而不支持第一网络连接方式,可以基于时钟差周期性地交互心跳包,从而进行电子设备的在线检测。That is to say, in the Smart Connect network shown in Figure 1A, between the mobile phone as the first-level node and the earphone as the second-level node, Bluetooth BLE in the first network connection mode is supported, and window alignment can be performed based on the clock difference. And periodically exchange heartbeat packets after the windows are aligned, so as to perform online detection of electronic equipment. The mobile phone as the first-level node and the speaker as the second-level node support Wi-Fi in the second network connection mode, but do not support the first network connection mode. Heartbeat packets can be exchanged periodically based on the clock difference, thereby On-line inspection of electronic equipment.
以上是以图1A所示的智连网络中,中心节点、一级节点和二级节点为例,对本申请实施例提供的在线检测方法进行了阐述。当智连网络中还包括其他层级的节点(例如三级节点和四级节点)时,中心节点将心跳包发给一级节点,一级节点将心跳包发送给二级节点,二级节点还可以将心跳包发给三级节点,三级节点还可以将心跳包发送给四级节点,依次类推,此处不予赘述。这样,全网相邻上、下级节点(或称为直连上、下级节点)之间高效、快速、准确地接收到心跳包,从而可以提高心跳包的接收效率,减少心跳包的收发次数和时长,降低电子设备的功耗,从而可以基于心跳包对网络中的多个电子设备实现快速、及时、准确的在线检测,还可以提高智连网络可接入电子设备的数量。The online detection method provided by the embodiment of the present application is described above by taking the central node, the first-level node and the second-level node in the smart connection network shown in FIG. 1A as examples. When the Wi-Fi network also includes nodes at other levels (such as third-level nodes and fourth-level nodes), the central node sends the heartbeat packet to the first-level node, and the first-level node sends the heartbeat packet to the second-level node. The heartbeat packet can be sent to the third-level node, and the third-level node can also send the heartbeat packet to the fourth-level node, and so on, which will not be described here. In this way, heartbeat packets can be efficiently, quickly and accurately received between adjacent upper and lower nodes (or directly connected upper and lower nodes) in the entire network, thereby improving the receiving efficiency of heartbeat packets and reducing the number of sending and receiving of heartbeat packets and It can reduce the power consumption of electronic devices, so that multiple electronic devices in the network can be detected quickly, timely and accurately based on heartbeat packets, and the number of electronic devices that can be connected to the Smart Connect network can also be increased.
从而,该方案可以在整个智连网络中的上、下级节点之间依次传递心跳包(这样也可以称为整个智连网络中的心跳同步),减少无序的心跳,对智连网络中的各电子设备进行统一、有序的在线检测,进而可使用在线电子设备快速、直接、协同地执行业务。Therefore, this solution can sequentially transmit heartbeat packets between the upper and lower nodes in the entire SmartConnect network (this can also be called heartbeat synchronization in the entire SmartConnect network), reducing disordered heartbeats and improving the performance of the SmartConnect network. Each electronic device performs unified and orderly online detection, and then the online electronic device can be used to perform business quickly, directly and collaboratively.
并且,在业务请求前进行智连网络组网时,可以提升组网心跳同步的效率,使智连网络内的设备状态和上下线响应更加实时准确。而且,能够降低后台组网的能耗,使得网络有序化,提高设备数量较多情况下的网络稳定性。In addition, when the smart connection network is formed before the service request, the efficiency of network heartbeat synchronization can be improved, and the device status and online and offline responses in the smart connection network can be more real-time and accurate. Moreover, it can reduce the energy consumption of background networking, make the network orderly, and improve the network stability in the case of a large number of devices.
可以理解的是,图1A所示的智连网络仅是举例说明,智连网络还可以有不同的网络拓扑结构,还可以具有更多的电子设备(比如还可以有智能灯,智能窗帘、智能遥控器或电子锁等)和更为复杂的网络连接关系。各种结构的智连网络均可以采用上述方法交互心跳包从而进行在线检测。It can be understood that the smart connection network shown in Figure 1A is only an example, and the smart connection network can also have different network topologies, and can also have more electronic devices (such as smart lights, smart curtains, smart remote control or electronic lock, etc.) and more complex network connection relationship. SmartConnect networks with various structures can use the above method to exchange heartbeat packets for online detection.
此外,在本申请的一些实施例中,当某一节点进入亮屏状态后,通常在执行业务,因而对耗电不敏感,扫描动作对该节点功耗的影响不大。因此,在该节点开启扫描窗 口以使得窗口对齐的同时,扫描窗口的占空比还可以较大,以保证该节点能够及时、快速地接收到心跳包,减少由于干扰较大而导致的错过心跳包的接收。相反地,当该节点进入灭屏状态后,扫描窗口的占空比可以较小,以节省功耗。In addition, in some embodiments of the present application, when a certain node enters the screen-on state, it is usually executing services, so it is not sensitive to power consumption, and the scanning action has little impact on the power consumption of the node. Therefore, when the node opens the scan window to align the windows, the duty cycle of the scan window can also be larger to ensure that the node can receive heartbeat packets in a timely and fast manner, reducing heartbeat misses caused by large interference The reception of the package. Conversely, when the node enters the off-screen state, the duty cycle of the scan window may be smaller to save power consumption.
在本申请的其他一些实施例中,节点的设备类型不同,扫描窗口的占空比也可以不同。例如,若节点对耗电不敏感,则扫描窗口的占空比可以较大,以保证能够及时、快速地接收到心跳包,减少由于干扰较大而导致的错过心跳包的接收。若节点对耗电较为敏感,则扫描窗口的占空比可以较小,以节省功耗。In some other embodiments of the present application, the duty cycle of the scan window may also be different if the device types of the nodes are different. For example, if the node is not sensitive to power consumption, the duty cycle of the scanning window can be larger to ensure that heartbeat packets can be received in a timely and fast manner, and to reduce missed reception of heartbeat packets due to large interference. If the node is more sensitive to power consumption, the duty cycle of the scan window can be smaller to save power consumption.
另外,在本申请的实施例中,节点扫描窗口的持续时长可预先设置,该时长大于一个心跳包的持续时间,例如可以设置为3个心跳包的时间长度,以尽量使得扫描窗口内能够接收到心跳包且扫描窗口的时长较短,从而使得该节点的功耗较小。In addition, in the embodiment of the present application, the duration of the node scanning window can be preset, and the duration is longer than the duration of one heartbeat packet, for example, it can be set to the duration of three heartbeat packets, so as to make it possible to receive The heartbeat packet is received and the scanning window is short, so that the power consumption of the node is small.
在本申请的一些实施例中,某个节点在执行业务时,可以暂停根据第一预设周期T1发送心跳包组。中心节点还可以触发调整开始周期性发送心跳包组的时间。比如,中心节点在执行业务时,可以暂停根据第一预设周期T1发送心跳包组。在业务结束后,中心节点可以触发从时刻tAdj开始,根据第一预设周期T1周期性地发送心跳包组。中心节点可以将调整后的时间tAdj通知给一级节点,一级节点相应地调整扫描窗口以进行窗口对齐。后续的节点将调整后的时间tAdj依次传递给各自的下级节点。In some embodiments of the present application, when a certain node is performing services, it may suspend sending heartbeat packet groups according to the first preset period T1. The central node can also trigger and adjust the time to start periodically sending the heartbeat packet group. For example, when the central node is performing services, it may suspend sending heartbeat packet groups according to the first preset period T1. After the service ends, the central node may trigger the heartbeat packet group to be sent periodically according to the first preset period T1 starting from time tAdj. The central node can notify the first-level node of the adjusted time tAdj, and the first-level node adjusts the scan window accordingly for window alignment. Subsequent nodes transmit the adjusted time tAdj to their respective subordinate nodes in turn.
另外,在一些实施例中,中心节点可以按照预设的第二预设周期T2触发重新计算时钟差,各级节点之间进行时钟差校准。当时钟差有变化时或者当时钟差的变化大于或者等于第二预设值时,智连网络中的节点更新时钟差,并重新基于时钟差进行窗口对齐。其中,第二预设周期T2大于第一预设周期T1。例如,第一预设周期T1可以为5分钟,第二预设周期可以为1小时,中心节点每隔5分钟广播一次心跳包组,每隔1个小时触发更新一次时钟差。In addition, in some embodiments, the central node may trigger recalculation of the clock difference according to the preset second preset period T2, and perform clock difference calibration between nodes at all levels. When the clock difference changes or when the change of the clock difference is greater than or equal to the second preset value, the nodes in the Smart Connect network update the clock difference, and perform window alignment based on the clock difference again. Wherein, the second preset period T2 is greater than the first preset period T1. For example, the first preset period T1 may be 5 minutes, and the second preset period may be 1 hour. The central node broadcasts a heartbeat packet every 5 minutes, and triggers an update of the clock difference every 1 hour.
在一些技术方案中,随着时间的推移,智连网络中节点之间的时钟差可能会发生变化,第二预设周期T2可以为预设的经验值,该经验值与时钟差累计变化的阈值相关。也就是说,在间隔T2后,时钟差的累计变化可能已经超过了阈值,因而中心节点可以触发重新计算时钟差。In some technical solutions, as time goes by, the clock difference between nodes in the Smart Connect network may change, and the second preset period T2 may be a preset experience value, which is the same as the cumulative change of the clock difference Threshold related. That is to say, after the interval T2, the cumulative change of the clock difference may have exceeded the threshold, so the central node may trigger recalculation of the clock difference.
在另一些实施例中,若某个节点发现本次接收到的心跳包与首次接收到的心跳包之间所间隔的心跳包数量大于或者等于第三预设值,则可能时钟差发生了较大的变化,因而可以请求中心节点触发更新时钟差。例如,第三预设值为3,手机首次接收到大屏广播的第2个心跳包,若手机本次接收到大屏广播的第7个心跳包,7-2=5大于第三预设值3,则可能时钟差发生了较大的变化,因而手机可以请求大屏触发重新计算时钟差。而后,各节点重新基于时钟差进行窗口对齐。In some other embodiments, if a certain node finds that the number of heartbeat packets between the heartbeat packet received this time and the heartbeat packet received for the first time is greater than or equal to the third preset value, it may be that the clock difference is relatively large. Large changes, so the central node can be requested to trigger an update clock difference. For example, the third default value is 3, the mobile phone receives the second heartbeat packet of the large-screen broadcast for the first time, 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 If the value is 3, the clock difference may have changed greatly, so the mobile phone can request the large screen to trigger recalculation of the clock difference. Then, each node performs window alignment again based on the clock difference.
在另一些实施例中,若某个节点发现本次接收到的心跳包与首次接收到的心跳包之间所间隔的心跳包数量大于或者等于第四预设值,则可以上报给该节点的上级节点,该节点的上级节点可以请求中心节点触发更新时钟差。例如,第四预设值为4,耳机首次接收到手机广播的第3个心跳包,若耳机本次接收到手机广播的第9个心跳包,9-3=6大于第四预设值4,则可能时钟差发生了较大的变化,因而耳机可以上报给手机,手机可以请求大屏触发重新计算时钟差。而后,各节点重新基于时钟差进行窗口对齐。In other embodiments, if a node finds that the number of heartbeat packets between the heartbeat packet received this time and the heartbeat packet received for the first time is greater than or equal to the fourth preset value, it can report to the node's The superior node, the superior node of the node can request the central node to trigger to update the clock difference. For example, the fourth preset value is 4, the headset receives the third heartbeat packet broadcast by the mobile phone for the first time, if the headset receives the ninth heartbeat packet broadcast by the mobile phone this time, 9-3=6 is greater than the fourth preset value 4 , the clock difference may have changed greatly, so the headset can report to the mobile phone, and the mobile phone can request the large screen to trigger recalculation of the clock difference. Then, each node performs window alignment again based on the clock difference.
在另一些实施例中,若某个节点根据接收到的心跳响应消息,发现该节点的下级 节点本次接收到的心跳包与首次接收到的心跳包之间所间隔的心跳包数量大于或者等于第五预设值,则可以请求中心节点触发更新时钟差。例如,第五预设值为3,手机确定耳机本次接收到手机广播的第8个心跳包,若耳机首次接收到手机广播的第4个心跳包,则8-4=4大于第五预设值3,则可能时钟差发生了较大的变化,因而手机可以请求大屏触发重新计算时钟差。若该节点为中心节点时,则在该种情况下直接触发更新时钟差。而后,各节点重新基于时钟差进行窗口对齐。In some other embodiments, if a node finds that the number of heartbeat packets between the heartbeat packet received by the node's subordinate node and the heartbeat packet received for the first time is greater than or equal to The fifth preset value may request the central node to trigger to update the clock difference. For example, if the fifth preset value is 3, the mobile phone determines that the headset has received the 8th heartbeat packet broadcast by the mobile phone this time, if the headset receives the 4th heartbeat packet broadcast by the mobile phone for the first time, then 8-4=4 is greater than the fifth preset If the value is set to 3, the clock difference may have changed greatly, so the mobile phone can request the large screen to trigger recalculation of the clock difference. If the node is the central node, it will directly trigger to update the clock difference in this case. Then, each node performs window alignment again based on the clock difference.
另外,在本申请的实施例中,若智连网络中新加入一个节点,则各节点重新确定网络拓扑关系,并重新计算时钟差并进行窗口对齐,从而在窗口对齐后交互心跳包以进行在线检测。若智连网络中某个节点离开,则各节点重新确定网络拓扑关系,并重新计算时钟差并进行窗口对齐,从而在窗口对齐后交互心跳包以进行在线检测。若由于新加入一个节点或一个节点离开等原因,使得中心节点发生了变化,则新的中心节点触发重新计算时钟差并进行窗口对齐,从而在窗口对齐后交互心跳包以进行在线检测。In addition, in the embodiment of this application, if a new node is added to the Zhilian network, each node will re-determine the network topology relationship, recalculate the clock difference, and perform window alignment, so that after the window alignment, exchange heartbeat packets for online detection. If a node in the Zhilian network leaves, each node will re-determine the network topology relationship, recalculate the clock difference and perform window alignment, so as to exchange heartbeat packets for online detection after window alignment. If the central node changes due to the addition of a new node or the departure of a node, the new central node triggers recalculation of the clock difference and window alignment, so that heartbeat packets can be exchanged for online detection after window alignment.
在一些实施例中,如前所述,智连网络中的各设备在组网成功后,可以确定各电子设备均上线。若通过心跳包进行在线检测时发现某个电子设备离开,则可以将该电子设备的下线信息通知给中心节点或通知给智连网络中的各个电子设备,以便中心节点或各电子设备可以统一获知各电子设备的在线情况。In some embodiments, as mentioned above, after each device in the Smart Connect network is successfully established, it may be determined that each electronic device is online. If it is found that an electronic device has left during the online detection through the heartbeat packet, the offline information of the electronic device can be notified to the central node or to each electronic device in the Zhilian network, so that the central node or each electronic device can be unified. Know the online status of each electronic device.
在智连网络中,某个节点首次接收到该节点的上级节点发送的心跳包后,再向该节点的下级节点发送心跳包组。后续,该节点根据首次向下级节点发送心跳包的时间,按照T1周期性地向下级节点发送心跳包组。因而,通常情形下,该节点后续按照T1向下级节点发送心跳包组时,已经接收到了来自上级节点的心跳包。若后续该节点按照周期向下级节点发送心跳包组时,未接收到来自上级节点的心跳包,则可能由于网络原因、时钟差发生了改变或者上级节点离开等原因导致出现了异常,从而可以按照正常周期向下级节点发送心跳包组,并触发进行异常恢复处理。例如,手机在窗口对齐后,确定以5分钟为周期分别在18:05、18:10、18:15…开始向耳机广播心跳包组;若手机在18:05时未接收到大屏广播的心跳包,则可能出现了异常,从而仍按照正常周期在18:05开始向耳机广播心跳包组,并触发进行异常恢复处理。In the Zhilian network, after a node receives the heartbeat packet sent by the upper node of the node for the first time, it sends the heartbeat packet group to the lower node of the node. Subsequently, the node periodically sends the heartbeat packet group to the subordinate node according to T1 according to the time when the heartbeat packet is sent to the subordinate node for the first time. Therefore, under normal circumstances, when the node subsequently sends the heartbeat packet group to the subordinate node according to T1, it has already received the heartbeat packet from the superior node. If the node does not receive the heartbeat packet from the upper-level node when it sends the heartbeat packet group to the lower-level node according to the cycle, it may be due to network reasons, changes in the clock difference, or the departure of the upper-level node. Send a heartbeat packet group to the lower-level node in a normal period, and trigger abnormal recovery processing. For example, after the windows are aligned, the mobile phone determines to start broadcasting heartbeat packets to the earphones at 18:05, 18:10, 18:15... in a period of 5 minutes; If there is an abnormality in the heartbeat packet, the heartbeat packet group will be broadcast to the earphone at 18:05 according to the normal cycle, and the exception recovery process will be triggered.
在异常恢复处理过程中,若该节点在预设时长内接收到来自上级节点的心跳包,则可以根据接收到的心跳包进行时钟差校准;若中间节点在预设时长内仍未接收到来自上级节点的心跳包,则可以确定上级节点是否离开,是否需要重新确定网络拓扑关系,是否需要重新计算时钟差等相关异常处理。During the abnormal recovery process, if the node receives the heartbeat packet from the superior node within the preset time period, it can perform clock difference calibration according to the received heartbeat packet; if the intermediate node has not received the heartbeat packet from the The heartbeat packet of the upper-level node can determine whether the upper-level node has left, whether it is necessary to re-determine the network topology relationship, whether it is necessary to recalculate the clock difference and other related exception handling.
在本申请以上实施例中,窗口对齐用于发送和接收心跳包,从而进行在线检测。在其他实施例中,时钟差也可以基于心跳包以外的其他消息来确定,窗口对齐也可以用于交互其他目标信息,而不用于发送和接收心跳包,从而可以进行在线检测以外的其他应用,本申请实施例对窗口对齐的应用场景和范围不予限定。这样,电子设备在接收窗口内能够快速、准确地接收到目标信息,从而可以减少单位时间内消息的交互次数,降低通信成本和功耗,提高目标信息接收的可靠性,使得智连网络中多个电子设备之间目标信息的收发更为快速、准确和及时。In the above embodiments of the present application, window alignment is used to send and receive heartbeat packets, so as to perform 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 exchange other target information instead of sending and receiving heartbeat packets, so that other applications other than online detection can be performed, The embodiment of the present application does not limit the application scenarios and scope of window alignment. 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, and improving the reliability of receiving target information. The sending and receiving of target information between electronic devices is more rapid, accurate and timely.
比如,该目标信息可以包括智连网络中某个电子设备的基本信息或网络能力信息 的变化等。采用本申请实施例提供的方案,智连网络中的其他电子设备可以在窗口对齐后,在接收窗口内快速、准确地接收到该目标信息,从而获知该电子设备基本信息或网络能力信息的变化等,以便其他电子设备根据该电子设备变化后的基本信息或网络能力信息等,进行相应的适配或其他相关处理。该方案可以提高目标信息接收的可靠性,提高智连网络内多个电子设备同步获知某个电子设备的基本信息或网络能力信息变化的效率,使得智连网络中多个电子设备之间目标信息的收发更为快速、准确和及时。For example, the target information may include basic information of an electronic device in the Smart Connect network or changes in network capability information. Using the solution provided by the embodiment of this application, other electronic devices in the Zhilian network can quickly and accurately receive the target information within the receiving window after the windows are aligned, so as to know the changes in the basic information of the electronic device or network capability information 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 receiving target information, improve the efficiency of multiple electronic devices in the Smart Connect network synchronously obtaining the basic information of an electronic device or the change of network capability information, and make the target information between multiple electronic devices in the Smart Connect network Sending and receiving more quickly, accurately and timely.
例如,电子设备的基本信息可以包括以下至少一项:电子设备的标识(device ID)、电子设备的名称(device name)、电子设备的类型(device type)、网络标识(Network ID)、电子设备的权重信息、电子设备的角色信息和电子设备的版本信息中的至少一项。其中,电子设备的标识用于唯一标识一个电子设备;电子设备的名称为用户定义的电子设备的名称或者电子设备出厂定义的名称;电子设备的类型表示电子设备所属哪一类型,例如类型为:手机、PC、穿戴、耳机、眼镜、音箱、车机、智慧屏或者车机等。网络标识为电子设备接入网络之后,网络为电子设备分配的唯一组网标识,例如可以为唯一设备识别符(unique device identifier,UDID)。电子设备的版本信息表示电子设备当前的系统的版本号。网络能力信息可以参见上文的相关描述。For example, the basic information of an electronic device may include at least one of the following: the identification (device ID) of the electronic device, the name (device name) of the electronic device (device name), the type (device type) of the electronic device, the network identification (Network ID), the electronic device At least one of 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 identification of the electronic device is used to uniquely identify an electronic device; the name of the electronic device is the name of the electronic device defined by the user or the name defined by the factory of the electronic device; the type of the electronic device indicates which type the electronic device belongs to, for example, the type is: Mobile phones, PCs, wearables, earphones, glasses, speakers, car phones, smart screens or car phones, etc. The network identifier is a unique network identifier assigned by the network to the electronic device after the electronic device is connected to the network, for example, it may be a unique device identifier (UDID). The version information of the electronic device indicates the version number of the current system of the electronic device. For network capability information, please refer to the relevant description above.
示例性的,智连网络中的其他电子设备之前保存有电子设备1的IP地址以便可以与电子设备1进行业务数据传输,目标信息为电子设备1更换了IP地址。智连网络中的其他电子设备基于窗口对齐可以高效、准确地接收到该目标信息。智连网络中的其他电子设备接收到该目标信息后,可以更新之前保存的电子设备1的IP地址。Exemplarily, other electronic devices in the Zhilian network previously saved the IP address of the electronic device 1 so as to transmit business data with the electronic device 1, and the target information is that the IP address of the electronic device 1 has been changed. Other electronic devices in the Smart Connect network can efficiently and accurately receive the target information based on window alignment. After receiving the target information, other electronic devices in the Zhilian network can update the IP address of the electronic device 1 saved before.
再示例性的,电子设备1之前的网络能力不支持点对点(point to point,P2P)通信,目标信息为电子设备1支持P2P通信。智连网络中的其他电子设备基于窗口对齐可以高效、准确地接收到该目标信息。智连网络中的其他电子设备接收到该目标信息后,可以与电子设备1进行P2P通信。As another example, the previous network capability of the electronic device 1 does not support point-to-point (point to point, P2P) communication, and the target information is that the electronic device 1 supports P2P communication. Other electronic devices in the Smart Connect network can efficiently and accurately receive the target information based on window alignment. After receiving the target information, other electronic devices in the Zhilian network can perform P2P communication with the electronic device 1 .
再示例性的,目标信息为电子设备1是否更换了热点等其他内容。In another example, the target information is whether the electronic device 1 has replaced a hotspot or other content.
本申请其他实施例还提供了一种在线检测方法,该方法可用于支持第一网络连接方式的任意两个电子设备之间,或者用于其他组网中支持第一网络连接方式的任意两个电子设备之间,而不限于应用在多设备组成的智连网络中。任意两个电子设备之间可以采用上述方式计算时钟差并进行窗口对齐,且在窗口对齐后交互心跳包以进行在线检测。这样,电子设备在接收窗口内能够快速、准确地接收到心跳包,从而可以减少单位时间内心跳包的收发,降低通信成本,提高心跳包接收的可靠性,使得在线检测更为快速、准确和及时。在其他一些实施例中,任意两个电子设备之间可以在窗口对齐后,交互心跳包以外的其他目标信息,从而实现在线检测以外的其他可能功能。Other embodiments of the present application also provide an online detection method, which can be used between any two electronic devices that support the first network connection mode, or between any two electronic devices that support the first network connection mode in other networking Between electronic devices, not limited to the application in the smart connection network composed of multiple devices. Any two electronic devices can use the above method to calculate the clock difference and perform window alignment, and exchange heartbeat packets for online detection after window alignment. In this way, the electronic device can quickly and accurately receive heartbeat packets within the receiving window, thereby reducing the sending and receiving of heartbeat packets per unit time, reducing communication costs, improving the reliability of heartbeat packet reception, and making online detection faster, more accurate and more efficient. timely. In some other embodiments, after the windows are aligned, any two electronic devices can exchange target information other than heartbeat packets, so as to realize other possible functions other than online detection.
本申请以上实施例通过计算各电子设备之间的时钟差来进行窗口对齐。其中,各电子设备的本机时钟相互独立,不需要与世界时间保持一致,不影响用户通过各电子设备对时间的感知。该方案还可兼容运行不同操作系统的电子设备,且轻量型设备也可以采用该方案来高效地交互心跳包或目标信息等内容。In the above embodiments of the present application, window alignment is performed by calculating clock differences between electronic devices. Wherein, the local clocks of each electronic device are independent of each other and do not need to be consistent with the world time, which does not affect the user's perception of time through each electronic device. This solution is also compatible with electronic devices running different operating systems, and lightweight devices can also use this solution to efficiently exchange content such as heartbeat packets or target information.
另外,结合上述实施例及相应的附图,本申请另一实施例提供一种在线检测方法,该方法可以用于多设备组成的智连网络,该智连网络包括第一电子设备以及一个或多 个第二电子设备。该第一电子设备和第二电子设备可以具有图1B所示的结构。其中,第一电子设备为第二电子设备的上级节点,第二电子设备为第一电子设备的下级节点。例如,第一电子设备可以为上述中心节点、第二电子设备可以为上述一级节点;或者,第一电子设备可以为上述一级节点、第二电子设备可以为上述二级节点等。参见图9,该方法可以包括:In addition, in combination with the above-mentioned embodiments and corresponding drawings, another embodiment of the present application provides an online detection method, which can be used in a smart-connected network composed of multiple devices, and the smart-connected network includes a first electronic device and one or A plurality of second electronic devices. The first electronic device and the second electronic device may have the structure shown in FIG. 1B . Wherein, the first electronic device is an upper-level node of the second electronic device, and the second electronic device is a lower-level node of the first electronic device. For example, the first electronic device may be the above-mentioned central node, and the second electronic device may be the above-mentioned primary node; or, the first electronic device may be the above-mentioned primary node, and the second electronic device may be the above-mentioned secondary node, etc. Referring to Figure 9, the method may include:
901、一个或多个第二电子设备获取各自对应的第一时钟差,第一时钟差为第二电子设备的本机时钟与第一电子设备的本机时钟之间的差值。901. One or more second electronic devices acquire respective corresponding first clock differences, where the first clock difference is a difference between a local clock of the second electronic device and a local clock of the first electronic device.
示例性的,第一电子设备可以为图1A所示的大屏,第二电子设备可以为图1A所示的手机,第一时钟差可以为手机与大屏之间的时钟差tC1。Exemplarily, the first electronic device may be the large screen shown in FIG. 1A , the second electronic device may be the mobile phone shown in FIG. 1A , and the first clock difference may be the clock difference tC1 between the mobile phone and the large screen.
902、第一电子设备向一个或多个第二电子设备发送对应的一个或多个第一目标消息。902. The first electronic device sends corresponding one or more first target messages to one or more second electronic devices.
示例性的,第二电子设备为手机,第一目标消息为心跳包。例如,该第一目标消息可以为上述第一种策略对应的心跳包组中的第1个心跳包,或者为上述第二种策略对应的心跳包组中的第X1个心跳包,或者为上述第三种策略对应的心跳包组中的第1个心跳包或第X1-X0个心跳包等。Exemplarily, the second electronic device is a mobile phone, and the first target message is a heartbeat packet. For example, the first target message may be the first 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 above-mentioned The third strategy corresponds to the first heartbeat packet or the X1-X0th heartbeat packets in the heartbeat packet group.
903、一个或多个第二电子设备根据各自对应的第一时钟差,控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息。903. The one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences.
例如,第二电子设备可以根据第一时钟差,以及上述第一至第三种策略中的任一种,控制第一电子设备发送第一目标消息的时机和/或第二电子设备进入接收状态的时机,从而控制第二电子设备在处于窗口接收状态时接收对应的第一目标消息。For example, the second electronic device may control the timing at which the first electronic device sends the first target message and/or the second electronic device enters the receiving state according to the first clock difference and any one of the above-mentioned first to third strategies timing, so as to control the second electronic device to receive the corresponding first target message when it is in the window receiving state.
例如,一个或多个第二电子设备根据各自对应的第一时钟差和第一预设周期,控制第二电子设备在第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。For example, one or more second electronic devices control the second electronic devices to enter the window reception state when the first electronic device sends the corresponding first target message according to their corresponding first clock difference and first preset period, so that The second electronic device receives the corresponding first target message when it is in the window receiving state.
再例如,一个或多个第二电子设备根据各自对应的第一时钟差,控制在根据预先获得的传输时延计算的对应的第一目标消息到达第二电子设备的时刻之前,第二电子设备处于窗口接收状态,以使得第二电子设备在处于窗口接收状态时接收对应的第一目标消息。For another example, one or more second electronic devices control, according to their corresponding first clock differences, that the second electronic device Being in the window receiving state, so that the second electronic device receives the corresponding first target message when in the window receiving state.
基于该方案,第二电子设备能够基于时钟差控制目标消息的发送时机和/或接收时机,使得接收端设备在处于窗口接收状态时接收目标消息,可高效接收目标消息,降低功耗。Based on this solution, the second electronic device can control the timing of sending and/or receiving the target message based on the clock difference, so that the receiving device receives the target message when it is in the window receiving state, which can efficiently receive the target message and reduce power consumption.
这样,智连网络中任意具有上、下级节点关系的电子设备之间,都可以采用本申请实施例提供的方法传递第一目标消息,并根据时钟差在处于窗口接收状态时接收第一目标消息,从而能够高效、快速、准确地接收第一目标消息,减少第一目标消息交互的条数和时长,节省智连网络中电子设备的功耗,提高根据第一目标消息进行相应处理的效率。例如,当第一目标消息包括心跳包时,可以高效地根据第一目标消息中的心跳包进行电子设备的在线检测。In this way, any electronic device in the Zhilian network that has the relationship between upper and lower nodes can use the method provided by the embodiment of the application to transmit the first target message, and receive the first target message when it is in the window receiving state according to the clock difference , so that the first target message can be received efficiently, quickly and accurately, the number and duration of the first target message interaction can be reduced, the power consumption of electronic devices in the Smart Connect network can be saved, and the efficiency of corresponding processing according to the first target message can be improved. For example, when the first target message includes a heartbeat packet, online detection of the electronic device can be efficiently performed according to the heartbeat packet in the first target message.
可以理解的是,为了实现上述功能,上述电子设备包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件 驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。It can be understood that, in order to realize the above functions, the above electronic device includes corresponding hardware and/or software modules for performing each function. Combining the algorithm steps of each example described in the embodiments disclosed herein, 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 by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions in combination with the embodiments for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
本实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment, the functional modules of the electronic device may be divided according to the above method example. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
在采用对应各个功能划分各个功能模块的情况下,电子设备可以包括:处理单元、接收单元和发送单元等。需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。In the case of dividing each functional module corresponding to each function, the electronic device may include: a processing unit, a receiving unit, a sending unit, and the like. It should be noted that all relevant content of the steps involved in the above method embodiments can be referred to the function description of the corresponding function module, and will not be repeated here.
本申请实施例还提供一种电子设备,如图10所示,包括:一个或多个处理器1001,存储器1002,以及一个或多个计算机程序1003,上述各器件可以通过一个或多个通信总线1004连接。其中该一个或多个计算机程序1003被存储在上述存储器1002中并被配置为被该一个或多个处理器1001执行,该一个或多个计算机程序1003包括指令,上述指令可以用于执行上述实施例中的各个步骤。其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应实体器件的功能描述,在此不再赘述。The embodiment of the present application also provides an electronic device, as shown in FIG. 10 , including: one or more processors 1001, memory 1002, and one or more computer programs 1003, each of which can be connected via one or more communication buses 1004 connected. 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-mentioned instructions can be used to perform the above-mentioned implementation steps in the example. Wherein, all relevant content of each step involved in the above method embodiment can be referred to the functional description of the corresponding physical device, and will not be repeated here.
示例性的,上述处理器1001具体可以为图1B所示的处理器110,上述存储器1002具体可以为图1B所示的内部存储器121。Exemplarily, the foregoing processor 1001 may specifically be the processor 110 shown in FIG. 1B , and the foregoing memory 1002 may specifically be the internal memory 121 shown in FIG. 1B .
本申请实施例还提供一种电子设备,包括一个或多个处理器以及一个或多个存储器。该一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述相关方法步骤实现上述实施例中的在线检测方法。The embodiment of the present application also provides an electronic device, including one or more processors and one or more memories. The one or more memories are coupled with one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device performs The above related method steps realize the online detection method in the above embodiment.
本申请的实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的在线检测方法。Embodiments of the present application also provide a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the electronic device, the electronic device executes the above-mentioned relevant method steps to realize the above-mentioned embodiment The online detection method in .
本申请的实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中电子设备执行的在线检测方法。Embodiments of the present application also provide a computer program product, which, when running on a computer, causes the computer to execute the above-mentioned related steps, so as to implement the online detection method performed by the electronic device in the above-mentioned embodiments.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中电子设备执行的在线检测方法。In addition, an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the online detection method performed by the electronic device in the above method embodiments.
其中,本实施例提供的电子设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Wherein, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment is all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the above-mentioned The beneficial effects of the corresponding method will not be repeated here.
本申请另一实施例提供了一种网络系统,该网络系统可以为上述智连网络,可以包括多个电子设备,可以用于实现上述在线检测方法。Another embodiment of the present application provides a network system. The network system may be the above-mentioned Smart Connect network, may include a plurality of electronic devices, and may be used to implement the above-mentioned online detection method.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述 功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and brevity of the description, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be assigned by different Completion of functional modules means that the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be Incorporation or may be integrated into another device, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places . Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function 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 embodiment of the present application is essentially 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, and the software product is stored in a storage medium Among them, several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes such as U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above content is only the specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application, and should covered within the scope of protection of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (43)

  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 acquire 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 difference;
    所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息;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 devices to receive the corresponding first target message when they are in the window receiving state according to their corresponding first clock differences.
  2. 根据权利要求1所述的方法,其特征在于,所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 1, wherein the first electronic device sends corresponding one or more first target messages to the one or more second electronic devices, comprising:
    所述第一电子设备根据第一预设周期,向所述一个或多个第二电子设备周期性地发送所述对应的一个或多个第一目标消息;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 control the second electronic devices to receive corresponding first target messages when they are in the window receiving state according to their corresponding first clock differences, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差和所述第一预设周期,控制所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息。The one or more second electronic devices control the second electronic devices to receive the corresponding first target message when they are in the window receiving state according to the corresponding first clock difference and the first preset period.
  3. 根据权利要求2所述的方法,其特征在于,所述一个或多个第二电子设备根据各自对应的所述第一时钟差和所述第一预设周期,控制所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息,包括: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, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息。The one or more second electronic devices control the second electronic devices to send the corresponding first target message on the first electronic device according to the corresponding first clock difference and the first preset period enter the window receiving state, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
  4. 根据权利要求3所述的方法,其特征在于,在所述一个或多个第二电子设备获取各自对应的第一时钟差之前,所述方法还包括:The method according to claim 3, wherein, before the one or more second electronic devices obtain their corresponding first clock differences, the method further comprises:
    所述第一电子设备根据所述一个或多个第二电子设备最近分别接收到的第二目标消息,计算所述第一时钟差;The first electronic device calculates the first clock difference according to the second target message recently received by the one or more second electronic devices;
    其中,所述第二目标消息来自所述第一电子设备发送的第一消息组,且所述第一消息组包括按照预设间隔发送的N个消息,所述第二目标消息为所述第一消息组中的第X个消息,所述N为正整数,所述X为小于或者等于所述N的正整数;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 preset intervals, and the second target message is the first message group sent by the first electronic device. The Xth message in a message group, the N is a positive integer, and the X is a positive integer less than or equal to the N;
    所述一个或多个第二电子设备获取各自对应的第一时钟差,包括:The one or more second electronic devices obtain respective corresponding first clock differences, including:
    所述一个或多个第二电子设备从所述第一电子设备获取各自对应的所述第一时钟差。The one or more second electronic devices obtain the respective first clock differences from the first electronic device.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, characterized in that the method further comprises:
    所述第一电子设备在t1时刻向所述一个或多个第二电子设备发送所述第一消息组;The first electronic device sends the first message group to the one or more second electronic devices at time t1;
    所述一个或多个第二电子设备在各自的tr时刻接收到所述第一消息组中的第X个消息后,分别向所述第一电子设备发送第一响应消息,所述第一响应消息包括所述tr和所述第X个消息的发送时间戳tX的指示信息;After the one or more second electronic devices receive the Xth message in the first message group at respective time tr, they respectively send a first response message to the first electronic device, and the first response The message includes the indication information of the tr and the sending time stamp tX of the Xth message;
    所述第一电子设备在一个或多个tnow时刻,接收到来自所述一个或多个所述第一 响应消息后,根据所述tnow和所述tX分别计算所述一个或多个第二电子设备对应的传输时延;After receiving the one or more first response messages from the one or more first response messages at one or more tnow times, the first electronic device calculates the one or more second electrons respectively according to the tnow and the tX The transmission delay corresponding to the device;
    所述第一电子设备根据所述一个或多个第二电子设备最近分别接收到的第二目标消息,计算所述第一时钟差,包括:The first electronic device calculates the first clock difference according to the second target message recently received by the one or more second electronic devices, including:
    所述第一电子设备根据所述一个或多个第二电子设备分别对应的所述传输时延、所述tr和所述tX,计算所述一个或多个第二电子设备各自对应的所述第一时钟差。The first electronic device calculates the respective transmission delays, the tr and the tX corresponding to the one or more second electronic devices respectively corresponding to the one or more second electronic devices. First clock difference.
  6. 根据权利要求5所述的方法,其特征在于,所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 5, wherein the first electronic device sends corresponding one or more first target messages to the one or more second electronic devices, comprising:
    所述第一电子设备根据所述t1和所述第一预设周期,向所述一个或多个第二电子设备周期性地发送第二消息组,所述第二消息组包括按照预设间隔发送的多个消息,所述一个或多个第二电子设备各自对应的第一目标消息,为所述第二消息组中所述一个或多个第二电子设备各自对应的第X个消息;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, and the second message group includes For the multiple messages sent, 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 devices to send the corresponding first target message on the first electronic device according to the corresponding first clock difference and the first preset period When entering the window receiving state, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差、所述t1和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送第二消息组时进入窗口接收状态,以使得第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态。The one or more second electronic devices control the second electronic devices to transmit the second The message group enters the window receiving state, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
  7. 根据权利要求5所述的方法,其特征在于,所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 5, wherein the first electronic device sends corresponding one or more first target messages to the one or more second electronic devices, comprising:
    所述第一电子设备根据所述t1和所述第一预设周期,向所述一个或多个第二电子设备周期性地发送第二消息组,所述第二消息组包括按照预设间隔发送的多个消息,所述一个或多个第二电子设备各自对应的第一目标消息,为所述第二消息组中所述一个或多个第二电子设备各自对应的第X个消息;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, and the second message group includes For the multiple messages sent, 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 devices to send the corresponding first target message on the first electronic device according to the corresponding first clock difference and the first preset period When entering the window receiving state, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差、所述tX和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态。The one or more second electronic devices control the second electronic devices to send corresponding When the first target message enters the window receiving state.
  8. 根据权利要求5所述的方法,其特征在于,所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 5, wherein the first electronic device sends corresponding one or more first target messages to the one or more second electronic devices, comprising:
    所述第一电子设备根据tX0和所述第一预设周期,向所述一个或多个第二电子设备周期性地发送第二消息组,所述tX0为所述一个或多个电子设备对应的tX中时机靠前的取值,所述tX0对应所述第一消息组中的第X0个消息,所述第二消息组包括按照预设间隔发送的多个消息,所述一个或多个第二电子设备各自对应的第一目标消息,为所述第二消息组中与所述一个或多个第二电子设备各自对应的第X-X0+1个消息;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, and the tX0 is a message corresponding to the one or more electronic devices The value of the timing in tX of tX, the tX0 corresponds to the X0th message in the first message group, the second message group includes a plurality of messages sent at preset intervals, and the one or more The first target message corresponding to each of the second electronic devices is the X-X0+1th 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 devices to send the corresponding first target message on the first electronic device according to the corresponding first clock difference and the first preset period When entering the window receiving state, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差、所述tX和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送第二消息组时进入窗口接收状态,以使得所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态。The one or more second electronic devices control the second electronic device to transmit the second When the message group enters the window receiving state, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message.
  9. 根据权利要求5所述的方法,其特征在于,所述网络包括一个第二电子设备,所述第一电子设备向所述第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 5, wherein the network includes a second electronic device, and the first electronic device sends one or more corresponding first target messages to the second electronic device, including:
    所述第一电子设备根据所述tX和所述第一预设周期,向所述第二电子设备周期性地发送第二消息组,所述第二消息组包括按照预设间隔发送的多个消息,所述第一目标消息为所述第二消息组中的第一个消息;The first electronic device periodically sends a second message group to the second electronic device according to the tX and the first preset period, and the second message group includes a plurality of messages sent at preset intervals. message, the first target message is the first message in the second message group;
    所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:The second electronic device controls the second electronic device to enter a 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 :
    所述第二电子设备根据所述第一时钟差、所述tX和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态。The second electronic device controls the second electronic device to enter the window when the first electronic device sends the corresponding first target message according to the first clock difference, the tX and the first preset period Receive status.
  10. 根据权利要求1-9中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-9, further comprising:
    若所述第二电子设备接收到第二消息组中的第Xi个消息,且所述第Xi与所述第X个消息所间隔的数量大于或者等于预设值,则请求所述第一电子设备更新所述第一时钟差。If the second electronic device receives the Xi th message in the second message group, and the interval 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 The device updates the first clock difference.
  11. 根据权利要求1-9中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-9, further comprising:
    若所述第一电子设备根据来自所述第二电子设备的响应消息确定,所述第二电子设备接收到的第Xi个消息与所述第X个消息所间隔的数量大于或者等于预设值,则所述第一电子设备更新所述第一时钟差。If the first electronic device determines according to the response message from the second electronic device, the interval 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. 根据权利要求2所述的方法,其特征在于,所述一个或多个第二电子设备根据各自对应的所述第一时钟差,控制所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息,包括:The method according to claim 2, wherein the one or more second electronic devices control the second electronic devices to receive the corresponding The first target message, including:
    所述一个或多个第二电子设备根据各自对应的所述第一时钟差,控制在根据预先获得的传输时延计算的对应的第一目标消息到达所述第二电子设备的时刻之前,所述第二电子设备进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息。The one or more second electronic devices control, according to their corresponding first clock differences, before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device, the The second electronic device enters the window receiving state, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述网络还包括一个或多个第三电子设备,每个所述第三电子设备对应一个所述第二电子设备,每个所述第二电子设备对应一个或多个所述第三电子设备,所述方法还包括:The method according to any one of claims 1-12, wherein the network further includes one or more third electronic devices, each of the third electronic devices corresponds to one of the second electronic devices, and each One of the second electronic devices corresponds to one or more of the third electronic devices, and the method further includes:
    所述一个或多个第三电子设备获取各自对应的第二时钟差,所述第二时钟差为所述第三电子设备的本机时钟与所述第三电子设备对应的第二电子设备的本机时钟之间的差值;The one or more third electronic devices obtain respective corresponding second clock differences, where the second clock difference is that the local clock of the third electronic device is different from that of the second electronic device corresponding to the third electronic device the difference between the local clocks;
    所述第二电子设备向对应的一个或多个所述第三电子设备发送第三目标消息;The second electronic device sends a third target message to one or more corresponding third electronic devices;
    所述一个或多个第三电子设备根据各自对应的所述第二时钟差,控制所述第三电子设备在处于窗口接收状态时接收所述第三目标消息。The one or more third electronic devices control the third electronic devices to receive the third target message when they are in the window receiving state according to the respective second clock differences.
  14. 根据权利要求1-13任一项所述的方法,其特征在于,所述第一目标消息为蓝牙低功耗BLE的不可连接广播ADV_NONCONN_IND消息。The method according to any one of claims 1-13, wherein the first target message is a non-connectable broadcast ADV_NONCONN_IND message of Bluetooth Low Energy BLE.
  15. 根据权利要求1-14任一项所述的方法,其特征在于,所述第二电子设备获取第一时钟差,包括:The method according to any one of claims 1-14, wherein the acquiring the first clock difference by the second electronic device comprises:
    所述第二电子设备从所述第一电子设备获取根据第二预设周期更新后的第一时钟差。The second electronic device acquires the first clock difference updated according to a second preset period from the first electronic device.
  16. 根据权利要求15所述的方法,其特征在于,所述第二预设周期与预设的时钟差累计变化阈值相对应。The method according to claim 15, characterized in that the second preset period corresponds to a preset clock difference cumulative change threshold.
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述第一目标消息用于传输心跳包。The method according to any one of claims 1-16, wherein the first target message is used to transmit a heartbeat packet.
  18. 一种消息交互方法,用于多设备组成的网络中的第一电子设备,所述网络还包括一个或多个第二电子设备,其特征在于,所述方法包括:A method for message interaction, used for a first electronic device in a network composed of multiple devices, the network also includes one or more second electronic devices, characterized in that the method includes:
    所述第一电子设备计算所述一个或多个第二电子设备分别对应的所述第一时钟差,所述第一时钟差为所述第二电子设备的本机时钟与所述第一电子设备的本机时钟之间的差值;The first electronic device calculates the first clock difference respectively corresponding to the one or more second electronic devices, and the first clock difference is the local clock of the second electronic device and the first electronic device the difference between the device's native clocks;
    所述第一电子设备将所述一个或多个第二电子设备分别对应的所述第一时钟差,发送给对应的所述第二电子设备,所述第一时钟差用于控制所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息;The first electronic device sends the first clock difference respectively corresponding to the one or more second electronic devices to the corresponding second electronic device, and the first clock difference is used to control the first clock difference The second electronic device receives the corresponding first target message when it is in the window receiving state;
    所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息。The first electronic device sends corresponding one or more first target messages to the one or more second electronic devices.
  19. 根据权利要求18所述的方法,其特征在于,所述第一电子设备向所述一个或多个第二电子设备发送对应的一个或多个第一目标消息,包括:The method according to claim 18, wherein the first electronic device sends corresponding one or more first target messages to the one or more second electronic devices, comprising:
    所述第一电子设备根据第一预设周期,向所述一个或多个第二电子设备周期性地发送所述对应的一个或多个第一目标消息。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. 根据权利要求19所述的方法,其特征在于,所述第一电子设备计算所述一个或多个第二电子设备分别对应的所述第一时钟差,包括:The method according to claim 19, wherein the calculation of the first clock difference respectively corresponding to the one or more second electronic devices by the first electronic device comprises:
    所述第一电子设备根据所述一个或多个第二电子设备最近分别接收到的第二目标消息,计算所述第一时钟差;The first electronic device calculates the first clock difference according to the second target message recently received by the one or more second electronic devices;
    其中,所述第二目标消息来自所述第一电子设备发送的第一消息组,且所述第一消息组包括按照预设间隔发送的N个消息,所述第二目标消息为所述第一消息组中的第X个消息,所述N为正整数,所述X为小于或者等于所述N的正整数。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 preset intervals, and the second target message is the first message group sent by the first electronic device. For the Xth message in a message group, the N is a positive integer, and the X is a positive integer less than or equal to the N.
  21. 根据权利要求20所述的方法,其特征在于,所述第一电子设备根据所述一个或多个第二电子设备最近分别接收到的第二目标消息,计算所述第一时钟差,包括:The method according to claim 20, wherein the first electronic device calculates the first clock difference according to the second target message recently received by the one or more second electronic devices, comprising:
    所述第一电子设备在t1时刻向所述一个或多个第二电子设备发送所述第一消息组;The first electronic device sends the first message group to the one or more second electronic devices at time t1;
    所述第一电子设备在一个或多个tnow时刻,接收到来自所述一个或多个第二电子设备的所述第一响应消息,所述第一响应消息包括所述第二电子设备接收到所述第一消息组中的第X个消息的时刻tr和所述第X个消息的发送时间戳tX的指示信息;The first electronic device receives the first response message from the one or more second electronic devices at one or more tnow moments, and the first response message includes that the second electronic device receives Indication information of the time tr of the Xth message in the first message group and the sending time stamp tX of the Xth message;
    所述第一电子设备根据一个或多个所述第二电子设备分别对应的所述tnow和所述tX,计算所述一个或多个第二电子设备分别对应的传输时延;The first electronic device calculates transmission delays corresponding to the one or more second electronic devices respectively according to the tnow and the tX respectively corresponding to the one or more second electronic devices;
    所述第一电子设备根据所述一个或多个第二电子设备分别对应的所述传输时延、所述tr和所述tX,计算所述一个或多个第二电子设备各自对应的所述第一时钟差。The first electronic device calculates the respective transmission delays, the tr and the tX corresponding to the one or more second electronic devices respectively corresponding to the one or more second electronic devices. First clock difference.
  22. 根据权利要求21所述的方法,其特征在于,所述第一电子设备根据第一预设周期,向所述一个或多个第二电子设备周期性地发送所述对应的一个或多个第一目标消息,包括:The method according to claim 21, wherein the first electronic device periodically sends the corresponding one or more second electronic devices to the one or more second electronic devices according to a first preset period. A target message, including:
    所述第一电子设备根据所述t1和所述第一预设周期,向所述一个或多个第二电子设备周期性地发送第二消息组,所述第二消息组包括按照预设间隔发送的多个消息,所述一个或多个第二电子设备各自对应的第一目标消息,为所述第二消息组中所述一个或多个第二电子设备各自对应的第X个消息。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, and the second message group includes For the multiple messages sent, 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.
  23. 根据权利要求21所述的方法,其特征在于,所述第一电子设备根据第一预设周期,向所述一个或多个第二电子设备周期性地发送所述对应的一个或多个第一目标消息,包括:The method according to claim 21, wherein the first electronic device periodically sends the corresponding one or more second electronic devices to the one or more second electronic devices according to a first preset period. A target message, including:
    所述第一电子设备根据tX0和所述第一预设周期,向所述一个或多个第二电子设备周期性地发送第二消息组,所述tX0为所述一个或多个电子设备对应的tX中时机靠前的取值,所述tX0对应所述第一消息组中的第X0个消息,所述第二消息组包括按照预设间隔发送的多个消息,所述一个或多个第二电子设备各自对应的第一目标消息,为所述第二消息组中与所述一个或多个第二电子设备各自对应的X-X0+1个消息。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, and the tX0 is a message corresponding to the one or more electronic devices The value of the timing in tX of tX, the tX0 corresponds to the X0th message in the first message group, the second message group includes a plurality of messages sent at preset intervals, and the one or more The first target messages corresponding to each of the second electronic devices are X-X0+1 messages corresponding to each of the one or more second electronic devices in the second message group.
  24. 根据权利要求21所述的方法,其特征在于,所述网络包括一个第二电子设备,所述第一电子设备根据第一预设周期,向所述一个或多个第二电子设备周期性地发送所述对应的一个或多个第一目标消息,包括:The method according to claim 21, wherein the network includes a second electronic device, and the first electronic device sends the one or more second electronic devices periodically according to a first preset period Sending the corresponding one or more first target messages includes:
    所述第一电子设备根据所述tX和所述第一预设周期,向所述第二电子设备周期性地发送第二消息组,所述第二消息组包括按照预设间隔发送的多个消息,所述第一目标消息为所述第二消息组中的第一个消息。The first electronic device periodically sends a second message group to the second electronic device according to the tX and the first preset period, and the second message group includes a plurality of messages sent at preset intervals. messages, the first target message is the first message in the second message group.
  25. 根据权利要求18-24任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 18-24, wherein the method further comprises:
    若所述第一电子设备根据来自所述第二电子设备的响应消息确定,所述第二电子设备接收到的第Xi个消息与所述第X个消息所间隔的数量大于或者等于预设值,则所述第一电子设备更新所述第一时钟差。If the first electronic device determines according to the response message from the second electronic device, the interval 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. 根据权利要求18-25任一项所述的方法,其特征在于,所述第一时钟差用于,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息。The method according to any one of claims 18-25, wherein the first clock difference is used to control the second electronic device to enter The window receiving state, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
  27. 根据权利要求18-25任一项所述的方法,其特征在于,所述第一时钟差用于,控制在根据预先获得的传输时延计算的对应的第一目标消息到达所述第二电子设备的时刻之前,所述第二电子设备进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收对应的第一目标消息。The method according to any one of claims 18-25, wherein the first clock difference is used to control when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device. Before the time of the device, the second electronic device enters the window receiving state, so that the second electronic device receives the corresponding first target message when it is in the window receiving state.
  28. 一种消息交互方法,用于多设备组成的网络中的第二电子设备,所述网络还包括第一电子设备,其特征在于,所述方法包括:A method for message interaction, used for a second electronic device in a network composed of multiple devices, the network also includes a first electronic device, characterized in that the method includes:
    所述第二电子设备获取第一时钟差,所述第一时钟差为所述第二电子设备的本机时钟与所述第一电子设备的本机时钟之间的差值;The second electronic device acquires a first clock difference, where the first clock difference is a difference between a local clock of the second electronic device and a 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.
  29. 根据权利要求28所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差,控制所述第二电子设备在处于窗口接收状态时接收来自所述第一电子设备的对应的第一目标消息,包括:The method according to claim 28, wherein the second electronic device controls the second electronic device to receive the corresponding message from the first electronic device when it is in the window receiving state according to the first clock difference. The first target message, 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 .
  30. 根据权利要求29所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在处于窗口接收状态时接收来自所述第一电子设备的对应的第一目标消息,包括:The method according to claim 29, wherein the second electronic device controls the second electronic device to receive the The corresponding first target message of the first electronic device includes:
    所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收来自所述第一电子设备的对应的第一目标消息。The second electronic device controls the second electronic device to enter a 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 as to Make the second electronic device receive the corresponding first target message from the first electronic device when it is in the window receiving state.
  31. 根据权利要求30所述的方法,其特征在于,所述第二电子设备获取第一时钟差,包括:The method according to claim 30, wherein the acquiring the first clock difference by the second electronic device comprises:
    所述第二电子设备从所述第一电子设备获取所述第一时钟差,所述第一时钟差根据所述第二电子设备最近接收到的第二目标消息获得;The second electronic device acquires the first clock difference from the first electronic device, and the first clock difference is obtained according to a second target message recently received by the second electronic device;
    其中,所述第二目标消息来自所述第一电子设备发送的第一消息组,且所述第一消息组包括按照预设间隔发送的N个消息,所述第二目标消息为所述第一消息组中的第X个消息,所述N为正整数,所述X为小于或者等于所述N的正整数。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 preset intervals, and the second target message is the first message group sent by the first electronic device. For the Xth message in a message group, the N is a positive integer, and the X is a positive integer less than or equal to the N.
  32. 根据权利要求31所述的方法,其特征在于,所述方法还包括:The method according to claim 31, further comprising:
    所述第二电子设备在tr时刻接收到来自所述第一电子设备的所述第一消息组中的第X个消息;The second electronic device receives the Xth message in the first message group from the first electronic device at time tr;
    所述第二电子设备向所述第一电子设备发送第一响应消息,所述第一响应消息包括所述tr和所述第X个消息的发送时间戳tX的指示信息,所述tr和所述tX用于计算所述第一时钟差。The second electronic device sends a first response message to the first electronic device, the first response message includes the indication information of the tr and the sending time stamp tX of the Xth message, the tr and the The tX is used to calculate the first clock difference.
  33. 根据权利要求32所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:The method according to claim 32, wherein the second electronic device controls the second electronic device to send The corresponding first target message enters the window receiving state, including:
    所述第二电子设备根据所述第一时钟差、所述第一消息组中第一个消息的发送时刻t1和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送所述第二消息组时进入窗口接收状态,以使得所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,其中,所述第二消息组包括按照预设间隔发送的多个消息,所述第一目标消息为所述第二消息组中的第X个消息。According to the first clock difference, the sending time t1 of the first message in the first message group and the first preset period, the second electronic device controls the second electronic device to The electronic device enters the window receiving state when sending the second message group, so that the second electronic device enters the window receiving state when the first electronic device sends the corresponding first target message, wherein the second message The group includes a plurality of messages sent at preset intervals, and the first target message is the Xth message in the second message group.
  34. 根据权利要求32所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:The method according to claim 32, wherein the second electronic device controls the second electronic device to send The corresponding first target message enters the window receiving state, including:
    所述第二电子设备根据所述第一时钟差、所述第一消息组中第X个消息的发送时刻tX和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第 一目标消息时进入窗口接收状态,其中,所述第二消息组包括按照预设间隔发送的多个消息,所述第一目标消息为所述第二消息组中的第一个消息。According to the first clock difference, the sending time tX of the Xth message in the first message group and the first preset period, the second electronic device controls the second electronic device to The electronic device enters the window receiving state when sending the corresponding first target message, wherein the second message group includes a plurality of messages sent at preset intervals, and the first target message is the first message in the second message group a message.
  35. 根据权利要求32所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,包括:The method according to claim 32, wherein the second electronic device controls the second electronic device to send The corresponding first target message enters the window receiving state, including:
    所述第二电子设备根据所述第一时钟差、所述tX和所述第一预设周期,控制所述第二电子设备在所述第一电子设备发送第二消息组时进入窗口接收状态,以使得所述第二电子设备在所述第一电子设备发送对应的第一目标消息时进入窗口接收状态,其中,所述第二消息组包括按照预设间隔发送的多个消息,所述第一目标消息为所述第二消息组中的第一个消息或者第X-X0+1个消息,所述第X0个消息在所述第一消息组中先于所述第X个消息发送。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 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 a plurality of messages sent at preset intervals, the The first target message is the first message or the X-X0+1th message in the second message group, and the X0th message is sent before the Xth message in the first message group .
  36. 根据权利要求28-35任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 28-35, wherein the method further comprises:
    若所述第二电子设备接收到第二消息组中的第Xi个消息,且所述Xi与所述第X个消息所间隔的数量大于或者等于预设值,则请求所述第一电子设备更新所述第一时钟差。If the second electronic device receives the Xi th message in the second message group, and the interval between Xi and the X th message is greater than or equal to a preset value, then request the first electronic device Updating the first clock difference.
  37. 根据权利要求28-36任一项所述的方法,其特征在于,所述第二电子设备根据所述第一时钟差,控制所述第二电子设备在处于窗口接收状态时接收来自所述第一电子设备的对应的第一目标消息,包括:The method according to any one of claims 28-36, wherein the second electronic device controls, according to the first clock difference, the second electronic device to receive the A corresponding first target message of an electronic device, including:
    所述第二电子设备根据所述第一时钟差,控制在根据预先获得的传输时延计算的对应的第一目标消息到达所述第二电子设备的时刻之前,所述第二电子设备进入窗口接收状态,以使得所述第二电子设备在处于窗口接收状态时接收来自所述第一电子设备的对应的第一目标消息。The second electronic device controls, according to the first clock difference, that the second electronic device enters the window before the time when the corresponding first target message calculated according to the pre-acquired transmission delay arrives at the second electronic device A receiving state, 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.
  38. 根据权利要求28-37任一项所述的方法,其特征在于,所述网络还包括一个或多个第三电子设备,每个所述第二电子设备对应一个或多个所述第三电子设备,所述方法还包括:The method according to any one of claims 28-37, wherein the network further includes one or more third electronic devices, and each second electronic device corresponds to one or more third electronic devices. device, the method further comprising:
    所述第二电子设备向对应的一个或多个所述第三电子设备发送第三目标消息。The second electronic device sends a third target message to one or more corresponding third electronic devices.
  39. 根据权利要求28-38任一项所述的方法,其特征在于,所述第二电子设备获取第一时钟差,包括:The method according to any one of claims 28-38, wherein the acquiring the first clock difference by the second electronic device comprises:
    所述第二电子设备从所述第一电子设备获取根据第二预设周期更新后的第一时钟差。The second electronic device acquires the first clock difference updated according to a second preset period from the first electronic device.
  40. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    一个或多个处理器;one or more processors;
    存储器;memory;
    以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述电子设备执行时,使得所述电子设备执行如权利要求1-39中任一项所述的第一电子设备执行的消息交互方法,或者使得所述电子设备执行如权利要求1-39中任一项所述的第二电子设备执行的消息交互方法。and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the electronic device, cause the The electronic device executes the message interaction method executed by the first electronic device according to any one of claims 1-39, or causes the electronic device to execute the second electronic device according to any one of claims 1-39 The message interaction method executed by the device.
  41. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指 令在计算机上运行时,使得所述计算机执行如权利要求1-39中任一项所述的第一电子设备执行的消息交互方法,或者使得所述计算机执行如权利要求1-39中任一项所述的第二电子设备执行的消息交互方法。A computer-readable storage medium, which is characterized by comprising computer instructions, and when the computer instructions are run on the computer, the computer is executed by the first electronic device according to any one of claims 1-39. The message interaction method, or causing the computer to execute the message interaction method executed by the second electronic device according to any one of claims 1-39.
  42. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-39中任一项所述的第一电子设备执行的消息交互方法,或者使得所述计算机执行如权利要求1-39中任一项所述的第二电子设备执行的消息交互方法。A computer program product, characterized in that, when the computer program product is run on a computer, the computer is made to execute the message interaction method executed by the first electronic device according to any one of claims 1-39, Or make the computer execute the message interaction method executed by the second electronic device according to any one of claims 1-39.
  43. 一种网络系统,其特征在于,包括第一电子设备、第二电子设备和第三电子设备,所述第一电子设备、所述第二电子设备和所述第三电子设备用于执行如权利要求1-17中任一项所述的消息交互方法。A network system, characterized by comprising a first electronic device, a second electronic device and a third electronic device, the first electronic device, the second electronic device and the third electronic device are used to execute the The message interaction method described in any one of requirements 1-17.
PCT/CN2022/084879 2021-05-31 2022-04-01 Online detection method based on heartbeat packet, and device WO2022252796A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110603439.3A CN115484576A (en) 2021-05-31 2021-05-31 Online detection method and equipment based on heartbeat packet
CN202110603439.3 2021-05-31

Publications (1)

Publication Number Publication Date
WO2022252796A1 true WO2022252796A1 (en) 2022-12-08

Family

ID=84322587

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084879 WO2022252796A1 (en) 2021-05-31 2022-04-01 Online detection method based on heartbeat packet, and device

Country Status (2)

Country Link
CN (1) CN115484576A (en)
WO (1) WO2022252796A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117135729A (en) * 2023-01-20 2023-11-28 荣耀终端有限公司 Multi-device cooperation method, system and terminal device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425846A (en) * 2007-10-29 2009-05-06 北京三星通信技术研究有限公司 Synchronous burst timing based on beacon frame structure and sequence number detection method and apparatus
CN104509176A (en) * 2012-07-31 2015-04-08 高通股份有限公司 Listen interval (li) selection for wlan client
CN107005967A (en) * 2014-12-12 2017-08-01 高通股份有限公司 Service announcement in neighbours' sensing network (NAN) data path
CN107889201A (en) * 2014-03-21 2018-04-06 苹果公司 Synchronous low energy detection technique

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425846A (en) * 2007-10-29 2009-05-06 北京三星通信技术研究有限公司 Synchronous burst timing based on beacon frame structure and sequence number detection method and apparatus
CN104509176A (en) * 2012-07-31 2015-04-08 高通股份有限公司 Listen interval (li) selection for wlan client
CN107889201A (en) * 2014-03-21 2018-04-06 苹果公司 Synchronous low energy detection technique
CN107005967A (en) * 2014-12-12 2017-08-01 高通股份有限公司 Service announcement in neighbours' sensing network (NAN) data path

Also Published As

Publication number Publication date
CN115484576A (en) 2022-12-16

Similar Documents

Publication Publication Date Title
TWI828840B (en) Fast role switch between bluetooth true wireless stereo (tws) earbuds
WO2018000134A1 (en) Bluetooth connection method and terminal
US11419182B2 (en) Electronic device supporting link sharing and method therefor
US9749940B2 (en) Discovery method and an electronic device thereof
JP7389264B2 (en) Wireless communication method and device with wireless communication function
KR20180005471A (en) Method and apparatus for communicating using multi frequency bands
CN111405681B (en) Wi-Fi Aware link establishment method, wi-Fi Aware link establishment system, electronic equipment and storage medium
US20230180315A1 (en) Neighborhood aware network-based device connection method and device
US10492155B2 (en) Association based on shared network-state information
WO2022052731A1 (en) Method for transmitting data and electronic device
WO2021115193A1 (en) Device networking method, electronic device, and system
CN114641032B (en) Terminal device and communication method
WO2022252796A1 (en) Online detection method based on heartbeat packet, and device
US11503137B2 (en) Electronic device and method for scheduling of communication data link thereof
CN111149313B (en) Data transmission method and equipment
US20220361095A1 (en) Short-range wireless communication method and apparatus
US20150382261A1 (en) Method and electronic device for operating communication service
WO2022068646A1 (en) Data transmission method and electronic device
CN114095998B (en) Service information synchronization method for terminal in local area network and terminal
US20230309012A1 (en) Sleep Control Method for Mobile Routing Device and Mobile Routing Device
CN114173317B (en) Method for transmitting data and electronic equipment
WO2023083068A1 (en) Wake-up alignment method and system, and related apparatus
WO2024022256A1 (en) Method for managing connection between devices, and device and system
KR102238897B1 (en) Method for proximity service data and an electronic device thereof
WO2023040705A1 (en) Device discovery method, device and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22814843

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE