CN-122028016-A - Bluetooth communication method, electronic equipment, readable storage medium and chip
Abstract
The application relates to the technical field of Bluetooth communication, and provides a Bluetooth communication method, electronic equipment, a readable storage medium and a chip, the method can solve the problems that in the prior art, the power consumption of equipment is increased and the use experience of a user is affected in the process of finding other surrounding Bluetooth equipment through active scanning. The method is applied to electronic equipment, the electronic equipment supports Bluetooth communication with low power consumption radio frequency and main radio frequency, the method comprises the steps of adopting a passive scanning mode to receive a first BLE broadcast packet, enabling the electronic equipment to work at the low power consumption radio frequency in the passive scanning mode, switching the passive scanning mode into the active scanning mode under the condition that the first BLE broadcast packet meets a first preset condition, and enabling the electronic equipment to work at the main radio frequency in the active scanning mode.
Inventors
- LIN JIANXIN
- WANG LIANG
- DENG QING
- XIONG YONG
Assignees
- 华为终端有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241112
Claims (11)
- 1. A bluetooth communication method, applied to an electronic device, the electronic device supporting bluetooth communication at a low power radio frequency and a main radio frequency, the method comprising: receiving a first BLE broadcast packet by adopting a passive scanning mode, wherein in the passive scanning mode, the electronic equipment works at the low-power-consumption radio frequency; And under the condition that the first BLE broadcast packet meets a first preset condition, switching from the passive scanning mode to an active scanning mode, wherein in the active scanning mode, the electronic equipment works at the main radio frequency.
- 2. The method of claim 1, wherein the first preset condition comprises at least one of: The first BLE broadcast packet is of a specified type; The first BLE broadcast packet carries indication information for indicating the scanning equipment to receive a second BLE broadcast packet; the data information carried by the first BLE broadcast packet lacks target information required by executing service; the data information carried by the first BLE broadcast packet comprises information specifying a data format and a data type; And the service corresponding to the data information carried by the first BLE broadcast packet is a designated service type.
- 3. The method of claim 2, wherein the specified types include adv_ind and adv_scan_ind.
- 4. A method according to any one of claims 1 to 3, wherein, when the first BLE broadcast packet meets a first preset condition, switching from the passive scanning mode to the active scanning mode includes: Sending a scanning request under the condition that the first BLE broadcast packet meets the first preset condition, wherein the scanning request indicates to return request information corresponding to the scanning request; and receiving a scanning response, wherein the scanning response carries the request information.
- 5. The method according to any one of claims 1-4, further comprising: and continuously receiving a third BLE broadcast packet by adopting the passive scanning mode under the condition that the first BLE broadcast packet does not meet the first preset condition, wherein the third BLE broadcast packet is the same as or different from the first BLE broadcast packet.
- 6. The method according to any one of claims 1-5, further comprising: and under the condition that a second preset condition is met, switching from the active scanning mode to the passive scanning mode.
- 7. The method of claim 6, wherein the second preset condition comprises at least one of: the method comprises the steps that a broadcast packet of a specified type is not received within preset time; the number of times of continuously not receiving the broadcast packet of the designated type satisfies the preset number of times; it is determined that reception of BLE broadcast packets in the active scanning mode has been completed.
- 8. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method of any one of claims 1-7 when executing the computer program.
- 9. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1-7.
- 10. A chip comprising a processor and a memory, wherein the memory stores a computer program which, when executed by the processor, implements the method of any of claims 1-7.
- 11. A computer program product comprising computer programs/instructions which, when executed by a processor/electronic device, implement the method of any of claims 1-7.
Description
Bluetooth communication method, electronic equipment, readable storage medium and chip Technical Field The present application relates to the field of bluetooth communication technologies, and in particular, to a bluetooth communication method, an electronic device, a readable storage medium, and a chip. Background Currently, bluetooth low energy (bluetooth low energy, BLE) devices (scanning devices) typically discover other bluetooth devices (broadcasting devices) around in an active scanning manner. For example, the bluetooth low energy device actively initiates a Scan Request (Scan Request) after receiving a broadcast packet message sent by other surrounding devices, and waits for a surrounding bluetooth device Response (Scan Response). The surrounding bluetooth devices may reply to the response message after receiving the scan request. After collecting the response messages, the bluetooth low energy device can decide whether to perform further interaction with the bluetooth device, such as connection establishment, etc. By the method, other surrounding Bluetooth devices can be found more quickly, but the active scanning process can obviously increase the power consumption of the device and influence the use experience of a user. Disclosure of Invention The application provides a Bluetooth communication method, electronic equipment, a readable storage medium and a chip, which solve the problems that in the prior art, equipment power consumption is increased and the use experience of a user is affected in the process of finding other surrounding Bluetooth equipment through active scanning. In order to achieve the above purpose, the application adopts the following technical scheme: In a first aspect, a bluetooth communication method is provided, applied to an electronic device, where the electronic device supports bluetooth communication with a low power consumption radio frequency and a main radio frequency, and the method includes adopting a passive scanning mode to receive a first BLE broadcast packet, where the electronic device operates in the low power consumption radio frequency, and switching from the passive scanning mode to the active scanning mode when the first BLE broadcast packet meets a first preset condition, and operating in the main radio frequency. According to the method provided by the embodiment of the application, the electronic equipment switches the scanning mode under the condition that the first BLE broadcast packet meets the first preset condition, so that the electronic equipment can switch the scanning mode according to the need, and works in a low-power-consumption radio frequency state under the passive scanning mode, and works in a main radio frequency state under the active scanning mode, and the balance between the power consumption and the function of the equipment can be realized on the premise of playing the low-power-consumption advantage of the low-power-consumption radio frequency. In some embodiments, the first preset condition comprises at least one of a first BLE broadcast packet being of a specified type, the first BLE broadcast packet carrying indication information indicating that the scanning device receives a second BLE broadcast packet, the data information carried by the first BLE broadcast packet lacking target information required for executing a service, the data information carried by the first BLE broadcast packet comprising information of the specified data format and the data type, and the service corresponding to the data information carried by the first BLE broadcast packet being of the specified service type. Optionally, the first preset condition may be that the first BLE broadcast packet is of a specified type, and the data information carried by the first BLE broadcast packet satisfies that the data information includes indication information indicating that the scanning device receives the second BLE broadcast packet, and/or that the data information lacks target information required for executing the service, and/or that the data information includes information of a specified data format and a specified data type, and/or that the service corresponding to the data information is of a specified service type. In this embodiment, whether the electronic device needs to switch the scan mode is indicated by limiting the type of the BLE broadcast packet and/or the content of the carried data information, so that the electronic device can switch as required, and frequent switching is avoided from affecting the communication effect. In some embodiments, the specified types include adv_ind and adv_scan_ind. In one implementation, the electronic device may determine the type of the first BLE broadcast packet from a broadcast data field in a broadcast data type field in a data structure of the first BLE broadcast packet. In some embodiments, when the first BLE broadcast packet meets a first preset condition, the passive scanning mode is switched to the