This application relates to the field of Bluetooth technologies, and in particular, to a Bluetooth connection method and an apparatus.
As a wireless transmission technology, Bluetooth is widely used in smart devices such as mobile phones, headsets, and wearable devices. After the Bluetooth special interest group (Bluetooth SIG) released a Bluetooth low energy (BLE/LE) connection mode in 2011, two connection modes: low energy Bluetooth and classic Bluetooth (BT) greatly expand Bluetooth application scenarios, so that the Bluetooth technology is applied to more devices.
When Bluetooth devices communicate with each other by using the Bluetooth, Bluetooth connection speed directly affects user experience. Currently, establishing a BLE connection needs to meet that a data packet for establishing the BLE connection is received by a BLE scan window, and establishing a BT connection needs to meet that a data packet for establishing the BT connection is received by a BT scan window. To increase connection speed of the two connection modes, enabling duration of the BLE scan window and the BT scan window is usually increased to increase a probability that the two scan windows receive corresponding data packets. This method greatly increases power consumption of the devices. Therefore, the Bluetooth devices need to increase the Bluetooth connection speed in another manner.
Embodiments of this application provide a Bluetooth connection method and an apparatus, to increase Bluetooth connection speed.
To achieve the foregoing objective, embodiments of this application provide the following technical solutions.
According to a first aspect, a Bluetooth connection establishment method is provided, including: A first device performs periodic scanning alternately, where a first scanning periodicity is used for a first-type Bluetooth connection, and a second scanning periodicity is used for a second-type Bluetooth connection; the first device receives a first-type data packet from a second device in a first scan window of any first scanning periodicity, where the first-type data packet is used to establish the first-type Bluetooth connection; the first device obtains, based on the first-type data packet, a second connection parameter for establishing the second-type Bluetooth connection to the second device; and the first device establishes the second-type Bluetooth connection to the second device based on the second connection parameter. According to the method provided in the first aspect, a Bluetooth device receives the first-type data packet for establishing the first-type Bluetooth connection, to establish the second-type Bluetooth connection, so as to increase Bluetooth connection establishment speed.
In a possible implementation, the first-type data packet includes first identification information and the second connection parameter corresponding to the first identification information, the first identification information indicates the first device to establish the second-type Bluetooth connection, and the method further includes: The first device parses the first-type data packet to obtain the first identification information, and determines, based on the first identification information, to establish the second-type Bluetooth connection; and that the first device obtains the second connection parameter based on the first-type data packet includes: The first device parses the first-type data packet to obtain the second connection parameter corresponding to the first identification information. In this possible implementation, the first identification information that indicates the first device to establish the second-type Bluetooth connection and the corresponding second connection information are carried in a data packet for establishing the first-type Bluetooth connection, to establish the second-type Bluetooth connection, implement information sharing of different types of Bluetooth connections, and accelerate Bluetooth connection establishment.
In a possible implementation, that the first device obtains the second connection parameter based on the first-type data packet includes: The first device enables a second scan window based on the first-type data packet, where the second scan window is used to receive a second-type data packet, and the second-type data packet includes the second connection parameter; and the first device parses the second-type data packet to obtain the second connection parameter. In this possible implementation, the first device is triggered by the first-type data packet to enable the second-type scan window for establishing the second-type Bluetooth connection. The Bluetooth connection establishment is accelerated through enabling, in advance, the second-type scan window for receiving the second-type data packet.
In a possible implementation, the first-type data packet includes first identification information, the first identification information indicates to enable the second scan window, and that the first device enables a second scan window based on the first-type data packet includes: The first device enables the second scan window based on the first identification information. In this possible implementation, the first-type data packet includes the first identification information indicating to enable the second scan window, and the second-type scan window for receiving the second-type data packet is enabled in advance, to accelerate the Bluetooth connection establishment.
In a possible implementation, the first-type data packet is an advertising packet, the second-type data packet is a paging packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection. This possible implementation is applicable to enabling, based on an indication of the first identification information included in the advertising packet, a scan window for receiving the paging packet, to accelerate establishment of the classic Bluetooth connection by successful exchanging the advertising packet first.
In a possible implementation, that the first device enables a second scan window based on the first-type data packet includes: The first device sends feedback of the first-type data packet to the second device based on the first-type data packet; the first device receives first identification information from the second device, where the first identification information indicates to enable the second scan window; and the first device enables the second scan window based on the first identification information. In this possible implementation, after the first-type data packet is exchanged, the second scan window is enabled based on the first identification information sent by the second device, and the second-type scan window for receiving the second-type data packet is enabled in advance, to accelerate the Bluetooth connection establishment.
In a possible implementation, the first-type data packet is a paging packet, the second-type data packet is an advertising packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection. The first-type data packet is the paging packet, the second-type data packet is the advertising packet, the first-type Bluetooth connection is the classic Bluetooth connection, and the second-type Bluetooth connection is the Bluetooth low energy connection. This possible implementation is applicable to, after the paging packet is successfully exchanged, enabling the scan window for receiving the advertising packet based on the indication of the received first identification information, to accelerate establishment of the Bluetooth low energy connection.
In a possible implementation, that the first device enables a second scan window based on the first-type data packet includes: The first device enables the second scan window in a preset time period after receiving the first-type data packet, where the preset time period is within the first scanning periodicity. In this possible implementation, the second scan window for receiving the second-type data packet is enabled based on the first-type data packet in the preset time period in the first scanning periodicity, to accelerate the Bluetooth connection establishment.
In a possible implementation, that the first device obtains the second connection parameter based on the first-type data packet includes: The first device obtains a first connection parameter based on the first-type data packet, where the first connection parameter is used to establish the first-type Bluetooth connection; the first device establishes a communication link of the first-type Bluetooth connection with the second device based on the first connection parameter; and the first device obtains, through the communication link, first identification information and the second connection parameter corresponding to the first identification information that are sent by the second device, where the first identification information indicates the first device to establish the second-type Bluetooth connection. In this possible implementation, the first-type Bluetooth connection is first established based on the first-type data packet, and the first identification information for indicating to establish the second-type Bluetooth connection and the second connection parameter corresponding to the first identification information are exchanged on the communication link of establishing the first-type Bluetooth connection, to implement the information sharing of different types of Bluetooth connections, and accelerate the Bluetooth connection establishment.
In a possible implementation, the first-type data packet is an advertising packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection. This possible implementation is applicable to a scenario in which the advertising packet includes the second connection parameter for establishing the classic Bluetooth connection, or the second connection parameter is exchanged on a communication link of establishing the Bluetooth low energy connection, to accelerate the establishment of the classic Bluetooth connection.
In a possible implementation, the first-type data packet is a paging packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection. This possible implementation is applicable to exchanging the second connection parameter on a communication link of establishing the classic Bluetooth connection, to accelerate the establishment of the Bluetooth low energy connection.
According to a second aspect, a Bluetooth connection establishment method is provided, including: A second device generates first identification information based on a second-type Bluetooth connection to be established; the second device sends a first-type data packet and a second-type data packet alternately, where the first-type data packet is used to establish a first-type Bluetooth connection, and the second-type data packet is used to establish the second-type Bluetooth connection; and the second device sends the first identification information. According to the method provided in the second aspect, a Bluetooth device determines a type of a Bluetooth connection to be established, and sends the first-type data packet for establishing the first-type Bluetooth connection and the second-type data packet for establishing the second-type Bluetooth connection alternately, to accelerate establishment of the second-type Bluetooth connection, and increase Bluetooth connection establishment speed.
In a possible implementation, the first-type data packet includes the first identification information and a second connection parameter corresponding to the first identification information, the first identification information indicates a first device to establish the second-type Bluetooth connection, and the second connection parameter is used to establish the second-type Bluetooth connection to the first device. In this possible implementation, connection information for establishing the second-type Bluetooth connection is carried in a data packet for establishing the first-type Bluetooth connection, to implement information sharing of different types of Bluetooth connections, and accelerate Bluetooth connection establishment.
In a possible implementation, the first-type data packet includes the first identification information. In this possible implementation, the first-type data packet includes the first identification information for determining to establish the second-type Bluetooth connection, to accelerate the Bluetooth connection establishment.
In a possible implementation, that the second device generates and sends the first identification information based on the second-type Bluetooth connection to be established includes: The second device sends the first identification information to a first device in response to feedback that is of the first-type data packet and that is sent by the first device. In this possible implementation, after exchanging the first-type data packet, the second device sends, to the first device, the first identification information for determining to establish the second-type Bluetooth connection, to accelerate the Bluetooth connection establishment.
In a possible implementation, the first identification information indicates the first device to enable a second scan window, and the second scan window is used by the first device to receive the second-type data packet. In this possible implementation, the first identification information indicates to enable the second-type scan window for receiving the second-type data packet in advance, to accelerate the Bluetooth connection establishment.
In a possible implementation, before that the second device sends the first identification information, the method further includes: The second device establishes a communication link of the first-type Bluetooth connection with a first device based on the first-type data packet; that the second device sends the first identification information includes: The second device sends the first identification information to the first device on the communication link, where the first identification information indicates the first device to establish the second-type Bluetooth connection; and the method further includes: The second device sends a second connection parameter corresponding to the first identification information to the first device on the communication link, where the second connection parameter is used to establish the second-type Bluetooth connection. In this possible implementation, the first-type Bluetooth connection is first established based on the first-type data packet, and the first identification information indicating to establish the second-type Bluetooth connection and the second connection parameter corresponding to the first identification information are exchanged on the communication link of establishing the first-type Bluetooth connection, to implement the information sharing of different types of Bluetooth connections, and accelerate the Bluetooth connection establishment.
In a possible implementation, the first-type data packet is an advertising packet, the second-type data packet is a paging packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection. This possible implementation is applicable to exchanging the second connection parameter on a communication link of establishing the Bluetooth low energy connection, to accelerate establishment of the classic Bluetooth connection.
In a possible implementation, the first-type data packet is a paging packet, the second-type data packet is an advertising packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection. This possible implementation is applicable to exchanging the second connection parameter on a communication link of establishing the classic Bluetooth connection, to accelerate establishment of the Bluetooth low energy connection.
According to a third aspect, a Bluetooth communication apparatus is provided, including: a processing unit, configured to perform periodic scanning alternately, where a first scanning periodicity is used for a first-type Bluetooth connection, and a second scanning periodicity is used for a second-type Bluetooth connection; and a receiving unit, configured to receive a first-type data packet from a second device in a first scan window of any first scanning periodicity, where the first-type data packet is used to establish the first-type Bluetooth connection. The processing unit is further configured to obtain, based on the first-type data packet, a second connection parameter for establishing the second-type Bluetooth connection to the second device; and the processing unit is further configured to establish the second-type Bluetooth connection to the second device based on the second connection parameter.
In a possible implementation, the first-type data packet includes first identification information and the second connection parameter corresponding to the first identification information, the first identification information indicates a first device to establish the second-type Bluetooth connection, and the processing unit is further configured to: parse the first-type data packet to obtain the first identification information, and determine, based on the first identification information, to establish the second-type Bluetooth connection; and the processing unit is specifically configured to parse the first-type data packet to obtain the second connection parameter corresponding to the first identification information.
In a possible implementation, the processing unit is specifically configured to: enable a second scan window based on the first-type data packet, where the second scan window is used to receive a second-type data packet, and the second-type data packet includes the second connection parameter; and parse the second-type data packet to obtain the second connection parameter.
In a possible implementation, the first-type data packet includes first identification information, the first identification information indicates to enable the second scan window, and the processing unit is specifically configured to enable the second scan window based on the first identification information.
In a possible implementation, the apparatus further includes: a sending unit, configured to send feedback of the first-type data packet to the second device based on the first-type data packet, where the receiving unit is further configured to receive first identification information from the second device, where the first identification information indicates to enable the second scan window; and the processing unit is specifically configured to enable the second scan window based on the first identification information.
In a possible implementation, the processing unit is specifically configured to: obtain a first connection parameter based on the first-type data packet, where the first connection parameter is used to establish the first-type Bluetooth connection; establish a communication link of the first-type Bluetooth connection with the second device based on the first connection parameter; and obtain, through the communication link, first identification information and the second connection parameter corresponding to the first identification information that are sent by the second device, where the first identification information indicates the first device to establish the second-type Bluetooth connection.
According to a fourth aspect, a Bluetooth communication apparatus is provided, including: a processing unit, configured to generate first identification information based on a second-type Bluetooth connection to be established; and a sending unit, configured to send a first-type data packet and a second-type data packet alternately, where the first-type data packet is used to establish a first-type Bluetooth connection, and the second-type data packet is used to establish the second-type Bluetooth connection. The sending unit is further configured to send the first identification information.
In a possible implementation, the first-type data packet includes the first identification information and a second connection parameter corresponding to the first identification information, the first identification information indicates a first device to establish the second-type Bluetooth connection, and the second connection parameter is used to establish the second-type Bluetooth connection to the first device.
In a possible implementation, the first-type data packet includes the first identification information.
In a possible implementation, the sending unit is specifically configured to send the first identification information to a first device in response to feedback that is of the first-type data packet and that is sent by the first device.
In a possible implementation, the first identification information indicates the first device to enable a second scan window, and the second scan window is used by the first device to receive the second-type data packet.
In a possible implementation, the processing unit is further configured to establish a communication link of the first-type Bluetooth connection with the first device based on the first-type data packet; the sending unit is specifically configured to send the first identification information to the first device on the communication link, where the first identification information indicates the first device to establish the second-type Bluetooth connection; and the sending unit is further configured to send a second connection parameter corresponding to the first identification information to the first device on the communication link, where the second connection parameter is used to establish the second-type Bluetooth connection.
According to a fifth aspect, a Bluetooth communication apparatus is provided, including: a processor, configured to perform periodic scanning alternately, where a first scanning periodicity is used for a first-type Bluetooth connection, and a second scanning periodicity is used for a second-type Bluetooth connection; and a receiver, configured to receive a first-type data packet from a second device in a first scan window of any first scanning periodicity, where the first-type data packet is used to establish the first-type Bluetooth connection. The processor is further configured to obtain, based on the first-type data packet, a second connection parameter for establishing the second-type Bluetooth connection to the second device; and the processor is further configured to establish the second-type Bluetooth connection to the second device based on the second connection parameter.
In a possible implementation, the first-type data packet includes first identification information and the second connection parameter corresponding to the first identification information, the first identification information indicates to establish the second-type Bluetooth connection, and the processor is further configured to: parse the first-type data packet to obtain the first identification information, and determine, based on the first identification information, to establish the second-type Bluetooth connection; and the processor is specifically configured to parse the first-type data packet to obtain the second connection parameter corresponding to the first identification information.
In a possible implementation, a second scan window is enabled based on the first-type data packet, where the second scan window is used to receive a second-type data packet, and the second-type data packet includes the second connection parameter; and the second-type data packet to obtain the second connection parameter is parsed.
In a possible implementation, the first-type data packet includes first identification information, the first identification information indicates to enable the second scan window, and the processor is specifically configured to enable the second scan window based on the first identification information.
In a possible implementation, the first-type data packet is an advertising packet, the second-type data packet is a paging packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection.
In a possible implementation, the apparatus further includes: a transmitter, configured to send feedback of the first-type data packet to the second device based on the first-type data packet, where the receiver is further configured to receive first identification information from the second device, where the first identification information indicates to enable the second scan window; and the processor is specifically configured to enable the second scan window based on the first identification information.
In a possible implementation, the first-type data packet is a paging packet, the second-type data packet is an advertising packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection.
In a possible implementation, the processor is specifically configured to enable the second scan window in a preset time period after receiving the first-type data packet, where the preset time period is within the first scanning periodicity.
In a possible implementation, the processor is specifically configured to: obtain a first connection parameter based on the first-type data packet, where the first connection parameter is used to establish the first-type Bluetooth connection; establish a communication link of the first-type Bluetooth connection with the second device based on the first connection parameter; and obtain, through the communication link, first identification information and the second connection parameter corresponding to the first identification information that are sent by the second device, where the first identification information indicates the first device to establish the second-type Bluetooth connection.
In a possible implementation, the first-type data packet is an advertising packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection.
In a possible implementation, the first-type data packet is a paging packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection.
According to a sixth aspect, a Bluetooth communication apparatus is provided, including: a processor, configured to generate first identification information based on a second-type Bluetooth connection to be established; and a transmitter, configured to send a first-type data packet and a second-type data packet alternately, where the first-type data packet is used to establish a first-type Bluetooth connection, and the second-type data packet is used to establish the second-type Bluetooth connection. The transmitter is further configured to send the first identification information.
In a possible implementation, the first-type data packet includes the first identification information and a second connection parameter corresponding to the first identification information, the first identification information indicates a first device to establish the second-type Bluetooth connection, and the second connection parameter is used to establish the second-type Bluetooth connection to the first device.
In a possible implementation, the first-type data packet includes the first identification information.
In a possible implementation, the transmitter is specifically configured to send the first identification information to a first device in response to feedback that is of the first-type data packet and that is sent by the first device.
In a possible implementation, the first identification information indicates the first device to enable a second scan window, and the second scan window is used by the first device to receive the second-type data packet.
In a possible implementation, the processor is further configured to establish a communication link of the first-type Bluetooth connection with a first device based on the first-type data packet; the transmitter is specifically configured to send the first identification information to the first device on the communication link, where the first identification information indicates the first device to establish the second-type Bluetooth connection; and the transmitter is further configured to send a second connection parameter corresponding to the first identification information to the first device on the communication link, where the second connection parameter is used to establish the second-type Bluetooth connection.
In a possible implementation, the first-type data packet is an advertising packet, the second-type data packet is a paging packet, the first-type Bluetooth connection is a Bluetooth low energy connection, and the second-type Bluetooth connection is a classic Bluetooth connection.
In a possible implementation, the first-type data packet is a paging packet, the second-type data packet is an advertising packet, the first-type Bluetooth connection is a classic Bluetooth connection, and the second-type Bluetooth connection is a Bluetooth low energy connection.
According to a seventh aspect, a Bluetooth communication system is provided, including the apparatuses provided in the third aspect and the fourth aspect, or the apparatuses provided in the fifth aspect and the sixth aspect.
According to an eighth aspect, a computer-readable storage medium is provided, including computer-executable instructions. When the computer-executable instructions are run on a computer, the computer is enabled to perform any method provided in the first aspect or the second aspect.
According to a ninth aspect, a computer program product is provided, including computer-executable instructions. When the computer-executable instructions are run on a computer, the computer is enabled to perform any method provided in the first aspect or the second aspect.
According to a tenth aspect, a chip is provided, including a processor and an interface, where the processor is coupled to a memory through the interface. When the processor executes a computer program or instructions in the memory, any method provided in the first aspect or the second aspect is performed.
In the foregoing aspects, for beneficial effects of an apparatus corresponding to a method, refer to beneficial effects of the corresponding method. Details are not described again. It should be noted that all possible implementations of any one of the foregoing aspects may be combined on a premise that there is no conflict between solutions.
In the descriptions of this application, unless otherwise specified, “/” means “or”, for example, A/B may represent A or B. A term “and/or” in this specification describes only an association relationship between associated objects and indicates that there may be three relationships. For example, A and/or B may indicate the following three cases: Only A exists, both A and B exist, and only B exists. In addition, “at least one” means one or more, and “a plurality of” means two or more. Terms such as “first” and “second” do not limit a quantity and an execution sequence, and the terms such as “first” and “second” do not indicate a definite difference.
It should be noted that, in this application, terms such as “example” or “for example” are used to indicate an example, an instance, or an illustration. Any embodiment or design scheme described as “example” or “for example” in this application should not be explained as being more preferred or having more advantages than another embodiment or design scheme. Exactly, use of the word “example”, “for example”, or the like is intended to present a related concept in a specific manner.
Currently, when two Bluetooth devices establish a classic Bluetooth (BT) connection or a Bluetooth low energy (BLE) connection, in a process of establishing the Bluetooth connection, a device that performs fixed-periodicity scanning is referred to as a scanning party, and a device that initiates a connection request is referred to as a connecting party. The scanning party and the connecting party need to implement the Bluetooth connection through four processes: device discovery, parameter exchange, connection confirmation, and information exchange.
With reference to
As shown in
S101: The connecting party sends a paging packet (an ID packet), and correspondingly, the scanning party receives the paging packet.
The ID packet sent by the connecting party is used by the scanning party to discover the connecting party. The ID packet is used by the connecting party to establish a connection to the scanning party, and the ID packet carries device synchronization code that is used by the connecting party to identify a determined scanning party.
In Bluetooth communication, the connecting party may send the ID packet in a frequency hopping manner. Frequency hopping means dividing a frequency band into several channels and “hopping” from one channel to another channel for data transmission.
In specific implementation of S101, the scanning party enables a page scan window (page scan) to perform fixed-periodicity scanning, where the page scan is used to receive the ID packet.
As shown in
It should be noted that duration of the BT scanning periodicity of the scanning party and duration and a quantity of the BT scan windows enabled in each BT scanning periodicity may be determined based on a power consumption requirement of the device. Longer total duration of the BT scan window indicates higher power consumption. This is not limited in this application.
S102: The scanning party replies to the connecting party with the ID packet, and correspondingly, the connecting party receives the ID packet replied with by the scanning party.
The scanning party parses the ID packet sent by the connecting party and replies with the ID packet. The ID packet replied with by the scanning party is used to confirm that the connection is supported. The ID packet replied with by the scanning party carries the device synchronization code. The ID packet replied with by the scanning party may also be referred to as feedback of the ID packet sent by the connecting party. Correspondingly, the connecting party receives the feedback.
S103: The connecting party sends a frequency hopping synchronization (FHS) packet, and correspondingly, the scanning party receives the FHS packet.
After receiving the ID packet, the connecting party parses the ID packet, and determines that the scanning party supports the connection. In this case, the connecting party sends the FHS packet to the scanning party, where the FHS packet includes frequency, slot, and address information of a signal sent by the connecting party through frequency hopping, that is, a specific communication resource for establishing the BT connection. The frequency and the slot are used to implement time and frequency synchronization between the scanning party and the connecting party in the process of establishing the connection. The specific communication resource for establishing the BT connection may also be referred to as connection information for establishing the BT connection.
S104: The scanning party replies with an acknowledgment ACK (acknowledge) frame to the connecting party, and correspondingly, the connecting party receives the ACK frame.
The ACK frame is used to confirm that the scanning party successfully receives the FHS packet and parses the slot and address information carried in the FHS packet.
It should be noted that, after step S101 to step S104 are completed, a communication link of the BT connection is established between the connecting party and the scanning party.
S105: The connecting party sends a poll (POLL) packet to the scanning party, and correspondingly, the scanning party receives and parses the poll packet.
The poll packet is sent to the scanning party on the communication link through the specific communication resource, to confirm whether the scanning party can successfully receive the poll packet. The poll packet may include data information, or may not include the data information.
S106: The scanning party replies with a null packet to the connecting party, and correspondingly, the connecting party receives and parses the null packet.
The null packet is also sent to the connecting party on the communication link based on the specific communication resource, indicating that the scanning party successfully receives the poll packet, and a process of determining that the connecting party and the scanning party can successfully transmit a signal on the specific communication resource is completed.
S107: The connecting party performs device information exchange with the scanning party.
In S107, the connecting party and the scanning party send device information such as a data packet type that is supported by either the connecting party or the scanning party and used for subsequent transmission of data information, confirm a bearing manner of exchanging data information between the two parties that establish the BT connection, to complete the BT connection.
In
With reference to
As shown in
S301: The connecting party sends an advertising packet, and correspondingly, the scanning party receives the advertising packet.
The advertising packet sent by the connecting party through frequency hopping is used by the scanning party to discover a device of the connecting party. Advertising is classified into legacy advertising and extended advertising. An advertising packet for establishing a connection in the legacy advertising includes a connectable undirected advertising (ADV_IND) packet, a connectable directed advertising (ADV_DIRECT_IND) packet, and a scannable undirected advertising (ADV_SCAN_IND) packet. The ADV_IND packet indicates that a current device can accept a connection from any device, and includes address information of the connecting party. The ADV_DIRECT_IND packet includes a device address of the determined scanning party, and the determined scanning party scans and receives the ADV_DIRECT_IND packet and establishes the connection. The ADV_SCAN_IND packet may send advertising data and be scanned by the scanning party, but the connection cannot be established.
During specific implementation of S301, the scanning party enables an advertising scan window (BLE SCAN) or a connection scan window (INIT) to perform fixed-periodicity scanning, where the BLE SCAN is used to receive the ADV_IND packet sent by the connecting party, and the INIT is used to receive the ADV_SCAN_IND packet sent by the connecting party. In this application, the ADV_IND packet and a corresponding advertising scan window (BLE scan window for short) are used as an example for description. For another type of advertising packet and a corresponding scan window, refer to this packet for understanding. Details are not described again.
As shown in
It should be noted that a BLE scanning periodicity of the scanning party and duration of enabling the BLE scan window in each BLE scanning periodicity also depend on a power consumption requirement of the device. Longer total duration of enabling the BLE scan window indicates higher power consumption. This is not limited in this application.
S302: The scanning party replies with a connection information (CONN_IND) packet to the connecting party, and correspondingly, the connecting party receives the CONN_IND packet.
The scanning party parses the ADV_IND packet sent by the connecting party and replies with the CONN_IND packet. The scanning party replies with the CONN_IND packet to confirm that the connection is supported, where the CONN_IND packet carries information such as access code, a frequency, a slot, an address, and the like. The access code is used to confirm the scanning party and the connecting party that establish the connection. The frequency, slot, and address information indicate frequency, slot, and address information that are used when the scanning party sends a signal to the connecting party, that is, a specific communication resource for establishing the BLE connection between the scanning party and the connecting party. This is used to implement a synchronous connection between the scanning party and the connecting party in time and frequency. The specific communication resource for establishing the BLE connection may also be referred to as connection information for establishing the BLE connection.
It should be noted that, after step S301 and step S302 are completed, a communication link of the BLE connection is established between the connecting party and the scanning party.
S303: The scanning party sends a data packet (Data Packet) to the connecting party.
The data packet is sent by the scanning party to the connecting party on the communication link based on the foregoing specific communication resource, and is referred to as an acknowledgment data packet in this application. The data packet is used to confirm whether the connecting party receives the CONN_IND packet and successfully obtains the specific communication resource in the CONN_IND packet. The data packet may further include device capability information such as a data packet type that is supported by the scanning party and used for data information transmission, for reference and selection by the connecting party that receives the data packet.
S304: The connecting party receives the data packet and replies with the data packet, and correspondingly, the scanning party receives the data packet.
When the connecting party successfully receives the data packet sent by the scanning party, this indicates that the connecting party successfully receives the CONN_IND packet and obtains the specific communication resource in the CONN_IND packet. The connecting party replies with the data packet on the communication link, and completes a process of determining whether the connecting party and the scanning party can successfully transmit the signal on the specific communication resource.
The data packet replied with by the connecting party may also include the device capability information such as a data packet type that is supported by the connecting party and used for data information transmission, so that the scanning party that receives the data packet determines a bearing manner of exchanging data information between the two parties that establish the BLE connection, and the process of establishing the BLE connection between the connecting party and the scanning party is completed.
In
In the foregoing two types of Bluetooth connections, both the scanning party device and the connecting party device are Bluetooth devices. The Bluetooth device is a device that supports the Bluetooth connection. Currently, Bluetooth devices are classified into three types based on the BLE connection and the BT connection: single-mode Bluetooth, dual-mode Bluetooth, and classic Bluetooth. The dual-mode Bluetooth supports the BLE connection and the BT connection, the single-mode Bluetooth supports only the BLE connection, and the classic Bluetooth supports only the BT connection.
The Bluetooth device may be a terminal, and the terminal is configured to provide one or more of a voice service and a data connectivity service for a user. The terminal may also be referred to as user equipment (UE), a terminal device, an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote station, a remote terminal, a mobile device, a user terminal, a wireless communication device, a user agent, or a user apparatus. There are various types of Bluetooth devices in the market, and the Bluetooth devices are mainly classified into two types. One is low-energy terminal devices with simple functions, such as a band, a mouse, and a headset. Some of these devices are the single-mode Bluetooth or the classic Bluetooth, that is, support one connection mode, the BT connection or the BLE connection, and some are the dual-mode Bluetooth, that is, support both connection modes. The other type is intelligent control center terminal devices, which generally have complex functions and need to be compatible with various low-energy nodes, such as a mobile phone, a smart TV, an augmented reality (AR) device, a virtual reality (VR) device, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA). These devices usually need to support two connection modes including the BT and the BLE. An organic combination of these two types of devices builds a variety of application scenarios, and greatly facilitates communication and life of people.
For the intelligent control center terminal device, to be compatible with various types of external devices that support only the BT connection or the BLE connection, a BT scan window and a BLE scan window need to be normally enabled. Once an ID packet sent by the external device is received by the BT scan window, or an ADV_IND packet sent by the external device is received by the BLE scan window, a corresponding BT connection or BLE connection may be established. Specifically, the intelligent control center terminal device (for example, a mobile phone) may determine, based on an application, a type of the Bluetooth connection to be established. It is assumed that the application chooses to establish the BT connection (where in this case, the application may be referred to as a BT application). If a BLE scan window of the mobile phone first receives an ADV_IND packet for establishing the BLE connection, the mobile phone chooses to discard the ADV_IND packet until an ID packet is received in a BT scan window, and the foregoing steps S102 to S107 are then performed. Similarly, when the application chooses to establish the BLE connection (where in this case, the application may be referred to as a BLE application), if the BT scan window of the mobile phone first receives the ID packet for establishing the BT connection, the mobile phone chooses to discard the ID packet until the ADV_IND packet is received in the BLE scan window, and the foregoing steps S302 to S304 are then performed. Therefore, information cannot be shared in a process of establishing the BT connection or the BLE connection. In other words, when the BT connection is established, information of the ADV_IND packet that is used for device discovery of the BLE connection cannot be shared, and when the BLE connection is established, information of the ID packet that is used for device discovery of the BT connection cannot be shared.
It may be understood that connection speed of the BT connection and connection speed of the BLE connection depend to a large extent on a scanning duty cycle corresponding to either the BT connection or the BLE connection. The scanning duty cycle is proportion of duration of a scan window to a scanning periodicity. A larger duty cycle indicates higher connection speed and higher power consumption. Most devices require a difficult trade-off between the power consumption and the connection speed.
For the foregoing processes of the two types of Bluetooth connection, to increase Bluetooth connection speed, this application provides a Bluetooth connection method used between Bluetooth devices. In this method, a scanning party receives an ID packet or an ADV_IND packet from a connecting party. For a BT application, if the ADV_IND packet is first received, a BT connection may be established to the connecting party based on the ADV_IND packet (where the process is referred to as BT Over BLE for short below). For a BLE application, if the ID packet is first received, a BLE connection may be established to the connecting party based on the ID packet (where the process is referred to as BLE Over BT below). Therefore, Bluetooth connection speed is increased.
The method provided in this application is applicable to a Bluetooth technology, and may also be applicable to another related connection technology, for example, a Greentooth technology in SparkLink.
To increase the Bluetooth connection speed, this application provides the following methods shown in a solution 1 to a solution 5. The solution 1 to the solution 3 are specific implementations of the BT Over BLE, and the solution 4 and the solution 5 are specific implementations of the BLE Over BT. The following describes an example of technical solutions of this application with reference to accompanying drawings.
Solution 1
In the solution 1, an ADV_IND packet triggers to enable a BT scan window to receive an ID packet, to increase BT connection speed.
As shown in
S501: A connecting party sends the ADV_IND packet and the ID packet alternately, and a scanning party enables the BT scan window and a BLE scan window to perform scanning.
A current connecting party sends the ID packet according to the foregoing S101 in a BT connection establishment mode, and sends the ADV_IND packet according to the foregoing S301 in a BLE connection establishment mode. The connecting party switches between the BT connection establishment mode and the BLE connection establishment mode, to send the ADV_IND packet and the ID packet alternately.
For example, the two modes may be switched by setting enabling duration of each mode. For example, when the BT connection mode is enabled, after the ID packet is sent for duration A based on the foregoing S101, the BT connection mode is switched to the BLE connection mode to send the ADV_IND packet for duration B based on the foregoing S301. Alternatively, the two modes may be switched by setting a quantity of packets sent in each mode. For example, when the BT connection mode is enabled, after M ID packets are sent based on the foregoing S101, the BT connection mode is switched to the BLE connection mode to send N ADV_IND packets based on the foregoing S301. A and B are real numbers greater than or equal to zero, and M and N are integers greater than or equal to zero.
As shown in
Optionally, the connecting party may send the ADV_IND packet and the ID packet alternately under an indication of an application layer. The connecting party supports two types of Bluetooth connection. When the application layer of the connecting party indicates to establish a BT connection or a BLE connection, the connecting party may send the ADV_IND packet and the ID packet alternately, to accelerate establishment of the BT connection or the BLE connection. When the connecting party determines to establish the BT connection, the connecting party generates identification information (which may be referred to as first identification information) corresponding to the BT connection, where the first identification information indicates the scanning party to enable the BT scan window. In a subsequent process, the scanning party may receive the ID packet in the enabled BT scan window and establish the BT connection. The first identification information may be included in the ADV_IND packet for sending.
S502: The scanning party receives the ADV_IND packet, and quickly enables the BT scan window to receive the ID packet.
The BLE scan window of the scanning party first receives the ADV_IND packet, and the scanning party parses the ADV_IND packet to obtain the first identification information, and enables the BT scan window based on the first identification information, to determine to establish the BT connection. In other words, the BLE exchange succeeds first, and the BT scan window is triggered to be enabled.
The quick enabling of the BT scan window means to enable the BT scan window in a preset time period, where the preset time period is in a scanning periodicity in which the BLE scan window is located, and the preset time period may be preset.
As shown in
It should be noted that, in the method shown in
It should be noted that, after receiving the ADV_IND packet, the scanning party does not need to reply with the packet, and the connecting party keeps sending the ADV_IND packet and the ID packet alternately. The scanning party enables the BT scan window to receive the ID packet to establish the BT connection. For example, a quantity and a size of the enabled BT scan windows may be adjusted based on power consumption performance of a device. As shown in the figure, two BT scan windows are enabled, or a plurality of BT scan windows may be enabled, or the BT scan window is continuously enabled to receive the ID packet.
S503 to S508 are respectively the same as S102 to S107.
According to the method provided in the solution 1, when the BLE scan window of the scanning party first receives the ADV_IND packet, the BT scan window is enabled based on the first identification information included in the ADV_IND packet, so that the ID packet can be received in the BT scan window as soon as possible instead of being received in an originally later BT scan window, and Bluetooth connection speed is increased.
According to the foregoing solution 1, the BT connection is established on a basis that the connecting party and the scanning party successfully exchange first based on the ADV_IND packet of the BLE. When a scanning periodicity of each type of Bluetooth is not shortened, or in other words, the scanning party keeps a current periodicity and enabling duration of the BT scan window and the BLE scan window, power consumption of the scanning party is not increased, a BLE device discovery process is accelerated, and Bluetooth response time is optimized by about 50%.
In the solution 1, the BLE scan window may be referred to as a first scan window, and the BT scan window may be referred to as a second scan window. A scanning periodicity in which the first scan window is located may be referred to as a first scanning periodicity, and a scanning periodicity in which the second scan window is located may be referred to as a second scanning periodicity. The ADV_IND packet may be referred to as a first-type data packet, and the ID packet may be referred to as a second-type data packet. The BLE connection may be referred to as a first-type Bluetooth connection, and the BT connection may be referred to as a second-type Bluetooth connection.
Solution 2
In the solution 2, an ADV_IND packet carries information for establishing a BT connection, to increase BT connection speed.
As shown in
S801: A connecting party sends the ADV_IND packet and an ID packet alternately, and a scanning party enables a BT scan window and a BLE scan window to perform scanning.
For descriptions of sending the ADV_IND packet and the ID packet alternately by the connecting party and enabling the BT scan window and the BLE scan window by the scanning party to perform scanning, refer to S501. The ADV_IND packet carries identification information (which may be referred to as first identification information) and an FHS packet corresponding to the first identification information.
It should be noted that, because the FHS packet includes connection information for establishing the BT connection between the scanning party and the connecting party, the FHS packet corresponding to the first identification information may also be understood as the connection information that is for establishing the BT connection between the scanning party and the connecting party and that corresponds to the first identification information.
S802: The scanning party receives the ADV_IND packet, and replies with an active scanning request SCAN_REQ.
The scanning party receives the ADV_IND packet, that is, BLE exchange succeeds first. The scanning party parses the ADV_IND packet to obtain the first identification information, determines, based on the first identification information, to establish the BT connection, and obtains connection information in the FHS packet corresponding to the first identification information, to establish the BT connection.
The scanning party replies with the SCAN_REQ based on the included connection information in the FHS packet corresponding to the first identification information, where a function of the SCAN_REQ is the same as that of an ACK frame, and is used to confirm that the scanning party receives the ANV_IND packet that carries the FHS packet. It should be noted that, the scanning party replies with the SCAN_REQ only when determining that the first identification information in the ADV_IND packet and the connection information in the FHS packet corresponding to the first identification information are received.
It should be noted that a slot carried in the ANV_IND packet needs to be dynamically updated based on a local clock, and the slot is the same as the slot carried in the FHS packet in S103, to ensure accuracy of synchronization between the connecting party and the scanning party in time and frequency.
S803 to S805 are respectively the same as S105 to S107. In other words, in S803 to S805, connection confirmation and information exchange in the BT connection are completed, to implement the BT connection.
According to the method provided in the solution 2, when the ADV_IND packet sent by the connecting party carries the connection information in the FHS packet, and the BLE scan window of the scanning party first receives the ADV_IND packet, the BT connection is directly established through parsing the first identification information carried in the ADV_IND packet and the connection information in the FHS packet corresponding to the first identification information, so that the BT connection is established by using information exchanged through the BLE instead of receiving the ID packet in the BT scan window to perform BT exchange, a part of device discovery and parameter exchange in the BT connection is omitted, and Bluetooth connection speed is increased on a basis that the BLE exchange succeeds first.
In the solution 2, the BLE scan window may be referred to as a first scan window, and the BT scan window may be referred to as a second scan window. A scanning periodicity in which the first scan window is located may be referred to as a first scanning periodicity, and a scanning periodicity in which the second scan window is located may be referred to as a second scanning periodicity. The ADV_IND packet may be referred to as a first-type data packet, and the ID packet may be referred to as a second-type data packet. The BLE connection may be referred to as a first-type Bluetooth connection, and the BT connection may be referred to as a second-type Bluetooth connection.
Solution 3
In the solution 3, connection information (which may be referred to as a second connection parameter) for establishing a BT connection is exchanged on a BLE link by establishing a BLE connection, to increase BT connection speed.
As shown in
S901 is the same as S501.
S902 and S903 are respectively the same as S302 and S303, and processes of parameter exchange and connection confirmation in the BLE connection is completed.
S904: The connecting party sends, on the BLE link, identification information (which may be referred to as first identification information) and an FHS packet corresponding to the first identification information.
It should be noted that, because the FHS packet includes the connection information for establishing the BT connection between the scanning party and the connecting party, the FHS packet corresponding to the first identification information may also be understood as the connection information that is for establishing the BT connection between the scanning party and the connecting party and that corresponds to the first identification information.
The connecting party may send, on the BLE link based on the communication resource carried in the CONN_IND packet, the first identification information and the FHS packet corresponding to the first identification information to the scanning party, where the first identification information indicates the scanning party to establish the BT connection.
It should be noted that the first identification information may alternatively be included in the FHS packet for sending. After receiving the FHS packet, the scanning party parses the FHS packet to obtain the first identification information, and establishes the BT connection by using the connection information in the FHS packet based on an indication of the first identification information.
S905 and S906 are respectively the same as S104 and S107. In other words, when the scanning party receives the FHS packet, the scanning party replies with an ACK frame and completes the information exchange part on a BT link.
In the solution 3, it should be noted that, after the BT connection is successfully established, because the BLE link does not need to continue to be used for data transmission, the established BLE link may be destroyed, to reduce power consumption of a device.
According to the method provided in the solution 3, when the BLE scan window of the scanning party receives the ADV_IND packet first, the BLE connection is established, and the FHS packet for the BT connection is exchanged on a link of establishing the BLE connection, so that resource waste caused by discarding of the ADV_IND packet after the ADV_IND packet is scanned first is prevented, processes of device discovery, parameter exchange, and connection confirmation in the BT connection are omitted, the BT connection is established on a basis that BLE exchange succeeds first and the BLE connection is established, and Bluetooth connection speed is increased.
It should be noted that in step S904, sending is performed on the communication link on which the connection confirmation is completed in step S903, so that communication security can be ensured. To meet a connection requirement of the connecting party more quickly, step S904 may alternatively be performed after step S902. In other words, after the parameter exchange of establishing the BLE connection is completed, the communication link between the scanning party and the connecting party is established. In a process of performing connection confirmation between the two parties, the connecting party may send the FHS packet on the foregoing communication link, so that the scanning party receives the packet and establishes the BT connection.
In the solution 3, the BLE scan window may be referred to as a first scan window, and the BT scan window may be referred to as a second scan window. A scanning periodicity in which the first scan window is located may be referred to as a first scanning periodicity, and a scanning periodicity in which the second scan window is located may be referred to as a second scanning periodicity. The ADV_IND packet may be referred to as a first-type data packet, and the ID packet may be referred to as a second-type data packet. The BLE connection may be referred to as a first-type Bluetooth connection, and the BT connection may be referred to as a second-type Bluetooth connection.
The foregoing three solutions can all implement BT Over BLE. The connecting party sends the ADV_IND packet and the ID packet alternately, and the scanning party enables the BT scan window and the BLE scan window. On a basis that the ADV_IND packet is first received in the BLE scan window, or in other words, the BLE exchange succeeds first, the first identification information is carried in the ADV_IND packet to indicate the scanning party to enable the BT scan window and establish the BT connection, or the ADV_IND packet carries the connection information for establishing the BT connection, or the communication link of the BLE connection is established based on the ADV_IND packet, and the connection information of the BT connection is exchanged on the BLE link to implement the BT connection. In the foregoing three solutions, on a basis that an existing manner of sending the connection request by the connecting party and a manner of performing scanning by the scanning party are not changed, or in other words, current sending frequencies of the ID packet and the ADV_IND packet and enabling duration of the BT scan window and the BLE scan window are maintained, BT connection establishment speed is increased, and intelligence of the device is improved.
In the solution 4, an FHS packet triggers to enable a BLE scan window to receive an ADV_IND packet, to accelerate BLE connection establishment.
As shown in
S1001 is the same as S501. When the connecting party determines to establish a BLE connection, the connecting party generates identification information (which may be referred to as first identification information) corresponding to the BLE connection, where the first identification information indicates the scanning party to enable the BLE scan window. In a subsequent process, the scanning party may receive the ADV_IND packet and establish the BLE connection.
S1002 and S1003 are respectively the same as S102 and S103. The FHS packet sent by the connecting party in step S1003 includes the first identification information in step S1001.
S1004: The scanning party receives the FHS packet, quickly enables the BLE scan window to receive the ADV_IND packet, and replies with an ID packet.
The BT scan window of the scanning party first receives the ID packet, that is, BT exchange succeeds first, and then the BT scan window receives the FHS packet sent by the connecting party. The scanning party parses the FHS packet to obtain the first identification information in the FHS packet, enables the BLE scan window based on the first identification information, to determine to establish the BLE connection, and replies with the ID packet.
The quick enabling of the BLE scan window means to enable the BT scan window in a preset time period, where the preset time period is in a scanning periodicity in which the BLE scan window is located, and the preset time period may be preset.
As shown in
It should be noted that, in the method shown in
S1005 to S1008 are respectively the same as S301 to S304.
According to the method provided in the solution 4, when the BT scan window of the scanning party first receives the ID packet, the scanning party receives the FHS packet sent by the connecting party, and enables the BLE scan window based on the first identification information included in the FHS packet. Through enabling of the BLE scan window, the ADV_IND packet can be received in the BLE scan window as soon as possible, and the ADV_IND packet does not need to be received in an originally later BLE scan window, so that Bluetooth connection speed is increased. According to the foregoing solution 4, the BLE connection is established on a basis that the connecting party and the scanning party exchange successfully first based on the ID packet of the BT. When a scanning periodicity of each type of Bluetooth is not shortened, or in other words, power consumption of the scanning party is not increased, the BLE device discovery process is accelerated, and Bluetooth response time is optimized by about 50%.
In the solution 4, the BT scan window may be referred to as a first scan window, and the BLE scan window may be referred to as a second scan window. A scanning periodicity in which the first scan window is located may be referred to as a first scanning periodicity, and a scanning periodicity in which the second scan window is located may be referred to as a second scanning periodicity. The ID packet may be referred to as a first-type data packet, and the ADV_IND packet may be referred to as a second-type data packet. The BT connection may be referred to as a first-type Bluetooth connection, and the BLE connection may be referred to as a second-type Bluetooth connection.
Solution 5
In the solution 5, a BT connection is established, and connection information for establishing a BLE connection is exchanged on a BT link, to increase Bluetooth connection speed.
As shown in
S1201 is the same as S501.
S1202 to S1206 are respectively the same as S102 to S106. The scanning party receives an FHS packet and establishes the BT link.
S1207: The connecting party sends identification information (which may be referred to as first identification information) and a CONN_IND packet corresponding to the first identification information on the BT link, and correspondingly, the scanning party receives the first identification information and the CONN_IND packet corresponding to the first identification information.
It should be noted that, because the CONN_IND packet includes the connection information for establishing the BLE connection between the scanning party and the connecting party, the CONN_IND packet corresponding to the first identification information may also be understood as the connection information that is for establishing the BLE connection between the scanning party and the connecting party and that corresponds to the first identification information.
The connecting party sends, on the BT link, the first identification information and the CONN_IND packet corresponding to the first identification information to the scanning party, where the first identification information indicates the scanning party to establish the BLE connection.
It should be noted that the first identification information may alternatively be included in the CONN_IND packet for sending. After receiving the CONN_IND packet, the scanning party parses the CONN_IND packet to obtain the first identification information, and establishes the BLE connection by using the connection information in the CONN_IND packet based on an indication of the first identification information.
S1208: The scanning party replies with an ACK frame, and correspondingly, the connecting party receives the ACK frame.
S1209 and S1210 are respectively the same as S303 and S304.
In the solution 5, it should be noted that, after the BLE connection is successfully established in the foregoing manner, the established BT link may be destroyed, to reduce power consumption of a device.
According to the method provided in the solution 5, when the BT scan window of the scanning party receives the ID packet first, the BT connection is established, and the CONN_IND packet for the BLE connection is exchanged on a link of establishing the BT connection, so that resource waste caused by discarding of the ID packet after the ID packet is scanned first is prevented, processes of device discovery and parameter exchange in the BLE connection are omitted, the BT connection is established on a basis that the BLE exchange succeeds first and the BLE connection is established, and Bluetooth connection speed is increased.
It should be noted that in step S1207, sending is performed on the communication link on which connection confirmation is completed in step S1206, and the link can ensure communication security. To meet a connection requirement of the connecting party more quickly, step S1207 may alternatively be performed after step S1204. In other words, after the parameter exchange of establishing the BT connection is completed, the communication link between the scanning party and the connecting party is established. In a process of performing connection confirmation between the two parties, the connecting party may send the CONN_IND packet on the foregoing communication link, so that the scanning party receives the packet and establishes the BLE connection.
In the solution 5, the BT scan window may be referred to as a first scan window, and the BLE scan window may be referred to as a second scan window. A scanning periodicity in which the first scan window is located may be referred to as a first scanning periodicity, and a scanning periodicity in which the second scan window is located may be referred to as a second scanning periodicity. The ID packet may be referred to as a first-type data packet, and an ADV_IND packet may be referred to as a second-type data packet. The BT connection may be referred to as a first-type Bluetooth connection, and the BLE connection may be referred to as a second-type Bluetooth connection.
Both the foregoing solution 4 and solution 5 can implement BLE Over BT. The connecting party sends the ADV_IND packet and the ID packet alternately, and the scanning party enables the BT scan window and the BLE scan window. On a basis that the ID packet in the BT scan window is first received, or in other words, the BT exchange succeeds first, the FHS packet is exchanged by using the ID packet, and the scanning party is indicated, based on the first identification information carried in the FHS packet, to enable the BLE scan window to establish the BLE connection, or the communication link of the BT connection is established based on the ID packet, and the connection information of the BLE connection is exchanged on the BT link to implement the BLE connection. In the foregoing two solutions, similarly, on a basis that an existing manner of sending the connection request by the connecting party and a manner of performing scanning by the scanning party are not changed, or in other words, current sending frequencies of the ID packet and the ADV_IND packet and enabling duration of the BT scan window and the BLE scan window are maintained, BLE connection establishment speed is increased, and intelligence of the device is improved.
In an alternative implementation of this embodiment of this application, the scanning party enables only one type of scan window. For example, when the scanning party does not enable the BT scan window, and only enables the BLE scan window, by performing the foregoing solution 1 to solution 3, both the BT connection and the BLE connection can be established, and power consumption is optimized by about 13% to 50%; or when the scanning party does not enable the BLE scan window, and only enables the BT scan window, by performing the foregoing solution 4 and solution 5, both the BLE connection and the BT connection can be established, and the power consumption is optimized by about 50% to 87%.
The solutions provided in the foregoing embodiments may be summarized as follows: The scanning party is used as a first device, and the connecting party is used as a second device. The second device generates and sends first identification information based on a second-type Bluetooth connection to be established, and the second device alternately sends a first-type data packet and a second-type data packet that are used for the device discovery, where the first-type data packet is used to establish a first-type Bluetooth connection, and the second-type data packet is used to establish the second-type Bluetooth connection. The first device performs periodic scanning alternately, where a first scanning periodicity is used for the first-type Bluetooth connection and a second scanning periodicity is used for the second-type Bluetooth connection; the first device receives the first-type data packet from the second device in a first scan window of any first scanning periodicity; the first device obtains, based on the first-type data packet, a second connection parameter for establishing the second-type Bluetooth connection to the second device; and the first device establishes the second-type Bluetooth connection to the second device based on the second connection parameter. When the first-type data packet is an ID packet, a BLE connection is established; or when the second-type data packet is an ADV_IND packet, a BT connection is established.
That the first device obtains, based on the first-type data packet, the second connection parameter for establishing the second-type Bluetooth connection to the second device includes the following three cases.
According to the methods provided in this embodiment of this application, when the connecting party initiates a connection, the connecting party sends the ID packet and the ADV_IND packet alternately. The scanning party organizes scanning intervals in an orderly manner, and enables the BT scan window and the BLE scan window alternately. When the BT connection is established, information about successful BLE exchange is shared, and when the BLE connection is established, information about successful BT exchange is shared, and an information sharing mechanism is established during the BT connection or BLE connection, to accelerate Bluetooth connection establishment.
According to the methods provided in this embodiment of this application, receiving one type of data packet can implement establishment of another type of Bluetooth connection based on the type of data packet, to increase the Bluetooth connection speed.
The foregoing mainly describes the solutions in this embodiment of this application from a perspective of the method. It may be understood that, to implement the foregoing functions, each module, for example, the Bluetooth communication apparatus, includes at least one of a corresponding hardware structure or a corresponding software module for performing each function. A person skilled in the art should easily be aware that units and algorithm steps in the examples described with reference to embodiments disclosed in this specification can be implemented by hardware or a combination of hardware and computer software in this application. Whether a function is executed in a manner of hardware or hardware driven by computer software depends on specific applications and design constraints of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each specific application. However, it should not be considered that the implementation goes beyond the scope of embodiments of this application.
In embodiments of this application, division into functional units may be performed on the Bluetooth communication apparatus based on the foregoing method examples. For example, each functional unit may be obtained through division based on each corresponding function, or two or more functions may be integrated into one processing unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit. It should be noted that, in embodiments of this application, division into the units is an example, and is merely logical function division. In actual implementation, another division manner may be used.
When an integrated unit is used,
When the schematic diagram of the structure shown in
When the schematic diagram of the structure shown in
When the schematic diagram of the structure shown in
When the schematic diagram of the structure shown in
When the integrated unit in
The unit in
Optionally, the receiver 1402 and the transmitter 1403 may be collectively referred to as a transceiver.
Optionally, the Bluetooth communication apparatus further includes a memory 1404, and the memory 1404 may include a read-only memory and a random access memory, and provide operation instructions and data for the processor 1401. A part of the memory 1404 may further include a non-volatile random access memory (NVRAM).
In this embodiment of this application, the Bluetooth communication apparatus performs a corresponding operation by invoking the operation instructions (where the operation instructions may be stored in an operating system) stored in the memory 1404.
The processor 1401 may also be referred to as a central processing unit (CPU).
The processor 1401, the receiver 1402, the transmitter 1403, and the memory 1404 are coupled together through a bus system 1405. In addition to a data bus, the bus system 1405 may further include a power bus, a control bus, a status signal bus, and the like. However, for clarity of description, various buses are marked as the bus system 1405 in
The methods disclosed in the foregoing embodiments of this application may be applied to the processor 1401, or may be implemented by the processor 1401. The processor 1401 may be an integrated circuit chip, and has a signal processing capability. In an implementation process, the steps of the foregoing methods may be completed by using an integrated logic circuit of hardware in the processor 1401 or instructions in a form of software. The processor 1401 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or another programmable logical device, a discrete gate or a transistor logic device, or a discrete hardware component. The processor can implement or perform the methods, the steps, and logical block diagrams that are disclosed in embodiments of this application. The general purpose processor may be a microprocessor, or the processor may be any conventional processor or the like. The steps of the methods disclosed with reference to embodiments of this application may be directly performed and completed by a hardware decoding processor, or may be performed and completed by a combination of hardware and a software module in the decoding processor. The software module may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The storage medium is located in the memory 1404, and the processor 1401 reads information in the memory 1404, and completes the steps of the foregoing methods in combination with hardware of the processor 1401.
For example, the schematic diagram of the structure shown in
When the schematic diagram of the structure shown in
When the schematic diagram of the structure shown in
The foregoing communication unit or communication interface may be an interface circuit or a communication interface of the apparatus, and is configured to receive a signal from another apparatus. For example, when the apparatus is implemented in a form of a chip, the communication unit or the communication interface is an interface circuit or a communication interface that is used by the chip to receive a signal or send a signal from another chip or apparatus.
In the foregoing embodiment, instructions that are stored in the memory and that are executed by the processor may be implemented in a form of a computer program product. The computer program product may be written into the memory in advance, or may be downloaded in a form of software and installed in the memory.
The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or some of the procedures or functions according to embodiments of this application are generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium that can be stored by a computer, or a data storage device that is integrated by one or more usable media, such as a server or a data center. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive (SSD)), or the like.
Optionally, an embodiment of this application further provides a computer-readable storage medium, and the computer-readable storage medium stores computer instructions. When the computer-readable storage medium runs on a computer, the computer is enabled to perform any method provided in embodiments of this application.
An embodiment of this application further provides a computer program product that includes computer instructions. When the computer program product runs on a computer, the computer is enabled to perform any method provided in embodiments of this application.
An embodiment of this application further provides a chip. The chip includes a processor. When the processor executes instructions, the chip is enabled to perform any method provided in embodiments of this application.
All or some of the foregoing embodiments may be implemented through software, hardware, firmware, or any combination thereof. When a software program is used for implementation, all or some of the foregoing embodiments may be implemented in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or some of the procedures or functions according to embodiments of this application are generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (digital subscriber line, DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium that can be accessed by a computer, or a data storage device that is integrated by one or more usable media, such as a server or a data center. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, an SSD), or the like.
Although this application is described with reference to embodiments, in a process of implementing this application that claims protection, a person skilled in the art may understand and implement another variation of the disclosed embodiments by viewing the accompanying drawings, disclosed content, and the accompanying claims. In the claims, the term “comprise” (comprising) does not exclude another component or another step, and “a” or “one” does not exclude a case of plurality. A single processor or another unit may implement several functions enumerated in the claims. Some measures are recorded in dependent claims that are different from each other, but this does not mean that these measures cannot be combined to produce a better effect.
Although this application is described with reference to specific features and embodiments thereof, it is clear that various modifications and combinations may be made to them without departing from the spirit and scope of this application. Correspondingly, the specification and accompanying drawings are merely descriptions of examples of this application defined by the accompanying claims, and are considered as any of or all modifications, variations, combinations or equivalents that cover the scope of this application. It is clear that, a person skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, this application is intended to cover these modifications and variations of this application provided that they fall within the scope of claims of this application and equivalent technologies thereof.
This application is a continuation of International Application No. PCT/CN2021/105860, filed on Jul. 12, 2021, the disclosure of which is hereby incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2021/105860 | Jul 2021 | US |
Child | 18410584 | US |