CN-122028219-A - Connection method and related device
Abstract
The application discloses a connecting method and a related device. After the first electronic device can receive the first broadcast packet sent by the second electronic device, if the first broadcast packet carries the first identifier, the second electronic device is automatically connected back without being based on the white list of the first electronic device. And if the first broadcast packet does not carry the first identifier, automatically connecting back to the second electronic device based on the white list of the first electronic device. In this way, the second electronic device can inform the first electronic device whether to automatically connect back to the second electronic device based on the white list by whether the first identifier is carried in the first broadcast packet. The first electronic device can be prevented from frequently competing with other devices to establish communication connection with the second electronic device after receiving the first broadcast packet sent by the second electronic device.
Inventors
- LIN JIANXIN
- SU JIONGJIN
- WANG LIANG
- ZHANG JINGYUN
- ZHENG FEI
Assignees
- 华为技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20250623
Claims (20)
- 1. A connection method applied to a first electronic device, the method comprising: Receiving a first broadcast packet sent by a second electronic device, wherein the first broadcast packet carries an address identifier of the second electronic device, and the first broadcast packet is a connectable broadcast packet; If the first broadcast packet carries a first identifier, a first communication connection is not established with the second electronic device based on a white list of the first electronic device; and if the first broadcast packet does not carry the first identifier, establishing the first communication connection with the second electronic equipment based on a white list of the first electronic equipment.
- 2. The method of claim 1, wherein if the first broadcast packet carries a first identification, not establishing a first communication connection with the second electronic device based on a whitelist of first electronic devices, comprises: if the first broadcast packet carries a first identifier, automatically connecting back to the second electronic device without being based on a white list of the first electronic device; If the first broadcast packet does not carry the first identifier, establishing the first communication connection with the second electronic device based on the white list of the first electronic device, including: and if the first broadcast packet does not carry the first identifier, automatically connecting back to the second electronic device based on the white list of the first electronic device.
- 3. The method of claim 2, wherein if the first broadcast packet does not carry the first identifier, automatically reconnecting the second electronic device based on a whitelist of the first electronic device, comprising: If the white list of the first electronic device has the address identifier of the second electronic device and a first instruction of initiating connection of the second electronic device by the application is not acquired before the first broadcast packet is received, and the first broadcast packet does not carry the first identifier, a first communication connection is established with the second electronic device.
- 4. A method according to claim 2 or 3, wherein if the first broadcast packet carries a first identifier, the second electronic device is not automatically connected back based on a whitelist of the first electronic device, comprising: If the white list of the first electronic device has the address identifier of the second electronic device and a first instruction of initiating connection of the second electronic device by the application is not acquired before a first broadcast packet is received, the first broadcast packet carries the first identifier, and the first communication connection is not established with the second electronic device.
- 5. The method according to claim 3 or 4, characterized in that the method further comprises: If the address identifier of the second electronic device is in the white list of the first electronic device, and a first instruction for initiating connection of the second electronic device by the application is acquired before a first broadcast packet is received, the first communication connection is established with the second electronic device.
- 6. The method according to any one of claims 1-4, further comprising: and if the address identifier of the second electronic equipment is not in the white list of the first electronic equipment, the first communication connection is not established with the second electronic equipment.
- 7. The method of any of claims 1-5, wherein the first broadcast packet is a directed and connectible broadcast packet or wherein the first broadcast packet is a non-directed and connectible broadcast packet.
- 8. The method of claim 7, wherein the first identification is not carried in the first broadcast packet if the first broadcast packet is a directed and connectible broadcast packet.
- 9. The method of claim 7, wherein the first identification is carried in the first broadcast packet if the first broadcast packet is a non-directional and connectible broadcast.
- 10. The method according to any one of claims 1-9, further comprising: If the first electronic equipment is paired with the second electronic equipment but the first communication connection is not established, storing an address identifier of the second electronic equipment in a white list of the first electronic equipment; and if the first electronic equipment is not matched with the second electronic equipment or the first communication connection is established, the address identification of the second electronic equipment is not stored in the white list of the first electronic equipment.
- 11. The method of claim 3, wherein if the first electronic device has an address identifier of the second electronic device in the white list of the first electronic device and a first instruction of an application to initiate connection to the second electronic device is not acquired before the first broadcast packet is received and the first broadcast packet does not carry the first identifier, establishing a first communication connection with the second electronic device includes: judging whether the white list of the first electronic equipment has the address identification of the second electronic equipment or not; If the address identification of the second electronic device exists in the white list of the first electronic device, judging whether a first instruction for initiating connection of the second electronic device by an application is acquired before the first broadcast packet is received; If it is determined that a first instruction for initiating connection of the second electronic device by the application is not acquired before the first broadcast packet is received, judging whether the first broadcast packet carries the first identifier or not; And if the first identifier is determined not to be carried in the first broadcast packet, establishing the first communication connection with the second electronic equipment.
- 12. The method according to any one of claims 3-5, further comprising: connecting a first input of the second electronic device in the application by a user; and responding to the first input, acquiring the first instruction of the application to initiate connection with the second electronic device.
- 13. The method according to any of claims 1-12, wherein the first communication connection is a bluetooth low energy BLE connection, the first broadcast packet is a BLE broadcast packet, or, The first communication connection is a star-flash super low-power SLE connection, and the first broadcast packet is a SLE broadcast packet.
- 14. The method according to any one of claims 1-13, wherein the first broadcast packet further carries a first field, wherein the first broadcast packet carries a first identifier, including the first field being a first value, and wherein the first broadcast packet does not carry a first identifier, including the first field being a second value.
- 15. A connection method applied to a second electronic device, the method comprising: And sending a first broadcast packet, wherein the first broadcast packet carries the address identifier of the second electronic equipment, the first broadcast packet is a connectable broadcast packet, the first broadcast packet carries or does not carry a first identifier, and the first identifier is used for indicating that equipment receiving the first broadcast packet does not establish first communication connection with the second electronic equipment based on a white list.
- 16. The method of claim 15, wherein the first identifying indicating that the device receiving the first broadcast packet does not establish a first communication connection with the second electronic device based on a whitelist comprises the first identifying indicating that the device receiving the first broadcast packet does not automatically connect back to the second electronic device based on a whitelist.
- 17. The method according to claim 15 or 16, wherein the first broadcast packet is a directed and connectible broadcast packet or wherein the first broadcast packet is a non-directed and connectible broadcast packet.
- 18. The method of claim 17, wherein the first identification is not carried in the first broadcast packet if the first broadcast packet is a directed and connectible broadcast packet.
- 19. The method of claim 17, wherein the first identification is carried in the first broadcast packet if the first broadcast packet is a non-directional and connectible broadcast.
- 20. The method according to any of claims 15-19, wherein the first broadcast packet is a BLE broadcast packet or wherein the first broadcast packet is a SLE broadcast packet.
Description
Connection method and related device The present application is a divisional application, the application number of the original application is 202510848585.0, the original application date is 2025, 6 and 23, and the whole content of the original application is incorporated by reference. Technical Field The present application relates to the field of communications technologies, and in particular, to a connection method and a related device. Background With the development of wireless communication technology, people have become familiar with connecting different intelligent terminal devices in a wireless manner. For example, the electronic device may establish a communication connection with the external device, thereby allowing the electronic device to perform some functions in conjunction with the external device. However, in some communication technologies, for example, star flash (Near Link) and bluetooth low energy (bluetooth lowenergy, BLE), the electronic device generally uses the external device as a broadcasting end to send a broadcast packet to the electronic device if the electronic device is to establish a communication connection with the external device. The electronic device may serve as a scanning terminal for scanning broadcast packets transmitted by the external device. If the broadcast packet sent by the external device is scanned, the electronic device may determine whether the white list has an address identifier of the external device, and if the white list has an address identifier of the external device, the electronic device may send a connection request to the external device, where the white list has address identifiers of one or more devices paired with the electronic device but not establishing the target communication connection. The external device may establish a communication connection with the electronic device upon receiving the connection request. However, this connection mode is inflexible and cannot meet the requirement of free connection switching of multiple devices. Disclosure of Invention The application provides a connection method and a related device, which can prevent a first electronic device from frequently contending with other devices to establish communication connection with a second electronic device after receiving a first broadcast packet sent by the second electronic device. In a first aspect, an embodiment of the present application provides a connection method, which is applied to a first electronic device, and the method includes receiving a first broadcast packet sent by a second electronic device, where the first broadcast packet carries an address identifier of the second electronic device, where the first broadcast packet is a connectable broadcast packet, if the first broadcast packet carries the first identifier, automatically connecting back to the second electronic device without being based on a white list of the first electronic device, and if the first broadcast packet does not carry the first identifier, automatically connecting back to the second electronic device based on the white list of the first electronic device. According to the connection method provided by the embodiment of the application, after the first electronic device receives the first broadcast packet, if the first broadcast packet carries the first identifier, the second electronic device is automatically connected back without being based on the white list of the first electronic device. And if the first broadcast packet does not carry the first identifier, automatically connecting back to the second electronic device based on the white list of the first electronic device. In this way, the second electronic device can inform the first electronic device whether to automatically connect back to the second electronic device based on the white list by whether the first identifier is carried in the first broadcast packet. The first electronic device can be prevented from frequently competing with other devices to establish communication connection with the second electronic device after receiving the first broadcast packet sent by the second electronic device. In one possible implementation manner, if the first broadcast packet does not carry the first identifier, the second electronic device is automatically connected back based on the white list of the first electronic device, which includes that if the white list of the first electronic device has the address identifier of the second electronic device and a first instruction of initiating connection with the second electronic device by an application is not acquired before the first broadcast packet is received and the first broadcast packet does not carry the first identifier, a first communication connection is established with the second electronic device. In this way, the first communication connection is established with the first electronic device based on the white list automatic reconnection mechanism under th