Communication method and apparatus
By updating one's own Bluetooth address in advance when receiving the addresses of other devices and pausing the update of the address during the broadcast period, the problem of high probability of connection failure in the prior art is solved, and the communication efficiency between devices is improved.
Patent Information
- Application Number
- PCT/CN2024/105320
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-02
- Filing Date
- 2024-07-12
- Publication Date
- 2025-02-06
AI Technical Summary
In the existing Bluetooth connection technology, the periodic update of Bluetooth addresses and does not support the same Bluetooth address to initiate multiple connections to multiple peer addresses, resulting in a high probability of connection failure, affecting the communication efficiency between devices.
By updating your own Bluetooth address in advance when receiving the address of other devices and pausing the update address during the broadcast cycle, it will avoid using the old address to initiate multiple connections, reducing the probability of connection failure.
It effectively reduces the probability of connection failure, improves communication efficiency between devices, and ensures the stability of the coordinated work of multiple devices.
Smart Images

Figure CN2024105320_06022025_PF_FP_ABST
Abstract
Description
Communication method and device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on August 2, 2023, with application number 202310970384.9 and invention name "A Communication Method and Device", the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of communication technology, and in particular to a communication method and device. Background Art
[0004] With the development of the Internet of Things (IoT), the number of wearable and smart devices around people has gradually increased. For example, a user may simultaneously own a smartphone, tablet, wearable device, TV, speakers, headphones, car computer, augmented reality (AR) device, virtual reality (VR) device, and other devices. These devices provide users with intelligent services and enhance the user experience in scenarios such as home, office, transportation, entertainment, and fitness. To provide users with convenient intelligent services, multiple devices need to be connected to a communication bus to exchange messages and work together. For example, multiple devices need to be connected to the same wireless bus, which can be implemented using wireless technologies such as wireless fidelity (Wi-Fi) and Bluetooth (BT).
[0005] To enable smooth collaboration between multiple devices, they can communicate using Bluetooth low energy (BLE) technology. Because the BLE protocol supports periodic Bluetooth address updates and doesn't support using the same Bluetooth address as the local address to initiate multiple Bluetooth connections to multiple peer addresses, the probability of Bluetooth connection failure is high.
[0006] Therefore, there is an urgent need for a communication method with a low probability of connection failure and high communication efficiency between devices.
[0007] Summary of the Invention
[0008] The embodiments of the present application provide a communication method and apparatus to reduce the probability of connection failure and improve the communication efficiency between devices.
[0009] In the first aspect, an embodiment of the present application also provides a communication method, which can be executed by a first device or a chip in the first device. Taking the method executed by the first device as an example, the method includes: the first device can receive the address of the second device broadcast by the second device at a first moment, and the first device has established a first connection, and updates the first address of the first device before reaching the second moment to obtain the second address of the first device, the first connection is a connection established by the first device with the second device or the third device based on the first address, and the second moment is one of the at least one address update moments of the first device; the first device can establish a second connection with the second device based on the second address and the address of the second device.
[0010] In the above scheme, the first device can update the address of the first device in advance when it receives the address of the second device and the first device has established a first connection, thereby using the updated address of the first device to initiate a second connection with the second device, avoiding the first device using the same address to initiate multiple connections before the first device updates the address of the first device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0011] In one possible implementation, the first device may also receive the address of the second device broadcast by the second device at the first moment, and the first device has not established the first connection, and establish the first connection with the second device based on the first address and the address of the second device.
[0012] When the first device receives the address of the second device and the first device has not established a first connection, it may not update the address of the first device in advance, but directly use the address of the first device before the update to initiate a second connection with the second device, so as to simplify the update process and reduce the update delay.
[0013] In one possible implementation, the first device may also suspend updating the current address of the first device when a third moment is reached and the third moment is within the first broadcast cycle of the first device, the third moment is one of the at least one address update moments, the first broadcast cycle is one of the at least one broadcast cycle of the first device, and the first device carries the same current address of the first device in the broadcast message broadcast within one of the broadcast cycles; the first device may also update the current address of the first device when the third moment is not within the first broadcast cycle.
[0014] The first device may suspend updating the address of the first device during the period of broadcasting the address of the first device, so as to avoid other devices using the address of the first device before the update to establish a connection with the first device after the first device updates the address of the first device, thereby reducing the probability of connection failure and improving the communication efficiency between devices.
[0015] In one possible implementation, after pausing to update the current address of the first device, the first device may also update the current address of the first device when reaching a fourth moment, where the fourth moment is the end moment of the first broadcast cycle, or the fourth moment is any moment between the end moment of the first broadcast cycle and the start moment of the second broadcast cycle, where the second broadcast cycle is one of the at least one broadcast cycle that is adjacent to the first broadcast cycle and after the first broadcast cycle.
[0016] The first device may update the address of the first device after finishing broadcasting the address of the first device, thereby avoiding updating the address of the first device during the broadcasting of the address of the first device, reducing the probability of connection failure, and improving communication efficiency between devices.
[0017] In one possible implementation, when the first device suspends updating the current address of the first device, the first device may set the address update status of the first device to a suspended update status; or, the first device may perform a first operation on the first timer, the timeout moment of the first timer is the third moment, and the first operation includes extending the timing duration of the timer.
[0018] The first device may suspend updating the address of the first device by setting the update status of the address of the first device or extending the first timer corresponding to the third moment, thereby avoiding updating the address of the first device during the period of broadcasting the address of the first device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0019] In one possible implementation, when the first device updates the current address of the first device, the first device may set the address update status of the first device to an updated status; or, the first device may perform a second operation on the first timer, and the second operation includes shortening the timing duration of the timer.
[0020] The first device can update the address of the first device by setting the update status of the address of the first device, or shortening the timing duration of the first timer corresponding to the third moment, thereby avoiding updating the address of the first device during the period of broadcasting the address of the first device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0021] In a possible implementation, there are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or there are two adjacent broadcast cycles in the at least one broadcast cycle that are discontinuous in time.
[0022] The first device can flexibly set the period for broadcasting the address of the first device to avoid updating the address of the first device during the period of broadcasting the address of the first device, thereby reducing the probability of connection failure and improving the communication efficiency between devices.
[0023] In the second aspect, an embodiment of the present application provides a communication method, which can be executed by a second device or a chip in the second device. Taking the method executed by the second device as an example, the method includes: the second device can suspend updating the current address of the second device when it reaches the fifth moment and the fifth moment is within the third broadcast cycle of the second device, the fifth moment is one of the at least one address update moments of the second device, the third broadcast cycle is one of the at least one broadcast cycle of the second device, and the second device carries the same current address of the second device in the broadcast message broadcast by the second device within one of the broadcast cycles; the second device can update the current address of the second device when the fifth moment is not within the third broadcast cycle.
[0024] In the above scheme, the second device can suspend updating the address of the second device during the broadcasting of the address of the second device to avoid other devices using the address of the second device before the update to establish a connection with the second device after the second device updates the address of the second device, thereby reducing the probability of connection failure and improving the communication efficiency between devices.
[0025] In one possible implementation, after the second device suspends updating the current address of the second device, the second device may also update the current address of the second device when reaching the sixth moment, where the sixth moment is the end moment of the third broadcast cycle, or the sixth moment is any moment between the end moment of the third broadcast cycle and the start moment of the fourth broadcast cycle, where the fourth broadcast cycle is one of the at least one broadcast cycle that is adjacent to the third broadcast cycle and after the third broadcast cycle.
[0026] The second device may update the address of the second device after finishing broadcasting the address of the second device, thereby avoiding updating the address of the second device during the broadcasting of the address of the second device, reducing the probability of connection failure, and improving communication efficiency between devices.
[0027] In one possible implementation, when the second device suspends updating the current address of the second device, the second device may set the address update status of the second device to a suspended update status; or, the second device may perform a first operation on the second timer, the timeout moment of the second timer is the fifth moment, and the first operation includes extending the timing duration of the timer.
[0028] The second device can suspend updating the address of the second device by setting the update status of the address of the second device or extending the timing duration of the second timer corresponding to the fifth moment, thereby avoiding updating the address of the second device during the period of broadcasting the address of the second device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0029] In one possible implementation, when the second device updates the current address of the second device, the second device may set the address update status of the second device to an updated status; or, the second device may perform a second operation on the second timer, and the second operation includes shortening the timing duration of the timer.
[0030] The second device can update the address of the second device by setting the update status of the address of the second device or shortening the timing duration of the second timer corresponding to the fifth moment, thereby avoiding updating the address of the second device during the broadcasting of the address of the second device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0031] In a possible implementation, there are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or there are two adjacent broadcast cycles in the at least one broadcast cycle that are discontinuous in time.
[0032] The second device can flexibly set the period for broadcasting the address of the second device to avoid updating the address of the second device during the broadcasting period of the address of the second device, thereby reducing the probability of connection failure and improving the communication efficiency between devices.
[0033] In one possible implementation, the second device may also receive the address of the first device broadcast by the first device at the seventh moment, and the second device has established a third connection, and update the third address of the second device before reaching the eighth moment to obtain the fourth address of the second device, the third connection being a connection established by the second device with the first device or the third device based on the third address, and the eighth moment being one of the at least one address update moments; the second device may also establish a fourth connection with the first device based on the fourth address and the address of the first device.
[0034] When the second device receives the address of the first device and the second device has established the third connection, the second device can update the address of the second device in advance, thereby using the updated address of the second device to initiate the fourth connection with the first device, avoiding the second device using the same address to initiate multiple connections before the second device updates the address of the second device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0035] In one possible implementation, the second device may also receive the address of the first device broadcast by the first device at the seventh moment, and the second device has not established the third connection, and establish the third connection with the first device based on the third address and the address of the first device.
[0036] When the second device receives the address of the first device and has not established the third connection, it may not update the address of the second device in advance, but directly use the address of the second device before the update to initiate the third connection with the first device, so as to simplify the update process and reduce the update delay.
[0037] In a third aspect, an embodiment of the present application also provides a communication method, which can be executed by a second device and a first device or by a chip in the second device and the first device. Taking the method executed by the second device and the first device as an example, the method includes: the first device can receive the address of the second device broadcast by the second device at a first moment, and the first device has established a first connection, and update the first address of the first device before reaching the second moment to obtain the second address of the first device, the first connection is the connection established by the first device with the second device or the third device based on the first address, and the second moment is one of the at least one address update moments of the first device; the first device can establish a second connection with the second device based on the second address and the address of the second device; the second device can suspend updating the current address of the second device when reaching the fifth moment and the fifth moment is within the third broadcast cycle of the second device, the fifth moment is one of the at least one address update moments of the second device, the third broadcast cycle is one of at least one broadcast cycle of the second device, and the second device carries the same current address of the second device in the broadcast message broadcast by the second device within one of the broadcast cycles; the second device can update the current address of the second device when the fifth moment is not within the third broadcast cycle.
[0038] In one possible implementation, after the second device suspends updating the current address of the second device, the second device may also update the current address of the second device when reaching the sixth moment, where the sixth moment is the end moment of the third broadcast cycle, or the sixth moment is any moment between the end moment of the third broadcast cycle and the start moment of the fourth broadcast cycle, where the fourth broadcast cycle is one of the at least one broadcast cycle that is adjacent to the third broadcast cycle and after the third broadcast cycle.
[0039] In one possible implementation, when the second device suspends updating the current address of the second device, the second device may set the address update status of the second device to a suspended update status; or, the second device may perform a first operation on the second timer, the timeout moment of the second timer is the fifth moment, and the first operation includes extending the timing duration of the timer.
[0040] In one possible implementation, when the second device updates the current address of the second device, the second device may set the address update status of the second device to an updated status; or, the second device may perform a second operation on the second timer, and the second operation includes shortening the timing duration of the timer.
[0041] In a possible implementation, there are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or there are two adjacent broadcast cycles in the at least one broadcast cycle that are discontinuous in time.
[0042] In a fourth aspect, an embodiment of the present application further provides a communication device, which may be a first device, or a chip or chip system used in the first device, or a second device, or a chip or chip system used in the second device, or a first device and a second device, or a chip or chip system used in the first device and the second device. The communication device includes a communication interface and a processor, and optionally, a memory. The memory is used to store a computer program, and the processor is coupled to the memory and the communication interface. When the processor reads the computer program or instruction, the communication device executes the method performed by the first device in the first aspect, or executes the method performed by the second device in the second aspect, or executes the method performed by the first device and the second device in the third aspect.
[0043] In a fifth aspect, embodiments of the present application further provide a communication system, which may include a first device and a second device. The first device may execute the method performed by the first device in the first or third aspect. The second device may execute the method performed by the second device in the second or third aspect. Optionally, the first device may be implemented using the communication apparatus described in the fourth aspect. Optionally, the second device may be implemented using the communication apparatus described in the fourth aspect.
[0044] In a sixth aspect, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program. When the computer program runs on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect.
[0045] In the seventh aspect, an embodiment of the present application also provides a computer program product, including a computer program. When the computer program is run on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect.
[0046] In the eighth aspect, an embodiment of the present application also provides a chip system, including a processor and an interface, wherein the processor is used to call and run instructions from the interface so that the chip system executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect.
[0047] The beneficial effects of the third to eighth aspects and their possible designs can refer to the description of the beneficial effects of the methods described in the first aspect and any possible design thereof or the second aspect and any possible design thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] FIG1 is a schematic diagram of a BLE protocol stack provided in an embodiment of the present application;
[0049] FIG2 is a schematic diagram of a scenario in which devices communicate at the GATT layer according to an embodiment of the present application;
[0050] FIG3 is a schematic diagram of a structure of a resolvable private address provided in an embodiment of the present application;
[0051] FIG4 is a schematic diagram of a Bluetooth connection scenario provided by an embodiment of the present application;
[0052] FIG5 is a schematic diagram of another Bluetooth connection scenario provided by an embodiment of the present application;
[0053] FIG6 is a schematic diagram of a scenario in which multiple devices work together according to an embodiment of the present application;
[0054] FIG7 is a schematic diagram of a scenario in which a device communicates based on BLE technology according to an embodiment of the present application;
[0055] FIG8 is a schematic diagram of another scenario in which devices communicate based on BLE technology according to an embodiment of the present application;
[0056] FIG9 is a schematic diagram of a communication system provided in an embodiment of the present application;
[0057] FIG10 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0058] FIG11a is a flow chart of a communication method provided in an embodiment of the present application;
[0059] FIG11b is a schematic diagram of a Bluetooth address update scenario provided by an embodiment of the present application;
[0060] FIG11c is a schematic diagram of another scenario of Bluetooth address update provided in an embodiment of the present application;
[0061] FIG12 is a flow chart of another communication method provided in an embodiment of the present application;
[0062] FIG13 is a flow chart of another communication method provided in an embodiment of the present application;
[0063] FIG14 is a flow chart of another communication method provided in an embodiment of the present application;
[0064] FIG15 is a schematic structural diagram of a first device provided in an embodiment of the present application;
[0065] FIG16 is a schematic structural diagram of a second device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below with reference to the accompanying drawings. The terms used in the implementation methods of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.
[0067] Before introducing the specific solutions provided in the embodiments of the present application, some of the terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art, and the terms in the present application are not limited.
[0068] (1) In the embodiments of the present application, "multiple" refers to two or more. In view of this, in the embodiments of the present application, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two or more. For example, including at least one means including one, two or more, and does not limit which ones are included. For example, including at least one of A, B and C, then the included ones may be A, B, C, A and B, A and C, B and C, or A, B and C. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previous and subsequent associated objects are in an "or" relationship.
[0069] Unless otherwise specified, ordinal numbers such as "first" and "second" in the embodiments of the present application are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects.
[0070] (2) Bluetooth low energy (BLE) is a low-cost, short-range, and robust wireless technology. Compared to classic Bluetooth, BLE aims to significantly reduce power consumption and cost while maintaining the same communication range. In addition, BLE increases support and utilization of broadcast communications. Devices can establish Bluetooth connections and exchange information by sending broadcast messages.
[0071] Exemplarily, FIG1 is a schematic diagram of the structure of a BLE protocol stack provided in an embodiment of the present application. As shown in FIG1 , the BLE protocol stack is divided into a controller, a host, and profiles from bottom to top. Among them, the controller includes a physical layer (PHY), a link layer (LL), and a host controller interface (HCI) layer. The host includes a logical link control and adaptation layer protocol (L2CAP) layer, an attribute protocol (ATT) layer, a security management protocol (SMP) layer, a generic attribute profile (GATT) layer, and a generic access profile (GAP) layer. The profile can be understood as a collection of application layer protocols corresponding to various application scenarios, including proprietary protocols, blood pressure protocols, heart rate protocols, thermometer protocols, battery protocols, etc.
[0072] Among them, when the devices communicate at the GATT layer of the host shown in Figure 1, as shown in Figure 2, the communicating parties can be understood as a client and a server. Once the two establish a connection, they can read and write each other's services using a universally unique identifier (UUID).
[0073] BLE can be implemented as a single chip or a multi-chip solution. A single-chip solution integrates the controller, host, and configuration files into the same chip and is often used for products with relatively simple functions. A multi-chip solution integrates the controller into one chip and the host and configuration files into another chip and is often used for products with more complex functions.
[0074] (3) Bluetooth device address (BD_ADDR). The Bluetooth address will play a role in device identification during the Bluetooth pairing and Bluetooth connection process. The Bluetooth address used by the device can be a public address (public device address) or a random address (random device address). However, whether it is a public address or a random address, their address length is 48 bits, that is, 6 bytes.
[0075] Among them, random addresses include two types: static addresses (static device address) and private addresses (private device address). The definition of private addresses also includes two subclasses: non-resolvable private addresses and resolvable private addresses. Non-resolvable private addresses are Bluetooth addresses that change periodically and cannot be resolved by other devices. In other words, non-resolvable private addresses are generated using a random number. Resolvable private addresses are Bluetooth addresses that change periodically and can be resolved by other devices. In other words, resolvable private addresses are generated using a random number and an identity resolving key (IRK).
[0076] For example, FIG3 is a schematic diagram of a resolvable private address provided by an embodiment of the present application. As shown in FIG3 , the resolvable private address includes two parts: a random (PRAND) value consisting of the upper 24 bits, that is, the most significant bit (MSB) of the PRAND value is the most significant bit of the resolvable private address; and a hash value consisting of the lower 24 bits, that is, the least significant bit (LSB) of the hash value is the least significant bit of the resolvable private address. The PRAND value is a random number and should meet the following requirements: at least one bit of the random part of the PRAND value is 0; at least one bit of the random part of the PRAND value is 1. The hash value is obtained by performing a hash operation using the random address function ah, the input parameters of which are the IRK value and the PRAND value, that is, hash = ah(IRK, prand).
[0077] Resolvable private addresses have three characteristics: Feature 1: Resolvable private addresses can only be scanned by devices with the same IRK and cannot be scanned by unknown devices. For example, device 1 uses resolvable private address 1, which is generated by random number 1 and IRK1. Device 2 can obtain IRK1 during Bluetooth pairing with device 1, and can obtain resolvable private address 1 during Bluetooth connection with device 1. The same hash operation is performed using IRK1 and the random number in resolvable private address 1, and the result of the operation is compared with the hash value in resolvable private address 1. Only when the results are the same can a Bluetooth connection be established. Feature 2: Resolvable private addresses cannot be used by a device alone. When a device uses a resolvable private address, the device must also use a public address or a static address. Feature 3: The resolvable private address is updated periodically. The update period is specified by GAP and is called T_GAP (private_addr_int). The recommended value is 15 minutes. Therefore, if the T_GAP (private_addr_int) expires during the Bluetooth connection process of a device using a resolvable private address, the resolvable private address of the device will change, causing the Bluetooth connection to fail.
[0078] (4) The upper computer and the lower computer are two roles in the device. The upper computer has the main control function and is mainly used to plan and control the tasks performed by the device. It belongs to the decision-making layer; the lower computer belongs to the specific execution layer and is mainly used to complete the tasks assigned by the upper computer, but the lower computer can also perform tasks on its own.
[0079] In the BLE protocol, the host computer can be the host in the BLE protocol stack, such as the central processing unit (CPU) in a device; the slave computer can be the controller in the BLE protocol stack, such as the Bluetooth chip (also known as the Bluetooth controller (BTC)) in the device. The BTC has a characteristic: it does not support the use of the same Bluetooth address as the local address to initiate multiple Bluetooth connections to multiple peer addresses.
[0080] For example, Figure 4 is a schematic diagram of a Bluetooth connection scenario provided in an embodiment of the present application. The scenario shown in Figure 4 includes device 1 (for example, a group client (GC) or a station (STA)) and device 2 (for example, a group owner (GO) or an access point (AP)). When device 1 and device 2 work together to complete services 1 and 2, device 1 can receive two peer addresses from device 2. For example, when device 1 and device 2 work together to complete service 1, device 1 can receive a broadcast message from device 2 for service 1, which carries peer address B1. At this time, the BTC of device 1 can establish Bluetooth connection 1 (local address A-peer address B1); when device 1 and device 2 work together to complete service 2, device 1 can receive a broadcast message from device 2 for service 2, which carries peer address B2. At this time, since the BTC of device 1 has established Bluetooth connection 1, if the BTC of device 1 establishes Bluetooth connection 2 (local address A-peer address B2), the BTC will exhibit undefined behavior, that is, one local address is connected to multiple different peer addresses, resulting in abnormalities in service 1 or service 2.
[0081] For example, FIG5 is a schematic diagram of another Bluetooth connection scenario provided by an embodiment of the present application. The scenario shown in FIG5 includes device 1 host, device 1 BTC, device 2 host, and device 2 BTC. When device 1 and device 2 work together to complete services 1 and 2, device 1 host issues a task to BTC1 to update device 1's Bluetooth address 1, wherein the Bluetooth address 1 of device 1 before the update is Bluetooth address A, and the Bluetooth address 1 of device 1 after the update is Bluetooth address B. Device 2 host issues a task to device 2BTC to broadcast device 2's Bluetooth address 2. After receiving the broadcast message from device 2BTC, device 1 host requests device 2 host to establish Bluetooth connection 2 (Bluetooth address 2-Bluetooth address B) for service 2 through the distributed soft bus. Device 2 host issues a task to device 2BTC to establish a Bluetooth connection from Bluetooth address 2 to Bluetooth address B. At this time, if device 2BTC has already established Bluetooth connection 1 (Bluetooth address 2-Bluetooth address A) for task 1, Bluetooth connection 2 or Bluetooth connection 1 will time out.
[0082] With the development of Internet of Things technology, various types of wearable devices and smart devices around people are gradually increasing. For example, users may have smart phones, tablets, wearable devices, TVs, speakers, headphones, car machines, augmented reality (AR) devices, virtual reality (VR) devices and other devices at the same time. These devices bring intelligent services to users in scenarios such as home, office, transportation, entertainment, and fitness, thereby improving user experience. For example, Figure 6 is a schematic diagram of a scenario in which multiple devices work together, as provided in an embodiment of the present application. The scenario shown in Figure 6 includes wearable devices, TVs, tablets, smart phones, headphones, speakers and VR devices. Different devices have different functions, and multiple devices can constitute a super terminal. For example, with the smartphone used by the user as the center, VR devices connected to smartphones can provide users with stronger sensing capabilities; speakers connected to smartphones can provide users with better player or microphone functions; and TVs connected to smartphones can provide users with stronger screen display capabilities.
[0083] To provide convenient intelligent services to users, multiple devices need to exchange messages and work together. Therefore, multiple devices need to be connected to a single communication bus. For example, multiple devices can be connected to the same wireless bus, which can be implemented using wireless technologies such as wireless fidelity (Wi-Fi) and Bluetooth. To achieve smooth collaboration between multiple devices, the communication bus between multiple devices must meet the following two requirements: 1. Devices must be able to quickly discover each other and quickly perceive changes in their status; 2. Devices communicating on this communication bus must consume low power and operate for extended periods of time.
[0084] Optionally, multiple devices can communicate based on BLE technology. For example, Figure 7 is a schematic diagram of a scenario in which a device provided in an embodiment of the present application communicates based on BLE technology. Referring to Figure 7, when the first BLE connection is established between two devices, the sending device sends a broadcast message 1, which carries the Bluetooth address B1 of the sending device. The receiving device receives the broadcast message 1 from the sending device and uses the Bluetooth address A1 of the receiving device to connect to the Bluetooth address B1. When the Bluetooth address B1 is a periodically updated resolvable private address, if the T_GAP (private_addr_int) of the sending device expires (i.e., a 15-minute timeout) while the sending device is sending the broadcast message 1, then the Bluetooth address B1 will be updated to the Bluetooth address B2. At this time, the receiving device uses the Bluetooth address A1 to connect to the Bluetooth address B1, which will cause the connection to fail. After the connection fails, the receiving device needs to first re-receive the broadcast message 2 from the sending device, which carries the Bluetooth address B2, and then re-use the Bluetooth address A1 to connect to the Bluetooth address B2, resulting in low communication efficiency between the receiving device and the sending device.
[0085] For example, FIG8 is a schematic diagram of a scenario in which another device provided in an embodiment of the present application communicates based on BLE technology. Referring to FIG8 , when the first BLE connection is established between two devices, the sending device sends a broadcast message 1, which carries the Bluetooth address B1 of the sending device. The receiving device receives the broadcast message 1 from the sending device and uses the Bluetooth address A1 of the receiving device to connect to the Bluetooth address B1. When the second BLE connection is established between the two devices, the sending device sends a broadcast message 2, which carries the Bluetooth address B2 of the sending device. The receiving device receives the broadcast message 2 from the sending device. When the Bluetooth address A1 is a periodically updated resolvable private address, if the T_GAP (private_addr_int) of the receiving device has not expired (i.e., it has not timed out for 15 minutes), then the Bluetooth address A1 will not be updated to the Bluetooth address A2. Since the BLE protocol does not support the same Bluetooth address as the local address to initiate multiple Bluetooth connections to multiple peer addresses, the receiving device continues to use the Bluetooth address A1 to connect to the Bluetooth address B2, which will cause the current connection to fail. After the connection fails, the receiving device needs to wait for T_GAP (private_addr_int) to expire (i.e., 15 minutes) to update Bluetooth address A1 to Bluetooth address A2, and then use Bluetooth address A2 to connect to Bluetooth address B2 again, resulting in low communication efficiency between the receiving device and the sending device.
[0086] Based on the above problems, the present application provides a communication method to reduce the probability of connection failure and improve the communication efficiency between devices.
[0087] This method can be applied to a communication system including multiple devices. For example, see Figure 9, which is a schematic diagram of a communication system provided in an embodiment of the present application. As shown in Figure 9, the communication system may include a first device and a second device. Among them, the first device may update the address of the first device in advance when it receives the address of the second device and the first device has established a first connection, thereby using the updated address of the first device to initiate a second connection with the second device, thereby avoiding the first device using the same address to initiate multiple connections before the first device updates the address of the first device, reducing the probability of connection failure, and improving the communication efficiency between devices. The second device may suspend updating the address of the second device during the broadcast of the address of the second device, so as to avoid other devices using the address of the second device before the update to establish a connection with the second device after the second device updates the address of the second device, thereby reducing the probability of connection failure and improving the communication efficiency between devices.
[0088] It should be understood that Figure 9 only shows an exemplary communication system for ease of understanding, but this should not constitute any limitation to the present application. The communication system can also include a larger number of first devices and a larger number of second devices; the second devices interacting with different first devices can be the same second devices or different second devices; the number of second devices interacting with different first devices can be the same or different, and the embodiments of the present application do not limit this.
[0089] It should be understood that the first device and the second device can be electronic devices, such as smart phones, tablet computers, wearable devices, vehicle-mounted terminal devices, AR devices, VR devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), and other portable devices.
[0090] For example, see Figure 10, which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in Figure 10, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195, etc.
[0091] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors. The controller may serve as the nerve center and command center of the electronic device 100. The controller may generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. The processor 110 may also include memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a high-speed cache memory. This memory may store instructions or data that have just been used or are being recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces the processor 110's waiting time, and thus improves system efficiency. The execution of the communication method provided by the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in a third-party device through the external memory interface 120, so that the first device can update the address of the first device in advance when receiving the address of the second device and the first device has established a first connection, thereby using the updated address of the first device to initiate a second connection with the second device, avoiding the first device using the same address to initiate multiple connections before the first device updates the address of the first device, reducing the probability of connection failure, and improving the communication efficiency between devices. The second device can also suspend updating the address of the second device during the broadcast of the address of the second device, so as to avoid other devices using the address of the second device before the update to establish a connection with the second device after the second device updates the address of the second device, reducing the probability of connection failure, and improving the communication efficiency between devices.
[0092] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, and the software code of at least one application, etc. The data storage area can store data generated during the use of the electronic device 100 (such as captured images, recorded videos, etc.). 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 disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0093] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as pictures and videos can be stored on the external memory card.
[0094] The USB interface 130 is an interface that complies with USB standards and specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or 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 transfer data between the electronic device 100 and peripheral devices. The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160.
[0095] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. For example, the first device can send a broadcast message carrying the Bluetooth address of the first device and receive a broadcast message carrying the Bluetooth address of the second device through the antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. The second device can receive a broadcast message carrying the Bluetooth address of the first device and send a broadcast message carrying the Bluetooth address of the second device through the antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.
[0096] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0097] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0098] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc. applied to the electronic device 100. The wireless communication module 160 can 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 for radiation through the antenna 2.
[0099] 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 a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0100] The display screen 194 is used to display the display interface of the application, such as displaying the display page of the application installed on the electronic device 100. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0101] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0102] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0103] Among them, the sensor module 180 may include a pressure sensor 180A, an acceleration sensor 180B, a touch sensor 180C, etc.
[0104] The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .
[0105] Touch sensor 180C, also known as a "touch panel," can be disposed on display screen 194. The touch sensor 180C and display screen 194 form a touch screen, also known as a "touch screen." Touch sensor 180C is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to an application processor to determine the type of touch event. Visual output related to the touch operations can be provided via display screen 194. In other embodiments, touch sensor 180C can also be disposed on the surface of electronic device 100, at a location different from that of display screen 194.
[0106] The buttons 190 include a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The electronic device 100 can receive button input and generate key signal input related to the user settings and function control of the electronic device 100. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100.
[0107] It is understood that the components shown in FIG10 do not constitute a specific limitation on the electronic device 100. The electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. In addition, the combination / connection relationship between the components in FIG10 may also be adjusted and modified.
[0108] The above content explains the possible application scenarios and applicable system architecture of the communication method provided in the embodiment of the present application. The communication method provided in the embodiment of the present application will be further introduced in combination with the structure of the communication system shown in Figure 9 and the structure of the electronic device shown in Figure 10.
[0109] For example, FIG11a is a flow chart of a communication method provided in an embodiment of the present application. As shown in FIG11a, taking the communication method provided in an embodiment of the present application as performed by a first device and a second device as an example, and the communication method provided in an embodiment of the present application as an example of a scenario where multiple devices communicate based on Bluetooth technology, the communication method provided in an embodiment of the present application includes the following steps:
[0110] S1101: The second device broadcasts the address of the second device. Correspondingly, the first device receives the address of the second device broadcast by the second device.
[0111] In an embodiment of the present application, the second device may broadcast the Bluetooth address of the second device, and accordingly, the first device may start scanning and receive the Bluetooth address of the second device broadcast by the second device.
[0112] In a specific implementation, the second device may have at least one broadcast cycle, and the second device may broadcast at least one broadcast message within one of the at least one broadcast cycle. Each of the at least one broadcast message may carry the same Bluetooth address of the second device. Accordingly, the first device may start scanning and receive at least one broadcast message from the second device. For example, device 2 broadcasts Message 1 every 1 second within Broadcast Cycle 1. Message 1 carries Device 2's Bluetooth address 1. Device 1 then starts scanning and receives Message 1 from Device 2 every 1 second.
[0113] Among them, if the Bluetooth connection established between the first device and the second device is a classic Bluetooth connection, the broadcast message can be a classic Bluetooth broadcast message; if the Bluetooth connection established between the first device and the second device is a BLE connection, the broadcast message can be a BLE broadcast message, which is not limited in the embodiments of the present application. The Bluetooth address can be a public address, a static address, an unresolvable private address, or a resolvable private address, which is not limited in the embodiments of the present application. For ease of explanation, the following example takes the Bluetooth connection as a BLE connection, the broadcast message as a BLE broadcast message, and the Bluetooth address as a resolvable private address.
[0114] In at least one broadcast cycle, there may be two adjacent broadcast cycles that are continuous in time, for example, the time interval between broadcast cycle 1 and broadcast cycle 2 is 0 minutes; or there may be two adjacent broadcast cycles that are discontinuous in time, for example, the time interval between broadcast cycle 1 and broadcast cycle 2 is 2 minutes; or there may be two adjacent broadcast cycles that are continuous and discontinuous in time, for example, the time interval between broadcast cycle 1 and broadcast cycle 2 is 0 minutes, and the time interval between broadcast cycle 2 and broadcast cycle 3 is 2 minutes.
[0115] At least one broadcast cycle can be triggered actively; or it can also be triggered passively, for example, the first device sends a broadcast request, which is used to request a Bluetooth address. After the second device starts scanning and receives the broadcast request from the first device, it sends at least one broadcast message (i.e., broadcast request response) within the corresponding broadcast cycle.
[0116] S1102: The first device receives the address of the second device broadcast by the second device at a first moment, and the first device has established a first connection. Before reaching a second moment, the first address of the first device is updated to obtain the second address of the first device.
[0117] In an embodiment of the present application, the first device starts scanning and receives the Bluetooth address of the second device broadcast by the second device at a first moment. The first device can determine whether the first device has established a first Bluetooth connection.
[0118] Among them, the first Bluetooth connection can be a Bluetooth connection established by the first device with the second device based on the first Bluetooth address of the first device, or it can be a Bluetooth connection established by the first device with other devices (such as a third device) based on the first Bluetooth address of the first device. This embodiment of the present application does not limit this.
[0119] If the first device has not established the first Bluetooth connection, the first device may establish the first Bluetooth connection with the second device based on the first Bluetooth address of the first device and the Bluetooth address of the second device. If the first device has established the first Bluetooth connection, the first device may update the first Bluetooth address of the first device before reaching the second time to obtain the second Bluetooth address of the first device.
[0120] The second moment may be one of the at least one address update moments of the first device. Optionally, the second moment may be located after the first moment and be the one with the shortest duration between the at least one address update moment of the first device and the first moment. The at least one address update moment of the first device may be the timeout moment of at least one timer of the first device. The first device may update the Bluetooth address of the first device at the time when each of the at least one timer times out, and start the next timer of the timer, so that the first device can periodically update the Bluetooth address of the first device.
[0121] For example, Figure 11b is a schematic diagram of a scenario of Bluetooth address update provided by an embodiment of the present application. As shown in Figure 11b, the timing duration of each timer is 15 minutes. The first device updates the Bluetooth address of the first device at the timeout moment of timer 1 (moment A) and starts timer 2. At the timeout moment of timer 2 (moment B), the first device updates the Bluetooth address of the first device and starts timer 3. At the timeout moment of timer 3 (moment C), the first device updates the Bluetooth address of the first device and starts timer 4, and so on. Moment A, moment B, and moment C are all address update moments of the first device. When the first device receives the Bluetooth address of the second device broadcast by the second device at moment 1, and the first device has established a Bluetooth connection with other devices based on the first Bluetooth address of the first device, if moment 1 is later than moment A and earlier than moment B and moment C, the duration between moment 1 and moment B (e.g., duration 1) is less than the duration between moment 1 and moment C (e.g., duration 2), the first device can update the first Bluetooth address of the first device before moment B to obtain the second Bluetooth address of the first device.
[0122] S1103: The first device establishes a second connection with the second device according to the second address and the address of the second device.
[0123] In an embodiment of the present application, the first device updates the first Bluetooth address of the first device before reaching the second moment. After obtaining the second Bluetooth address of the first device, the first device can establish a second Bluetooth connection with the second device based on the second Bluetooth address of the first device and the Bluetooth address of the second device.
[0124] For example, Figure 11c is a schematic diagram of another Bluetooth address update scenario provided in an embodiment of the present application. As shown in Figure 11c, the Bluetooth address of the first device is updated to Bluetooth address A1 at time A, updated to Bluetooth address A2 at time B, and updated to Bluetooth address A3 at time C. When the first device receives the Bluetooth address B1 of the second device broadcast by the second device at moment 1 (after moment A and before moment B), and the first device has not established a Bluetooth connection with any device, the first device can establish a Bluetooth connection with the second device based on the Bluetooth address A1 of the first device and the Bluetooth address B1 of the second device; when the first device receives the Bluetooth address B1 of the second device broadcast by the second device at moment 1, and the first device has established a Bluetooth connection with other devices (such as Bluetooth address A1-Bluetooth address C1), the first device can update the Bluetooth address of the first device before moment B (such as from Bluetooth address A1 to Bluetooth address A2), and establish a Bluetooth connection with the second device based on the Bluetooth address A2 of the first device and the Bluetooth address B1 of the second device, wherein moment B is after moment 1 and is the one with the shortest time length between the at least one address update moment of the first device and moment B, such as time length 1 between moment B and moment 1 is less than time length 2 between moment C and moment 1.
[0125] Based on the implementation process of Figure 11a, the present application may also perform the steps shown in Figure 12:
[0126] S1201: A first device broadcasts an address of the first device, and a second device receives the address of the first device broadcast by the first device.
[0127] In an embodiment of the present application, the first device may broadcast the Bluetooth address of the first device, and accordingly, the second device may start scanning and receive the Bluetooth address of the first device broadcast by the first device.
[0128] In a specific implementation, the first device may have at least one broadcast cycle. The first device may broadcast at least one broadcast message within one of the at least one broadcast cycle. Each of the at least one broadcast message may carry the same Bluetooth address of the first device. Accordingly, the second device may start scanning and receive at least one broadcast message from the first device. For example, device 1 broadcasts message 1 every 1 second within broadcast cycle 1. Message 1 carries device 1's Bluetooth address 1. Device 2 starts scanning and receives message 1 from device 1 every 1 second.
[0129] S1202: When the first device reaches a third time point, and the third time point is within a first broadcast cycle of the first device, the first device suspends updating the current address of the first device.
[0130] In an embodiment of the present application, when the first device reaches a third time point, and the third time point is within the first broadcast period of the first device, the first device may suspend updating the current Bluetooth address of the first device. The third time point is one of at least one address update time point of the first device, and the first broadcast period is one of at least one broadcast period of the first device.
[0131] For example, at the time when Timer 1 times out (Time A), Device 1 updates its Bluetooth address 1, obtains its Bluetooth address 2, and starts Timer 2. Device 1 broadcasts Message 1 every 1 second during Advertisement Cycle 1. Message 1 carries Device 1's Bluetooth address 1. Advertisement Cycle 1 starts at Time 1 and ends at Time 2. If Time A falls within Advertisement Cycle 1 (i.e., Advertisement Cycle 1 is later than Time 1 but earlier than Time 2), Device 1 can pause updating its Bluetooth address 1 at Time A.
[0132] In a specific implementation, when the first device suspends updating the current Bluetooth address of the first device, the first device can set the address update state of the first device to the suspended update state; or, the first device can also perform a first operation on the first timer, the timeout moment of the first timer is the third moment, and the first operation includes extending the timing duration of the timer. For example, device 1 originally needs to update the Bluetooth address 1 of device 1 at the timeout moment of timer 1 (moment A) to obtain the Bluetooth address 2 of device 1, but if moment A is within the broadcast cycle 1 of device 1, then when moment A is reached, device 1 needs to suspend updating the Bluetooth address 1 of device 1. Device 1 can set the address update state of device 1 to the suspended update state, or it can extend the timing duration of timer 1, such as if the timing duration of timer 1 is 15 minutes, it can be extended to 16 minutes. After the timing duration is extended, the timeout moment of timer 1 is moment B, and device 1 will update the Bluetooth address 1 of device 1 at moment B to obtain the Bluetooth address 2 of device 1.
[0133] After the first device suspends updating the current Bluetooth address of the first device, the first device may update the current Bluetooth address of the first device when reaching a fourth moment, wherein the fourth moment is the end moment of the first broadcast cycle, or the fourth moment is any moment between the end moment of the first broadcast cycle and the start moment of the second broadcast cycle, and the second broadcast cycle is one of at least one broadcast cycle of the first device that is adjacent to the first broadcast cycle and after the first broadcast cycle.
[0134] For example, at the time when Timer 1 times out (Time A), Device 1 updates its Bluetooth address 1, obtains its Bluetooth address 2, and starts Timer 2. Device 1 broadcasts Message 1 every 1 second during Broadcast Period 1 and Broadcast Period 2. Message 1 carries Device 1's Bluetooth address 1. Broadcast Period 1 starts at Time 1 and ends at Time 2. Broadcast Period 2 starts at Time 3 and ends at Time 4. If Time A falls within Broadcast Period 1, i.e., Broadcast Period 1 is later than Time 1 but earlier than Time 2, then upon reaching Time A, Device 1 may pause updating its Bluetooth address 1. Upon reaching Time 2 or any time between Time 2 and Time 3, the device may update its Bluetooth address 1 and obtain its Bluetooth address 2.
[0135] In a specific implementation, when the first device updates its current Bluetooth address, it may set the first device's address update status to the updated state. Alternatively, the first device may perform a second operation on the first timer, where the second operation includes shortening the timer's duration. For example, device 1 originally needs to update its Bluetooth address 1 at the timer 1 timeout (time A) to obtain its Bluetooth address 2. However, because time A falls within device 1's broadcast cycle 1, device 1 pauses updating its Bluetooth address 1 at time A. Then, at the end of broadcast cycle 1 (time 2), device 1 needs to update its Bluetooth address 1 to obtain its Bluetooth address 2. Device 1 may set its address update status to the updated state to obtain its Bluetooth address 2, or it may shorten the timer 1 duration. For example, if timer 1's current duration is 16 minutes, the timeout is time B, and the duration between time B and time 2 is 1 minute, shortening it to 15 minutes will cause device 1 to update its Bluetooth address 1 at time 2 to obtain its Bluetooth address 2.
[0136] S1203: When the first device reaches the third time point and the third time point is not within the first broadcast period of the first device, the first device updates the current address of the first device.
[0137] In an embodiment of the present application, when the first device reaches the third moment and the third moment is not within the first broadcast cycle of the first device, the first device can update the Bluetooth address of the first device. For example, device 1 updates the Bluetooth address 1 of device 1 at the timeout moment (moment A) of timer 1, obtains the Bluetooth address 2 of device 1, and starts timer 2. Device 1 broadcasts a message 1 every 1 second within broadcast cycle 1, and message 1 carries the Bluetooth address 1 of device 1. The start moment of broadcast cycle 1 is moment 1 and the end moment is moment 2. If moment A is not within broadcast cycle 1, that is, broadcast cycle 1 is earlier than moment 1 but later than moment 2, then when moment A is reached, device 1 can update the Bluetooth address 1 of device 1 and obtain the Bluetooth address 2 of device 1.
[0138] For example, FIG13 is a flow chart of another communication method provided in an embodiment of the present application. As shown in FIG13 , taking the communication method provided in an embodiment of the present application as an example where the second device performs the communication method, and the communication method provided in an embodiment of the present application as an example where multiple devices communicate based on Bluetooth technology, the communication method provided in an embodiment of the present application includes the following steps:
[0139] S1301: The second device broadcasts the address of the second device. Correspondingly, the first device receives the address of the second device broadcast by the second device.
[0140] In the embodiment of the present application, the second device can broadcast the Bluetooth address of the second device, and accordingly, the first device can start scanning and receive the Bluetooth address of the second device broadcast by the second device. The specific implementation process of the second device broadcasting the Bluetooth address of the second device can be referred to the introduction of S1101 above, and will not be repeated here.
[0141] S1302: When the second device reaches a fifth time point, and the fifth time point is within the third broadcast period of the second device, the second device suspends updating the current address of the second device.
[0142] In an embodiment of the present application, the second device suspends updating the current Bluetooth address of the second device when the fifth moment is reached and the fifth moment is within the third broadcast cycle of the second device. The fifth moment is one of the at least one address update moments of the second device. The third broadcast cycle is one of the at least one broadcast cycle of the second device. The at least one address update moment of the second device may be the timeout moment of at least one timer of the second device. The second device may update the Bluetooth address of the second device at the timeout moment of each timer in the at least one timer, and start the next timer of the timer, so that the second device can periodically update the Bluetooth address of the second device.
[0143] In a specific implementation, when the second device suspends updating the current Bluetooth address of the second device, the second device can set the address update status of the second device to a suspended update status; or, the second device can also perform a first operation on the second timer, the timeout moment of the second timer is the fifth moment, and the first operation includes extending the timing duration of the timer.
[0144] After the second device suspends updating the current Bluetooth address of the second device, the second device can update the current Bluetooth address of the second device when it reaches the sixth moment, where the sixth moment is the end moment of the third broadcast cycle, or the sixth moment is any moment between the end moment of the third broadcast cycle and the start moment of the fourth broadcast cycle, and the fourth broadcast cycle is one of at least one broadcast cycle of the second device that is adjacent to the third broadcast cycle and after the third broadcast cycle.
[0145] In a specific implementation, when the second device updates the current Bluetooth address of the second device, the second device may set the address update status of the second device to the updated status; or, the second device may also perform a second operation on the second timer, and the second operation includes shortening the timing duration of the timer.
[0146] S1303: When the second device reaches the fifth time point and the fifth time point is not within the third broadcast period of the second device, the second device updates the current address of the second device.
[0147] In the embodiment of the present application, the second device updates the current Bluetooth address of the second device when the fifth moment is reached and the fifth moment is not within the third broadcast period of the second device.
[0148] Based on the implementation process of Figure 13, the present application may also perform the steps shown in Figure 14:
[0149] S1401: A first device broadcasts an address of the first device, and a second device receives the address of the first device broadcast by the first device.
[0150] In the embodiment of the present application, the first device may broadcast the Bluetooth address of the first device, and accordingly, the second device may start scanning and receive the Bluetooth address of the first device broadcast by the first device. The specific implementation process of the first device broadcasting the Bluetooth address of the first device can be referred to the introduction of S1201 above, and will not be repeated here.
[0151] S1402: The second device receives the address of the first device broadcasted by the first device at the seventh moment, and the second device has established a third connection. Before reaching the eighth moment, the second device updates the third address of the second device to obtain the fourth address of the second device.
[0152] In the embodiment of the present application, the second device starts scanning and receives the Bluetooth address of the first device broadcast by the first device at the seventh moment. The second device can determine whether the second device has established a third Bluetooth connection. The third Bluetooth connection can be a Bluetooth connection established between the second device and the first device based on the third Bluetooth address of the second device, or a Bluetooth connection established between the second device and another device (such as a third device) based on the third Bluetooth address of the second device. This embodiment of the present application is not limited to this.
[0153] If the second device has not established the third Bluetooth connection, the second device may establish a third Bluetooth connection with the first device based on the third Bluetooth address of the second device and the Bluetooth address of the first device. If the second device has established the third Bluetooth connection, the second device may update the third Bluetooth address of the second device before reaching the eighth moment to obtain the fourth Bluetooth address of the second device.
[0154] The eighth moment may be one of the at least one address update moment of the second device. Optionally, the eighth moment may be located after the seventh moment and be the one with the shortest duration between the at least one address update moment of the second device and the seventh moment.
[0155] S1403: The second device establishes a fourth connection with the first device according to the fourth address and the address of the first device.
[0156] In an embodiment of the present application, the second device updates the third Bluetooth address of the second device before reaching the eighth moment, and after obtaining the fourth Bluetooth address of the second device, can establish a fourth Bluetooth connection with the second device based on the fourth Bluetooth address of the second device and the Bluetooth address of the first device.
[0157] Based on the above embodiments and the same concept, an embodiment of the present application further provides a first device, which is used to implement the communication method provided in the embodiment of the present application.
[0158] As shown in Figure 15 , the first device 1500 may include: a memory 1501, one or more processors 1502, and one or more computer programs (not shown). The aforementioned components may be coupled via one or more communication buses 1503. Optionally, when the first device 1500 is used to implement the communication method provided in the embodiments of the present application, the first device 1500 may further include a display screen 1504.
[0159] The memory 1501 stores one or more computer programs (codes), each of which includes computer instructions. The one or more processors 1502 invoke the computer instructions stored in the memory 1501, causing the first device 1500 to execute the communication method provided in the embodiments of the present application. The display screen 1504 is used to display images, videos, application interfaces, and other related user interfaces.
[0160] In a specific implementation, the memory 1501 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 1501 can store an operating system (hereinafter referred to as system), such as ANDROID, IOS, WINDOWS, or embedded operating systems such as LINUX. The memory 1501 can be used to store the implementation program of the embodiment of the present application. The memory 1501 can also store a network communication program, which can be used to communicate with one or more additional devices, one or more user devices, or one or more network devices. The one or more processors 1502 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0161] It should be noted that Figure 15 is only one implementation of the first device 1500 provided in an embodiment of the present application. In actual applications, the first device 1500 may also include more or fewer components, which is not limited here.
[0162] Based on the above embodiments and the same concept, an embodiment of the present application further provides a second device, which is used to implement the communication method provided in the embodiment of the present application.
[0163] As shown in Figure 16, the second device 1600 may include: a memory 1601, one or more processors 1602, and one or more computer programs (not shown). The above-mentioned components may be coupled via one or more communication buses 1603. Optionally, when the second device 1600 is used to implement the communication method provided in the embodiment of the present application, the second device 1600 may also include a display screen 1604.
[0164] The memory 1601 stores one or more computer programs (codes), each of which includes computer instructions. The one or more processors 1602 invoke the computer instructions stored in the memory 1601, causing the second device 1600 to execute the communication method provided in the embodiments of the present application. The display screen 1604 is used to display images, videos, application interfaces, and other related user interfaces.
[0165] In a specific implementation, the memory 1601 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 1601 can store an operating system (hereinafter referred to as system), such as ANDROID, IOS, WINDOWS, or embedded operating systems such as LINUX. The memory 1601 can be used to store the implementation program of the embodiment of the present application. The memory 1601 can also store a network communication program, which can be used to communicate with one or more additional devices, one or more user devices, or one or more network devices. The one or more processors 1602 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0166] It should be noted that Figure 16 is only one implementation of the second device 1600 provided in an embodiment of the present application. In actual applications, the second device 1600 may also include more or fewer components, which is not limited here.
[0167] Based on the above embodiments and the same concept, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the communication method provided in the above embodiments.
[0168] Based on the above embodiments and the same concept, an embodiment of the present application further provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes the communication method provided in the above embodiments.
[0169] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0170] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or box in the flow chart and / or block diagram, as well as the combination of the flow chart and / or box in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more flow charts and / or one or more boxes in the block diagram.
[0171] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0172] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0173] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A communication method, characterized in that: Applied to a first device, comprising: receiving the address of the second device broadcasted by the second device at a first moment, and the first device has established a first connection, updating the first address of the first device before reaching a second moment to obtain the second address of the first device, wherein the first connection is a connection established by the first device with the second device or a third device according to the first address, and the second moment is one of at least one address update moment of the first device; A second connection is established with the second device according to the second address and the address of the second device.
2. The method according to claim 1, characterized in that The method further comprises: The address of the second device broadcasted by the second device is received at the second time, and the first device has not established the first connection, and the first connection is established with the second device according to the first address and the address of the second device.
3. The method according to claim 1, characterized in that The method further comprises: When a third time is reached and the third time is within a first broadcast cycle of the first device, suspending updating of the current address of the first device, the third time is one of the at least one address update time, the first broadcast cycle is one of at least one broadcast cycle of the first device, and the first device carries the same current address of the first device in a broadcast message broadcasted by the first device within one of the broadcast cycles; When the third time is not within the first broadcast period, the current address of the first device is updated.
4. The method according to claim 3, characterized in that After pausing to update the current address of the first device, the method further includes: When the fourth moment is reached, the current address of the first device is updated, and the fourth moment is the end moment of the first broadcast cycle, or the fourth moment is any moment between the end moment of the first broadcast cycle and the start moment of the second broadcast cycle, and the second broadcast cycle is one of the at least one broadcast cycle that is adjacent to the first broadcast cycle and after the first broadcast cycle.
5. The method according to claim 3 or 4, characterized in that The step of suspending updating of the current address of the first device includes: Setting the address update state of the first device to a suspended update state; or, A first operation process is performed on a first timer, the timeout moment of the first timer is the third moment, and the first operation process includes extending the timing duration of the timer.
6. The method according to claim 5, characterized in that Updating the current address of the first device includes: Setting the address update state of the first device to an updated state; or, A second operation process is performed on the first timer, where the second operation process includes shortening the timing duration of the timer.
7. The method according to claim 3 or 4, characterized in that There are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or There are two adjacent broadcast cycles in the at least one broadcast cycle that are not continuous in time.
8. A communication method, characterized in that: Applied to the second device, comprising: When a fifth moment is reached and the fifth moment is within a third broadcast cycle of the second device, suspending updating of the current address of the second device, the fifth moment is one of at least one address update moment of the second device, the third broadcast cycle is one of at least one broadcast cycle of the second device, and the second device carries the same current address of the second device in a broadcast message broadcasted by the second device within one of the broadcast cycles; When the fifth time point is not within the third broadcast period, the current address of the second device is updated.
9. The method according to claim 8, characterized in that After pausing to update the current address of the second device, the method further includes: When the sixth moment is reached, the current address of the second device is updated, the sixth moment is the end moment of the third broadcast cycle, or the sixth moment is any moment between the end moment of the third broadcast cycle and the start moment of the fourth broadcast cycle, and the fourth broadcast cycle is one of the at least one broadcast cycle that is adjacent to the third broadcast cycle and after the third broadcast cycle.
10. The method according to claim 8 or 9, characterized in that The step of suspending updating of the current address of the second device includes: Setting the address update state of the second device to a suspended update state; or, A first operation process is performed on the second timer, the timeout moment of the second timer is the fifth moment, and the first operation process includes extending the timing duration of the timer.
11. The method according to claim 10, characterized in that Updating the current address of the second device includes: Setting the address update state of the second device to an updated state; or, A second operation process is performed on the second timer, where the second operation process includes shortening the timing duration of the timer.
12. The method according to any one of claims 8 to 11, characterized in that: There are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or There are two adjacent broadcast cycles in the at least one broadcast cycle that are not continuous in time.
13. The method according to claim 8, characterized in that The method further comprises: receiving the address of the first device broadcasted by the first device at the seventh moment, and the second device has established a third connection, updating the third address of the second device before reaching an eighth moment, and obtaining a fourth address of the second device, wherein the third connection is a connection established by the second device with the first device or the third device according to the third address, and the eighth moment is one of the at least one address update moment; A fourth connection is established with the first device according to the fourth address and the address of the first device.
14. The method according to claim 13, characterized in that The method further comprises: At the seventh moment, the address of the first device broadcasted by the first device is received, and the second device has not established the third connection, and establishes the third connection with the first device according to the third address and the address of the first device.
15. A communication method, characterized in that: include: The first device receives the address of the second device broadcasted by the second device at a first time, and the first device has established a first connection, and updates the first address of the first device before reaching a second time to obtain the second address of the first device, wherein the first connection is a connection established by the first device with the second device or a third device according to the first address, and the second time is one of at least one address update time of the first device; The first device establishes a second connection with the second device according to the second address and the address of the second device; The second device suspends updating the current address of the second device when a fifth time point is reached and the fifth time point is within a third broadcast cycle of the second device, the fifth time point is one of at least one address update time point of the second device, the third broadcast cycle is one of at least one broadcast cycle of the second device, and the second device carries the same current address of the second device in a broadcast message broadcasted by the second device within one of the broadcast cycles; The second device is not within the third broadcast period at the fifth moment, and the current address of the second device is updated.
16. The method according to claim 15, characterized in that The method further comprises: The first device receives the address of the second device broadcasted by the second device at the second time, and the first device has not established the first connection, and establishes the first connection with the second device according to the first address and the address of the second device.
17. The method according to claim 15, characterized in that After the second device suspends updating the current address of the second device, the method further includes: When the second device reaches the sixth moment, the current address of the second device is updated, and the sixth moment is the end moment of the third broadcast cycle, or the sixth moment is any moment between the end moment of the third broadcast cycle and the start moment of the fourth broadcast cycle, and the fourth broadcast cycle is one of the at least one broadcast cycle that is adjacent to the third broadcast cycle and after the third broadcast cycle.
18. The method according to claim 15 or 17, characterized in that The second device suspending updating of the current address of the second device includes: The second device sets the address update state of the second device to a suspended update state; or, The second device performs a first operation process on a second timer, the timeout moment of the second timer is the fifth moment, and the first operation process includes extending the timing duration of the timer.
19. The method according to claim 18, characterized in that The second device updating the current address of the second device includes: The second device sets the address update state of the second device to an updated state; or, The second device performs a second operation process on the second timer, where the second operation process includes shortening the timing duration of the timer.
20. The method according to claim 15 or 17, characterized in that There are two adjacent broadcast cycles in the at least one broadcast cycle that are continuous in time; and / or There are two adjacent broadcast cycles in the at least one broadcast cycle that are not continuous in time.
21. A communication device, characterized in that: The communication device comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the communication device executes the method according to any one of claims 1 to 7, claims 8 to 14, or claims 15 to 20.
22. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 7, claims 8 to 14, or claims 15 to 20.
23. A computer program product, characterized in that The method comprises a computer program, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 7, claims 8 to 14, or claims 15 to 20.
Citation Information
Patent Citations
Bluetooth communication method, and dual-mode bluetooth terminal
CN111602344A
Bluetooth search method, system and related device
CN112449328A
Bluetooth connection method and Bluetooth connection system
CN114189840A
Data broadcasting method, broadcasting accelerator, NOC, SOC and electronic equipment
CN115102896A
Positioning method and electronic device
WO2022001147A1